-static void generate_sim(char *project)
-{
- xbt_dict_cursor_t cursor=NULL;
- char *key = NULL;
- void *data = NULL;
- char *filename = NULL;
- FILE *OUT = NULL;
-
- /*
- * Creation d'un fichier nommé : <projet>_simulator.c
- */
-
-
- filename = xbt_new(char,strlen(project) + strlen(SIM_SOURCENAME));
- sprintf(filename,SIM_SOURCENAME,project);
-
- OUT=fopen(filename,"w");
-
-
- xbt_assert1(OUT, "Unable to open %s for writing",filename);
-
- /*
- * Ecriture du message d'avertissement.
- */
- fprintf(OUT, "%s\n",warning);
-
- /*
- * Ecriture du préambule (inclusion de certains fichiers d'en-tête
- */
- fprintf(OUT, "%s", SIM_PREEMBULE);
-
- /*
- * Déclaration des fonction int <process>(int argc,char *argv[]);
- */
- xbt_dict_foreach(process_function_set,cursor,key,data) {
- fprintf(OUT,"int %s(int argc,char *argv[]);\n",key);
- }
-
- fprintf(OUT,"\n");
-
- /*
- * Déclaration des fonction int launch_<process>(int argc,char *argv[]);
- */
- xbt_dict_foreach(process_function_set,cursor,key,data) {
- fprintf(OUT,"int launch_%s(int argc,char *argv[]);\n",key);
- }
-
- /*
- * Ecriture du message d'avertissement.
- */
- fprintf(OUT, "\n%s\n",warning);
-
- xbt_dict_foreach(process_function_set,cursor,key,data) {
- fprintf(OUT,SIM_LAUNCH_FUNC,key,key);
- }
- fprintf(OUT, "\n%s\n",warning);
-
- fprintf(OUT,"%s", "/* specific to Borland Compiler */\n"
- "#ifdef __BORLANDDC__\n"
- "#pragma argsused\n"
- "#endif\n\n");
-
- fprintf(OUT, "%s", "int main (int argc,char *argv[]) {\n"
- "\n"
- " /* Simulation setup */\n"
- " gras_global_init(&argc,argv);\n"
- " 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,
- " gras_create_environment(argv[1]);\n"
- "\n"
- " /* Application deployment */\n"
- );
- xbt_dict_foreach(process_function_set,cursor,key,data) {
- fprintf(OUT," gras_function_register(\"%s\", launch_%s);\n",key,key);
- }
- fprintf(OUT, "%s", SIM_MAIN_POSTEMBULE);
- fclose(OUT);
- free(filename);
+static void generate_sim(char *project) {
+ xbt_dict_cursor_t cursor=NULL;
+ char *key = NULL;
+ void *data = NULL;
+ char *filename = NULL;
+ FILE *OUT = NULL;
+
+ /* Output file: <projet>_simulator.c */
+ filename = xbt_new(char,strlen(project) + strlen(SIM_SOURCENAME));
+ sprintf(filename,SIM_SOURCENAME,project);
+
+ OUT=fopen(filename,"w");
+
+ xbt_assert1(OUT, "Unable to open %s for writing",filename);
+
+ fprintf(OUT, "%s\n",warning);
+ fprintf(OUT, "%s", SIM_PREEMBULE);
+
+ xbt_dict_foreach(process_function_set,cursor,key,data) {
+ fprintf(OUT,"int %s(int argc,char *argv[]);\n",key);
+ }
+
+ fprintf(OUT,"\n");
+
+ xbt_dict_foreach(process_function_set,cursor,key,data) {
+ fprintf(OUT,"int launch_%s(int argc,char *argv[]);\n",key);
+ }
+
+ fprintf(OUT, "\n%s\n",warning);
+
+ xbt_dict_foreach(process_function_set,cursor,key,data) {
+ fprintf(OUT,SIM_LAUNCH_FUNC,key,key);
+ }
+ fprintf(OUT, "\n%s\n",warning);
+
+ fprintf(OUT,"%s", "/* specific to Borland Compiler */\n"
+ "#ifdef __BORLANDDC__\n"
+ "#pragma argsused\n"
+ "#endif\n\n");
+
+ fprintf(OUT, "%s", "int main (int argc,char *argv[]) {\n"
+ "\n"
+ " /* Simulation setup */\n"
+ " gras_global_init(&argc,argv);\n"
+ " 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,
+ " gras_create_environment(argv[1]);\n"
+ "\n"
+ " /* Application deployment */\n"
+ );
+ xbt_dict_foreach(process_function_set,cursor,key,data) {
+ fprintf(OUT," gras_function_register(\"%s\", launch_%s);\n",key,key);
+ }
+ fprintf(OUT, "%s", SIM_MAIN_POSTEMBULE);
+ fclose(OUT);
+ free(filename);