/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-#include"xbt/sysdep.h"
-#include"xbt/dict.h"
-#include"xbt/dynar.h"
-#include"xbt/error.h"
-#include "surf/surf_parse.h"
+#include "xbt/sysdep.h"
+#include "xbt/function_types.h"
+#include "xbt/log.h"
+#include "surf/surfxml_parse.h"
#include "surf/surf.h"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(stubgen,gras,"Stub generator");
parse_argv = NULL;
parse_argc++;
parse_argv = xbt_realloc(parse_argv, (parse_argc) * sizeof(char *));
- parse_argv[(parse_argc) - 1] = xbt_strdup(A_process_function);
+ parse_argv[(parse_argc) - 1] = xbt_strdup(A_surfxml_process_function);
}
static void parse_argument(void)
{
parse_argc++;
parse_argv = xbt_realloc(parse_argv, (parse_argc) * sizeof(char *));
- parse_argv[(parse_argc) - 1] = xbt_strdup(A_argument_value);
+ parse_argv[(parse_argc) - 1] = xbt_strdup(A_surfxml_argument_value);
}
static void parse_process_finalize(void)
s_process_t process;
void *p = (void *) 1234;
- xbt_dict_set(process_function_set, A_process_function, p, NULL);
- xbt_dict_set(machine_set, A_process_host, p, NULL);
+ xbt_dict_set(process_function_set, A_surfxml_process_function, p, NULL);
+ xbt_dict_set(machine_set, A_surfxml_process_host, p, NULL);
process.argc=parse_argc;
process.argv=parse_argv;
- process.host=strdup(A_process_host);
+ process.host=strdup(A_surfxml_process_host);
xbt_dynar_push(process_list,&process);
}
fprintf(OUT, "\n%s\n",warning);
fprintf(OUT, "%s", "int main (int argc,char *argv[]) {\n"
- " int i,j;\n"
"\n"
" /* Simulation setup */\n"
- " MSG_global_init_args(&argc,argv);\n"
+ " MSG_global_init(&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");
fprintf(OUT,
" MSG_paje_output(\"%s.trace\");\n"
- " MSG_set_channel_number(10); /* Using at most 10 channel (ports) per host. Change it here if needed */\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",
static void generate_makefile_remote(char *project, char *deployment)
{
- xbt_dict_cursor_t cursor=NULL;
- char *key = NULL;
- void *data = NULL;
char *filename = NULL;
FILE *OUT = NULL;
{
char *project_name = NULL;
char *deployment_file = NULL;
-
+ int i;
+
surf_init(&argc, argv);
- xbt_assert1((argc ==3),"Usage: %s project_name deployment_file\n",argv[0]);
+ xbt_assert1((argc >= 3),"Usage: %s project_name deployment_file [deployment_file...]\n",argv[0]);
project_name = argv[1];
- deployment_file = argv[2];
process_function_set = xbt_dict_new();
process_list = xbt_dynar_new(sizeof(s_process_t),s_process_free);
machine_set = xbt_dict_new();
- STag_process_fun = parse_process_init;
- ETag_argument_fun = parse_argument;
- ETag_process_fun = parse_process_finalize;
- surf_parse_open(deployment_file);
- if(surf_parse()) xbt_assert1(0,"Parse error in %s",deployment_file);
- surf_parse_close();
+ STag_surfxml_process_fun = parse_process_init;
+ ETag_surfxml_argument_fun = parse_argument;
+ ETag_surfxml_process_fun = parse_process_finalize;
+ for(i=2; i<argc; i++) {
+ deployment_file = argv[i];
+ surf_parse_open(deployment_file);
+ if(surf_parse()) xbt_assert1(0,"Parse error in %s",deployment_file);
+ surf_parse_close();
+ }
+
warning = xbt_new(char,strlen(WARN)+strlen(deployment_file)+10);
sprintf(warning,WARN,deployment_file);
generate_deployment(project_name, deployment_file);
free(warning);
- surf_finalize();
+ surf_exit();
return 0;
}