Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cleanup
[simgrid.git] / examples / gras_stub_generator
index 9fd9bd6..2791ff5 100755 (executable)
@@ -15,7 +15,7 @@ eval qq{
 
 sub usage {
     my ($msg)=@_;
-    fail ($msg? "gras_stub_generator: $msg\n":"").
+    die ($msg? "gras_stub_generator: $msg\n":"").
         "gras_stub_generator: USAGE\n".
         "  gras_stub_generator project_name deployment_file\n"
 }
@@ -46,7 +46,7 @@ $warn
 
 #include <stdlib.h>
 #include <stdio.h>
-#include <msg.h>
+#include "msg/msg.h"
 #include <gras.h>
 
 char *gras_log=NULL;
@@ -64,6 +64,7 @@ int launch_$_(int argc, char **argv) {
   char **myargv=argv;
   int myargc=argc;
   int i;
+  int retcode;
     
   if (gras_log) {
     myargv=malloc((argc+1) * sizeof(char**));
@@ -71,10 +72,10 @@ int launch_$_(int argc, char **argv) {
       myargv[i] = argv[i];
     myargv[myargc++] = gras_log;
   }
-  $_(myargc,myargv);
+  retcode = $_(myargc,myargv);
   if (myargv != argv)
     free(myargv);
-  return 0;
+  return retcode;
 }
 
 EOF
@@ -114,7 +115,7 @@ int main (int argc,char *argv[]) {
   /*  Simulation setup */
   MSG_global_init();
   MSG_set_verbosity(MSG_SILENT);
-  MSG_set_channel_number(GRAS_MAX_CHANNEL);
+  MSG_set_channel_number(10); // GRAS_MAX_CHANNEL hardcoded since Alvin killed its definition
   MSG_create_environment(argv[1]);
 
   /*  Application deployment */
@@ -130,6 +131,8 @@ print OUT <<EOF
   /*  Run the simulation */
   MSG_main();
 
+  /* cleanup the place */
+  MSG_clean();
   if (gras_log)
     free(gras_log);
   return 0;