absyntax_utils/function_param_iterator.hh
author mario
Thu, 18 Jun 2009 18:49:29 +0200
changeset 193 5ef4fe412e34
parent 181 38d6eb056260
child 202 da1a8186f86f
permissions -rw-r--r--
Fixing indentification
181
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
     1
/*
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
     2
 * (c) 2003 Mario de Sousa
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
     3
 *
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
     4
 * Offered to the public under the terms of the GNU General Public License
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
     5
 * as published by the Free Software Foundation; either version 2 of the
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
     6
 * License, or (at your option) any later version.
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
     7
 *
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
     8
 * This program is distributed in the hope that it will be useful, but
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
     9
 * WITHOUT ANY WARRANTY; without even the implied warranty of
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    11
 * Public License for more details.
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    12
 *
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    13
 * This code is made available on the understanding that it will not be
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    14
 * used in safety-critical situations without a full and competent review.
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    15
 */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    16
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    17
/*
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    18
 * An IEC 61131-3 IL and ST compiler.
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    19
 *
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    20
 * Based on the
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    21
 * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    22
 *
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    23
 */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    24
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    25
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    26
/*
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    27
 * Function parameter iterator.
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    28
 * Iterate through the in/out parameters of a function declaration.
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    29
 * Function blocks are also suported.
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    30
 *
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    31
 * This is part of the 4th stage that generates
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    32
 * a c++ source program equivalent to the IL and ST
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    33
 * code.
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    34
 */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    35
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    36
/* Given a function_declaration_c, iterate through each
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    37
 * function in/out/inout parameter, returning the name
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    38
 * of each parameter...function_param_iterator_c
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    39
 */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    40
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    41
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    42
#include "../absyntax/visitor.hh"
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    43
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    44
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    45
class function_param_iterator_c : public null_visitor_c {
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    46
  public:
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    47
    /* A type to specify the type of parameter.
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    48
     * VAR_INPUT => direction_in
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    49
     * VAR_OUTPUT => direction_out
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    50
     * VAR_IN_OUT => direction_inout
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    51
     * VAR_EXTERNAL => direction_extref
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    52
     *
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    53
     * Note that VAR_EXTERNAL declares variables that are in reality references
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    54
     * to global variables. This is used only inside programs!
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    55
     * These references to external variables must be correctly initialised to refer
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    56
     * to the correct global variable. Note that the user may define which variable is to be
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    57
     * referenced in a CONFIGURATION, and that different instantiations of a program
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    58
     * may have the same external variable reference diffenrent global variables!
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    59
     * The references must therefore be correctly initialised when the program instance
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    60
     * is created. This may be done by the PROGRAM class constructor since the ST and IL
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    61
     * languages do not allow the VAR_EXTERNAL reference to change at runtime
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    62
     * for a specific instance.
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    63
     *
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    64
     * We therefore need to call a PROGRAM class constructor with the variables
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    65
     * that should be refernced by the VAR_EXTERNAL variables. The direction_extref will
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    66
     * be used to identify these parameters!
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    67
     */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    68
    typedef enum {direction_in, direction_out, direction_inout, direction_extref} param_direction_t ;
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    69
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    70
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    71
  private:
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    72
      /* a pointer to the function_block_declaration_c
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    73
       * or function_declaration_c currently being analysed.
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    74
       */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    75
    symbol_c *f_decl;
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    76
    int next_param, param_count;
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    77
    identifier_c *current_param_name;
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    78
    symbol_c *current_param_type;
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    79
    symbol_c *current_param_default_value;
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    80
    param_direction_t current_param_direction;
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    81
    bool en_declared;
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    82
    bool eno_declared;
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    83
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    84
  private:
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    85
    void* handle_param_list(list_c *list);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    86
    void* handle_single_param(symbol_c *var_name);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    87
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    88
    void* iterate_list(list_c *list);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    89
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    90
  public:
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    91
    /* start off at the first parameter once again... */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    92
    void reset(void);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    93
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    94
    /* initialise the iterator object.
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    95
     * We must be given a reference to the function declaration
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    96
     * that will be analysed...
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    97
     */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    98
    function_param_iterator_c(function_declaration_c *f_decl);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    99
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   100
    /* initialise the iterator object.
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   101
     * We must be given a reference to the function block declaration
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   102
     * that will be analysed...
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   103
     */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   104
    function_param_iterator_c(function_block_declaration_c *fb_decl);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   105
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   106
    /* initialise the iterator object.
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   107
     * We must be given a reference to the program declaration
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   108
     * that will be analysed...
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   109
     */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   110
    function_param_iterator_c(program_declaration_c *p_decl);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   111
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   112
    /* Skip to the next parameter. After object creation,
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   113
     * the object references on parameter _before_ the first, so
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   114
     * this function must be called once to get the object to
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   115
     * reference the first parameter...
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   116
     *
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   117
     * Returns the parameter's name!
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   118
     */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   119
    identifier_c *next(void);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   120
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   121
    identifier_c *declare_en_param(void);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   122
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   123
    identifier_c *declare_eno_param(void);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   124
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   125
    /* Returns the currently referenced parameter's default value,
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   126
     * or NULL if none is specified in the function declrataion itself.
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   127
     */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   128
    symbol_c *default_value(void);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   129
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   130
    /* Returns the currently referenced parameter's type name. */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   131
    symbol_c *param_type(void);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   132
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   133
    /* Returns the currently referenced parameter's data passing direction.
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   134
     * i.e. VAR_INPUT, VAR_OUTPUT or VAR_INOUT
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   135
     */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   136
    param_direction_t param_direction(void);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   137
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   138
    private:
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   139
    /******************************************/
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   140
    /* B 1.4.3 - Declaration & Initialisation */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   141
    /******************************************/
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   142
    void *visit(input_declarations_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   143
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   144
    void *visit(input_declaration_list_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   145
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   146
    void *visit(edge_declaration_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   147
    void *visit(en_param_declaration_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   148
    /* var1_list ':' array_spec_init */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   149
    //SYM_REF2(array_var_init_decl_c, var1_list, array_spec_init)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   150
    void *visit(array_var_init_decl_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   151
    
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   152
    /*  var1_list ':' initialized_structure */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   153
    //SYM_REF2(structured_var_init_decl_c, var1_list, initialized_structure)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   154
    void *visit(structured_var_init_decl_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   155
    
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   156
#if 0
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   157
/* name_list ':' function_block_type_name ASSIGN structure_initialization */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   158
/* structure_initialization -> may be NULL ! */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   159
SYM_REF4(fb_name_decl_c, fb_name_list, function_block_type_name, structure_initialization, unused)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   160
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   161
/* name_list ',' fb_name */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   162
SYM_LIST(fb_name_list_c)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   163
#endif
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   164
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   165
    void *visit(output_declarations_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   166
    void *visit(eno_param_declaration_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   167
    void *visit(input_output_declarations_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   168
    void *visit(var_declaration_list_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   169
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   170
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   171
    /*  var1_list ':' array_specification */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   172
    //SYM_REF2(array_var_declaration_c, var1_list, array_specification)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   173
    void *visit(array_var_declaration_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   174
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   175
    /*  var1_list ':' structure_type_name */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   176
    //SYM_REF2(structured_var_declaration_c, var1_list, structure_type_name)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   177
    void *visit(structured_var_declaration_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   178
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   179
    /* VAR [CONSTANT] var_init_decl_list END_VAR */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   180
    void *visit(var_declarations_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   181
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   182
#if 0
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   183
/*  VAR RETAIN var_init_decl_list END_VAR */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   184
SYM_REF2(retentive_var_declarations_c, var_init_decl_list, unused)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   185
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   186
/*  VAR [CONSTANT|RETAIN|NON_RETAIN] located_var_decl_list END_VAR */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   187
/* option -> may be NULL ! */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   188
SYM_REF2(located_var_declarations_c, option, located_var_decl_list)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   189
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   190
/* helper symbol for located_var_declarations */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   191
/* located_var_decl_list located_var_decl ';' */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   192
SYM_LIST(located_var_decl_list_c)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   193
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   194
/*  [variable_name] location ':' located_var_spec_init */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   195
/* variable_name -> may be NULL ! */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   196
SYM_REF4(located_var_decl_c, variable_name, location, located_var_spec_init, unused)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   197
#endif
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   198
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   199
    /*| VAR_EXTERNAL [CONSTANT] external_declaration_list END_VAR */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   200
    /* option -> may be NULL ! */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   201
    // SYM_REF2(external_var_declarations_c, option, external_declaration_list)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   202
    void *visit(external_var_declarations_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   203
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   204
    /* helper symbol for external_var_declarations */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   205
    /*| external_declaration_list external_declaration';' */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   206
    // SYM_LIST(external_declaration_list_c)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   207
    void *visit(external_declaration_list_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   208
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   209
    /*  global_var_name ':' (simple_specification|subrange_specification|enumerated_specification|array_specification|prev_declared_structure_type_name|function_block_type_name */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   210
    //SYM_REF2(external_declaration_c, global_var_name, specification)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   211
    void *visit(external_declaration_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   212
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   213
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   214
#if 0
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   215
/*| VAR_GLOBAL [CONSTANT|RETAIN] global_var_decl_list END_VAR */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   216
/* option -> may be NULL ! */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   217
SYM_REF2(global_var_declarations_c, option, global_var_decl_list)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   218
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   219
/* helper symbol for global_var_declarations */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   220
/*| global_var_decl_list global_var_decl ';' */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   221
SYM_LIST(global_var_decl_list_c)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   222
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   223
/*| global_var_spec ':' [located_var_spec_init|function_block_type_name] */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   224
/* type_specification ->may be NULL ! */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   225
SYM_REF2(global_var_decl_c, global_var_spec, type_specification)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   226
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   227
/*| global_var_name location */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   228
SYM_REF2(global_var_spec_c, global_var_name, location)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   229
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   230
/*  AT direct_variable */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   231
SYM_REF2(location_c, direct_variable, unused)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   232
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   233
/*| global_var_list ',' global_var_name */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   234
SYM_LIST(global_var_list_c)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   235
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   236
/*  var1_list ':' single_byte_string_spec */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   237
SYM_REF2(single_byte_string_var_declaration_c, var1_list, single_byte_string_spec)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   238
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   239
/*  STRING ['[' integer ']'] [ASSIGN single_byte_character_string] */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   240
/* integer ->may be NULL ! */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   241
/* single_byte_character_string ->may be NULL ! */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   242
SYM_REF2(single_byte_string_spec_c, integer, single_byte_character_string)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   243
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   244
/*  var1_list ':' double_byte_string_spec */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   245
SYM_REF2(double_byte_string_var_declaration_c, var1_list, double_byte_string_spec)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   246
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   247
/*  WSTRING ['[' integer ']'] [ASSIGN double_byte_character_string] */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   248
/* integer ->may be NULL ! */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   249
/* double_byte_character_string ->may be NULL ! */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   250
SYM_REF2(double_byte_string_spec_c, integer, double_byte_character_string)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   251
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   252
/*| VAR [RETAIN|NON_RETAIN] incompl_located_var_decl_list END_VAR */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   253
/* option ->may be NULL ! */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   254
SYM_REF2(incompl_located_var_declarations_c, option, incompl_located_var_decl_list)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   255
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   256
/* helper symbol for incompl_located_var_declarations */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   257
/*| incompl_located_var_decl_list incompl_located_var_decl ';' */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   258
SYM_LIST(incompl_located_var_decl_list_c)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   259
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   260
/*  variable_name incompl_location ':' var_spec */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   261
SYM_REF4(incompl_located_var_decl_c, variable_name, incompl_location, var_spec, unused)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   262
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   263
/*  AT incompl_location_token */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   264
SYM_TOKEN(incompl_location_c)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   265
#endif
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   266
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   267
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   268
    void *visit(var1_init_decl_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   269
    void *visit(var1_list_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   270
    void *visit(var_init_decl_list_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   271
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   272
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   273
    /***********************/
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   274
    /* B 1.5.1 - Functions */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   275
    /***********************/
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   276
    void *visit(function_declaration_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   277
    /* intermediate helper symbol for function_declaration */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   278
    void *visit(var_declarations_list_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   279
    void *visit(function_var_decls_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   280
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   281
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   282
    /*****************************/
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   283
    /* B 1.5.2 - Function Blocks */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   284
    /*****************************/
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   285
    /*  FUNCTION_BLOCK derived_function_block_name io_OR_other_var_declarations function_block_body END_FUNCTION_BLOCK */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   286
    void *visit(function_block_declaration_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   287
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   288
    /* intermediate helper symbol for function_declaration */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   289
    /*  { io_var_declarations | other_var_declarations }   */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   290
    /*
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   291
     * NOTE: we re-use the var_declarations_list_c
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   292
     */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   293
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   294
    /*  VAR_TEMP temp_var_decl_list END_VAR */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   295
    void *visit(temp_var_decls_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   296
    void *visit(temp_var_decls_list_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   297
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   298
    /*  VAR NON_RETAIN var_init_decl_list END_VAR */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   299
    void *visit(non_retentive_var_decls_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   300
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   301
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   302
    /**********************/
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   303
    /* B 1.5.3 - Programs */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   304
    /**********************/
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   305
    /*  PROGRAM program_type_name program_var_declarations_list function_block_body END_PROGRAM */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   306
    // SYM_REF4(program_declaration_c, program_type_name, var_declarations, function_block_body, unused)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   307
    void *visit(program_declaration_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   308
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   309
    /* intermediate helper symbol for program_declaration_c */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   310
    /*  { io_var_declarations | other_var_declarations }   */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   311
    /*
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   312
     * NOTE: we re-use the var_declarations_list_c
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   313
     */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   314
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   315
}; // function_param_iterator_c
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   316
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   317
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   318
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   319
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   320
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   321
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   322