@@ -116,6 +116,8 @@ def apply_styles(graph):
116
116
__str_kw_ieee_exceptions__ = r"[Ii][Ee][Ee][Ee]_[Ee][Xx][Cc][Ee][Pp][Tt][Ii][Oo][Nn][Ss]"
117
117
__str_kw_ieee_arithmetic__ = r"[Ii][Ee][Ee][Ee]_[Aa][Rr][Ii][Tt][Hh][Mm][Ee][Tt][Ii][Cc]"
118
118
__str_kw_ieee_features__ = r"[Ii][Ee][Ee][Ee]_[Ff][Ee][Aa][Tt][Uu][Rr][Ee][Ss]"
119
+ __str_kw_openacc__ = r"[Oo][Pp][Ee][Nn][Aa][Cc][Cc]"
120
+ __str_kw_omp_lib__ = r"[Oo][Mm][Pp]_[Ll][Ii][Bb]"
119
121
__str_kw_module__ = r"[Mm][Oo][Dd][Uu][Ll][Ee]"
120
122
__str_kw_submodule__ = r"[Ss][Uu][Bb][Mm][Oo][Dd][Uu][Ll][Ee]"
121
123
__str_kw_program__ = r"[Pp][Rr][Oo][Gg][Rr][Aa][Mm]"
@@ -157,6 +159,14 @@ def apply_styles(graph):
157
159
__str_kw_use__ + # keyword "use"
158
160
r"\s+" + __str_kw_ieee_features__ + # keyword intrinsic module ieee_features
159
161
r"(?P<mod_eol>(.*))" )
162
+ __str_use_mod_openacc__ = (r"^(\s*)" + # eventual initial white spaces
163
+ __str_kw_use__ + # keyword "use"
164
+ r"\s+" + r"(.*)" + __str_kw_openacc__ + r".*" + # keyword intrinsic module openacc
165
+ r"(?P<mod_eol>(.*))" )
166
+ __str_use_mod_omp_lib__ = (r"^(\s*)" + # eventual initial white spaces
167
+ __str_kw_use__ + # keyword "use"
168
+ r"\s+" + r"(.*)" + __str_kw_omp_lib__ + r".*" + # keyword intrinsic module omp_lib
169
+ r"(?P<mod_eol>(.*))" )
160
170
__str_include__ = (r"^(\s*|\#)" + # eventual initial white spaces or "#" character
161
171
__str_kw_include__ + # keyword "include"
162
172
r"(\s+)" + # 1 or more white spaces
@@ -196,12 +206,16 @@ def apply_styles(graph):
196
206
__regex_use_mod_ieee_exceptions__ = re .compile (__str_use_mod_ieee_exceptions__ )
197
207
__regex_use_mod_ieee_arithmetic__ = re .compile (__str_use_mod_ieee_arithmetic__ )
198
208
__regex_use_mod_ieee_features__ = re .compile (__str_use_mod_ieee_features__ )
209
+ __regex_use_mod_openacc__ = re .compile (__str_use_mod_openacc__ )
210
+ __regex_use_mod_omp_lib__ = re .compile (__str_use_mod_omp_lib__ )
199
211
__regex_use_intrinsic_modules__ = [__regex_use_mod_intrinsic__ ,
200
212
__regex_use_mod_iso_fortran_env__ ,
201
213
__regex_use_mod_iso_c_binding__ ,
202
214
__regex_use_mod_ieee_exceptions__ ,
203
215
__regex_use_mod_ieee_arithmetic__ ,
204
- __regex_use_mod_ieee_features__ ]
216
+ __regex_use_mod_ieee_features__ ,
217
+ __regex_use_mod_openacc__ ,
218
+ __regex_use_mod_omp_lib__ ]
205
219
__regex_mpifh__ = re .compile (__str_mpifh__ )
206
220
207
221
# alternative "open and read"... it should avoid encoding issues with python 2.X vs 3.X
@@ -297,7 +311,7 @@ def sort_dependencies(self):
297
311
self .pfile_dep_all .sort (key = operator .attrgetter ('order' ), reverse = True )
298
312
return
299
313
300
- def parse (self , inc , preprocessor = 'cpp' , preproc = '' ):
314
+ def parse (self , inc = [ '.INC' , '.F' , '.FOR' , '.FPP' , '.F77' , '.F90' , '.F95' , '.F03' , '.F08' ], preprocessor = 'cpp' , preproc = '' , include = '' ):
301
315
"""
302
316
Parse the file creating its the dependencies list and the list of modules names that self eventually contains.
303
317
@@ -309,12 +323,14 @@ def parse(self, inc, preprocessor='cpp', preproc=''):
309
323
preprocessor name
310
324
preproc : str
311
325
preprocessor flags
326
+ include : list
327
+ include directories
312
328
"""
313
329
self .module_names = []
314
330
self .submodule_names = []
315
331
self .dependencies = []
316
332
317
- if self .extension in [ '.INC' , '.F' , '.FOR' , '.FPP' , '.F77' , '.F90' , '.F95' , '.F03' , '.F08' ] :
333
+ if self .extension in inc :
318
334
preprocessor_exist = False
319
335
for path in os .environ ["PATH" ].split (os .pathsep ):
320
336
preprocessor_exist = os .path .exists (os .path .join (path , preprocessor ))
@@ -325,7 +341,7 @@ def parse(self, inc, preprocessor='cpp', preproc=''):
325
341
preprocessor += ' -C -w '
326
342
elif preprocessor == 'fpp' :
327
343
preprocessor += ' -w '
328
- source = str (check_output (preprocessor + ' ' + preproc + ' ' + self .name , shell = True , stderr = STDOUT , encoding = 'UTF-8' ))
344
+ source = str (check_output (preprocessor + ' ' + preproc + ' ' + '-I' . join ( include ) + ' ' + self .name , shell = True , stderr = STDOUT , encoding = 'UTF-8' ))
329
345
source = source .replace ('\\ n' , '\n ' )
330
346
else :
331
347
source = str (openReader (self .name ).read ())
0 commit comments