10
0
mirror of https://gitlab.com/scemama/irpf90.git synced 2024-12-21 11:53:32 +01:00

Less printing

This commit is contained in:
Anthony Scemama 2015-06-01 14:56:41 +02:00
parent ab735fc6a3
commit 452b20c40b
4 changed files with 18 additions and 3 deletions

View File

@ -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['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['w'] = [ 'warnings' , 'Activate Warnings', 0 ]
options['z'] = [ 'openmp' , 'Activate for OpenMP code', 0 ]
class CommandLine(object):
@ -161,6 +162,15 @@ or
return self._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):
if '_openmp' not in self.__dict__:
self._openmp = False

View File

@ -27,6 +27,8 @@
import sys
from irpf90_t import *
from command_line import command_line
do_warnings = command_line.do_warnings
######################################################################
def fail(line,message):
@ -43,6 +45,8 @@ Error:
######################################################################
def warn(line,message):
if not command_line.do_warnings:
return
if line is not None:
assert isinstance(line,Line)
print """

View File

@ -75,6 +75,7 @@ def init():
try:
file = open(filename,"r")
except IOError:
if command_line.do_warnings:
print "Warning : Unable to read file %s."%(filename)
else:
buffer = file.read()

View File

@ -46,7 +46,7 @@ def write_module(m):
text = m.header + m.head
text = map(lambda x: "%s\n"%(x),text)
if not same_file(filename,text):
print filename
# print filename
file = open(filename,"w")
file.writelines(text)
file.close()
@ -56,7 +56,7 @@ def write_module(m):
text = m.header + m.generated_text + m.residual_text
text = map(lambda x: "%s\n"%(x),text)
if not same_file(filename,text):
print filename
# print filename
file = open(filename,"w")
file.writelines(text)
file.close()