stage4/generate_c/generate_var_list.cc
changeset 1041 56ebe2a31b5b
parent 958 7474d2cd1d6e
child 1088 9cb7c8bf7dbc
equal deleted inserted replaced
1040:e8563dcaefca 1041:56ebe2a31b5b
   287       list_c *list = dynamic_cast<list_c *>(symbol);
   287       list_c *list = dynamic_cast<list_c *>(symbol);
   288       /* should NEVER EVER occur!! */
   288       /* should NEVER EVER occur!! */
   289       if (list == NULL) ERROR;
   289       if (list == NULL) ERROR;
   290 
   290 
   291       for(int i = 0; i < list->n; i++) {
   291       for(int i = 0; i < list->n; i++) {
   292         declare_variable(list->elements[i]);
   292         declare_variable(list->get_element(i));
   293       }
   293       }
   294     }
   294     }
   295     
   295     
   296     void declare_variable(symbol_c *symbol) {
   296     void declare_variable(symbol_c *symbol) {
   297       // Arrays and structures are not supported in debugging
   297       // Arrays and structures are not supported in debugging
   791       return NULL;
   791       return NULL;
   792     }
   792     }
   793 
   793 
   794     void *visit(structure_element_declaration_list_c *symbol) {
   794     void *visit(structure_element_declaration_list_c *symbol) {
   795       for(int i = 0; i < symbol->n; i++) {
   795       for(int i = 0; i < symbol->n; i++) {
   796         symbol->elements[i]->accept(*this);
   796         symbol->get_element(i)->accept(*this);
   797       }
   797       }
   798       return NULL;
   798       return NULL;
   799     }
   799     }
   800 
   800 
   801     void *visit(structure_element_declaration_c *symbol) {
   801     void *visit(structure_element_declaration_c *symbol) {
   858     void *visit(sequential_function_chart_c *symbol) {
   858     void *visit(sequential_function_chart_c *symbol) {
   859       step_number = 0;
   859       step_number = 0;
   860       transition_number = 0;
   860       transition_number = 0;
   861       action_number = 0;
   861       action_number = 0;
   862       for(int i = 0; i < symbol->n; i++) {
   862       for(int i = 0; i < symbol->n; i++) {
   863         symbol->elements[i]->accept(*this);
   863         symbol->get_element(i)->accept(*this);
   864       }
   864       }
   865       return NULL;
   865       return NULL;
   866     }
   866     }
   867     
   867     
   868     /* INITIAL_STEP step_name ':' action_association_list END_STEP */
   868     /* INITIAL_STEP step_name ':' action_association_list END_STEP */
   935     
   935     
   936     /* | step_name_list ',' step_name */
   936     /* | step_name_list ',' step_name */
   937     //SYM_LIST(step_name_list_c)
   937     //SYM_LIST(step_name_list_c)
   938     void *visit(step_name_list_c *symbol) {
   938     void *visit(step_name_list_c *symbol) {
   939       for(int i = 0; i < symbol->n; i++) {
   939       for(int i = 0; i < symbol->n; i++) {
   940         symbol->elements[i]->accept(*this);
   940         symbol->get_element(i)->accept(*this);
   941         if (i < symbol->n - 1)
   941         if (i < symbol->n - 1)
   942           s4o.print(",");
   942           s4o.print(",");
   943       }
   943       }
   944       return NULL;
   944       return NULL;
   945     }
   945     }