From efd67d12f96a229b6054429b7047c6bfdcb3b74a Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 20 Nov 2013 17:43:03 +0100 Subject: [PATCH] Work to do --- example/input.irp.f | 22 ---------------------- src/command_line.py | 10 ++++++++++ src/irpf90_t.py | 3 +++ 3 files changed, 13 insertions(+), 22 deletions(-) delete mode 100644 example/input.irp.f diff --git a/example/input.irp.f b/example/input.irp.f deleted file mode 100644 index 2f5049a..0000000 --- a/example/input.irp.f +++ /dev/null @@ -1,22 +0,0 @@ - BEGIN_PROVIDER [ integer, d1 ] -&BEGIN_PROVIDER [ integer, d2 ] -&BEGIN_PROVIDER [ integer, d3 ] -&BEGIN_PROVIDER [ integer, d4 ] -&BEGIN_PROVIDER [ integer, d5 ] - - print *, 'd1' - read(*,*) d1 - - BEGIN_TEMPLATE - print *, '$X' - read(*,*) $X - ASSERT ( $X > $Y ) - - SUBST [ X, Y ] - d2; d1;; - d3; d2;; - d4; d3;; - d5; d4;; - END_TEMPLATE -END_PROVIDER - diff --git a/src/command_line.py b/src/command_line.py index f25e81b..11facfa 100644 --- a/src/command_line.py +++ b/src/command_line.py @@ -48,6 +48,7 @@ options['s'] = [ 'substitute' , 'Substitute values in do loops for generating options['r'] = [ 'no_directives', 'Ignore all compiler directives !DEC$ and !DIR$', 0 ] options['n'] = [ 'inline' , 'all|providers|builders : Force inlining of providers or builders', 1 ] options['u'] = [ 'unused' , 'Print unused providers', 0 ] +options['I'] = [ 'include' , 'Include directory', 1 ] class CommandLine(object): @@ -67,6 +68,15 @@ class CommandLine(object): return self._defined defined = property(fget=defined) + def include_dir(self): + if '_include_dir' not in self.__dict__: + self._include_dir = [] + for o,a in self.opts: + if o in [ "-I", '--'+options['I'][0] ]: + self._include_dir.append(a) + return self._include_dir + include_dir = property(fget=include_dir) + def inline(self): if '_inline' not in self.__dict__: self._inline = "" diff --git a/src/irpf90_t.py b/src/irpf90_t.py index 3d413e2..6aaa30a 100644 --- a/src/irpf90_t.py +++ b/src/irpf90_t.py @@ -349,8 +349,11 @@ def create_irpf90_files(): def is_irpf90_file(filename): return filename.endswith(".irp.f") and not filename.startswith('.') result = filter ( is_irpf90_file, os.listdir(os.getcwd()) ) + for dir in command_line.include_dir: + result += map(lambda x: dir+'/'+x, filter ( is_irpf90_file, os.listdir(dir) ) ) return result irpf90_files = create_irpf90_files() +print irpf90_files