dict acceleration

Version:1.1.65
This commit is contained in:
Anthony Scemama 2011-04-09 23:45:50 +02:00
parent cdab9bb2c0
commit 4179c67037
7 changed files with 19 additions and 20 deletions

View File

@ -102,7 +102,7 @@ Options:
def opts(self):
if self._opts is None:
optlist = ["",[]]
for o in options.keys():
for o in options:
b = [o]+options[o]
if b[3] == 1:
b[0] = b[0]+":"
@ -132,7 +132,7 @@ def do_$LONG(self):
return self._do_$LONG
do_$LONG = property(fget=do_$LONG)
"""
for short in options.keys():
for short in options:
long = options[short][0]
exec t.replace("$LONG",long).replace("$SHORT",short)

View File

@ -97,13 +97,13 @@ def do_print(var):
def run():
import parsed_text
import os,sys
l = variables.keys()
if os.fork() == 0:
for v in l:
do_print(variables[v])
for v in variables.values():
do_print(v)
sys.exit(0)
if os.fork() == 0:
l = variables.keys()
file = open("irpf90_entities","w")
l.sort()
for v in l:

View File

@ -63,8 +63,8 @@ def run():
from modules import modules
if os.fork() == 0:
mod = []
for m in modules.keys():
mod.append(modules[m])
for m in modules.values():
mod.append(m)
file = open('irpf90.make','w')

View File

@ -63,6 +63,6 @@ def write_module(m):
######################################################################
if __name__ == '__main__':
write_module(modules['electrons.irp.f'])
write_module(modules['psi.irp.f'])

View File

@ -166,13 +166,13 @@ def get_parsed_text():
l = line.lower.split()[1:]
l = filter(lambda x: x not in varlist, l)
for v in l:
if v not in variables.keys():
if v not in variables:
error.fail(line,"Variable %s is unknown"%(v))
append( (l,Simple_line(line.i,"!%s"%(line.text),line.filename)) )
elif type(line) == NoDep:
l = line.lower.split()[1:]
for v in l:
if v not in variables.keys():
if v not in variables:
error.fail(line,"Variable %s is unknown"%(v))
l = map(lambda x: "-%s"%(x), l)
append( (l,Simple_line(line.i,"!%s"%(line.text),line.filename)) )
@ -447,25 +447,25 @@ def build_needs():
funcs = find_funcs_in_line(line)
for f in funcs:
var.needs += subroutines[f].needs
for v in variables.keys():
for v in variables:
main = variables[v].same_as
if main != v:
variables[v].needs = variables[main].needs
variables[v].to_provide = variables[main].to_provide
# Needed_by
for v in variables.keys():
for v in variables:
variables[v].needed_by = []
for v in variables.keys():
for v in variables:
main = variables[v].same_as
if main != v:
variables[v].needed_by = variables[main].needed_by
for v in variables.keys():
for v in variables:
var = variables[v]
if var.is_main:
for x in var.needs:
variables[x].needed_by.append(var.same_as)
for v in variables.keys():
for v in variables:
var = variables[v]
var.needed_by = make_single(var.needed_by)
@ -507,7 +507,7 @@ check_opt()
######################################################################
if __name__ == '__main__':
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])
for line in parsed_text[i][1]:
print line[1]

View File

@ -85,7 +85,6 @@ simple_dict = {
"function": Function ,
"recursive": Function ,
}
simple_dict_keys = simple_dict.keys()
def get_type (i, filename, line, is_doc):
'''Find the type of a text line'''
@ -126,7 +125,7 @@ def get_type (i, filename, line, is_doc):
if 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
if firstword in [ "select", "selectcase" ]:
@ -621,7 +620,7 @@ def irp_simple_statements(text):
result = []
for line in text:
buffer = [ line ]
for t in d.keys():
for t in d:
if type(line) == t:
buffer = d[t](line)
break

View File

@ -1 +1 @@
version = "1.1.64"
version = "1.1.65"