diff --git a/example/irp_example2.irp.f b/example/irp_example2.irp.f index 79036a5..2d0d23b 100644 --- a/example/irp_example2.irp.f +++ b/example/irp_example2.irp.f @@ -2,6 +2,6 @@ program irp_example2 print *, "Example 2" print *, 't = ', t -! IRP_WRITE t + IRP_WRITE t end diff --git a/src/parsed_text.py b/src/parsed_text.py index e088145..6d11285 100644 --- a/src/parsed_text.py +++ b/src/parsed_text.py @@ -133,10 +133,10 @@ def get_parsed_text(): result += map(lambda x: ([],Simple_line(line.i,x,line.filename)), variables[var].free) elif isinstance(line,Irp_read): - variables[line.filename].is_read = True + variables[line.filename]._is_read = True result.append( ([],Simple_line(line.i,"!%s"%(line.text),line.filename)) ) elif isinstance(line,Irp_write): - variables[line.filename].is_written = True + variables[line.filename]._is_written = True result.append( ([],Simple_line(line.i,"!%s"%(line.text),line.filename)) ) elif isinstance(line,Touch): vars = line.text.split() diff --git a/src/preprocessed_text.py b/src/preprocessed_text.py index 5a1a4b8..0421dcd 100644 --- a/src/preprocessed_text.py +++ b/src/preprocessed_text.py @@ -352,11 +352,11 @@ def irp_simple_statements(text): f = line.filename txt = line.text.lstrip() result = [ - Simple_line(i,"!",f), + Empty_line(i,"!",f), t(i,"! >>> %s"%(txt,),variable ), Provide_all(i," call %ser_%s('%s')"%(rw,variable,num),f), - Simple_line(i,"! >>> END %s "%(txt,),f ), - Simple_line(line.i,"!",f), + Empty_line(i,"! >>> END %s "%(txt,),f ), + Empty_line(line.i,"!",f), ] return result @@ -403,8 +403,8 @@ def irp_simple_statements(text): f = line.filename txt = line.text.strip() result = [ - Simple_line(i, "!", f), - Simple_line(i, "! >>> %s"%(txt,), f), + Empty_line(i, "!", f), + Empty_line(i, "! >>> %s"%(txt,), f), If (i, " if (.not.%s) then"%(condition,), f), Simple_line(i, " call irp_trace", f), Simple_line(i, " print *, irp_here//': Assert failed:'", f), @@ -413,8 +413,8 @@ def irp_simple_statements(text): ] + debug_conditions(line) + [ Simple_line(i, " stop 1", f), Endif (i, " endif", f), - Simple_line(i, "! <<< END %s"%(txt,), f), - Simple_line(i, "!", f) + Empty_line(i, "! <<< END %s"%(txt,), f), + Empty_line(i, "!", f) ] else: result = [] diff --git a/src/variable.py b/src/variable.py index 23f1d56..69bf9e0 100644 --- a/src/variable.py +++ b/src/variable.py @@ -40,15 +40,12 @@ class Variable(object): self.text = text if name is not None: self._name = name.lower() - self.is_read = False - self.is_written = False ############################################################ def is_touched(self): - '''Name is lowercase''' if '_is_touched' not in self.__dict__: from variables import variables - result = False + result = self.is_read for i in self.children: if variables[i].is_touched: result = True @@ -57,9 +54,34 @@ class Variable(object): return self._is_touched is_touched = property(is_touched) + ############################################################ + def is_written(self): + if '_is_written' not in self.__dict__: + from variables import variables + result = False + for i in self.parents: + if variables[i].is_written: + result = True + break + self._is_written = result + return self._is_written + is_written = property(is_written) + + ############################################################ + def is_read(self): + if '_is_read' not in self.__dict__: + from variables import variables + result = False + for i in self.parents: + if variables[i].is_read: + result = True + break + self._is_read = result + return self._is_read + is_read = property(is_read) + ############################################################ def is_main(self): - '''Name is lowercase''' if '_is_main' not in self.__dict__: self._is_main = (self.name == self.same_as) return self._is_main diff --git a/src/version.py b/src/version.py index d68b189..e23bc06 100644 --- a/src/version.py +++ b/src/version.py @@ -1 +1 @@ -version = "1.1.25" +version = "1.1.26"