SST/macro
skeleton.h
Go to the documentation of this file.
1 #ifndef sstmac_skeleton_h
2 #define sstmac_skeleton_h
3 
4 #define SSTPP_QUOTE(name) #name
5 #define SSTPP_STR(name) SSTPP_QUOTE(name)
6 #define SST_APP_NAME_QUOTED SSTPP_STR(sstmac_app_name)
7 #define ELI_NAME(app) app##_eli
8 typedef int (*main_fxn)(int,char**);
9 typedef int (*empty_main_fxn)();
10 
11 #if SSTMAC_INTEGRATED_SST_CORE && defined(SSTMAC_EXTERNAL_SKELETON)
12 #include <Python.h>
13 #define sst_eli_block(app) \
14  static PyMethodDef sst_macro_null_methods[] = { \
15  { NULL, NULL, 0, NULL } \
16  }; \
17  static inline void* gen_sst_macro_integrated_pymodule(void) \
18  { \
19  PyObject* module = Py_InitModule("sst." #app, sst_macro_null_methods); \
20  return module; \
21  } \
22  extern "C" { \
23  SST::ElementLibraryInfo ELI_NAME(app) = { \
24  "macro", \
25  "SST Macroscale skeleton app", \
26  NULL, \
27  NULL, \
28  NULL, \
29  NULL, \
30  NULL, \
31  NULL, \
32  gen_sst_macro_integrated_pymodule \
33  }; \
34  }
35 #else
36 #define sst_eli_block(app)
37 #endif
38 
40 
41 #ifdef __cplusplus
45 
46 /** Automatically inherit runtime types */
47 using sprockit::sim_parameters;
48 
49 #ifndef USER_MAIN
50 #define USER_MAIN(...) \
51  fxn_that_nobody_ever_uses_to_make_magic_happen(); \
52  typedef int (*this_file_main_fxn)(__VA_ARGS__); \
53  int user_skeleton_main_init_fxn(const char* name, this_file_main_fxn fxn); \
54  static int user_skeleton_main(__VA_ARGS__); \
55  static int dont_ignore_this = \
56  user_skeleton_main_init_fxn(SST_APP_NAME_QUOTED, user_skeleton_main); \
57  sst_eli_block(sstmac_app_name) \
58  static int user_skeleton_main(__VA_ARGS__)
59 #endif
60 
61 extern sprockit::sim_parameters*
62 get_params();
63 #else //not C++, extra work required
64 
65 #ifndef USER_MAIN
66 #define USER_MAIN(...) \
67  fxn_that_nobody_ever_uses_to_make_magic_happen(); \
68  sst_eli_block(sstmac_app_name) \
69  int sstmac_app_name(__VA_ARGS__)
70 #endif
71 
72 #endif
73 
74 
75 
76 
77 #endif
int(* empty_main_fxn)()
Definition: skeleton.h:9
int(* main_fxn)(int, char **)
Definition: skeleton.h:8