Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
slight modifications
[simgrid.git] / examples / msg / mc / automatonparse_promela.c
index 857ff0e..128a874 100644 (file)
@@ -1,5 +1,6 @@
-#include "automatonparse_promela.h"
+#include "xbt/automatonparse_promela.h"
 
+xbt_automaton_t automaton;
 char* state_id_src;
 
 void init(){
@@ -10,16 +11,10 @@ void new_state(char* id, int src){
 
   char* id_state = strdup(id);
   char* first_part = strtok(id,"_");
-  int type = 0 ; // -1=état initial, 0=état intermédiaire, 1=état final, 2=état initial/final
+  int type = 0 ; // -1=état initial, 0=état intermédiaire, 1=état final
 
   if(strcmp(first_part,"accept")==0){
-     char* second_part = strtok(NULL,"_");
-     if(strcmp(second_part,"init")==0){
-       type = 2;
-     }else{
-       type = 1;
-     }
-     
+    type = 1;
   }else{
     char* second_part = strtok(NULL,"_");
     if(strcmp(second_part,"init")==0){
@@ -33,7 +28,7 @@ void new_state(char* id, int src){
     state = xbt_automaton_new_state(automaton, type, id_state);
   }
 
-  if(type==-1 || type==2)
+  if(type==-1)
     automaton->current_state = state;
 
   if(src)
@@ -49,8 +44,8 @@ void new_transition(char* id, xbt_exp_label_t label){
   state_dst = xbt_automaton_state_exists(automaton, id_state);
   xbt_state_t state_src = xbt_automaton_state_exists(automaton, state_id_src); 
   
-  xbt_transition_t trans = NULL;
-  trans = xbt_automaton_new_transition(automaton, state_src, state_dst, label);
+  //xbt_transition_t trans = NULL;
+  xbt_automaton_new_transition(automaton, state_src, state_dst, label);
 
 }
 
@@ -94,8 +89,5 @@ xbt_automaton_t get_automaton(){
   return automaton;
 }
 
-void display_automaton(){
-  xbt_automaton_display(automaton);
-}