mirror of
https://gitlab.com/scemama/irpf90.git
synced 2024-12-22 04:13:33 +01:00
Working on mangled entity
This commit is contained in:
parent
dea0fccca5
commit
0e60db07ff
@ -167,6 +167,7 @@ class Entity(object):
|
||||
if not self.is_main:
|
||||
result = []
|
||||
else:
|
||||
from util import mangled
|
||||
name = self.name
|
||||
result = [ \
|
||||
"subroutine writer_%s(irp_num)"%(name),
|
||||
@ -184,7 +185,7 @@ class Entity(object):
|
||||
" if (.not.%s_is_built) then"%(self.same_as),
|
||||
" call provide_%s"%(self.same_as),
|
||||
" endif" ]
|
||||
result += map(lambda x: " call writer_%s(irp_num)" % (x), self.needs)
|
||||
result += map(lambda x: " call writer_%s(irp_num)" % (x), mangles(self.needs))
|
||||
result += [ \
|
||||
" irp_is_open = .True.",
|
||||
" irp_iunit = 9",
|
||||
@ -213,6 +214,7 @@ class Entity(object):
|
||||
if not self.is_main:
|
||||
result = []
|
||||
else:
|
||||
from util import mangled
|
||||
name = self.name
|
||||
result = [ \
|
||||
"subroutine reader_%s(irp_num)"%(name),
|
||||
@ -226,7 +228,7 @@ class Entity(object):
|
||||
result += [\
|
||||
" character*(%d) :: irp_here = 'reader_%s'"%(length,name),
|
||||
" call irp_enter(irp_here)" ]
|
||||
result += map(lambda x: " call reader_%s(irp_num)" % (x), self.needs)
|
||||
result += map(lambda x: " call reader_%s(irp_num)" % (x), mangled(self.needs))
|
||||
result += [ \
|
||||
" irp_is_open = .True.",
|
||||
" irp_iunit = 9",
|
||||
|
13
src/util.py
13
src/util.py
@ -285,6 +285,10 @@ def build_dim(l_dim, colons=False):
|
||||
|
||||
return "(%s)" % (",".join(l_dim_colons))
|
||||
|
||||
def mangled(l_ent, d_ent):
|
||||
# (List, Dict[str,Entity]) -> list
|
||||
'''Create a uniq list of provider'''
|
||||
return OrderedUniqueList(d_ent[name].same_as for name in l_ent)
|
||||
|
||||
def build_use(l_ent, d_ent):
|
||||
# (List, Dict[str,Entity]) -> list
|
||||
@ -294,12 +298,13 @@ def build_use(l_ent, d_ent):
|
||||
def build_call_provide(l_ent, d_ent):
|
||||
# (List, Dict[str,Entity]) -> list
|
||||
'''Construct the fortran 90 call the provider needed by the list of entity'''
|
||||
def fun(x):
|
||||
|
||||
# Get the corect name (in the case of multiple provider line)
|
||||
l_same_as = mangled(l_ent,d_ent)
|
||||
def bld_f90(x):
|
||||
return [ " if (.not.%s_is_built) then" % x,
|
||||
" call provide_%s" % x,
|
||||
" endif"]
|
||||
|
||||
# Get the corect name (in the case of multiple provider line)
|
||||
l_same_as = OrderedUniqueList(d_ent[x].same_as for x in l_ent)
|
||||
return flatten(map(fun, l_same_as))
|
||||
return flatten(map(bld_f90, l_same_as))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user