mirror of
https://gitlab.com/scemama/irpf90.git
synced 2024-12-22 04:13:33 +01:00
dict acceleration
Version:1.1.65
This commit is contained in:
parent
cdab9bb2c0
commit
4179c67037
@ -102,7 +102,7 @@ Options:
|
|||||||
def opts(self):
|
def opts(self):
|
||||||
if self._opts is None:
|
if self._opts is None:
|
||||||
optlist = ["",[]]
|
optlist = ["",[]]
|
||||||
for o in options.keys():
|
for o in options:
|
||||||
b = [o]+options[o]
|
b = [o]+options[o]
|
||||||
if b[3] == 1:
|
if b[3] == 1:
|
||||||
b[0] = b[0]+":"
|
b[0] = b[0]+":"
|
||||||
@ -132,7 +132,7 @@ def do_$LONG(self):
|
|||||||
return self._do_$LONG
|
return self._do_$LONG
|
||||||
do_$LONG = property(fget=do_$LONG)
|
do_$LONG = property(fget=do_$LONG)
|
||||||
"""
|
"""
|
||||||
for short in options.keys():
|
for short in options:
|
||||||
long = options[short][0]
|
long = options[short][0]
|
||||||
exec t.replace("$LONG",long).replace("$SHORT",short)
|
exec t.replace("$LONG",long).replace("$SHORT",short)
|
||||||
|
|
||||||
|
@ -97,13 +97,13 @@ def do_print(var):
|
|||||||
def run():
|
def run():
|
||||||
import parsed_text
|
import parsed_text
|
||||||
import os,sys
|
import os,sys
|
||||||
l = variables.keys()
|
|
||||||
if os.fork() == 0:
|
if os.fork() == 0:
|
||||||
for v in l:
|
for v in variables.values():
|
||||||
do_print(variables[v])
|
do_print(v)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
if os.fork() == 0:
|
if os.fork() == 0:
|
||||||
|
l = variables.keys()
|
||||||
file = open("irpf90_entities","w")
|
file = open("irpf90_entities","w")
|
||||||
l.sort()
|
l.sort()
|
||||||
for v in l:
|
for v in l:
|
||||||
|
@ -63,8 +63,8 @@ def run():
|
|||||||
from modules import modules
|
from modules import modules
|
||||||
if os.fork() == 0:
|
if os.fork() == 0:
|
||||||
mod = []
|
mod = []
|
||||||
for m in modules.keys():
|
for m in modules.values():
|
||||||
mod.append(modules[m])
|
mod.append(m)
|
||||||
|
|
||||||
file = open('irpf90.make','w')
|
file = open('irpf90.make','w')
|
||||||
|
|
||||||
|
@ -63,6 +63,6 @@ def write_module(m):
|
|||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
write_module(modules['electrons.irp.f'])
|
write_module(modules['psi.irp.f'])
|
||||||
|
|
||||||
|
|
||||||
|
@ -166,13 +166,13 @@ def get_parsed_text():
|
|||||||
l = line.lower.split()[1:]
|
l = line.lower.split()[1:]
|
||||||
l = filter(lambda x: x not in varlist, l)
|
l = filter(lambda x: x not in varlist, l)
|
||||||
for v in l:
|
for v in l:
|
||||||
if v not in variables.keys():
|
if v not in variables:
|
||||||
error.fail(line,"Variable %s is unknown"%(v))
|
error.fail(line,"Variable %s is unknown"%(v))
|
||||||
append( (l,Simple_line(line.i,"!%s"%(line.text),line.filename)) )
|
append( (l,Simple_line(line.i,"!%s"%(line.text),line.filename)) )
|
||||||
elif type(line) == NoDep:
|
elif type(line) == NoDep:
|
||||||
l = line.lower.split()[1:]
|
l = line.lower.split()[1:]
|
||||||
for v in l:
|
for v in l:
|
||||||
if v not in variables.keys():
|
if v not in variables:
|
||||||
error.fail(line,"Variable %s is unknown"%(v))
|
error.fail(line,"Variable %s is unknown"%(v))
|
||||||
l = map(lambda x: "-%s"%(x), l)
|
l = map(lambda x: "-%s"%(x), l)
|
||||||
append( (l,Simple_line(line.i,"!%s"%(line.text),line.filename)) )
|
append( (l,Simple_line(line.i,"!%s"%(line.text),line.filename)) )
|
||||||
@ -447,25 +447,25 @@ def build_needs():
|
|||||||
funcs = find_funcs_in_line(line)
|
funcs = find_funcs_in_line(line)
|
||||||
for f in funcs:
|
for f in funcs:
|
||||||
var.needs += subroutines[f].needs
|
var.needs += subroutines[f].needs
|
||||||
for v in variables.keys():
|
for v in variables:
|
||||||
main = variables[v].same_as
|
main = variables[v].same_as
|
||||||
if main != v:
|
if main != v:
|
||||||
variables[v].needs = variables[main].needs
|
variables[v].needs = variables[main].needs
|
||||||
variables[v].to_provide = variables[main].to_provide
|
variables[v].to_provide = variables[main].to_provide
|
||||||
|
|
||||||
# Needed_by
|
# Needed_by
|
||||||
for v in variables.keys():
|
for v in variables:
|
||||||
variables[v].needed_by = []
|
variables[v].needed_by = []
|
||||||
for v in variables.keys():
|
for v in variables:
|
||||||
main = variables[v].same_as
|
main = variables[v].same_as
|
||||||
if main != v:
|
if main != v:
|
||||||
variables[v].needed_by = variables[main].needed_by
|
variables[v].needed_by = variables[main].needed_by
|
||||||
for v in variables.keys():
|
for v in variables:
|
||||||
var = variables[v]
|
var = variables[v]
|
||||||
if var.is_main:
|
if var.is_main:
|
||||||
for x in var.needs:
|
for x in var.needs:
|
||||||
variables[x].needed_by.append(var.same_as)
|
variables[x].needed_by.append(var.same_as)
|
||||||
for v in variables.keys():
|
for v in variables:
|
||||||
var = variables[v]
|
var = variables[v]
|
||||||
var.needed_by = make_single(var.needed_by)
|
var.needed_by = make_single(var.needed_by)
|
||||||
|
|
||||||
@ -507,7 +507,7 @@ check_opt()
|
|||||||
######################################################################
|
######################################################################
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
for i in range(len(parsed_text)):
|
for i in range(len(parsed_text)):
|
||||||
if parsed_text[i][0] == 'mo.irp.f':
|
if parsed_text[i][0] == 'psi.irp.f':
|
||||||
print '!-------- %s -----------'%(parsed_text[i][0])
|
print '!-------- %s -----------'%(parsed_text[i][0])
|
||||||
for line in parsed_text[i][1]:
|
for line in parsed_text[i][1]:
|
||||||
print line[1]
|
print line[1]
|
||||||
|
@ -85,7 +85,6 @@ simple_dict = {
|
|||||||
"function": Function ,
|
"function": Function ,
|
||||||
"recursive": Function ,
|
"recursive": Function ,
|
||||||
}
|
}
|
||||||
simple_dict_keys = simple_dict.keys()
|
|
||||||
|
|
||||||
def get_type (i, filename, line, is_doc):
|
def get_type (i, filename, line, is_doc):
|
||||||
'''Find the type of a text line'''
|
'''Find the type of a text line'''
|
||||||
@ -126,7 +125,7 @@ def get_type (i, filename, line, is_doc):
|
|||||||
if is_doc:
|
if is_doc:
|
||||||
return [ Doc (i,line,filename) ], is_doc
|
return [ Doc (i,line,filename) ], is_doc
|
||||||
|
|
||||||
if firstword in simple_dict_keys:
|
if firstword in simple_dict:
|
||||||
return [ simple_dict[firstword](i,line,filename) ], is_doc
|
return [ simple_dict[firstword](i,line,filename) ], is_doc
|
||||||
|
|
||||||
if firstword in [ "select", "selectcase" ]:
|
if firstword in [ "select", "selectcase" ]:
|
||||||
@ -621,7 +620,7 @@ def irp_simple_statements(text):
|
|||||||
result = []
|
result = []
|
||||||
for line in text:
|
for line in text:
|
||||||
buffer = [ line ]
|
buffer = [ line ]
|
||||||
for t in d.keys():
|
for t in d:
|
||||||
if type(line) == t:
|
if type(line) == t:
|
||||||
buffer = d[t](line)
|
buffer = d[t](line)
|
||||||
break
|
break
|
||||||
|
@ -1 +1 @@
|
|||||||
version = "1.1.64"
|
version = "1.1.65"
|
||||||
|
Loading…
Reference in New Issue
Block a user