Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Change the default port
[simgrid.git] / examples / gras_stub_generator
index 63828eb..9670c75 100755 (executable)
@@ -58,9 +58,10 @@ print OUT "\n$warn\n";
 foreach (keys %process) {
     print OUT<<EOF
 int launch_$_(int argc, char *argv[]) {
+    
   if (gras_process_init()) exit(1);
   $_(argc,argv);
-  if (gras_process_finalize()) exit(1);
+  if (gras_process_exit()) exit(1);
 
   return 0;
 }
@@ -72,16 +73,19 @@ print OUT "\n$warn\n";
 
 print OUT <<EOF
 int main (int argc,char *argv[]) {
-
-  if (argc != 3) {
-    fprintf(stderr, "Usage: %s platform_file application_description.txt\\n",argv[0]);
+    
+  if (argc < 3) {
+    fprintf(stderr, "Usage: %s platform_file application_description.txt [extra args]\\n",argv[0]);
     exit(1);
   }
 
-  /*  Simulation setting */
+  /* GRAS setup */
+  gras_init(&argc, argv);
+
+  /*  Simulation setup */
   MSG_global_init();
   MSG_set_verbosity(MSG_SILENT);
-  MSG_set_channel_number(MAX_CHANNEL);
+  MSG_set_channel_number(GRAS_MAX_CHANNEL);
   MSG_create_environment(argv[1]);
 
   /*  Application deployment */
@@ -115,11 +119,6 @@ $warn
 #include <signal.h>
 #include <gras.h>
 
-/* signal handler for SIGPIPE from NWS */
-void SocketFailure(int sig);
-/* minimum needed from diagnostic.h for initialization, so that we don''t have to ship this file */
-typedef enum {DIAGLOG, DIAGINFO, DIAGWARN, DIAGERROR, DIAGFATAL, DIAGDEBUG} DiagLevels;
-void DirectDiagnostics(DiagLevels level, FILE *whereTo);
 /* user code */
 int $pname(int argc, char *argv[]);
 
@@ -128,19 +127,12 @@ $warn
 int main(int argc, char *argv[]){
   int errcode;
 
-  DirectDiagnostics(DIAGDEBUG, stdout);
-  DirectDiagnostics(DIAGINFO, stdout);
-  DirectDiagnostics(DIAGLOG, stdout);
-  DirectDiagnostics(DIAGWARN, stderr);
-  DirectDiagnostics(DIAGERROR, stderr);
-  DirectDiagnostics(DIAGFATAL, stderr);
-
-  signal(SIGPIPE, SocketFailure);
-
+  gras_init(&argc,argv);
   gras_process_init();
   errcode=$pname(argc,argv);
-  gras_process_finalize();
-
+  gras_process_exit();
+  gras_exit();
   return errcode;
 }