#include "xbt/log.h"
#include "surf/surfxml_parse.h"
#include "surf/surf.h"
-#include "portable.h" /* Needed for the time of the SIMIX convertion */
+#include "portable.h" /* Needed for the time of the SIMIX convertion */
#include "gras_stub_generator.h"
#include <stdarg.h>
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(stubgen,gras,"Stub generator");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(stubgen, gras, "Stub generator");
#ifdef _WIN32
xbt_dynar_t process_list = NULL;
xbt_dict_t machine_set = NULL;
-void s_process_free(void *process) {
- s_process_t*p = (s_process_t*)process;
+void s_process_free(void *process)
+{
+ s_process_t *p = (s_process_t *) process;
int i;
- for (i=0; i<p->argc ; i++)
+ for (i = 0; i < p->argc; i++)
free(p->argv[i]);
free(p->argv);
free(p->host);
{
xbt_dict_set(process_function_set, A_surfxml_process_function, NULL, NULL);
xbt_dict_set(machine_set, A_surfxml_process_host, NULL, NULL);
- process.argc = 1 ;
- process.argv = xbt_new(char*,1);
+ process.argc = 1;
+ process.argv = xbt_new(char *, 1);
process.argv[0] = xbt_strdup(A_surfxml_process_function);
- process.host=strdup(A_surfxml_process_host);
- /*VERB1("Function: %s",A_surfxml_process_function);*/
+ process.host = strdup(A_surfxml_process_host);
+ /*VERB1("Function: %s",A_surfxml_process_function); */
}
static void parse_argument(void)
static void parse_process_finalize(void)
{
- xbt_dynar_push(process_list,&process);
- /*VERB1("Function: %s",process.argv[0]);*/
+ xbt_dynar_push(process_list, &process);
+ /*VERB1("Function: %s",process.argv[0]); */
}
void surfxml_add_callback(xbt_dynar_t cb_list, void_f_void_t function)
{
- xbt_dynar_push(cb_list, &function);
+ xbt_dynar_push(cb_list, &function);
}
char *project_name = NULL;
char *deployment_file = NULL;
int i;
-
+
surf_init(&argc, argv);
process_function_set = xbt_dict_new();
- process_list = xbt_dynar_new(sizeof(s_process_t),s_process_free);
+ process_list = xbt_dynar_new(sizeof(s_process_t), s_process_free);
machine_set = xbt_dict_new();
- for (i=1; i<argc; i++) {
- int need_removal = 0;
- if (!strncmp("--extra-process=",argv[i], strlen("--extra-process="))) {
- xbt_dict_set(process_function_set, argv[i]+strlen("--extra-process="), NULL, NULL);
- need_removal = 1;
- }
-
-
- if (need_removal) { /* remove the handled argument from argv */
- int j;
- for (j=i+1; j<argc; j++) {
- argv[j-1] = argv[j];
- }
- argv[j-1] = NULL;
- argc--;
- i--; /* compensate effect of next loop incrementation */
- }
+ for (i = 1; i < argc; i++) {
+ int need_removal = 0;
+ if (!strncmp("--extra-process=", argv[i], strlen("--extra-process="))) {
+ xbt_dict_set(process_function_set, argv[i] + strlen("--extra-process="),
+ NULL, NULL);
+ need_removal = 1;
+ }
+
+
+ if (need_removal) { /* remove the handled argument from argv */
+ int j;
+ for (j = i + 1; j < argc; j++) {
+ argv[j - 1] = argv[j];
+ }
+ argv[j - 1] = NULL;
+ argc--;
+ i--; /* compensate effect of next loop incrementation */
+ }
}
-
- xbt_assert1((argc >= 3),"Usage: %s project_name deployment_file [deployment_file...]\n",argv[0]);
+
+ xbt_assert1((argc >= 3),
+ "Usage: %s project_name deployment_file [deployment_file...]\n",
+ argv[0]);
project_name = argv[1];
surf_parse_reset_parser();
- DEBUG2("%p %p",parse_process_init,&parse_process_init);
+ DEBUG2("%p %p", parse_process_init, &parse_process_init);
surfxml_add_callback(STag_surfxml_process_cb_list, &parse_process_init);
surfxml_add_callback(ETag_surfxml_argument_cb_list, &parse_argument);
surfxml_add_callback(ETag_surfxml_process_cb_list, &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();
+
+ 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);
+ warning = xbt_new(char, strlen(WARN) + strlen(deployment_file) + 10);
+ sprintf(warning, WARN, deployment_file);
/*if(XBT_LOG_ISENABLED(stubgen, xbt_log_priority_debug)) {
- xbt_dict_cursor_t cursor=NULL;
- char *key = NULL;
- void *data = NULL;
-
- for (cursor=NULL, xbt_dict_cursor_first((process_function_set),&(cursor)) ;
- xbt_dict_cursor_get_or_free(&(cursor),&(key),(void**)(&data));
- xbt_dict_cursor_step(cursor) ) {
- DEBUG1("Function %s", key);
- }
-
- xbt_dict_dump(process_function_set,print);
- }*/
+ xbt_dict_cursor_t cursor=NULL;
+ char *key = NULL;
+ void *data = NULL;
+
+ for (cursor=NULL, xbt_dict_cursor_first((process_function_set),&(cursor)) ;
+ xbt_dict_cursor_get_or_free(&(cursor),&(key),(void**)(&data));
+ xbt_dict_cursor_step(cursor) ) {
+ DEBUG1("Function %s", key);
+ }
+
+ xbt_dict_dump(process_function_set,print);
+ } */
generate_sim(project_name);
generate_rl(project_name);
generate_simulation_dsp_file(project_name);
generate_real_live_dsp_file(project_name);
- if(__gras_path)
- xbt_free(__gras_path);
+ if (__gras_path)
+ xbt_free(__gras_path);
#endif
free(warning);