Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
A meta-resource : workstation is simply a CPU and a network card.
[simgrid.git] / src / surf / surf_parse.l
index 39fd337..d2bee65 100644 (file)
@@ -1,7 +1,9 @@
-/* Authors: Arnaud Legrand                                                  */
+/*     $Id$     */
+
+/* Copyright (c) 2004 Arnaud Legrand. All rights reserved.                  */
 
 /* 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. */
* under the terms of the license (GNU LGPL) which comes with this package. */
 
 %option noyywrap
 %{
@@ -135,7 +137,7 @@ static void __print_val(void) {
 
 e_surf_token_t surf_parse(void) {
   tok_num = surf_parse_lex();
-  __print_val();
+/*   __print_val(); */
   char_pos += strlen(surf_parse_text);
   return(tok_num);
 }
@@ -200,7 +202,29 @@ void  surf_parse_close(void) {
   tok_num = 0;
 }
 
+void surf_parse_float(xbt_maxmin_float_t *value)
+{ 
+  e_surf_token_t token;
+  int ret = 0;
+
+  token = surf_parse();                /* power_scale */
+  xbt_assert1((token == TOKEN_WORD), "Parse error line %d", line_pos);
+  ret = sscanf(surf_parse_text, XBT_MAXMIN_FLOAT_T, value);
+  xbt_assert2((ret==1), "Parse error line %d : %s not a number", line_pos,
+             surf_parse_text);
+}
 
+void surf_parse_trace(tmgr_trace_t *trace)
+{
+  e_surf_token_t token;
+  
+  token = surf_parse();                /* power_trace */
+  xbt_assert1((token == TOKEN_WORD), "Parse error line %d", line_pos);
+  if (strcmp(surf_parse_text, "") == 0)
+    *trace = NULL;
+  else
+    *trace = tmgr_trace_new(surf_parse_text);
+}
 /*  Local variables: */
 /*  mode: c */
 /*  End: */