X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/825fb3d5095e6cce48885d1d04ab1ec3823dae6c..15afbe2327850f075af976703a182bf99289c118:/include/msg/msg.h diff --git a/include/msg/msg.h b/include/msg/msg.h index 80fae8ff17..8194d19eb3 100644 --- a/include/msg/msg.h +++ b/include/msg/msg.h @@ -9,7 +9,6 @@ #include "xbt.h" #include "msg/datatypes.h" -#include "xbt/automaton.h" #include "simgrid/simix.h" @@ -35,11 +34,29 @@ typedef enum { /************************** Global ******************************************/ XBT_PUBLIC(void) MSG_config(const char *name, ...); -XBT_PUBLIC(void) MSG_global_init(int *argc, char **argv); -XBT_PUBLIC(void) MSG_global_init_args(int *argc, char **argv); +/** \ingroup msg_simulation + * \brief Initialize the MSG internal data. + * \hideinitializer + * + * It also check that the link-time and compile-time versions of SimGrid do + * match, so you should use this version instead of the #MSG_init_nocheck + * function that does the same initializations, but without this check. + * + * We allow to link against compiled versions that differ in the patch level. + */ +#define MSG_init(argc,argv) { \ + int ver_major,ver_minor,ver_patch; \ + sg_version(&ver_major,&ver_minor,&ver_patch); \ + if ((ver_major != SIMGRID_VERSION_MAJOR) || \ + (ver_minor != SIMGRID_VERSION_MINOR)) { \ + fprintf(stderr,"FATAL ERROR: Your program was compiled with SimGrid version %d.%d.%d, and then linked against SimGrid %d.%d.%d. Please fix this.\n", \ + SIMGRID_VERSION_MAJOR,SIMGRID_VERSION_MINOR,SIMGRID_VERSION_PATCH,ver_major,ver_minor,ver_patch); \ + } \ + MSG_init_nocheck(argc,argv); \ + } + +XBT_PUBLIC(void) MSG_init_nocheck(int *argc, char **argv); XBT_PUBLIC(MSG_error_t) MSG_main(void); -XBT_PUBLIC(MSG_error_t) MSG_main_stateful(void); -XBT_PUBLIC(MSG_error_t) MSG_main_liveness(xbt_automaton_t a); XBT_PUBLIC(MSG_error_t) MSG_clean(void); XBT_PUBLIC(void) MSG_function_register(const char *name, xbt_main_func_t code); @@ -56,7 +73,7 @@ XBT_PUBLIC(unsigned long int) MSG_get_sent_msg(void); /************************** File handling ***********************************/ -XBT_PUBLIC(size_t) MSG_file_read(void* ptr, size_t size, size_t nmemb, msg_file_t stream); +XBT_PUBLIC(double) MSG_file_read(void* ptr, size_t size, size_t nmemb, msg_file_t stream); XBT_PUBLIC(size_t) MSG_file_write(const void* ptr, size_t size, size_t nmemb, msg_file_t stream); XBT_PUBLIC(msg_file_t) MSG_file_open(const char* mount, const char* path, const char* mode); XBT_PUBLIC(int) MSG_file_close(msg_file_t fp); @@ -138,7 +155,7 @@ XBT_PUBLIC(const char *) MSG_process_get_property_value(m_process_t XBT_PUBLIC(MSG_error_t) MSG_process_suspend(m_process_t process); XBT_PUBLIC(MSG_error_t) MSG_process_resume(m_process_t process); XBT_PUBLIC(int) MSG_process_is_suspended(m_process_t process); -XBT_PUBLIC(void) MSG_process_on_exit_add(int_f_pvoid_t fun, void *data); +XBT_PUBLIC(void) MSG_process_on_exit(int_f_pvoid_t fun, void *data); /************************** Task handling ************************************/ XBT_PUBLIC(m_task_t) MSG_task_create(const char *name, @@ -246,6 +263,9 @@ XBT_PUBLIC(MSG_error_t) MSG_error_t MSG_action_trace_run(char *path); #ifdef MSG_USE_DEPRECATED +#define MSG_global_init(argc, argv) MSG_init(argc,argv) +#define MSG_global_init_args(argc, argv) MSG_init(argc,argv) + /* these are the functions which are deprecated. Do not use them, they may get removed in future releases */ XBT_PUBLIC(int) MSG_get_host_number(void); XBT_PUBLIC(m_host_t *) MSG_get_host_table(void);