Added touch query

This commit is contained in:
Anthony Scemama 2010-08-31 11:53:34 +02:00
parent 777c893967
commit d3f76c4580
2 changed files with 24 additions and 1 deletions

View File

@ -38,8 +38,9 @@ options['i'] = [ 'init' , 'Initialize current directory', 0 ]
options['D'] = [ 'define' , 'Define variable', 1 ]
options['o'] = [ 'checkopt' , 'Show where optimization may be required', 0 ]
options['p'] = [ 'preprocess' , 'Preprocess file', 1 ]
options['t'] = [ 'openmp' , 'Task Auto-parallelization', 0 ]
options['t'] = [ 'touch' , 'Display which entities are touched', 1 ]
options['m'] = [ 'memory' , 'Debug memory info', 0 ]
options['z'] = [ 'openmp' , 'Automatic openMP tasks (may not work)', 0 ]
class CommandLine(object):
@ -67,6 +68,15 @@ class CommandLine(object):
return self._preprocessed
preprocessed = property(fget=preprocessed)
def touched(self):
if '_touched' not in self.__dict__:
self._touched = []
for o,a in self.opts:
if o in [ "-t", options['t'][0] ]:
self._touched.append(a)
return self._touched
touched = property(fget=touched)
def usage(self):
t = """
$EXE - $DESCR

View File

@ -47,6 +47,7 @@ def main():
for line in text:
print line.text
if not command_line.do_run:
return
@ -69,5 +70,17 @@ def main():
import create_man
create_man.run()
if command_line.do_touch:
from variables import variables
for var in command_line.touched:
if var not in variables:
print "%s is not an IRP entity"%(var,)
else:
print "%s touches the following entities:"%(var,)
parents = variables[var].parents
parents.sort()
for x in parents:
print "- %s"%(x,)
if __name__ == '__main__':
main()