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.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(post)
f.close()
if __name__=='__main__':
#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)
* 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_MC_COMPARE_SNAPSHOTS,
SIMCALL_MC_RANDOM,
#endif
+
+SIMCALL_NEW_API_INIT,
+NUM_SIMCALLS
+} e_smx_simcall_t;
+
\ No newline at end of file
*
* */
-/**
- * \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);