10
0
mirror of https://gitlab.com/scemama/irpf90.git synced 2024-06-02 11:25:19 +02:00

Bug in touch of multiple variables

This commit is contained in:
vijaygopalchilkuri 2013-07-09 19:53:05 +02:00
parent 45b328c442
commit 5abd43782f

View File

@ -1,7 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
# IRPF90 is a Fortran90 preprocessor written in Python for programming using # IRPF90 is a Fortran90 preprocessor written in Python for programming using
# the Implicit Reference to Parameters (IRP) method. # the Implicit Reference to Parameters (IRP) method.
# Copyright (C) 2009 Anthony SCEMAMA # Copyright (C) 2009 Anthony SCEMAMA
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -20,8 +20,8 @@
# Anthony Scemama # Anthony Scemama
# LCPQ - IRSAMC - CNRS # LCPQ - IRSAMC - CNRS
# Universite Paul Sabatier # Universite Paul Sabatier
# 118, route de Narbonne # 118, route de Narbonne
# 31062 Toulouse Cedex 4 # 31062 Toulouse Cedex 4
# scemama@irsamc.ups-tlse.fr # scemama@irsamc.ups-tlse.fr
@ -82,7 +82,6 @@ def check_touch(line,vars,main_vars):
all_others = make_single(flatten( map(fun,main_vars) )) all_others = make_single(flatten( map(fun,main_vars) ))
all_others.sort() all_others.sort()
vars.sort() vars.sort()
print vars
for x,y in zip(vars,all_others): for x,y in zip(vars,all_others):
if x != y: if x != y:
message = "The following entities should be touched:\n" message = "The following entities should be touched:\n"
@ -118,7 +117,7 @@ def update_variables():
variables[line.filename]._is_written = True variables[line.filename]._is_written = True
################################################################################ ################################################################################
def get_parsed_text(): def get_parsed_text():
def func(filename, text): def func(filename, text):
varlist = [] varlist = []
@ -144,7 +143,7 @@ def get_parsed_text():
Subroutine, Subroutine,
Function, Function,
End, End,
]: ]:
append( ([],line) ) append( ([],line) )
elif type(line) in [ Begin_provider, Cont_provider ]: elif type(line) in [ Begin_provider, Cont_provider ]:
if type(line) == Begin_provider: if type(line) == Begin_provider:
@ -243,7 +242,7 @@ def get_parsed_text():
# main_result.append( (filename, func(filename,text)) ) # main_result.append( (filename, func(filename,text)) )
#return main_result #return main_result
return parallel_loop(func,preprocessed_text) return parallel_loop(func,preprocessed_text)
update_variables() update_variables()
parsed_text = get_parsed_text() parsed_text = get_parsed_text()
@ -321,7 +320,7 @@ def add_subroutine_needs():
append( (vars,line) ) append( (vars,line) )
main_result.append( (filename, result) ) main_result.append( (filename, result) )
return main_result return main_result
parsed_text = add_subroutine_needs() parsed_text = add_subroutine_needs()
###################################################################### ######################################################################
@ -386,7 +385,7 @@ def move_variables():
error.fail(line,"Unable to parse file") error.fail(line,"Unable to parse file")
result.reverse() result.reverse()
# 2nd pass # 2nd pass
text = result text = result
result = [] result = []
@ -458,12 +457,12 @@ def build_needs():
Simple_line, Assert, Simple_line, Assert,
Do , If, Do , If,
Elseif , Select, Elseif , Select,
]: ]:
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: 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
@ -472,7 +471,7 @@ def build_needs():
for v in variables: for v in variables:
variables[v].needed_by = [] variables[v].needed_by = []
for v in variables: 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: for v in variables:
@ -534,7 +533,7 @@ def perform_loop_substitutions():
append( (vars,line) ) append( (vars,line) )
main_result.append( (filename, result) ) main_result.append( (filename, result) )
return main_result return main_result
parsed_text = perform_loop_substitutions() parsed_text = perform_loop_substitutions()
###################################################################### ######################################################################