From c5ce9e88fdb16df795017687474249dae1803056 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 6 Apr 2010 15:24:24 +0200 Subject: [PATCH 1/2] Improvements of parallel vepison Version:1.1.49 --- bin/irpf90 | 10 +++++++-- src/irp_stack.py | 12 ++++++----- src/irpf90.py | 2 ++ src/irpf90_t.py | 1 + src/makefile.py | 28 +++++++++++++++++++------ src/parsed_text.py | 52 ++++++++++++++++++++++++++-------------------- src/variable.py | 3 ++- src/variables.py | 11 +++++----- src/version.py | 2 +- 9 files changed, 78 insertions(+), 43 deletions(-) diff --git a/bin/irpf90 b/bin/irpf90 index 773b5d8..7112473 100755 --- a/bin/irpf90 +++ b/bin/irpf90 @@ -32,5 +32,11 @@ wd = os.path.abspath(os.path.dirname(__file__)) sys.path.insert(0,(wd+"/../src/")) sys.path.insert(0,(wd+"/../share/irpf90/src/")) -import irpf90 -irpf90.main() +debug = int(os.getenv("IRP_DEBUG",0)) +if debug == 0: + import irpf90 + irpf90.main() +else: + import profile + print "Profiling irpf90" + profile.run('import irpf90 ; irpf90.main()') diff --git a/src/irp_stack.py b/src/irp_stack.py index 74550ee..1046e47 100644 --- a/src/irp_stack.py +++ b/src/irp_stack.py @@ -54,9 +54,11 @@ subroutine irp_enter(irp_where) integer :: nthread character*(*) :: irp_where $OMP_DECL +!$OMP CRITICAL ithread = $OMP_GET_THREAD_NUM nthread = $OMP_GET_NUM_THREADS $1 +!$OMP END CRITICAL """ if command_line.do_memory: txt+=""" @@ -75,9 +77,11 @@ subroutine irp_leave (irp_where) integer :: ithread double precision :: cpu $OMP_DECL +!$OMP CRITICAL ithread = $OMP_GET_THREAD_NUM $3 $4 +!$OMP END CRITICAL end subroutine """ @@ -97,14 +101,12 @@ end subroutine # $1 if do_assert or do_debug: txt = txt.replace("$1",""" -!$OMP CRITICAL if (.not.alloc) then - allocate(irp_stack(STACKMAX,nthread)) - allocate(irp_cpu(STACKMAX,nthread)) - allocate(stack_index(nthread)) + allocate(irp_stack(STACKMAX,nthread+1)) + allocate(irp_cpu(STACKMAX,nthread+1)) + allocate(stack_index(nthread+1)) alloc = .True. endif -!$OMP END CRITICAL stack_index(ithread+1) = stack_index(ithread+1)+1 irp_stack(stack_index(ithread+1),ithread+1) = irp_where""") if command_line.do_memory: diff --git a/src/irpf90.py b/src/irpf90.py index fba054a..da5a049 100644 --- a/src/irpf90.py +++ b/src/irpf90.py @@ -24,6 +24,8 @@ # 31062 Toulouse Cedex 4 # scemama@irsamc.ups-tlse.fr +import sys +sys.setcheckinterval(1000) def main(): from command_line import command_line diff --git a/src/irpf90_t.py b/src/irpf90_t.py index 8fea5af..6ae2184 100644 --- a/src/irpf90_t.py +++ b/src/irpf90_t.py @@ -33,6 +33,7 @@ class Line(object): def __init__(self,i,text,filename): self.i = i self.text = text + self.lower = text.lower() self.filename = filename class Empty_line(Line): diff --git a/src/makefile.py b/src/makefile.py index c6736bc..4fd37a3 100644 --- a/src/makefile.py +++ b/src/makefile.py @@ -92,16 +92,25 @@ def run(): if m.is_main: exe = m.name[:-4] print >>file, "%s: %s%s.irp.o $(OBJ1)"%(exe,irpdir,exe) - print >>file, "\t$(FC) -o $@ %s$@.irp.o $(OBJ1) $(LIB)"%(irpdir) + print >>file, "\t@echo Linking %s"%(exe) + print >>file, "\t@$(FC) -o $@ %s$@.irp.o $(OBJ1) $(LIB)"%(irpdir) print >>file, "\t@make -s move" buffer = "" + for m in mod: + filename = "%s%s.irp.module:"%(irpdir,m.name[:-4]) + mds = map (lambda x: " %s%s.irp.module"%(irpdir,x[:-4]),m.needed_modules) + print >>file, filename+" ".join(mds) for m in mod: filename = "%s%s.irp.o:"%(irpdir,m.name[:-4]) - mds = map (lambda x: " %s%s.irp.o"%(irpdir,x[:-4]),m.needed_modules) + mds = map (lambda x: " %s%s.irp.module"%(irpdir,x[:-4]),m.needed_modules) print >>file, filename+" ".join(mds) if not m.is_main: buffer += "\t - @echo '"+filename+" ".join(mds)+"' >> %sdist_Makefile\n"%(irpdir) + print >>file, "%sirp_touches.irp.module:"%(irpdir), + mds = filter(lambda x: not x.is_main,mod) + mds = map(lambda x: " %s%s.irp.module"%(irpdir,x.name[:-4]),mds) + print >>file," ".join(mds) print >>file, "%sirp_touches.irp.o:"%(irpdir), mds = filter(lambda x: not x.is_main,mod) mds = map(lambda x: " %s%s.irp.o"%(irpdir,x.name[:-4]),mds) @@ -135,15 +144,22 @@ def run(): print >>file, "\t- @cp %s$*.irp.F90 dist/$*/| DO_NOTHING="%(irpdir) print >>file, "\t- cd dist ; tar -zcvf ../$*.tar.gz $*\n" - print >>file, irpdir+"%.irp.o: "+irpdir+"%.irp.F90" - print >>file, "\t$(FC) $(FCFLAGS) -c "+irpdir+"$*.irp.F90 -o "+irpdir+"$*.irp.o" + print >>file, irpdir+"%.irp.module: "+irpdir+"%.irp.F90" + print >>file, "\t@echo Creating $* module" + print >>file, "\t@$(FC) -O0 -c "+irpdir+"$*.irp.F90 -o "+irpdir+"$*.irp.o" + print >>file, "\t@rm "+irpdir+"$*.irp.o" + print >>file, "\t@touch "+irpdir+"$*.irp.module" + print >>file, irpdir+"%.irp.o: "+irpdir+"%.irp.module" + print >>file, "\t@echo Compiling $*" + print >>file, "\t@$(FC) $(FCFLAGS) -c "+irpdir+"$*.irp.F90 -o "+irpdir+"$*.irp.o" print >>file, irpdir+"%.o: %.F90" - print >>file, "\t$(FC) $(FCFLAGS) -c $*.F90 -o "+irpdir+"$*.o" + print >>file, "\t@echo Compiling $*" + print >>file, "\t@$(FC) $(FCFLAGS) -c $*.F90 -o "+irpdir+"$*.o" print >>file, irpdir+"%.o: %.f90\n\t$(FC) $(FCFLAGS) -c $*.f90 -o "+irpdir+"$*.o" print >>file, irpdir+"%.o: %.f\n\t$(FC) $(FCFLAGS) -c $*.f -o "+irpdir+"$*.o" print >>file, irpdir+"%.o: %.F\n\t$(FC) $(FCFLAGS) -c $*.F -o "+irpdir+"$*.o" print >>file, irpdir+"%.irp.F90: irpf90.make\n" - print >>file, "move:\n\t@mv -f *.mod IRPF90_temp/ 2> /dev/null | DO_NOTHING=\n" + print >>file, "move:\n\t@mv -f *.mod IRPF90_temp/ 2> /dev/null | DO_NOTHING=\n\t@touch IRPF90_temp/*\n" print >>file, "clean:\n\trm -rf $(EXE) $(OBJ1) $(ALL_OBJ1) $(ALL)\n" print >>file, "veryclean:\n\t- make clean\n" print >>file, "\t- rm -rf "+irpdir+" "+mandir+" irpf90.make irpf90_variables dist\n" diff --git a/src/parsed_text.py b/src/parsed_text.py index 4e04dbb..6f22cd2 100644 --- a/src/parsed_text.py +++ b/src/parsed_text.py @@ -37,6 +37,7 @@ vtuple = map(lambda v: (v, variables[v].same_as, variables[v].regexp), variables stuple = map(lambda s: (s, subroutines[s].regexp), subroutines.keys()) stuple = filter(lambda s: subroutines[s[0]].is_function, stuple) +regexps_re_string_sub = regexps.re_string.sub def find_variables_in_line(line): assert isinstance(line,Line) result = [] @@ -45,7 +46,7 @@ def find_variables_in_line(line): for v,same_as,regexp in vtuple: if v in buffer: if not sub_done: - buffer = regexps.re_string.sub('',buffer) + buffer = regexps_re_string_sub('',buffer) sub_done = True if regexp.search(buffer) is not None: result.append(same_as) @@ -54,12 +55,13 @@ def find_variables_in_line(line): def find_funcs_in_line(line): assert isinstance(line,Line) result = [] + append = result.append sub_done = False buffer = line.text.lower() for s,regexp in stuple: if s in buffer: if regexp.search(buffer) is not None: - result.append(s) + append(s) return result @@ -90,6 +92,7 @@ def get_parsed_text(): varlist = [] for filename, text in preprocessed_text: result = [] + append = result.append for line in filter( lambda x: type(x) not in [ Doc, Begin_doc, End_doc ], text): @@ -110,28 +113,28 @@ def get_parsed_text(): Function, End, ]: - result.append( ([],line) ) + append( ([],line) ) elif isinstance(line,End_provider): varlist = [] - result.append( ([],line) ) + append( ([],line) ) elif isinstance(line,Provide): l = line.text.lower().split()[1:] l = filter(lambda x: x not in varlist, l) for v in l: if v not in variables.keys(): error.fail(line,"Variable %s is unknown"%(v)) - result.append( (l,Simple_line(line.i,"!%s"%(line.text),line.filename)) ) + append( (l,Simple_line(line.i,"!%s"%(line.text),line.filename)) ) elif isinstance(line,Call): l = find_variables_in_line(line) l = filter(lambda x: x not in varlist, l) sub = find_subroutine_in_line(line) if sub not in subroutines: t = Simple_line - result.append( (l,Simple_line(line.i,line.text,line.filename)) ) + append( (l,Simple_line(line.i,line.text,line.filename)) ) else: - result.append( (l,line) ) + append( (l,line) ) if subroutines[sub].touches != []: - result.append( ([],Provide_all(line.i,"",line.filename)) ) + append( ([],Provide_all(line.i,"",line.filename)) ) elif isinstance(line,Free): vars = line.text.split() if len(vars) < 2: @@ -139,7 +142,7 @@ def get_parsed_text(): vars = map(lower,vars[1:]) for v in vars: variables[v].is_freed = True - result.append( ([],Simple_line(line.i,"!%s"%(line.text),line.filename)) ) + append( ([],Simple_line(line.i,"!%s"%(line.text),line.filename)) ) use = map(lambda x: " use %s"%(variables[x].fmodule),vars) for var in vars: result += map(lambda x: ([],Use(line.i,x,line.filename)), @@ -148,10 +151,10 @@ def get_parsed_text(): variables[var].free) elif isinstance(line,Irp_read): variables[line.filename]._is_read = True - result.append( ([],Simple_line(line.i,"!%s"%(line.text),line.filename)) ) + append( ([],Simple_line(line.i,"!%s"%(line.text),line.filename)) ) elif isinstance(line,Irp_write): variables[line.filename]._is_written = True - result.append( ([],Simple_line(line.i,"!%s"%(line.text),line.filename)) ) + append( ([],Simple_line(line.i,"!%s"%(line.text),line.filename)) ) elif isinstance(line,Touch): vars = line.text.split() if len(vars) < 2: @@ -197,11 +200,11 @@ def get_parsed_text(): except ValueError: print v, variables[v].same_as raise - result.append( (variable_list,line) ) + append( (variable_list,line) ) else: l = find_variables_in_line(line) l = filter(lambda x: x not in varlist, l) - result.append( (l,line) ) + append( (l,line) ) main_result.append( (filename, result) ) return main_result @@ -245,6 +248,7 @@ def move_variables(): main_result = [] for filename, text in parsed_text: result = [] + append = result.append # 1st pass varlist = [] ifvars = [] @@ -257,20 +261,20 @@ def move_variables(): for vars,line in revtext: if type(line) in [ End_provider,End ]: varlist = [] - result.append( ([],line) ) + append( ([],line) ) elif type(line) in [ Endif, End_select ]: old_ifvars.append( list(ifvars) ) old_elsevars.append( list(elsevars) ) old_varlist.append( list(varlist) ) varlist = [] - result.append( ([],line) ) + append( ([],line) ) elif type(line) == Else: elsevars += list(varlist) - result.append( (varlist,line) ) + append( (varlist,line) ) varlist = [] elif type(line) in [ Elseif, Case ]: ifvars += list(varlist) - result.append( (varlist,line) ) + append( (varlist,line) ) if vars != []: varlist = old_varlist.pop() varlist += vars @@ -278,29 +282,30 @@ def move_variables(): varlist = [] elif type(line) in [ If, Select ]: ifvars += list(varlist) - result.append( (varlist,line) ) + append( (varlist,line) ) vars += filter(lambda x: x in elsevars, ifvars) ifvars = old_ifvars.pop() elsevars = old_elsevars.pop() varlist = old_varlist.pop() + vars elif type(line) in [ Begin_provider, Subroutine, Function ]: varlist += vars - result.append( (varlist,line) ) + append( (varlist,line) ) if old_varlist != [] \ or old_ifvars != [] \ or old_elsevars != []: error.fail(line,"End if missing") varlist = [] elif isinstance(line,Provide_all): - result.append( (vars,line) ) + append( (vars,line) ) else: varlist += vars - result.append( ([],line) ) + append( ([],line) ) result.reverse() # 2nd pass text = result result = [] + append = result.append old_varlist = [] varlist = [] for vars,line in text: @@ -326,7 +331,7 @@ def move_variables(): elif type(line) in [ End_provider, End ]: assert old_varlist == [] varlist = [] - result.append( (vars,line) ) + append( (vars,line) ) main_result.append( (filename, result) ) return main_result @@ -356,11 +361,12 @@ def add_subroutine_needs(): main_result = [] for filename, text in parsed_text: result = [] + append = result.append for vars,line in text: if isinstance(line,Call): subname = find_subname(line) vars = subroutines[subname].to_provide - result.append( (vars,line) ) + append( (vars,line) ) main_result.append( (filename, result) ) return main_result diff --git a/src/variable.py b/src/variable.py index 5fb6086..659fb49 100644 --- a/src/variable.py +++ b/src/variable.py @@ -121,10 +121,11 @@ class Variable(object): def others(self): if '_others' not in self.__dict__: result = [] + append = result.append f = lambda l: type(l) in [Begin_provider, Cont_provider] lines = filter(f, self.text) for line in lines: - result.append(line.filename[1]) + append(line.filename[1]) result.remove(self.name) self._others = result return self._others diff --git a/src/variables.py b/src/variables.py index dd48d4d..0b10bed 100644 --- a/src/variables.py +++ b/src/variables.py @@ -66,13 +66,14 @@ def call_provides(vars,opt=False): all_children = flatten( map(lambda x: variables[x].children, vars )) vars = filter(lambda x: x not in all_children,vars) def fun(x): + result = [] if command_line.do_openmp: - result = [ "!$OMP TASK" ] - else: - result = [] + result += [ "!$OMP TASK" ] + result += [ \ + " if (.not.%s_is_built) then"%(x) ] + result += [ \ + " call provide_%s"%(x) ] result += [ \ - " if (.not.%s_is_built) then"%(x), - " call provide_%s"%(x), " endif" ] if command_line.do_openmp: result += [ "!$OMP END TASK" ] diff --git a/src/version.py b/src/version.py index 8879ada..60c8797 100644 --- a/src/version.py +++ b/src/version.py @@ -1 +1 @@ -version = "1.1.48" +version = "1.1.49" From ed77fd8bde760ef4edacae2f71fc9507ae68f925 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 19 May 2010 19:01:05 +0200 Subject: [PATCH 2/2] Improved makefile Version:1.1.50 --- src/makefile.py | 40 ++++++++++++++++++++-------------------- src/parsed_text.py | 17 +++++++++-------- src/preprocessed_text.py | 12 ++++++------ src/subroutine.py | 2 +- src/util.py | 4 ++-- src/version.py | 2 +- 6 files changed, 39 insertions(+), 38 deletions(-) diff --git a/src/makefile.py b/src/makefile.py index 4fd37a3..cd9d7af 100644 --- a/src/makefile.py +++ b/src/makefile.py @@ -78,6 +78,11 @@ def run(): result += " %s%s.irp.o"%(irpdir,m.name[:-4]) print >>file, result + result = "MODULES += %sirp_stack.irp.module"%(irpdir) + for m in mod: + result += " %s%s.irp.module"%(irpdir,m.name[:-4]) + print >>file, result + print >>file, "OBJ1 = $(patsubst %%, %s%%,$(notdir $(OBJ))) %sirp_touches.irp.o"%(irpdir,irpdir) all = filter(lambda x: modules[x].is_main, modules) @@ -87,14 +92,11 @@ def run(): print >>file, "ALL_OBJ = %s"%(" ".join(all_o)) print >>file, "ALL_OBJ1 = $(patsubst %%, %s%%,$(notdir $(ALL_OBJ)))"%(irpdir) print >>file, "all:$(ALL)" - print >>file, "\t@make -s move" for m in mod: if m.is_main: exe = m.name[:-4] print >>file, "%s: %s%s.irp.o $(OBJ1)"%(exe,irpdir,exe) - print >>file, "\t@echo Linking %s"%(exe) - print >>file, "\t@$(FC) -o $@ %s$@.irp.o $(OBJ1) $(LIB)"%(irpdir) - print >>file, "\t@make -s move" + print >>file, "\t$(FC) -o $@ %s$@.irp.o $(OBJ1) $(LIB)"%(irpdir) buffer = "" for m in mod: @@ -102,7 +104,7 @@ def run(): mds = map (lambda x: " %s%s.irp.module"%(irpdir,x[:-4]),m.needed_modules) print >>file, filename+" ".join(mds) for m in mod: - filename = "%s%s.irp.o:"%(irpdir,m.name[:-4]) + filename = "%s%s.irp.o: %s%s.irp.F90 %s%s.irp.module"%(irpdir,m.name[:-4],irpdir,m.name[:-4],irpdir,m.name[:-4]) mds = map (lambda x: " %s%s.irp.module"%(irpdir,x[:-4]),m.needed_modules) print >>file, filename+" ".join(mds) if not m.is_main: @@ -111,10 +113,10 @@ def run(): mds = filter(lambda x: not x.is_main,mod) mds = map(lambda x: " %s%s.irp.module"%(irpdir,x.name[:-4]),mds) print >>file," ".join(mds) - print >>file, "%sirp_touches.irp.o:"%(irpdir), - mds = filter(lambda x: not x.is_main,mod) - mds = map(lambda x: " %s%s.irp.o"%(irpdir,x.name[:-4]),mds) - print >>file," ".join(mds) +# print >>file, "%sirp_touches.irp.o:"%(irpdir), +# mds = filter(lambda x: not x.is_main,mod) +# mds = map(lambda x: " %s%s.irp.o"%(irpdir,x.name[:-4]),mds) +# print >>file," ".join(mds) print >>file, "%sdist_Makefile:"%(irpdir) @@ -145,22 +147,20 @@ def run(): print >>file, "\t- cd dist ; tar -zcvf ../$*.tar.gz $*\n" print >>file, irpdir+"%.irp.module: "+irpdir+"%.irp.F90" - print >>file, "\t@echo Creating $* module" - print >>file, "\t@$(FC) -O0 -c "+irpdir+"$*.irp.F90 -o "+irpdir+"$*.irp.o" - print >>file, "\t@rm "+irpdir+"$*.irp.o" - print >>file, "\t@touch "+irpdir+"$*.irp.module" - print >>file, irpdir+"%.irp.o: "+irpdir+"%.irp.module" - print >>file, "\t@echo Compiling $*" - print >>file, "\t@$(FC) $(FCFLAGS) -c "+irpdir+"$*.irp.F90 -o "+irpdir+"$*.irp.o" + print >>file, "\t$(FC) -O0 -c "+irpdir+"$*.irp.F90 -o /dev/null && \\" + print >>file, "\ttouch "+irpdir+"$*.irp.module" + print >>file, irpdir+"%.irp.o: IRPF90_temp/%.irp.F90 IRPF90_temp/modules" + print >>file, "\t$(FC) $(FCFLAGS) -c "+irpdir+"$*.irp.F90 -o "+irpdir+"$*.irp.o" print >>file, irpdir+"%.o: %.F90" - print >>file, "\t@echo Compiling $*" - print >>file, "\t@$(FC) $(FCFLAGS) -c $*.F90 -o "+irpdir+"$*.o" + print >>file, "\t$(FC) $(FCFLAGS) -c $*.F90 -o "+irpdir+"$*.o" print >>file, irpdir+"%.o: %.f90\n\t$(FC) $(FCFLAGS) -c $*.f90 -o "+irpdir+"$*.o" print >>file, irpdir+"%.o: %.f\n\t$(FC) $(FCFLAGS) -c $*.f -o "+irpdir+"$*.o" print >>file, irpdir+"%.o: %.F\n\t$(FC) $(FCFLAGS) -c $*.F -o "+irpdir+"$*.o" print >>file, irpdir+"%.irp.F90: irpf90.make\n" - print >>file, "move:\n\t@mv -f *.mod IRPF90_temp/ 2> /dev/null | DO_NOTHING=\n\t@touch IRPF90_temp/*\n" - print >>file, "clean:\n\trm -rf $(EXE) $(OBJ1) $(ALL_OBJ1) $(ALL)\n" + print >>file, "modules: IRPF90_temp/modules" + print >>file, "IRPF90_temp/modules: $(MODULES)" + print >>file, "\ttouch IRPF90_temp/modules" + print >>file, "clean:\n\trm -rf $(EXE) $(OBJ1) $(ALL_OBJ1) $(ALL) $(MODULES) IRPF90_temp/modules\n" print >>file, "veryclean:\n\t- make clean\n" print >>file, "\t- rm -rf "+irpdir+" "+mandir+" irpf90.make irpf90_variables dist\n" diff --git a/src/parsed_text.py b/src/parsed_text.py index 6f22cd2..0fd1325 100644 --- a/src/parsed_text.py +++ b/src/parsed_text.py @@ -42,14 +42,15 @@ def find_variables_in_line(line): assert isinstance(line,Line) result = [] sub_done = False - buffer = line.text.lower() + buffer = line.lower + ap = result.append for v,same_as,regexp in vtuple: if v in buffer: if not sub_done: buffer = regexps_re_string_sub('',buffer) sub_done = True if regexp.search(buffer) is not None: - result.append(same_as) + ap(same_as) return result def find_funcs_in_line(line): @@ -57,7 +58,7 @@ def find_funcs_in_line(line): result = [] append = result.append sub_done = False - buffer = line.text.lower() + buffer = line.lower for s,regexp in stuple: if s in buffer: if regexp.search(buffer) is not None: @@ -118,7 +119,7 @@ def get_parsed_text(): varlist = [] append( ([],line) ) elif isinstance(line,Provide): - l = line.text.lower().split()[1:] + l = line.lower.split()[1:] l = filter(lambda x: x not in varlist, l) for v in l: if v not in variables.keys(): @@ -190,9 +191,9 @@ def get_parsed_text(): elif type(line) in [ Begin_provider, Cont_provider ]: if isinstance(line,Begin_provider): varlist = [] - buffer = map(strip,line.text.replace(']','').split(',')) + buffer = map(strip,line.lower.replace(']','').split(',')) assert len(buffer) > 1 - v = buffer[1].lower() + v = buffer[1] varlist.append(v) variable_list = find_variables_in_line(line) try: @@ -379,8 +380,8 @@ def build_needs(): var = None for vars,line in text: if isinstance(line,Begin_provider): - buffer = map(strip,line.text.replace(']',',').split(',')) - var = variables[buffer[1].lower()] + buffer = map(strip,line.lower.replace(']',',').split(',')) + var = variables[buffer[1]] var.needs = [] var.to_provide = vars elif isinstance(line,End_provider): diff --git a/src/preprocessed_text.py b/src/preprocessed_text.py index 9e96a7e..642307a 100644 --- a/src/preprocessed_text.py +++ b/src/preprocessed_text.py @@ -539,12 +539,12 @@ def irp_simple_statements(text): def process_begin_provider(line): assert isinstance(line,Begin_provider) - buffer = line.text.replace('['," ") + buffer = line.lower.replace('['," ") buffer = buffer.replace(']',"") buffer = buffer.split(',') if len(buffer) < 2: error.fail(line,"Error in Begin_provider statement") - varname = buffer[1].strip().lower() + varname = buffer[1].strip() length = len(varname) i = line.i f = line.filename @@ -558,12 +558,12 @@ def irp_simple_statements(text): def process_cont_provider(line): assert isinstance(line,Cont_provider) - buffer = line.text.replace('['," ") + buffer = line.lower.replace('['," ") buffer = buffer.replace(']',"") buffer = buffer.split(',') if len(buffer) < 2: error.fail(line,"Error in Cont_provider statement") - varname = buffer[1].strip().lower() + varname = buffer[1].strip() i = line.i f = line.filename return [ Cont_provider(i,line.text,(f,varname)) ] @@ -600,7 +600,7 @@ def irp_simple_statements(text): def process_program(line): assert isinstance(line,Program) - program_name = line.text.split()[1].lower() + program_name = line.lower.split()[1] result = [ Program(0,"",program_name) ] + \ process_subroutine( Subroutine(line.i,"subroutine %s"%(program_name,),line.filename) ) return result @@ -692,7 +692,7 @@ endif''' result = [] for line in text: if isinstance(line,If): - if line.text.lower().endswith("then"): + if line.lower.endswith("then"): result.append(line) else: buffer = line.text diff --git a/src/subroutine.py b/src/subroutine.py index e17b085..e555173 100644 --- a/src/subroutine.py +++ b/src/subroutine.py @@ -49,7 +49,7 @@ class Sub(object): ############################################################ def is_function(self): if '_is_function' not in self.__dict__: - self._is_function = "function" in self.line.text.lower() + self._is_function = "function" in self.line.lower return self._is_function is_function = property(is_function) diff --git a/src/util.py b/src/util.py index edd51a8..fc05edf 100644 --- a/src/util.py +++ b/src/util.py @@ -67,11 +67,11 @@ def build_dim_colons(v): import error def find_subname(line): - buffer = line.text + buffer = line.lower if not buffer.endswith(')'): buffer += "()" buffer = buffer.split('(') - buffer = buffer[0].lower().split() + buffer = buffer[0].split() if len(buffer) < 2: error.fail(line,"Syntax Error") return buffer[-1] diff --git a/src/version.py b/src/version.py index 60c8797..3be16b6 100644 --- a/src/version.py +++ b/src/version.py @@ -1 +1 @@ -version = "1.1.49" +version = "1.1.50"