mirror of
https://gitlab.com/scemama/irpf90.git
synced 2024-12-21 11:53:32 +01:00
Less printing
This commit is contained in:
parent
ab735fc6a3
commit
452b20c40b
@ -50,6 +50,7 @@ options['r'] = [ 'no_directives', 'Ignore all compiler directives !DEC$ and !DIR
|
|||||||
options['s'] = [ 'substitute' , 'Substitute values in do loops for generating specific optimized code.', 1 ]
|
options['s'] = [ 'substitute' , 'Substitute values in do loops for generating specific optimized code.', 1 ]
|
||||||
options['t'] = [ 'touch' , 'Display which entities are touched when touching the variable given as an argument.', 1 ]
|
options['t'] = [ 'touch' , 'Display which entities are touched when touching the variable given as an argument.', 1 ]
|
||||||
options['v'] = [ 'version' , 'Prints version of irpf90', 0 ]
|
options['v'] = [ 'version' , 'Prints version of irpf90', 0 ]
|
||||||
|
options['w'] = [ 'warnings' , 'Activate Warnings', 0 ]
|
||||||
options['z'] = [ 'openmp' , 'Activate for OpenMP code', 0 ]
|
options['z'] = [ 'openmp' , 'Activate for OpenMP code', 0 ]
|
||||||
|
|
||||||
class CommandLine(object):
|
class CommandLine(object):
|
||||||
@ -161,6 +162,15 @@ or
|
|||||||
return self._coarray
|
return self._coarray
|
||||||
coarray = property(fget=coarray)
|
coarray = property(fget=coarray)
|
||||||
|
|
||||||
|
def warnings(self):
|
||||||
|
if '_warnings' not in self.__dict__:
|
||||||
|
self._warnings= False
|
||||||
|
for o,a in self.opts:
|
||||||
|
if o in [ "-w", '--'+options['w'][0] ]:
|
||||||
|
self._warnings= True
|
||||||
|
return self._warnings
|
||||||
|
do_warnings = property(fget=warnings)
|
||||||
|
|
||||||
def openmp(self):
|
def openmp(self):
|
||||||
if '_openmp' not in self.__dict__:
|
if '_openmp' not in self.__dict__:
|
||||||
self._openmp = False
|
self._openmp = False
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
from irpf90_t import *
|
from irpf90_t import *
|
||||||
|
from command_line import command_line
|
||||||
|
do_warnings = command_line.do_warnings
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
def fail(line,message):
|
def fail(line,message):
|
||||||
@ -43,6 +45,8 @@ Error:
|
|||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
def warn(line,message):
|
def warn(line,message):
|
||||||
|
if not command_line.do_warnings:
|
||||||
|
return
|
||||||
if line is not None:
|
if line is not None:
|
||||||
assert isinstance(line,Line)
|
assert isinstance(line,Line)
|
||||||
print """
|
print """
|
||||||
|
@ -75,7 +75,8 @@ def init():
|
|||||||
try:
|
try:
|
||||||
file = open(filename,"r")
|
file = open(filename,"r")
|
||||||
except IOError:
|
except IOError:
|
||||||
print "Warning : Unable to read file %s."%(filename)
|
if command_line.do_warnings:
|
||||||
|
print "Warning : Unable to read file %s."%(filename)
|
||||||
else:
|
else:
|
||||||
buffer = file.read()
|
buffer = file.read()
|
||||||
file.close()
|
file.close()
|
||||||
|
@ -46,7 +46,7 @@ def write_module(m):
|
|||||||
text = m.header + m.head
|
text = m.header + m.head
|
||||||
text = map(lambda x: "%s\n"%(x),text)
|
text = map(lambda x: "%s\n"%(x),text)
|
||||||
if not same_file(filename,text):
|
if not same_file(filename,text):
|
||||||
print filename
|
# print filename
|
||||||
file = open(filename,"w")
|
file = open(filename,"w")
|
||||||
file.writelines(text)
|
file.writelines(text)
|
||||||
file.close()
|
file.close()
|
||||||
@ -56,7 +56,7 @@ def write_module(m):
|
|||||||
text = m.header + m.generated_text + m.residual_text
|
text = m.header + m.generated_text + m.residual_text
|
||||||
text = map(lambda x: "%s\n"%(x),text)
|
text = map(lambda x: "%s\n"%(x),text)
|
||||||
if not same_file(filename,text):
|
if not same_file(filename,text):
|
||||||
print filename
|
# print filename
|
||||||
file = open(filename,"w")
|
file = open(filename,"w")
|
||||||
file.writelines(text)
|
file.writelines(text)
|
||||||
file.close()
|
file.close()
|
||||||
|
Loading…
Reference in New Issue
Block a user