@@ -118,16 +118,19 @@ def load_prototypes(fname):
118118class FortranBinding :
119119 """Class for generating the binding for a single function."""
120120
121- def __init__ (self , prototype , out , bigcount = False ):
121+ def __init__ (self , prototype , out , bigcount = False , ts = False ):
122+ # Generate bigcount interface version
122123 self .bigcount = bigcount
124+ # Generate files with support for TS 29113 or not
125+ self .ts = ts
123126 self .fn_name = prototype .fn_name
124127 self .out = out
125128 self .parameters = []
126129 param_map = {}
127130 dep_params = {}
128131 for param in prototype .parameters :
129132 type_ = FortranType .get (param .type_name )
130- param_type = type_ (param .name , self .fn_name , bigcount = bigcount )
133+ param_type = type_ (param .name , self .fn_name , bigcount = bigcount , ts = ts )
131134 self .parameters .append (param_type )
132135 param_map [param .name ] = param_type
133136 if param .dep_params is not None :
@@ -340,10 +343,10 @@ def print_profiling_rename_macros(prototypes, out):
340343 out .dump ('#endif /* OMPI_BUILD_MPI_PROFILING */' )
341344
342345
343- def print_c_source_header (out ):
346+ def print_c_source_header (out , ts = False ):
344347 """Print the header of the C source file."""
345348 out .dump (f'/* { consts .GENERATED_MESSAGE } */' )
346- if compiler . HAVE_TS :
349+ if ts :
347350 out .dump ('#include <ISO_Fortran_binding.h>' )
348351 out .dump ('#include "ts.h"' )
349352 out .dump ('#include "ompi_config.h"' )
@@ -356,9 +359,9 @@ def print_c_source_header(out):
356359 out .dump ('#include "ompi/communicator/communicator.h"' )
357360
358361
359- def print_binding (prototype , lang , out , bigcount = False ):
362+ def print_binding (prototype , lang , out , bigcount = False , ts = False ):
360363 """Print the binding with or without bigcount."""
361- binding = FortranBinding (prototype , out = out , bigcount = bigcount )
364+ binding = FortranBinding (prototype , out = out , bigcount = bigcount , ts = ts )
362365 if lang == 'fortran' :
363366 binding .print_f_source ()
364367 else :
@@ -374,13 +377,13 @@ def generate_code(args, out):
374377 print_profiling_rename_macros (prototypes , out )
375378 out .dump ()
376379 else :
377- print_c_source_header (out )
380+ print_c_source_header (out , ts = args . ts )
378381 for prototype in prototypes :
379382 out .dump ()
380- print_binding (prototype , args .lang , out )
383+ print_binding (prototype , args .lang , out , ts = args . ts )
381384 if util .fortran_prototype_has_bigcount (prototype ):
382385 out .dump ()
383- print_binding (prototype , args .lang , bigcount = True , out = out )
386+ print_binding (prototype , args .lang , bigcount = True , out = out , ts = args . ts )
384387
385388
386389def generate_interface (args , out ):
@@ -390,10 +393,10 @@ def generate_interface(args, out):
390393 for prototype in prototypes :
391394 ext_name = util .ext_api_func_name (prototype .fn_name )
392395 out .dump (f'interface { ext_name } ' )
393- binding = FortranBinding (prototype , out = out )
396+ binding = FortranBinding (prototype , out = out , ts = args . ts )
394397 binding .print_interface ()
395398 if util .fortran_prototype_has_bigcount (prototype ):
396399 out .dump ()
397- binding_c = FortranBinding (prototype , out = out , bigcount = True )
400+ binding_c = FortranBinding (prototype , out = out , bigcount = True , ts = args . ts )
398401 binding_c .print_interface ()
399402 out .dump (f'end interface { ext_name } ' )
0 commit comments