10
0
mirror of https://gitlab.com/scemama/irpf90.git synced 2024-12-21 11:53:32 +01:00

Improved touch

Version:1.1.13
This commit is contained in:
Anthony Scemama 2009-09-14 17:16:52 +02:00
parent 6da6ed407e
commit 50cfddd824
5 changed files with 25 additions and 13 deletions

View File

@ -30,6 +30,9 @@ def main():
makefile.run()
import touches
touches.create()
import create_man
create_man.run()

View File

@ -42,6 +42,7 @@ def run():
file = open('irpf90.make','w')
result = "SRC += %sirp_stack.irp.F90"%(irpdir)
result += " %sirp_touches.irp.F90"%(irpdir)
for m in mod:
result += " %s%s.irp.F90"%(irpdir,m.name[:-4])
print >>file, result
@ -52,7 +53,7 @@ def run():
result += " %s%s.irp.o"%(irpdir,m.name[:-4])
print >>file, result
print >>file, "OBJ1 = $(patsubst %%, %s%%,$(notdir $(OBJ)))"%(irpdir)
print >>file, "OBJ1 = $(patsubst %%, %s%%,$(notdir $(OBJ))) %sirp_touches.irp.o"%(irpdir,irpdir)
all = filter(lambda x: modules[x].is_main, modules)
all = map(lambda x: x[:-6], all)
@ -76,24 +77,30 @@ def run():
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.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)
print >>file, "\t- @echo FC=$(FC) > %sdist_Makefile"%(irpdir)
print >>file, "\t- @echo FCFLAGS=$(FCFLAGS) >> %sdist_Makefile"%(irpdir)
print >>file, "\t- @echo LIB=$(LIB) >> %sdist_Makefile"%(irpdir)
print >>file, "\t- @echo .DEFAULT_GOAL: exe >> %sdist_Makefile"%(irpdir)
print >>file, "\t- @echo 'exe: $$(EXE).irp.F90 $(OBJ)' >> %sdist_Makefile"%(irpdir)
print >>file, "\t- @echo '\t$$(FC) -o $$(EXE) $$(EXE).irp.F90 $(OBJ) $$(LIB)' >> %sdist_Makefile"%(irpdir)
print >>file, "\t- @echo 'exe: $$(EXE).irp.F90 $(OBJ) irp_touches.irp.o' >> %sdist_Makefile"%(irpdir)
print >>file, "\t- @echo '\t$$(FC) -o $$(EXE) $$(EXE).irp.F90 $(OBJ) irp_touches.irp.o $$(LIB)' >> %sdist_Makefile"%(irpdir)
print >>file, "\t- @echo '%%.o: %%.F90' >> %sdist_Makefile"%(irpdir)
print >>file, "\t- @echo '\t$$(FC) $$(FCFLAGS) -c $$*.F90 -o $$*.o' >> %sdist_Makefile"%(irpdir)
print >>file, "\t- @echo 'clean:' >> %sdist_Makefile"%(irpdir)
print >>file, "\t- @echo '\trm *.o *.mod $$(EXE) 2>/dev/null' >> %sdist_Makefile"%(irpdir)
print >>file, buffer
print >>file, "\t- @echo '\tirp_touches.irp.o: irp_touches.irp.F90 $(OBJ) >> %sdist_Makefile"%(irpdir)
print >>file, "%%.dist: %sdist_Makefile"%(irpdir)
print >>file, "\t- @mkdir -p dist/$*| DO_NOTHING="
print >>file, "\t- @cp %s* dist/$*/| DO_NOTHING="%(irpdir)
print >>file, "\t- @for i in $(ALL) $(OBJ) $(ALL_OBJ); do rm dist/$*/$$i ; done| DO_NOTHING="
print >>file, "\t- @for i in $(ALL) $(OBJ) irp_touches.irp.o $(ALL_OBJ); do rm dist/$*/$$i ; done| DO_NOTHING="
print >>file, "\t- @for i in $(ALL) ; do rm dist/$*/$$i.irp.F90 ; done| DO_NOTHING="
print >>file, "\t- @rm dist/$*/{*.irp.f,*.mod,irpf90_entities}| DO_NOTHING="
print >>file, "\t- @rm dist/$*/*.mod 2>/dev/null| DO_NOTHING="

View File

@ -69,8 +69,6 @@ class Fmodule(object):
var = variables[var]
result += var.provider
result += var.builder
if var.is_touched:
result += var.toucher
if var.is_read:
result += var.reader
if var.is_written:

View File

@ -130,7 +130,6 @@ def get_parsed_text():
if x not in variables:
error.fail(line,"Variable %s unknown"%(x,))
return [ ([],Simple_line(line.i," call touch_%s"%(x,),line.filename)),
([],Simple_line(line.i," %s_is_built = .True."%(x,),line.filename)),
([],Use(line.i," use %s"%(variables[x].fmodule), line.filename)) ]
result += flatten(map( fun, main_vars ))
def fun(x):

View File

@ -185,19 +185,24 @@ class Variable(object):
if not self.is_main:
self._toucher = []
else:
from modules import modules
from variables import variables
if '_needed_by' not in self.__dict__:
import parsed_text
parents = self.parents
parents.sort()
mods = map(lambda x: variables[x].fmodule, parents)
mods = make_single(mods)+[self.fmodule]
name = self.name
result = [ "subroutine touch_%s"%(name) ,
" use %s"%(self.fmodule),
" implicit none" ]
result = [ "subroutine touch_%s"%(name) ]
result += map(lambda x: " Use %s"%(x),mods)
result.append(" implicit none")
if command_line.do_debug:
length = str(len("touch_%s"%(name)))
result += [ " character*(%s), parameter :: irp_here = 'touch_%s'"%(length,name),
" call irp_enter(irp_here)" ]
result += [ " %s_is_built = .False."%(name) ]
result += map( lambda x: "!DEC$ ATTRIBUTES FORCEINLINE :: touch_%s"%(x), self.needed_by )
result += map( lambda x: " call touch_%s"%(x), self.needed_by )
result += map( lambda x: " %s_is_built = .False."%(x), parents)
result.append(" %s_is_built = .True."%(name))
if command_line.do_debug:
result.append(" call irp_leave(irp_here)")
result.append("end subroutine touch_%s"%(name))