X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/c42000db0f347a26ac1645d830ac949194ec4da0..4fc610b42e6253c348b6fcc85f41f41bf13a19ea:/src/xbt/module.c diff --git a/src/xbt/module.c b/src/xbt/module.c index d2a718853c..0c90ca5c3b 100644 --- a/src/xbt/module.c +++ b/src/xbt/module.c @@ -21,35 +21,37 @@ #include "xbt_modinter.h" /* prototype of other module's init/exit in XBT */ #include "gras_modinter.h" /* same in GRAS */ -GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(module,xbt, "module handling"); +XBT_LOG_NEW_DEFAULT_SUBCATEGORY(module,xbt, "module handling"); -static int gras_running_process = 0; +static int xbt_running_process = 0; -struct gras_module_ { - gras_dynar_t *deps; - gras_cfg_t *cfg; +struct xbt_module_ { + xbt_dynar_t *deps; + xbt_cfg_t *cfg; int ref; - gras_module_new_fct_t new; - gras_module_finalize_fct_t finalize; + xbt_module_new_fct_t new; + xbt_module_finalize_fct_t finalize; }; void -gras_init(int *argc, char **argv) { - gras_init_defaultlog(argc, argv, NULL); +xbt_init(int *argc, char **argv) { + static int first_run = 1; + if(first_run) + xbt_init_defaultlog(argc, argv, NULL); + first_run = 0; } /** - * gras_init_defaultlog: + * xbt_init_defaultlog: * @argc: * @argv: * * Initialize the gras mecanisms. */ void -gras_init_defaultlog(int *argc,char **argv, const char *defaultlog) { +xbt_init_defaultlog(int *argc,char **argv, const char *defaultlog) { int i,j; char *opt; - gras_error_t errcode; int found=0; INFO0("Initialize GRAS"); @@ -60,7 +62,7 @@ gras_init_defaultlog(int *argc,char **argv, const char *defaultlog) { found = 1; opt=strchr(argv[i],'='); opt++; - gras_log_control_set(opt); + xbt_log_control_set(opt); DEBUG1("Did apply '%s' as log setting",opt); /*remove this from argv*/ for (j=i+1; j<*argc; j++) { @@ -72,12 +74,12 @@ gras_init_defaultlog(int *argc,char **argv, const char *defaultlog) { } } if (!found && defaultlog) { - gras_log_control_set(defaultlog); + xbt_log_control_set(defaultlog); } gras_process_init(); /* calls procdata_init, which calls dynar_new */ /** init other submodules */ - if (gras_running_process++ == 0) { + if (xbt_running_process++ == 0) { gras_msg_init(); gras_trp_init(); gras_datadesc_init(); @@ -85,19 +87,19 @@ gras_init_defaultlog(int *argc,char **argv, const char *defaultlog) { } /** - * gras_exit: + * xbt_exit: * * Finalize the gras mecanisms. */ void -gras_exit(){ +xbt_exit(){ INFO0("Exiting GRAS"); gras_process_exit(); - if (--gras_running_process == 0) { + if (--xbt_running_process == 0) { gras_msg_exit(); gras_trp_exit(); gras_datadesc_exit(); } - gras_log_exit(); + xbt_log_exit(); DEBUG0("Exited GRAS"); }