Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add a convenient function
authoralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 17 Dec 2004 23:30:56 +0000 (23:30 +0000)
committeralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 17 Dec 2004 23:30:56 +0000 (23:30 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@682 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/include/surf/surf_parse.h
src/surf/surf_parse.l

index 8aea81b..284224f 100644 (file)
@@ -35,6 +35,7 @@ void find_section(const char *file, const char *section_name);
 void close_section(const char *section_name);
 void surf_parse_double(double *value);
 void surf_parse_trace(tmgr_trace_t * trace);
+void surf_parse_deployment_line(char **host, int *argc, char ***argv);
 
 
 /* Should not be called if you use the previous "section" functions */
index d0c25da..9111248 100644 (file)
@@ -225,6 +225,30 @@ void surf_parse_trace(tmgr_trace_t *trace)
   else
     *trace = tmgr_trace_new(surf_parse_text);
 }
+
+void surf_parse_deployment_line(char **host, int *argc, char ***argv)
+{
+  e_surf_token_t token;
+
+
+  /* Parse Host name */
+  *host = xbt_strdup(surf_parse_text);  
+
+  *argc = 0;
+  *argv = NULL;
+
+  /* Parse command line */
+  while((token = surf_parse())) {
+    if(token == TOKEN_NEWLINE) return; 
+    xbt_assert1((token == TOKEN_WORD), "Parse error line %d", surf_line_pos);
+
+    (*argc)++;
+    *argv=xbt_realloc (*argv, (*argc) * sizeof(char*));
+    (*argv)[(*argc)-1]=xbt_strdup(surf_parse_text);
+  }
+}
+
+
 /*  Local variables: */
 /*  mode: c */
 /*  End: */