10
0
mirror of https://gitlab.com/scemama/irpf90.git synced 2024-12-22 04:13:33 +01:00

Added includes dependencies in irpf90.make

Version:1.1.59
This commit is contained in:
Anthony Scemama 2010-11-22 11:48:11 +01:00
parent bd7d363c08
commit 6568fd4166
4 changed files with 33 additions and 7 deletions

View File

@ -103,7 +103,7 @@ def run():
for m in mod: for m in mod:
filename = "%s%s.irp.o: %s%s.irp.module.o"%(irpdir,m.name[:-4],irpdir,m.name[:-4]) filename = "%s%s.irp.o: %s%s.irp.module.o"%(irpdir,m.name[:-4],irpdir,m.name[:-4])
mds = map (lambda x: " %s%s.irp.module.o"%(irpdir,x[:-4]),m.needed_modules) mds = map (lambda x: " %s%s.irp.module.o"%(irpdir,x[:-4]),m.needed_modules)
print >>file, filename+" ".join(mds) print >>file, filename," ".join(mds)," ".join(m.includes)
if not m.is_main: if not m.is_main:
buffer += "\t - @echo '"+filename+" ".join(mds)+"' >> %sdist_Makefile\n"%(irpdir) buffer += "\t - @echo '"+filename+" ".join(mds)+"' >> %sdist_Makefile\n"%(irpdir)
print >>file, "%sirp_touches.irp.o:"%(irpdir), print >>file, "%sirp_touches.irp.o:"%(irpdir),

View File

@ -92,6 +92,15 @@ class Fmodule(object):
return self._needed_vars return self._needed_vars
needed_vars = property(needed_vars) needed_vars = property(needed_vars)
def includes(self):
if '_includes' not in self.__dict__:
buffer = []
for v in self.needed_vars:
buffer += variables[v].includes
self._includes = make_single(buffer)
return self._includes
includes = property(includes)
def generated_text(self): def generated_text(self):
if '_generated_text' not in self.__dict__: if '_generated_text' not in self.__dict__:
result = [] result = []
@ -200,6 +209,7 @@ class Fmodule(object):
return self._dec return self._dec
dec = property(dec) dec = property(dec)
def needed_modules(self): def needed_modules(self):
if '_needed_modules' not in self.__dict__: if '_needed_modules' not in self.__dict__:
buffer = filter(lambda x: x.lstrip().startswith("use "), \ buffer = filter(lambda x: x.lstrip().startswith("use "), \
@ -217,9 +227,10 @@ class Fmodule(object):
if __name__ == '__main__': if __name__ == '__main__':
from parsed_text import parsed_text from parsed_text import parsed_text
for filename, text in parsed_text: for filename, text in parsed_text:
if filename == 'random.irp.f': if filename == 'vmc_step.irp.f':
x = Fmodule(text,filename) x = Fmodule(text,filename)
break break
for line in x.head: for line in x.head:
print line print line
print x.includes

View File

@ -642,6 +642,7 @@ def change_includes(text):
try: try:
file = open(filename,'r') file = open(filename,'r')
file.close() file.close()
result.append(Include(line.i,"! include '%s'"%filename,filename))
result += create_preprocessed_text(filename) result += create_preprocessed_text(filename)
except IOError: except IOError:
result.append(Declaration(line.i,line.text,line.filename)) result.append(Declaration(line.i,line.text,line.filename))

View File

@ -92,7 +92,8 @@ class Variable(object):
'''Name is lowercase''' '''Name is lowercase'''
if '_name' not in self.__dict__: if '_name' not in self.__dict__:
buffer = None buffer = None
for line in self.text: text = self.text
for line in text:
if type(line) == Begin_provider: if type(line) == Begin_provider:
self._name = line.filename[1] self._name = line.filename[1]
break break
@ -102,8 +103,8 @@ class Variable(object):
############################################################ ############################################################
def doc(self): def doc(self):
if '_doc' not in self.__dict__: if '_doc' not in self.__dict__:
def f(l): return text = self.text
buffer = filter(lambda l:type(l) == Doc, self.text) buffer = filter(lambda l:type(l) == Doc, text)
self._doc = map(lambda l: l.text[1:], buffer) self._doc = map(lambda l: l.text[1:], buffer)
if buffer == []: if buffer == []:
error.warn(None,"Variable %s is not documented"%(self.name)) error.warn(None,"Variable %s is not documented"%(self.name))
@ -117,13 +118,25 @@ class Variable(object):
return self._documented return self._documented
documented = property(documented) documented = property(documented)
############################################################
def includes(self):
if '_includes' not in self.__dict__:
self._includes = []
text = self.text
for line in filter(lambda x: type(x) == Include,text):
self._includes.append(line.filename)
make_single(self._includes)
return self._includes
includes = property(includes)
############################################################ ############################################################
def others(self): def others(self):
if '_others' not in self.__dict__: if '_others' not in self.__dict__:
result = [] result = []
append = result.append append = result.append
f = lambda l: type(l) in [Begin_provider, Cont_provider] f = lambda l: type(l) in [Begin_provider, Cont_provider]
lines = filter(f, self.text) text = self.text
lines = filter(f, text)
for line in lines: for line in lines:
append(line.filename[1]) append(line.filename[1])
result.remove(self.name) result.remove(self.name)
@ -200,7 +213,8 @@ class Variable(object):
def line(self): def line(self):
if '_line' not in self.__dict__: if '_line' not in self.__dict__:
f = lambda l: type(l) in [Begin_provider, Cont_provider] f = lambda l: type(l) in [Begin_provider, Cont_provider]
lines = filter(f, self.text) text = self.text
lines = filter(f, text)
for line in lines: for line in lines:
buffer = line.filename[1] buffer = line.filename[1]
if self._name == buffer: if self._name == buffer: