absyntax_utils/function_call_param_iterator.hh
author 'Gr?gory Tr?lat <gregory.trelat@lolitech.fr>'
Fri, 10 Jul 2009 11:41:29 +0200
changeset 198 f68ef6f05e17
parent 181 38d6eb056260
child 202 da1a8186f86f
permissions -rw-r--r--
prevent eclipse to push .project with .hgignore
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
 * Function call parameter iterator.
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    27
 * It will iterate through the formal parameters of a function call
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    28
 * (i.e. function calls using the foo(<param1>, <param2>, ...) syntax).
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    29
 * and/or search through the non-formal parameters of a function call
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    30
 * (i.e. function calls using the foo(<name1> = <param1>, <name2> = <param2>, ...) syntax).
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    31
 *
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    32
 * Calls to function blocks and programs are also supported.
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    33
 *
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    34
 * Note that calls to next() will only iterate through formal parameters,
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    35
 * and calls to search()  will only serach through non-formal parameters.
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    36
 */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    37
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    38
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    39
#include "../absyntax/visitor.hh"
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
class function_call_param_iterator_c : public null_visitor_c {
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
  private:
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    45
      /* a pointer to the function call
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    46
       * (or function block or program call!)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    47
       */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    48
    symbol_c *f_call;
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    49
    int next_param, param_count;
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    50
    identifier_c *search_param_name;
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    51
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    52
    /* Which operation of the class was called...
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    53
     * Search a parameter, or iterate to the next parameter.
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    54
     */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    55
    typedef enum {iterate_op, search_op} operation_t;
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    56
    operation_t current_operation;
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    57
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    58
  private:
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    59
    void *search_list(list_c *list);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    60
    void *handle_parameter_assignment(symbol_c *variable_name, symbol_c *expression) ;
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    61
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    62
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    63
  public:
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    64
    /* start off at the first parameter once again... */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    65
    void reset(void);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    66
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    67
    /* initialise the iterator object.
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    68
     * We must be given a reference to the function/program/function block call
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    69
     * that will be analysed...
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
    function_call_param_iterator_c(symbol_c *f_call);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    72
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    73
    /* Skip to the next parameter. After object creation,
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    74
     * the object references on parameter _before_ the first, so
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    75
     * 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
    76
     * reference the first parameter...
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    77
     *
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    78
     * Returns whatever is being passed to the parameter!
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    79
     */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    80
    symbol_c *next(void);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    81
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    82
    /* Search for the value passed to the parameter named <param_name>...  */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    83
    symbol_c *search(symbol_c *param_name);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    84
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    85
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    86
  private:
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
  /* B 1.7 Configuration elements */
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
 
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    91
  /*
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    92
  CONFIGURATION configuration_name
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    93
     optional_global_var_declarations
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    94
   (resource_declaration_list | single_resource_declaration)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    95
   optional_access_declarations
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    96
   optional_instance_specific_initializations
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    97
  END_CONFIGURATION
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
    98
  */
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
  SYM_REF6(configuration_declaration_c, configuration_name, global_var_declarations, resource_declarations, access_declarations, instance_specific_initializations, unused)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   101
  */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   102
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   103
  /* helper symbol for configuration_declaration */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   104
  /*
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   105
  SYM_LIST(resource_declaration_list_c)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   106
  */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   107
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   108
  /*
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   109
  RESOURCE resource_name ON resource_type_name
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   110
     optional_global_var_declarations
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   111
   single_resource_declaration
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   112
  END_RESOURCE
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   113
  */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   114
  /*
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   115
  SYM_REF4(resource_declaration_c, resource_name, resource_type_name, global_var_declarations, resource_declaration)
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
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   118
  /* task_configuration_list program_configuration_list */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   119
  /*
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   120
  SYM_REF2(single_resource_declaration_c, task_configuration_list, program_configuration_list)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   121
  */
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
  /* helper symbol for single_resource_declaration */
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
  SYM_LIST(task_configuration_list_c)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   126
  */
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
  /* helper symbol for single_resource_declaration */
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
  SYM_LIST(program_configuration_list_c)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   131
  */
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
  /* helper symbol for
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   134
   *  - access_path
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   135
   *  - instance_specific_init
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   136
   */
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
  SYM_LIST(any_fb_name_list_c)
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
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   141
  /*  [resource_name '.'] global_var_name ['.' structure_element_name] */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   142
  /*
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   143
  SYM_REF4(global_var_reference_c, resource_name, global_var_name, structure_element_name, unused)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   144
  */
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
  /*  prev_declared_program_name '.' symbolic_variable */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   147
  /*
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   148
  SYM_REF2(program_output_reference_c, program_name, symbolic_variable)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   149
  */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   150
 
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   151
  /*  TASK task_name task_initialization */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   152
  /*
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   153
  SYM_REF2(task_configuration_c, task_name, task_initialization)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   154
  */
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
  /*  '(' [SINGLE ASSIGN data_source ','] [INTERVAL ASSIGN data_source ','] PRIORITY ASSIGN integer ')' */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   157
  /*
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   158
  SYM_REF4(task_initialization_c, single_data_source, interval_data_source, priority_data_source, unused)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   159
  */
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
  /*  PROGRAM [RETAIN | NON_RETAIN] program_name [WITH task_name] ':' program_type_name ['(' prog_conf_elements ')'] */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   162
  // SYM_REF6(program_configuration_c, retain_option, program_name, task_name, program_type_name, prog_conf_elements, unused)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   163
    void *visit(program_configuration_c *symbol);
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
  /* prog_conf_elements ',' prog_conf_element */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   166
  // SYM_LIST(prog_conf_elements_c)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   167
    void *visit(prog_conf_elements_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   168
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   169
  /*  fb_name WITH task_name */
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
  SYM_REF2(fb_task_c, fb_name, task_name)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   172
  */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   173
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   174
  /*  any_symbolic_variable ASSIGN prog_data_source */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   175
  // SYM_REF2(prog_cnxn_assign_c, symbolic_variable, prog_data_source)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   176
    void *visit(prog_cnxn_assign_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   177
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   178
  /* any_symbolic_variable SENDTO data_sink */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   179
  // SYM_REF2(prog_cnxn_sendto_c, symbolic_variable, prog_data_source)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   180
    void *visit(prog_cnxn_sendto_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
  /* VAR_CONFIG instance_specific_init_list END_VAR */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   183
  /*
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   184
  SYM_REF2(instance_specific_initializations_c, instance_specific_init_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
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   187
  /* helper symbol for instance_specific_initializations */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   188
  /*
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   189
  SYM_LIST(instance_specific_init_list_c)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   190
  */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   191
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   192
  /* resource_name '.' program_name '.' {fb_name '.'}
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   193
      ((variable_name [location] ':' located_var_spec_init) | (fb_name ':' fb_initialization))
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   194
  */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   195
  /*
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   196
  SYM_REF6(instance_specific_init_c, resource_name, program_name, any_fb_name_list, variable_name, location, initialization)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   197
  */
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
  /* helper symbol for instance_specific_init */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   200
  /* function_block_type_name ':=' structure_initialization */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   201
  /*
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   202
  SYM_REF2(fb_initialization_c, function_block_type_name, structure_initialization)
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
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   205
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   206
  /****************************************/
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   207
  /* B.2 - Language IL (Instruction List) */
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
  /***********************************/
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   210
  /* B 2.1 Instructions and Operands */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   211
  /***********************************/
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
  /* | function_name [il_operand_list] */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   214
  // SYM_REF2(il_function_call_c, function_name, il_operand_list)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   215
    void *visit(il_function_call_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   216
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   217
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   218
  /* | function_name '(' eol_list [il_param_list] ')' */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   219
  // SYM_REF2(il_formal_funct_call_c, function_name, il_param_list)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   220
    void *visit(il_formal_funct_call_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   221
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
  /*   il_call_operator prev_declared_fb_name
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   224
   * | il_call_operator prev_declared_fb_name '(' ')'
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   225
   * | il_call_operator prev_declared_fb_name '(' eol_list ')'
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   226
   * | il_call_operator prev_declared_fb_name '(' il_operand_list ')'
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   227
   * | il_call_operator prev_declared_fb_name '(' eol_list il_param_list ')'
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   228
   */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   229
  // SYM_REF4(il_fb_call_c, il_call_operator, fb_name, il_operand_list, il_param_list)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   230
    void *visit(il_fb_call_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   231
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
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   234
  /* | il_operand_list ',' il_operand */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   235
  // SYM_LIST(il_operand_list_c)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   236
    void *visit(il_operand_list_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   237
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
  /* | il_initial_param_list il_param_instruction */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   240
  // SYM_LIST(il_param_list_c)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   241
    void *visit(il_param_list_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   242
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   243
  /*  il_assign_operator il_operand
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   244
   * | il_assign_operator '(' eol_list simple_instr_list ')'
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   245
   */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   246
  // SYM_REF4(il_param_assignment_c, il_assign_operator, il_operand, simple_instr_list, unused)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   247
    void *visit(il_param_assignment_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   248
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   249
  /*  il_assign_out_operator variable */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   250
  // SYM_REF2(il_param_out_assignment_c, il_assign_out_operator, variable);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   251
    void *visit(il_param_out_assignment_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   252
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   253
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   254
  /*******************/
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   255
  /* B 2.2 Operators */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   256
  /*******************/
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   257
  /*| [NOT] any_identifier SENDTO */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   258
  // SYM_REF2(il_assign_out_operator_c, option, variable_name)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   259
    void *visit(il_assign_out_operator_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   260
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   261
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
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   264
  /***************************************/
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   265
  /* B.3 - Language ST (Structured Text) */
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
  /* B 3.1 - Expressions */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   269
  /***********************/
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   270
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
  SYM_REF2(function_invocation_c, function_name, parameter_assignment_list)
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
    void *visit(function_invocation_c *symbol);
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
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   277
  /********************/
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   278
  /* B 3.2 Statements */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   279
  /********************/
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
  /* B 3.2.1 Assignment Statements */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   283
  /*********************************/
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
  SYM_REF2(assignment_statement_c, l_exp, r_exp)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   286
  */
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
  /*****************************************/
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   289
  /* B 3.2.2 Subprogram Control Statements */
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
  /*  RETURN */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   292
  // SYM_REF0(return_statement_c)
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
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   295
  /* fb_name '(' [param_assignment_list] ')' */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   296
  /* param_assignment_list -> may be NULL ! */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   297
  // SYM_REF2(fb_invocation_c, fb_name, param_assignment_list)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   298
    void *visit(fb_invocation_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   299
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   300
  /* helper symbol for fb_invocation */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   301
  /* param_assignment_list ',' param_assignment */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   302
  // SYM_LIST(param_assignment_list_c)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   303
    void *visit(param_assignment_list_c *symbol);
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
  /*  variable_name ASSIGN expression */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   306
  // SYM_REF2(input_variable_param_assignment_c, variable_name, expression)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   307
    void *visit(input_variable_param_assignment_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
  /* [NOT] variable_name '=>' variable */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   310
  // SYM_REF4(output_variable_param_assignment_c, not_param, variable_name, variable, unused)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   311
    void *visit(output_variable_param_assignment_c *symbol);
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   312
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   313
  /* helper CLASS for output_variable_param_assignment */
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   314
  // SYM_REF0(not_paramassign_c)
38d6eb056260 Moving absyntax utility files out from stage4/generate_c
mario
parents:
diff changeset
   315
  // TODO... ???
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
};  // function_call_param_iterator_c
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