stage4/generate_cc/generate_cc_sfcdecl.cc
changeset 49 c96d1a4c23f8
parent 22 08bcc40be1fa
child 52 f44458d1fa29
equal deleted inserted replaced
48:3d24cc85bb3c 49:c96d1a4c23f8
    37 /***********************************************************************/
    37 /***********************************************************************/
    38 /***********************************************************************/
    38 /***********************************************************************/
    39 /***********************************************************************/
    39 /***********************************************************************/
    40 /***********************************************************************/
    40 /***********************************************************************/
    41 
    41 
    42 class generate_cc_sfc_steptable_c: public generate_cc_base_c {
    42 class generate_cc_sfcdecl_c: protected generate_cc_typedecl_c {
       
    43   
       
    44   public:
       
    45       typedef enum {
       
    46         sfcdecl_sg,
       
    47         sfcinit_sg,
       
    48         stepdef_sg,
       
    49         stepundef_sg,
       
    50         actiondef_sg,
       
    51         actionundef_sg
       
    52        } sfcgeneration_t;
    43   
    53   
    44   private:
    54   private:
    45     char step_number;
    55     char step_number;
       
    56     char action_number;
       
    57     char transition_number;
       
    58     
       
    59     sfcgeneration_t wanted_sfcgeneration;
    46     
    60     
    47   public:
    61   public:
    48     generate_cc_sfc_steptable_c(stage4out_c *s4o_ptr): generate_cc_base_c(s4o_ptr) {}
    62     generate_cc_sfcdecl_c(stage4out_c *s4o_ptr, sfcgeneration_t sfcgeneration)
    49     ~generate_cc_sfc_steptable_c(void) {}
    63     : generate_cc_typedecl_c(s4o_ptr) {
    50     
    64       wanted_sfcgeneration = sfcgeneration;
    51     void reset_step_number(void) {step_number = 0;}
    65     }
    52     void print_step_number(void) {
    66     ~generate_cc_sfcdecl_c(void) {}
    53       char str[10];
    67     
    54       sprintf(str, "%d", step_number);
    68     void print(symbol_c *symbol, const char *variable_prefix = NULL) {
    55       s4o.print(str);
    69       this->set_variable_prefix(variable_prefix);
    56     }
    70       
       
    71       symbol->accept(*this);
       
    72     }
       
    73     
    57 /*********************************************/
    74 /*********************************************/
    58 /* B.1.6  Sequential function chart elements */
    75 /* B.1.6  Sequential function chart elements */
    59 /*********************************************/
    76 /*********************************************/
    60     
    77     
       
    78     void *visit(sequential_function_chart_c *symbol) {
       
    79       step_number = 0;
       
    80       action_number = 0;
       
    81       transition_number = 0;
       
    82       switch (wanted_sfcgeneration) {
       
    83         case sfcdecl_sg:
       
    84           for(int i = 0; i < symbol->n; i++)
       
    85             symbol->elements[i]->accept(*this);
       
    86           
       
    87           /* steps table declaration */
       
    88           s4o.print(s4o.indent_spaces + "STEP step_list[");
       
    89           s4o.print_integer(step_number);
       
    90           s4o.print("];\n");
       
    91           s4o.print(s4o.indent_spaces + "UINT nb_steps = ");
       
    92           s4o.print_integer(step_number);
       
    93           s4o.print(";\n");
       
    94           
       
    95           /* actions table declaration */
       
    96           s4o.print(s4o.indent_spaces + "ACTION action_list[");
       
    97           s4o.print_integer(action_number);
       
    98           s4o.print("];\n");
       
    99           s4o.print(s4o.indent_spaces + "UINT nb_actions = ");
       
   100           s4o.print_integer(action_number);
       
   101           s4o.print(";\n");
       
   102           
       
   103           /* transitions table declaration */
       
   104           s4o.print(s4o.indent_spaces + "USINT transition_list[");
       
   105           s4o.print_integer(transition_number);
       
   106           s4o.print("];\n");
       
   107           break;
       
   108         case sfcinit_sg:
       
   109           /* steps table initialisation */
       
   110           s4o.print(s4o.indent_spaces + "STEP temp_step = {0, 0, 0};\n");
       
   111           s4o.print(s4o.indent_spaces + "for(UINT i = 0; i < ");
       
   112           print_variable_prefix();
       
   113           s4o.print("nb_steps; i++) {\n");
       
   114           s4o.indent_right();
       
   115           s4o.print(s4o.indent_spaces);
       
   116           print_variable_prefix();
       
   117           s4o.print("step_list[i] = temp_step;\n");
       
   118           s4o.indent_left();
       
   119           s4o.print(s4o.indent_spaces + "}\n");
       
   120           for(int i = 0; i < symbol->n; i++)
       
   121             symbol->elements[i]->accept(*this);
       
   122           
       
   123           /* actions table initialisation */
       
   124           s4o.print(s4o.indent_spaces + "ACTION temp_action = {0, 0, 0, 0, 0, 0};\n");
       
   125           s4o.print(s4o.indent_spaces + "for(UINT i = 0; i < ");
       
   126           print_variable_prefix();
       
   127           s4o.print("nb_actions; i++) {\n");
       
   128           s4o.indent_right();
       
   129           s4o.print(s4o.indent_spaces);
       
   130           print_variable_prefix();
       
   131           s4o.print("action_list[i] = temp_action;\n");
       
   132           s4o.indent_left();
       
   133           s4o.print(s4o.indent_spaces + "}\n");
       
   134           break;
       
   135         case stepdef_sg:
       
   136           s4o.print("// Steps definitions\n");
       
   137           for(int i = 0; i < symbol->n; i++)
       
   138             symbol->elements[i]->accept(*this);
       
   139           s4o.print("\n");
       
   140           break;
       
   141         case actiondef_sg:
       
   142           s4o.print("// Actions definitions\n");
       
   143           for(int i = 0; i < symbol->n; i++)
       
   144             symbol->elements[i]->accept(*this);
       
   145           s4o.print("\n");
       
   146           break;
       
   147         case stepundef_sg:
       
   148           s4o.print("// Steps undefinitions\n");
       
   149           for(int i = 0; i < symbol->n; i++)
       
   150             symbol->elements[i]->accept(*this);
       
   151           s4o.print("\n");
       
   152           break;
       
   153         case actionundef_sg:
       
   154           s4o.print("// Actions undefinitions\n");
       
   155           for(int i = 0; i < symbol->n; i++)
       
   156             symbol->elements[i]->accept(*this);
       
   157           s4o.print("\n");
       
   158           break;
       
   159       }
       
   160       return NULL;
       
   161     }
       
   162     
    61     void *visit(initial_step_c *symbol) {
   163     void *visit(initial_step_c *symbol) {
    62       if (step_number > 0) {
   164       switch (wanted_sfcgeneration) {
    63         s4o.print(",\n");
   165         case sfcdecl_sg:
    64       }
   166           step_number++;
    65       s4o.print(s4o.indent_spaces + "{1, 0, 0}");
   167           break;
    66       step_number++;
   168         case sfcinit_sg:
       
   169           s4o.print(s4o.indent_spaces);
       
   170           print_variable_prefix();
       
   171           s4o.print("action_list[");
       
   172           s4o.print_integer(step_number);
       
   173           s4o.print("].state = 1;\n");
       
   174           step_number++;
       
   175           break;
       
   176         case stepdef_sg:
       
   177           s4o.print("#define ");
       
   178           s4o.print(SFC_STEP_ACTION_PREFIX);
       
   179           symbol->step_name->accept(*this);
       
   180           s4o.print(" ");
       
   181           s4o.print_integer(step_number);
       
   182           s4o.print("\n");
       
   183           step_number++;
       
   184           break;
       
   185         case stepundef_sg:
       
   186           s4o.print("#undef ");
       
   187           s4o.print(SFC_STEP_ACTION_PREFIX);
       
   188           symbol->step_name->accept(*this);
       
   189           s4o.print("\n");
       
   190           break;
       
   191         default:
       
   192           break;
       
   193       }
    67       return NULL;
   194       return NULL;
    68     }
   195     }
    69     
   196     
    70     void *visit(step_c *symbol) {
   197     void *visit(step_c *symbol) {
    71       if (step_number > 0) {
   198       switch (wanted_sfcgeneration) {
    72         s4o.print(",\n");
   199         case sfcdecl_sg:
    73       }
   200           step_number++;
    74       s4o.print(s4o.indent_spaces + "{0, 0, 0}");
   201           break;
    75       step_number++;
   202         case stepdef_sg:
    76       return NULL;
   203           s4o.print("#define ");
    77     }
   204           s4o.print(SFC_STEP_ACTION_PREFIX);
    78 
   205           symbol->step_name->accept(*this);
    79     void *visit(transition_c *symbol) {return NULL;}
   206           s4o.print(" ");
    80 
   207           s4o.print_integer(step_number);
    81     void *visit(action_c *symbol) {return NULL;}
   208           s4o.print("\n");
    82 
   209           step_number++;
    83 }; /* generate_cc_sfc_steptable_c */
   210           break;
    84 
   211         case stepundef_sg:
    85 
   212           s4o.print("#undef ");
    86 
   213           s4o.print(SFC_STEP_ACTION_PREFIX);
    87 
   214           symbol->step_name->accept(*this);
    88 /***********************************************************************/
   215           s4o.print("\n");
    89 /***********************************************************************/
   216           break;
    90 /***********************************************************************/
   217         default:
    91 /***********************************************************************/
   218           break;
    92 
   219       }
    93 class generate_cc_sfc_actiontable_c: public generate_cc_base_c {
   220       return NULL;
    94   
   221     }
    95   private:
   222 
    96     char action_number;
   223     void *visit(transition_c *symbol) {
    97     
   224       switch (wanted_sfcgeneration) {
    98   public:
   225         case sfcdecl_sg:
    99     generate_cc_sfc_actiontable_c(stage4out_c *s4o_ptr): generate_cc_base_c(s4o_ptr) {}
   226           transition_number++;
   100     ~generate_cc_sfc_actiontable_c(void) {}
   227           break;
   101     
   228         default:
   102     void reset_action_number(void) {action_number = 0;}
   229           break;
   103     void print_action_number(void) {
   230       }
   104       char str[10];
   231       return NULL;
   105       sprintf(str, "%d", action_number);
   232     }
   106       s4o.print(str);
       
   107     }
       
   108 /*********************************************/
       
   109 /* B.1.6  Sequential function chart elements */
       
   110 /*********************************************/
       
   111     
       
   112     void *visit(initial_step_c *symbol) {return NULL;}
       
   113     
       
   114     void *visit(step_c *symbol) {return NULL;}
       
   115 
       
   116     void *visit(transition_c *symbol) {return NULL;}
       
   117 
   233 
   118     void *visit(action_c *symbol) {
   234     void *visit(action_c *symbol) {
   119       if (action_number > 0) {
   235       switch (wanted_sfcgeneration) {
   120         s4o.print(",\n");
   236         case actiondef_sg:
   121       }
   237           s4o.print("#define ");
   122       s4o.print(s4o.indent_spaces + "{0, 0, 0, 0, 0, 0}");
   238           s4o.print(SFC_STEP_ACTION_PREFIX);
   123       action_number++;
   239           symbol->action_name->accept(*this);
   124       return NULL;
   240           s4o.print(" ");
   125     }
   241           s4o.print_integer(action_number);
   126 
   242           s4o.print("\n");
   127 }; /* generate_cc_sfc_actiontable_c */
   243           action_number++;
   128 
   244           break;
   129 
   245         case actionundef_sg:
   130 
   246           s4o.print("#undef ");
   131 
   247           s4o.print(SFC_STEP_ACTION_PREFIX);
   132 /***********************************************************************/
   248           symbol->action_name->accept(*this);
   133 /***********************************************************************/
   249           s4o.print("\n");
   134 /***********************************************************************/
   250           break;
   135 /***********************************************************************/
   251         case sfcdecl_sg:
   136 
   252           action_number++;
   137 class generate_cc_sfc_transitiontable_c: public generate_cc_base_c {
   253           break;
   138   
   254         default:
   139   private:
   255           break;
   140     char transition_number;
   256       }
   141     
   257       return NULL;
   142   public:
   258     }
   143     generate_cc_sfc_transitiontable_c(stage4out_c *s4o_ptr): generate_cc_base_c(s4o_ptr) {}
   259 
   144     ~generate_cc_sfc_transitiontable_c(void) {}
   260 }; /* generate_cc_sfcdecl_c */
   145     
   261 
   146     void reset_transition_number(void) {transition_number = 0;}
       
   147     void print_transition_number(void) {
       
   148       char str[10];
       
   149       sprintf(str, "%d", transition_number);
       
   150       s4o.print(str);
       
   151     }
       
   152 /*********************************************/
       
   153 /* B.1.6  Sequential function chart elements */
       
   154 /*********************************************/
       
   155     
       
   156     void *visit(initial_step_c *symbol) {return NULL;}
       
   157     
       
   158     void *visit(step_c *symbol) {return NULL;}
       
   159 
       
   160     void *visit(transition_c *symbol) {
       
   161       transition_number++;
       
   162       return NULL;
       
   163     }
       
   164 
       
   165     void *visit(action_c *symbol) {return NULL;}
       
   166 
       
   167 }; /* generate_cc_sfc_steptable_c */
       
   168 
       
   169 
       
   170 
       
   171 
       
   172 /***********************************************************************/
       
   173 /***********************************************************************/
       
   174 /***********************************************************************/
       
   175 /***********************************************************************/
       
   176 
       
   177 class generate_cc_sfctables_c: public iterator_visitor_c {
       
   178   
       
   179   protected:
       
   180     stage4out_c &s4o;
       
   181   
       
   182   private:
       
   183     generate_cc_sfc_steptable_c *generate_cc_sfc_steptable;
       
   184     generate_cc_sfc_actiontable_c *generate_cc_sfc_actiontable;
       
   185     generate_cc_sfc_transitiontable_c *generate_cc_sfc_transitiontable;
       
   186 
       
   187   public:
       
   188     generate_cc_sfctables_c(stage4out_c *s4o_ptr) : s4o(*s4o_ptr) {
       
   189       generate_cc_sfc_steptable = new generate_cc_sfc_steptable_c(s4o_ptr);
       
   190       generate_cc_sfc_actiontable = new generate_cc_sfc_actiontable_c(s4o_ptr);
       
   191       generate_cc_sfc_transitiontable = new generate_cc_sfc_transitiontable_c(s4o_ptr);
       
   192     }
       
   193 
       
   194     virtual ~generate_cc_sfctables_c(void) {
       
   195       delete generate_cc_sfc_steptable;
       
   196       delete generate_cc_sfc_actiontable;
       
   197       delete generate_cc_sfc_transitiontable;
       
   198     }
       
   199 
       
   200   public:
       
   201 
       
   202     /* generate steps and actions tables */
       
   203     void *visit(sequential_function_chart_c *symbol) {
       
   204       /* generate steps table */
       
   205       generate_cc_sfc_steptable->reset_step_number();
       
   206       s4o.print(s4o.indent_spaces + "STEP step_list[] = {\n");
       
   207       s4o.indent_right();
       
   208       symbol->accept(*generate_cc_sfc_steptable);
       
   209       s4o.indent_left();
       
   210       s4o.print("\n" + s4o.indent_spaces + "};\n" + s4o.indent_spaces + "nb_steps = ");
       
   211       generate_cc_sfc_steptable->print_step_number();
       
   212       s4o.print(";\n");
       
   213       
       
   214       /* generate actions table */
       
   215       generate_cc_sfc_actiontable->reset_action_number();
       
   216       s4o.print(s4o.indent_spaces + "ACTION action_list[] = {\n");
       
   217       s4o.indent_right();
       
   218       symbol->accept(*generate_cc_sfc_actiontable);
       
   219       s4o.indent_left();
       
   220       s4o.print("\n" + s4o.indent_spaces + "};\n" + s4o.indent_spaces + "nb_actions = ");
       
   221       generate_cc_sfc_actiontable->print_action_number();
       
   222       s4o.print(";\n");
       
   223       
       
   224       /* generate transitions table */
       
   225       generate_cc_sfc_transitiontable->reset_transition_number();
       
   226       symbol->accept(*generate_cc_sfc_transitiontable);
       
   227       s4o.print(s4o.indent_spaces + "char transition_list[");
       
   228       generate_cc_sfc_transitiontable->print_transition_number();
       
   229       s4o.print("];\n");
       
   230       
       
   231       return NULL;
       
   232     }
       
   233 
       
   234 /***********************************/
       
   235 /* B 2.1 Instructions and Operands */
       
   236 /***********************************/
       
   237 /*| instruction_list il_instruction */
       
   238     void *visit(instruction_list_c *symbol) {return NULL;}
       
   239 
       
   240 /***************************************/
       
   241 /* B.3 - Language ST (Structured Text) */
       
   242 /***************************************/
       
   243 /********************/
       
   244 /* B 3.2 Statements */
       
   245 /********************/
       
   246     void *visit(statement_list_c *symbol) {return NULL;}
       
   247 
       
   248 /* Remainder implemented in generate_cc_sfcdecl_c... */
       
   249 };
       
   250 
       
   251     
       
   252 
       
   253 
       
   254 /***********************************************************************/
       
   255 /***********************************************************************/
       
   256 /***********************************************************************/
       
   257 /***********************************************************************/
       
   258 
       
   259 class generate_cc_sfc_stepdecl_c: public generate_cc_base_c {
       
   260   
       
   261   private:
       
   262     char step_number;
       
   263     
       
   264   public:
       
   265     generate_cc_sfc_stepdecl_c(stage4out_c *s4o_ptr): generate_cc_base_c(s4o_ptr) {}
       
   266     ~generate_cc_sfc_stepdecl_c(void) {}
       
   267     
       
   268     void reset_step_number(void) {step_number = 0;}
       
   269     void print_step_number(void) {
       
   270       char str[10];
       
   271       sprintf(str, "%d", step_number);
       
   272       s4o.print(str);
       
   273     }
       
   274 
       
   275 /*********************************************/
       
   276 /* B.1.6  Sequential function chart elements */
       
   277 /*********************************************/
       
   278     
       
   279     void *visit(initial_step_c *symbol) {
       
   280       s4o.print("#define ");
       
   281       s4o.print(SFC_STEP_ACTION_PREFIX);
       
   282       symbol->step_name->accept(*this);
       
   283       s4o.print(" ");
       
   284       print_step_number();
       
   285       s4o.print("\n");
       
   286       step_number++;
       
   287       return NULL;
       
   288     }
       
   289     
       
   290     void *visit(step_c *symbol) {
       
   291       s4o.print("#define ");
       
   292       s4o.print(SFC_STEP_ACTION_PREFIX);
       
   293       symbol->step_name->accept(*this);
       
   294       s4o.print(" ");
       
   295       print_step_number();
       
   296       s4o.print("\n");
       
   297       step_number++;
       
   298       return NULL;
       
   299     }
       
   300 
       
   301     void *visit(transition_c *symbol) {return NULL;}
       
   302 
       
   303     void *visit(action_c *symbol) {return NULL;}
       
   304 
       
   305 }; /* generate_cc_sfc_stepdecl_c */
       
   306 
       
   307 
       
   308 
       
   309 
       
   310 /***********************************************************************/
       
   311 /***********************************************************************/
       
   312 /***********************************************************************/
       
   313 /***********************************************************************/
       
   314 
       
   315 class generate_cc_sfc_actiondecl_c: public generate_cc_base_c {
       
   316   
       
   317   private:
       
   318     char action_number;
       
   319     
       
   320   public:
       
   321     generate_cc_sfc_actiondecl_c(stage4out_c *s4o_ptr): generate_cc_base_c(s4o_ptr) {}
       
   322     ~generate_cc_sfc_actiondecl_c(void) {}
       
   323     
       
   324     void reset_action_number(void) {action_number = 0;}
       
   325     void print_action_number(void) {
       
   326       char str[10];
       
   327       sprintf(str, "%d", action_number);
       
   328       s4o.print(str);
       
   329     }
       
   330 
       
   331 /*********************************************/
       
   332 /* B.1.6  Sequential function chart elements */
       
   333 /*********************************************/
       
   334     
       
   335     void *visit(initial_step_c *symbol) {return NULL;}
       
   336     
       
   337     void *visit(step_c *symbol) {return NULL;}
       
   338 
       
   339     void *visit(transition_c *symbol) {return NULL;}
       
   340 
       
   341     void *visit(action_c *symbol) {
       
   342       s4o.print("#define ");
       
   343       s4o.print(SFC_STEP_ACTION_PREFIX);
       
   344       symbol->action_name->accept(*this);
       
   345       s4o.print(" ");
       
   346       print_action_number();
       
   347       s4o.print("\n");
       
   348       action_number++;
       
   349       return NULL;
       
   350     }
       
   351 
       
   352 }; /* generate_cc_sfc_actiondecl_c */
       
   353 
       
   354 
       
   355 
       
   356 
       
   357 /***********************************************************************/
       
   358 /***********************************************************************/
       
   359 /***********************************************************************/
       
   360 /***********************************************************************/
       
   361 
       
   362 class generate_cc_sfcdecl_c: public iterator_visitor_c {
       
   363   
       
   364   protected:
       
   365     stage4out_c &s4o;
       
   366   
       
   367   private:
       
   368     generate_cc_sfc_stepdecl_c *generate_cc_sfc_stepdecl;
       
   369     generate_cc_sfc_actiondecl_c *generate_cc_sfc_actiondecl;
       
   370 
       
   371   public:
       
   372     generate_cc_sfcdecl_c(stage4out_c *s4o_ptr) : s4o(*s4o_ptr) {
       
   373       generate_cc_sfc_stepdecl = new generate_cc_sfc_stepdecl_c(s4o_ptr);
       
   374       generate_cc_sfc_actiondecl = new generate_cc_sfc_actiondecl_c(s4o_ptr);
       
   375     }
       
   376 
       
   377     virtual ~generate_cc_sfcdecl_c(void) {
       
   378       delete generate_cc_sfc_stepdecl;
       
   379       delete generate_cc_sfc_actiondecl;
       
   380     }
       
   381 
       
   382   public:
       
   383 
       
   384     /* generate steps and actions tables */
       
   385     void *visit(sequential_function_chart_c *symbol) {
       
   386       /* generate steps definitions */
       
   387       generate_cc_sfc_stepdecl->reset_step_number();
       
   388       s4o.print("// Steps definitions\n");
       
   389       symbol->accept(*generate_cc_sfc_stepdecl);
       
   390       s4o.print("\n");
       
   391       
       
   392       /* generate actions definitions */
       
   393       generate_cc_sfc_actiondecl->reset_action_number();
       
   394       s4o.print("// Actions definitions\n");
       
   395       symbol->accept(*generate_cc_sfc_actiondecl);
       
   396       s4o.print("\n");
       
   397       
       
   398       return NULL;
       
   399     }
       
   400 
       
   401 /***********************************/
       
   402 /* B 2.1 Instructions and Operands */
       
   403 /***********************************/
       
   404 /*| instruction_list il_instruction */
       
   405     void *visit(instruction_list_c *symbol) {return NULL;}
       
   406 
       
   407 /***************************************/
       
   408 /* B.3 - Language ST (Structured Text) */
       
   409 /***************************************/
       
   410 /********************/
       
   411 /* B 3.2 Statements */
       
   412 /********************/
       
   413     void *visit(statement_list_c *symbol) {return NULL;}
       
   414 
       
   415 /* Remainder implemented in generate_cc_sfcdecl_c... */
       
   416 };
       
   417 
       
   418 
       
   419 
       
   420 
       
   421 /***********************************************************************/
       
   422 /***********************************************************************/
       
   423 /***********************************************************************/
       
   424 /***********************************************************************/
       
   425 
       
   426 class generate_cc_sfc_stepundecl_c: public generate_cc_base_c {
       
   427   
       
   428   public:
       
   429     generate_cc_sfc_stepundecl_c(stage4out_c *s4o_ptr): generate_cc_base_c(s4o_ptr) {}
       
   430     ~generate_cc_sfc_stepundecl_c(void) {}
       
   431 
       
   432 /*********************************************/
       
   433 /* B.1.6  Sequential function chart elements */
       
   434 /*********************************************/
       
   435     
       
   436     void *visit(initial_step_c *symbol) {
       
   437       s4o.print("#undef ");
       
   438       s4o.print(SFC_STEP_ACTION_PREFIX);
       
   439       symbol->step_name->accept(*this);
       
   440       s4o.print("\n");
       
   441       return NULL;
       
   442     }
       
   443     
       
   444     void *visit(step_c *symbol) {
       
   445       s4o.print("#undef ");
       
   446       s4o.print(SFC_STEP_ACTION_PREFIX);
       
   447       symbol->step_name->accept(*this);
       
   448       s4o.print("\n");
       
   449       return NULL;
       
   450     }
       
   451 
       
   452     void *visit(transition_c *symbol) {return NULL;}
       
   453 
       
   454     void *visit(action_c *symbol) {return NULL;}
       
   455 
       
   456 }; /* generate_cc_sfc_stepdecl_c */
       
   457 
       
   458 
       
   459 
       
   460 
       
   461 /***********************************************************************/
       
   462 /***********************************************************************/
       
   463 /***********************************************************************/
       
   464 /***********************************************************************/
       
   465 
       
   466 class generate_cc_sfc_actionundecl_c: public generate_cc_base_c {
       
   467   
       
   468   public:
       
   469     generate_cc_sfc_actionundecl_c(stage4out_c *s4o_ptr): generate_cc_base_c(s4o_ptr) {}
       
   470     ~generate_cc_sfc_actionundecl_c(void) {}
       
   471 
       
   472 /*********************************************/
       
   473 /* B.1.6  Sequential function chart elements */
       
   474 /*********************************************/
       
   475     
       
   476     void *visit(initial_step_c *symbol) {return NULL;}
       
   477     
       
   478     void *visit(step_c *symbol) {return NULL;}
       
   479 
       
   480     void *visit(transition_c *symbol) {return NULL;}
       
   481 
       
   482     void *visit(action_c *symbol) {
       
   483       s4o.print("#undef ");
       
   484       s4o.print(SFC_STEP_ACTION_PREFIX);
       
   485       symbol->action_name->accept(*this);
       
   486       s4o.print("\n");
       
   487       return NULL;
       
   488     }
       
   489 
       
   490 }; /* generate_cc_sfc_stepdecl_c */
       
   491 
       
   492 
       
   493 
       
   494 
       
   495 /***********************************************************************/
       
   496 /***********************************************************************/
       
   497 /***********************************************************************/
       
   498 /***********************************************************************/
       
   499 
       
   500 class generate_cc_sfcundecl_c: public iterator_visitor_c {
       
   501   
       
   502   protected:
       
   503     stage4out_c &s4o;
       
   504   
       
   505   private:
       
   506     generate_cc_sfc_stepundecl_c *generate_cc_sfc_stepundecl;
       
   507     generate_cc_sfc_actionundecl_c *generate_cc_sfc_actionundecl;
       
   508 
       
   509   public:
       
   510     generate_cc_sfcundecl_c(stage4out_c *s4o_ptr) : s4o(*s4o_ptr) {
       
   511       generate_cc_sfc_stepundecl = new generate_cc_sfc_stepundecl_c(s4o_ptr);
       
   512       generate_cc_sfc_actionundecl = new generate_cc_sfc_actionundecl_c(s4o_ptr);
       
   513     }
       
   514 
       
   515     virtual ~generate_cc_sfcundecl_c(void) {
       
   516       delete generate_cc_sfc_stepundecl;
       
   517       delete generate_cc_sfc_actionundecl;
       
   518     }
       
   519 
       
   520   public:
       
   521 
       
   522 /*********************************************/
       
   523 /* B.1.6  Sequential function chart elements */
       
   524 /*********************************************/
       
   525 
       
   526     /* generate steps and actions tables */
       
   527     void *visit(sequential_function_chart_c *symbol) {
       
   528       /* generate steps undefinitions */
       
   529       s4o.print("// Steps undefinitions\n");
       
   530       symbol->accept(*generate_cc_sfc_stepundecl);
       
   531       s4o.print("\n");
       
   532       
       
   533       /* generate actions table */
       
   534       s4o.print("// Actions undefinitions\n");
       
   535       symbol->accept(*generate_cc_sfc_actionundecl);
       
   536       s4o.print("\n");
       
   537       
       
   538       return NULL;
       
   539     }
       
   540 
       
   541 /***********************************/
       
   542 /* B 2.1 Instructions and Operands */
       
   543 /***********************************/
       
   544 /*| instruction_list il_instruction */
       
   545     void *visit(instruction_list_c *symbol) {return NULL;}
       
   546 
       
   547 /***************************************/
       
   548 /* B.3 - Language ST (Structured Text) */
       
   549 /***************************************/
       
   550 /********************/
       
   551 /* B 3.2 Statements */
       
   552 /********************/
       
   553     void *visit(statement_list_c *symbol) {return NULL;}
       
   554 
       
   555 /* Remainder implemented in generate_cc_sfcdecl_c... */
       
   556 };