absyntax_utils/function_param_iterator.hh
changeset 350 2c3c4dc34979
parent 279 c0453b7f99df
child 424 43d73e28eca8
equal deleted inserted replaced
341:ba80c3ceb6fb 350:2c3c4dc34979
    88     identifier_c *current_param_name;
    88     identifier_c *current_param_name;
    89     symbol_c *current_param_type;
    89     symbol_c *current_param_type;
    90     symbol_c *current_param_default_value;
    90     symbol_c *current_param_default_value;
    91     param_direction_t current_param_direction;
    91     param_direction_t current_param_direction;
    92     bool en_eno_param_implicit;
    92     bool en_eno_param_implicit;
       
    93     /* used when we reach an extensible parameter in the function declaration */
       
    94     /* NOTE: this will handle syntax that is not in the standard.
       
    95      *       It is used to handle the extensible standard functions
       
    96      *       (e.g. AND(word#3, word#55, word#44); )
       
    97      *       See absyntax.def or iec.y for more details.
       
    98      */
       
    99     bool current_param_is_extensible;
       
   100     int  current_extensible_param_index;
       
   101     int  _first_extensible_param_index;
       
   102 
    93     /* Which operation of the class was called...
   103     /* Which operation of the class was called...
    94      * Search a parameter, or iterate to the next parameter.
   104      * Search a parameter, or iterate to the next parameter.
    95      */
   105      */
    96     typedef enum {iterate_op, search_op} operation_t;
   106     typedef enum {iterate_op, search_op} operation_t;
    97     operation_t current_operation;
   107     operation_t current_operation;
    98 
   108 
    99   private:
   109   private:
       
   110     int   cmp_extparam_names(const char* s1, const char* s2);
   100     void* handle_param_list(list_c *list);
   111     void* handle_param_list(list_c *list);
   101     void* handle_single_param(symbol_c *var_name);
   112     void* handle_single_param(symbol_c *var_name);
   102 
   113 
   103     void* iterate_list(list_c *list);
   114     void* iterate_list(list_c *list);
   104 
   115 
   126 
   137 
   127     /* Search for the parameter named <param_name>...  */
   138     /* Search for the parameter named <param_name>...  */
   128     /* The seach() function does not in any way affect the internal state related 
   139     /* The seach() function does not in any way affect the internal state related 
   129      * to the iterate() function.
   140      * to the iterate() function.
   130      * It will, however, affect the internal state necessary to correctly
   141      * It will, however, affect the internal state necessary to correctly
   131      * return the param_type() and default_value() of the found parameter.
   142      * return the param_type(), default_value() and is_en_eno_param_implicit()
       
   143      * of the found parameter.
   132      */
   144      */
   133     identifier_c *search(symbol_c *param_name);
   145     identifier_c *search(symbol_c *param_name);
   134 
   146 
   135     /* Returns the currently referenced parameter's default value,
   147     /* Returns the currently referenced parameter's default value,
   136      * or NULL if none is specified in the function declrataion itself.
   148      * or NULL if none is specified in the function declrataion itself.
   141     symbol_c *param_type(void);
   153     symbol_c *param_type(void);
   142 
   154 
   143     /* Returns if currently referenced parameter is an implicit defined EN/ENO parameter. */
   155     /* Returns if currently referenced parameter is an implicit defined EN/ENO parameter. */
   144     bool is_en_eno_param_implicit(void);
   156     bool is_en_eno_param_implicit(void);
   145 
   157 
       
   158     /* Returns if currently referenced parameter is an extensible parameter. */
       
   159     /* extensible paramters only occur in some standard functions, e.g. AND(word#34, word#44, word#65); */
       
   160     bool is_extensible_param(void);
       
   161     /* Returns the index of the current extensible parameter. */             
       
   162     /* If the current parameter is not an extensible paramter, returns -1 */
       
   163     int extensible_param_index(void);
       
   164     /* Returns the index of the first extensible parameter, or -1 if no extensible parameter found. */             
       
   165     /* WARNING: Will only return the correct value _after_ an extensible parameter has been found! */
       
   166     int first_extensible_param_index(void);
       
   167     
   146     /* Returns the currently referenced parameter's data passing direction.
   168     /* Returns the currently referenced parameter's data passing direction.
   147      * i.e. VAR_INPUT, VAR_OUTPUT or VAR_INOUT
   169      * i.e. VAR_INPUT, VAR_OUTPUT or VAR_INOUT
   148      */
   170      */
   149     param_direction_t param_direction(void);
   171     param_direction_t param_direction(void);
   150 
   172