From 5bafb278b17376a13899c29bedae2faee2430ce7 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 25 Sep 2009 16:57:22 +0200 Subject: [PATCH] Bug in IRP_READ/IRP_WRITE array sizes --- src/util.py | 9 +++++++++ src/variable.py | 12 +++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/util.py b/src/util.py index 4a23fd9..1aa8ab4 100644 --- a/src/util.py +++ b/src/util.py @@ -54,6 +54,15 @@ def build_dim(dim): else: return "(%s)"%( ",".join(dim) ) +def build_dim_colons(v): + d = v.dim + if d == []: + return "" + else: + x = map(lambda x: ":", d) + return "(%s)"%(','.join(x)) + + import error def find_subname(line): buffer = line.text diff --git a/src/variable.py b/src/variable.py index 69bf9e0..4867444 100644 --- a/src/variable.py +++ b/src/variable.py @@ -214,13 +214,7 @@ class Variable(object): def header(self): if '_header' not in self.__dict__: name = self.name - def build_dim(d): - if d == []: - return "" - else: - x = map(lambda x: ":", self.dim) - return "(%s)"%(','.join(x)) - self._header = [ " %s :: %s %s"%(self.type, name, build_dim(self.dim) ) ] + self._header = [ " %s :: %s %s"%(self.type, name, build_dim_colons(self) ) ] if self.is_main: self._header += [ " logical :: %s_is_built = .False."%(name) ] return self._header @@ -291,7 +285,7 @@ class Variable(object): for n in [ name ]+self.others: result += [\ " open(unit=irp_iunit,file='irpf90_%s_'//trim(irp_num),form='FORMATTED',status='OLD',action='READ')"%(n), - " read(irp_iunit,*) %s%s"%(n,build_dim(variables[n].dim)), + " read(irp_iunit,*) %s%s"%(n,build_dim_colons(variables[n])), " close(irp_iunit)" ] result += [ \ " call touch_%s"%(name), @@ -341,7 +335,7 @@ class Variable(object): for n in [ name ] + self.others: result += [\ " open(unit=irp_iunit,file='irpf90_%s_'//trim(irp_num),form='FORMATTED',status='UNKNOWN',action='WRITE')"%(n), - " write(irp_iunit,*) %s%s"%(n,build_dim(variables[n].dim)), + " write(irp_iunit,*) %s%s"%(n,build_dim_colons(variables[n])), " close(irp_iunit)" ] if command_line.do_debug: result.append(" call irp_leave(irp_here)")