Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
try to have valid chunks in generated files to please eclipse
authorMartin Quinson <martin.quinson@loria.fr>
Thu, 9 Oct 2014 21:29:50 +0000 (23:29 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Thu, 9 Oct 2014 21:29:50 +0000 (23:29 +0200)
src/simix/simcalls.py
src/simix/simcalls_generated_enum.h
src/simix/smx_smurf_private.h

index 570815e..cedb985 100755 (executable)
@@ -197,7 +197,7 @@ def parse(fn):
       resdi.append(sim)
   return res, resd
 
       resdi.append(sim)
   return res, resd
 
-def write(fn, func, scs, scd):
+def write(fn, func, scs, scd,pre="",post=""):
   f = open(fn, 'w')
   f.write('/*********************************************\n')
   f.write(' * File Generated by src/simix/simcalls.py   *\n')
   f = open(fn, 'w')
   f.write('/*********************************************\n')
   f.write(' * File Generated by src/simix/simcalls.py   *\n')
@@ -205,9 +205,11 @@ def write(fn, func, scs, scd):
   f.write(' * Do not modify this file, add new simcalls *\n')
   f.write(' * in src/simix/simcalls.in                  *\n')  
   f.write(' *********************************************/\n\n')
   f.write(' * Do not modify this file, add new simcalls *\n')
   f.write(' * in src/simix/simcalls.in                  *\n')  
   f.write(' *********************************************/\n\n')
+  f.write(pre)
   f.write('\n'.join(func(sc) for sc in scs))
   for k, v in scd.items():
     f.write('\n#ifdef %s\n%s\n#endif\n'%(k, '\n'.join(func(sc) for sc in v)))
   f.write('\n'.join(func(sc) for sc in scs))
   for k, v in scd.items():
     f.write('\n#ifdef %s\n%s\n#endif\n'%(k, '\n'.join(func(sc) for sc in v)))
+  f.write(post)
   f.close()
 
 if __name__=='__main__':
   f.close()
 
 if __name__=='__main__':
@@ -221,7 +223,18 @@ if __name__=='__main__':
   #if not ok:
   #  sys.exit(1)
 
   #if not ok:
   #  sys.exit(1)
 
-  write('simcalls_generated_enum.h', Simcall.enum, simcalls, simcalls_dict)
+  write('simcalls_generated_enum.h', Simcall.enum, simcalls, simcalls_dict,"""
+/**
+ * @brief All possible simcalls.
+ */
+typedef enum {
+SIMCALL_NONE,
+  ""","""
+SIMCALL_NEW_API_INIT,
+NUM_SIMCALLS
+} e_smx_simcall_t;
+  """)
+  
   write('simcalls_generated_string.c', Simcall.string, simcalls, simcalls_dict)
   write('simcalls_generated_res_getter_setter.h', Simcall.result_getter_setter, simcalls, simcalls_dict)
   write('simcalls_generated_args_getter_setter.h', Simcall.args_getter_setter, simcalls, simcalls_dict)
   write('simcalls_generated_string.c', Simcall.string, simcalls, simcalls_dict)
   write('simcalls_generated_res_getter_setter.h', Simcall.result_getter_setter, simcalls, simcalls_dict)
   write('simcalls_generated_args_getter_setter.h', Simcall.args_getter_setter, simcalls, simcalls_dict)
index c2e7fe9..597a621 100644 (file)
@@ -5,7 +5,13 @@
  * in src/simix/simcalls.in                  *
  *********************************************/
 
  * in src/simix/simcalls.in                  *
  *********************************************/
 
-SIMCALL_HOST_GET_BY_NAME,
+
+/**
+ * @brief All possible simcalls.
+ */
+typedef enum {
+SIMCALL_NONE,
+  SIMCALL_HOST_GET_BY_NAME,
 SIMCALL_HOST_GET_NAME,
 SIMCALL_HOST_ON,
 SIMCALL_HOST_OFF,
 SIMCALL_HOST_GET_NAME,
 SIMCALL_HOST_ON,
 SIMCALL_HOST_OFF,
@@ -136,3 +142,8 @@ SIMCALL_MC_SNAPSHOT,
 SIMCALL_MC_COMPARE_SNAPSHOTS,
 SIMCALL_MC_RANDOM,
 #endif
 SIMCALL_MC_COMPARE_SNAPSHOTS,
 SIMCALL_MC_RANDOM,
 #endif
+
+SIMCALL_NEW_API_INIT,
+NUM_SIMCALLS
+} e_smx_simcall_t;
+  
\ No newline at end of file
index dcd3402..5b07a12 100644 (file)
@@ -18,15 +18,7 @@ SG_BEGIN_DECL()
  *
  * */
 
  *
  * */
 
-/**
- * \brief All possible simcalls.
- */
-typedef enum {
-SIMCALL_NONE,
-#include "simcalls_generated_enum.h"
-SIMCALL_NEW_API_INIT,
-NUM_SIMCALLS
-} e_smx_simcall_t;
+#include "simcalls_generated_enum.h" /* All possible simcalls (generated) */
 
 typedef int (*simix_match_func_t)(void *, void *, smx_action_t);
 typedef void (*simix_copy_data_func_t)(smx_action_t, void*, size_t);
 
 typedef int (*simix_match_func_t)(void *, void *, smx_action_t);
 typedef void (*simix_copy_data_func_t)(smx_action_t, void*, size_t);