X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f25af1e2829458e33a3a0b74c75865c89dff5f9e..8bf2cf8030ae6d911565e7726e275a560f201dfb:/tools/gras/stub_generator.c diff --git a/tools/gras/stub_generator.c b/tools/gras/stub_generator.c index 7d4d55729d..e082e156fa 100644 --- a/tools/gras/stub_generator.c +++ b/tools/gras/stub_generator.c @@ -21,12 +21,10 @@ #include "gras_stub_generator.h" #include - - +extern char *xbt_binary_name; XBT_LOG_NEW_DEFAULT_SUBCATEGORY(stubgen, gras, "Stub generator"); - #ifdef _XBT_WIN32 #include #endif @@ -43,6 +41,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(stubgen, gras, "Stub generator"); xbt_dict_t process_function_set = NULL; xbt_dynar_t process_list = NULL; xbt_dict_t machine_set = NULL; +char *warning = NULL; void s_process_free(void *process) { @@ -58,8 +57,7 @@ static s_process_t process; static void parse_process_init(void) { - xbt_dict_set(process_function_set, A_surfxml_process_function, NULL, - NULL); + xbt_dict_set(process_function_set, A_surfxml_process_function, NULL, NULL); xbt_dict_set(machine_set, A_surfxml_process_host, NULL, NULL); process.argc = 1; process.argv = xbt_new(char *, 1); @@ -97,10 +95,14 @@ int main(int argc, char *argv[]) char *deployment_file = NULL; int i; + XBT_LOG_CONNECT(stubgen, gras); + + xbt_binary_name=xbt_strdup(argv[0]); + surf_init(&argc, argv); - process_function_set = xbt_dict_new(); + process_function_set = xbt_dict_new_homogeneous(NULL); process_list = xbt_dynar_new(sizeof(s_process_t), s_process_free); - machine_set = xbt_dict_new(); + machine_set = xbt_dict_new_homogeneous(NULL); for (i = 1; i < argc; i++) { int need_removal = 0; @@ -122,7 +124,7 @@ int main(int argc, char *argv[]) } } - xbt_assert1((argc >= 3), + xbt_assert((argc >= 3), "Usage: %s project_name deployment_file [deployment_file...]\n", argv[0]); @@ -171,11 +173,15 @@ int main(int argc, char *argv[]) generate_simulation_dsp_file(project_name); generate_real_live_dsp_file(project_name); - if (__gras_path) - xbt_free(__gras_path); + xbt_free(__gras_path); #endif free(warning); + + xbt_dict_free(&process_function_set); + xbt_dynar_free(&process_list); + xbt_dict_free(&machine_set); surf_exit(); + return 0; }