Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
paje has to be initialized at the very beginning
authoralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 1 Mar 2005 18:54:45 +0000 (18:54 +0000)
committeralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 1 Mar 2005 18:54:45 +0000 (18:54 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@1130 48e7efb5-ca39-0410-a469-dd3cf9ba447f

examples/msg/msg_test.c
tools/gras/stub_generator.c

index b5f2a88..012ba95 100644 (file)
@@ -225,6 +225,7 @@ int forwarder(int argc, char *argv[])
 void test_all(const char *platform_file,const char *application_file)
 {
   {                            /*  Simulation setting */
 void test_all(const char *platform_file,const char *application_file)
 {
   {                            /*  Simulation setting */
+    MSG_paje_output("msg_test.trace");
     MSG_set_channel_number(MAX_CHANNEL);
     MSG_create_environment(platform_file);
   }
     MSG_set_channel_number(MAX_CHANNEL);
     MSG_create_environment(platform_file);
   }
@@ -234,7 +235,6 @@ void test_all(const char *platform_file,const char *application_file)
     MSG_function_register("forwarder", forwarder);
     MSG_launch_application(application_file);
   }
     MSG_function_register("forwarder", forwarder);
     MSG_launch_application(application_file);
   }
-  MSG_paje_output("msg_test.trace");
   MSG_main();
   printf("Simulation time %g\n",MSG_getClock());
 }
   MSG_main();
   printf("Simulation time %g\n",MSG_getClock());
 }
index ffcace9..d3eb67f 100644 (file)
@@ -67,21 +67,22 @@ const char *SIM_PREEMBULE =
 "  return retcode;\n" \
 "}\n"
 
 "  return retcode;\n" \
 "}\n"
 
-const char* SIM_MAIN_PREEMBULE =
-"int main (int argc,char *argv[]) {\n"
-"  int i,j;\n"
-"\n"
-"  /*  Simulation setup */\n"
-"  MSG_global_init_args(&argc,argv);\n"
-"  if (argc != 3) {\n"
-"    fprintf(stderr, \"Usage: %s platform_file application_description.txt [--gras-log=...]\\n\",argv[0]);\n"
-"    exit(1);\n"
-"  }\n"
-"\n"
-"  MSG_set_channel_number(10); // GRAS_MAX_CHANNEL hardcoded since Alvin killed its definition\n"
-"  MSG_create_environment(argv[1]);\n"
-"\n"
-"  /*  Application deployment */\n";
+#define SIM_MAIN_PREEMBULE \
+"int main (int argc,char *argv[]) {\n" \
+"  int i,j;\n" \
+"\n" \
+"  /*  Simulation setup */\n" \
+"  MSG_global_init_args(&argc,argv);\n" \
+"  if (argc != 3) {\n" \
+"    fprintf(stderr, \"Usage: %%s platform_file application_description.txt [--gras-log=...]\\n\",argv[0]);\n" \
+"    exit(1);\n" \
+"  }\n" \
+"\n" \
+"  MSG_paje_output(\"%s.trace\");\n" \
+"  MSG_set_channel_number(10); // GRAS_MAX_CHANNEL hardcoded since Alvin killed its definition\n" \
+"  MSG_create_environment(argv[1]);\n" \
+"\n" \
+"  /*  Application deployment */\n"
 
 const char *SIM_MAIN_POSTEMBULE = "\n"
 "\n"
 
 const char *SIM_MAIN_POSTEMBULE = "\n"
 "\n"
@@ -180,7 +181,7 @@ static void generate_sim(char *project)
   }
   fprintf(OUT, "\n%s\n",warning);
 
   }
   fprintf(OUT, "\n%s\n",warning);
 
-  fprintf(OUT, "%s", SIM_MAIN_PREEMBULE);
+  fprintf(OUT, SIM_MAIN_PREEMBULE, project);
   xbt_dict_foreach(process_function_set,cursor,key,data) {
     fprintf(OUT,"  MSG_function_register(\"%s\", launch_%s);\n",key,key);
   }
   xbt_dict_foreach(process_function_set,cursor,key,data) {
     fprintf(OUT,"  MSG_function_register(\"%s\", launch_%s);\n",key,key);
   }