From 6da6ed407e988e9de537a9efa3a709fc443c35cd Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 14 Sep 2009 14:36:39 +0200 Subject: [PATCH] QmcChem OK Version:1.1.13 --- src/parsed_text.py | 4 +-- src/variable.py | 73 +++++++++++++++++++++++----------------------- src/variables.py | 6 ++-- src/version.py | 2 +- 4 files changed, 44 insertions(+), 41 deletions(-) diff --git a/src/parsed_text.py b/src/parsed_text.py index a754b9d..e25f45c 100644 --- a/src/parsed_text.py +++ b/src/parsed_text.py @@ -125,7 +125,7 @@ def get_parsed_text(): check_touch(line,vars,main_vars) txt = " ".join(vars) result += [ ([],Simple_line(line.i,"!",line.filename)), - ([],Simple_line(line.i,"! >>> TOUCH %s"%(txt,),line.filename)) ] + (vars,Simple_line(line.i,"! >>> TOUCH %s"%(txt,),line.filename)) ] def fun(x): if x not in variables: error.fail(line,"Variable %s unknown"%(x,)) @@ -328,7 +328,7 @@ parsed_text = result ###################################################################### if __name__ == '__main__': for i in range(len(parsed_text)): - if parsed_text[i][0] == 'mpi.irp.f': + if parsed_text[i][0] == 'vmc_step.irp.f': print '!-------- %s -----------'%(parsed_text[i][0]) for line in parsed_text[i][1]: print line[1] diff --git a/src/variable.py b/src/variable.py index cf0ea6f..0ef9f0a 100644 --- a/src/variable.py +++ b/src/variable.py @@ -241,7 +241,7 @@ class Variable(object): " 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)), " close(irp_iunit)" ] - rsult += [ \ + result += [ \ " call touch_%s"%(name), " %s_is_built = .True."%(name) ] if command_line.do_debug: @@ -409,42 +409,43 @@ class Variable(object): if '_builder' not in self.__dict__: if not self.is_main: self._builder = [] - import parsed_text - from variables import build_use, call_provides - for filename,buffer in parsed_text.parsed_text: - if self.line.filename[0].startswith(filename): - break - text = [] - same_as = self.same_as - inside = False - for vars,line in buffer: - if isinstance(line,Begin_provider): - if line.filename[1] == same_as: - inside = True - vars = [] - if inside: - text.append( (vars,line) ) - text += map( lambda x: ([],Simple_line(line.i,x,line.filename)), call_provides(vars) ) - if isinstance(line,End_provider): - if inside: + else: + import parsed_text + from variables import build_use, call_provides + for filename,buffer in parsed_text.parsed_text: + if self.line.filename[0].startswith(filename): break - name = self.name - text = parsed_text.move_to_top(text,Declaration) - text = parsed_text.move_to_top(text,Implicit) - text = parsed_text.move_to_top(text,Use) - text = map(lambda x: x[1], text) - for line in filter(lambda x: type(x) not in [ Begin_doc, End_doc, Doc], text): - if type(line) == Begin_provider: - result = [ "subroutine bld_%s"%(name) ] - result += build_use([name]+self.needs) - elif type(line) == Cont_provider: - pass - elif type(line) == End_provider: - result.append( "end subroutine bld_%s"%(name) ) - break - else: - result.append(line.text) - self._builder = result + text = [] + same_as = self.same_as + inside = False + for vars,line in buffer: + if isinstance(line,Begin_provider): + if line.filename[1] == same_as: + inside = True + vars = [] + if inside: + text.append( (vars,line) ) + text += map( lambda x: ([],Simple_line(line.i,x,line.filename)), call_provides(vars) ) + if isinstance(line,End_provider): + if inside: + break + name = self.name + text = parsed_text.move_to_top(text,Declaration) + text = parsed_text.move_to_top(text,Implicit) + text = parsed_text.move_to_top(text,Use) + text = map(lambda x: x[1], text) + for line in filter(lambda x: type(x) not in [ Begin_doc, End_doc, Doc], text): + if type(line) == Begin_provider: + result = [ "subroutine bld_%s"%(name) ] + result += build_use([name]+self.needs) + elif type(line) == Cont_provider: + pass + elif type(line) == End_provider: + result.append( "end subroutine bld_%s"%(name) ) + break + else: + result.append(line.text) + self._builder = result return self._builder builder = property(builder) diff --git a/src/variables.py b/src/variables.py index d2a04c3..dfa6e8a 100644 --- a/src/variables.py +++ b/src/variables.py @@ -34,9 +34,11 @@ def build_use(vars): return result ###################################################################### -def call_provides(vars): +def call_provides(vars,opt=False): vars = make_single( map(lambda x: variables[x].same_as, vars) ) - vars = map(lambda x: variables[x].name,vars) + if opt: + all_children = flatten( map(lambda x: variables[x].children, vars )) + vars = filter(lambda x: x not in all_children,vars) def fun(x): return [ \ " if (.not.%s_is_built) then"%(x), diff --git a/src/version.py b/src/version.py index 09e52b8..45312fc 100644 --- a/src/version.py +++ b/src/version.py @@ -1 +1 @@ -version = "1.1.12" +version = "1.1.13"