X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a5030ee44e0b07c5ce1775ea36cead3c875d89a8..01468b426eb004d5fbdbbf6ef89374c5dd1e06fd:/tools/gras/stub_generator.c diff --git a/tools/gras/stub_generator.c b/tools/gras/stub_generator.c index 0c5f099a78..5bd5375a22 100644 --- a/tools/gras/stub_generator.c +++ b/tools/gras/stub_generator.c @@ -19,6 +19,7 @@ #include "xbt/log.h" #include "surf/surfxml_parse.h" #include "surf/surf.h" +#include "portable.h" /* Needed for the time of the SIMIX convertion */ #include @@ -279,6 +280,7 @@ const char *SIM_PREEMBULE = const char *SIM_MAIN_POSTEMBULE = "\n" "\n" +#ifdef USE_SIMIX " gras_launch_application(argv[2]);\n" "\n" " /* Run the simulation */\n" @@ -286,6 +288,15 @@ const char *SIM_MAIN_POSTEMBULE = "\n" "\n" " /* cleanup the place */\n" " gras_clean();\n" +#else +" MSG_launch_application(argv[2]);\n" +"\n" +" /* Run the simulation */\n" +" MSG_main();\n" +"\n" +" /* cleanup the place */\n" +" MSG_clean();\n" +#endif " if (gras_log)\n" " free(gras_log);\n" " return 0;\n" @@ -408,21 +419,36 @@ static void generate_sim(char *project) fprintf(OUT, "%s", "int main (int argc,char *argv[]) {\n" "\n" " /* Simulation setup */\n" - " gras_global_init(&argc,argv);\n" +#ifdef USE_SIMIX + " gras_global_init(&argc,argv);\n" +#else + " MSG_global_init(&argc,argv);\n" +#endif " if (argc != 3) {\n" " fprintf(stderr, \"Usage: %s platform.xml deployment.xml [--gras-log=...]\\n\",argv[0]);\n" " exit(1);\n" " }\n" "\n"); - fprintf(OUT, - " //MSG_paje_output(\"%s.trace\");\n" - " //MSG_set_channel_number(XBT_MAX_CHANNEL); /* Using at most 10 channel (ports) per host. Change it here if needed */\n" + fprintf(OUT, +#ifdef USE_SIMIX " gras_create_environment(argv[1]);\n" "\n" + " /* Application deployment */\n" + ); +#else + " MSG_paje_output(\"%s.trace\");\n" + " MSG_set_channel_number(XBT_MAX_CHANNEL); /* Using at most 10 channel (ports) per host. Change it here if needed */\n" + " MSG_create_environment(argv[1]);\n" + "\n" " /* Application deployment */\n", project); +#endif xbt_dict_foreach(process_function_set,cursor,key,data) { +#ifdef USE_SIMIX fprintf(OUT," gras_function_register(\"%s\", launch_%s);\n",key,key); +#else + fprintf(OUT," MSG_function_register(\"%s\", launch_%s);\n",key,key); +#endif } fprintf(OUT, "%s", SIM_MAIN_POSTEMBULE); fclose(OUT);