Modify code generated to fit latest modifications in matiec
authorlaurent
Wed, 02 Sep 2009 18:21:46 +0200
changeset 406 af07b091bbee
parent 405 2c598d24205f
child 407 0a324a874981
Modify code generated to fit latest modifications in matiec
generate_IEC_std.py
plcopen/iec_std.csv
--- a/generate_IEC_std.py	Wed Sep 02 18:20:46 2009 +0200
+++ b/generate_IEC_std.py	Wed Sep 02 18:21:46 2009 +0200
@@ -150,12 +150,12 @@
 {
     identifier_c param_name("%(input_name)s");
     /* Get the value from a foo(<param_name> = <param_value>) style call */
-    symbol_c *%(input_name)s_param_value = function_call_param_iterator.search(&param_name);
+    symbol_c *%(input_name)s_param_value = function_call_param_iterator.search_f(&param_name);
     symbol_c *%(input_name)s_type_symbol = NULL;
     
     /* Get the value from a foo(<param_value>) style call */
     if (%(input_name)s_param_value == NULL)
-      %(input_name)s_param_value = function_call_param_iterator.next();
+      %(input_name)s_param_value = function_call_param_iterator.next_nf();
     if (%(input_name)s_param_value != NULL) {
       %(input_name)s_type_symbol = search_expression_type->get_type(%(input_name)s_param_value);
       last_type_symbol = last_type_symbol && %(input_name)s_type_symbol && search_expression_type->is_same_type(%(input_name)s_type_symbol, last_type_symbol) ? search_expression_type->common_type(%(input_name)s_type_symbol, last_type_symbol) : %(input_name)s_type_symbol ;
@@ -213,11 +213,11 @@
     identifier_c param_name(my_name);
     
     /* Get the value from a foo(<param_name> = <param_value>) style call */
-    param_value = function_call_param_iterator.search(&param_name);
+    param_value = function_call_param_iterator.search_f(&param_name);
     
     /* Get the value from a foo(<param_value>) style call */
     if (param_value == NULL)
-      param_value = function_call_param_iterator.next();
+      param_value = function_call_param_iterator.next_nf();
     if (param_value != NULL){
         symbol_c *current_type_symbol = search_expression_type->get_type(param_value);
         last_type_symbol = last_type_symbol && search_expression_type->is_same_type(current_type_symbol, last_type_symbol) ? search_expression_type->common_type(current_type_symbol, last_type_symbol) : current_type_symbol ;
@@ -380,7 +380,7 @@
 """
 search_type_code = matiec_header + """
 
-void *compute_standard_function_default(function_invocation_c *st_symbol = NULL, il_formal_funct_call_c *il_symbol = NULL) {
+void *search_expression_type_c::compute_standard_function_default(function_invocation_c *st_symbol = NULL, il_formal_funct_call_c *il_symbol = NULL) {
   function_type_t current_function_type;
   function_call_param_iterator_c *tmp_function_call_param_iterator;
   if (st_symbol != NULL && il_symbol == NULL) {
@@ -423,7 +423,7 @@
   return NULL;
 }
 
-void *compute_standard_function_il(il_function_call_c *symbol, symbol_c *param_data_type) {
+void *search_expression_type_c::compute_standard_function_il(il_function_call_c *symbol, symbol_c *param_data_type) {
   
   function_type_t current_function_type = get_function_type((identifier_c *)symbol->function_name);
   function_call_param_iterator_c function_call_param_iterator(symbol);  
--- a/plcopen/iec_std.csv	Wed Sep 02 18:20:46 2009 +0200
+++ b/plcopen/iec_std.csv	Wed Sep 02 18:21:46 2009 +0200
@@ -13,67 +13,67 @@
 ;;;;;;;;
 ;;;;;;;;
 Standard_functions_type;name;baseinputnumber;inputs;outputs;comment;extensible;python_eval_c_code_format;return_type_rule
-_("Type conversion");*_TO_**;1;(ANY);ANY;_("Data type conversion");no;ANY_TO_ANY_FORMAT_GEN(ANY_TO_ANY_LIST,fdecl);defined
-;TRUNC;1;(ANY_REAL);ANY_INT;_("Rounding up/down");no;("int", None, None);&search_constant_type_c::constant_int_type_name
-;BCD_TO_**;1;(ANY_BIT);ANY_INT;_("Conversion from BCD");no;ANY_TO_ANY_FORMAT_GEN(BCD_TO_ANY_LIST,fdecl);defined
-;*_TO_BCD;1;(ANY_INT);ANY_BIT;_("Conversion to BCD");no;ANY_TO_ANY_FORMAT_GEN(ANY_TO_BCD_LIST,fdecl);&search_constant_type_c::constant_int_type_name
-;DATE_AND_TIME_TO_TIME_OF_DAY;1;(DT);TOD;_("Conversion to time-of-day");no;(None, "__date_and_time_to_time_of_day", None);defined
-;DATE_AND_TIME_TO_DATE;1;(DT);DATE;_("Conversion to date");no;(None, "__date_and_time_to_date", None);defined
-_("Numerical");ABS;1;(ANY_NUM);ANY_NUM;_("Absolute number");no;(None, "__abs_", "IN_type");IN_type_symbol
-;SQRT;1;(ANY_REAL);ANY_REAL;_("Square root (base 2)");no;(None, "__sqrt_", "IN_type");IN_type_symbol
-;LN;1;(ANY_REAL);ANY_REAL;_("Natural logarithm");no;(None, "__ln_", "IN_type");IN_type_symbol
-;LOG;1;(ANY_REAL);ANY_REAL;_("Logarithm to base 10");no;(None, "__log_", "IN_type");IN_type_symbol
-;EXP;1;(ANY_REAL);ANY_REAL;_("Exponentiation");no;(None, "__exp_", "IN_type");IN_type_symbol
-;SIN;1;(ANY_REAL);ANY_REAL;_("Sine");no;(None, "__sin_", "IN_type");IN_type_symbol
-;COS;1;(ANY_REAL);ANY_REAL;_("Cosine");no;(None, "__cos_", "IN_type");IN_type_symbol
-;TAN;1;(ANY_REAL);ANY_REAL;_("Tangent");no;(None, "__tan_", "IN_type");IN_type_symbol
-;ASIN;1;(ANY_REAL);ANY_REAL;_("Arc sine");no;(None, "__asin_", "IN_type");IN_type_symbol
-;ACOS;1;(ANY_REAL);ANY_REAL;_("Arc cosine");no;(None, "__acos_", "IN_type");IN_type_symbol
-;ATAN;1;(ANY_REAL);ANY_REAL;_("Arc tangent");no;(None, "__atan_", "IN_type");IN_type_symbol
-_("Arithmetic");ADD;1;(ANY_NUM, ANY_NUM);ANY_NUM;_("Addition");yes;(None, "__add_", "return_type");copy_input
-;ADD;1;(TIME, TIME);TIME;_("Time addition");no;(None, "__time_add", None);defined
-;ADD;1;(TOD, TIME);TOD;_("Time-of-day addition");no;(None, "__time_add", None);defined
-;ADD;1;(DT, TIME);DT;_("Date addition");no;(None, "__time_add", None);defined
-;MUL;1;(ANY_NUM, ANY_NUM);ANY_NUM;_("Multiplication");yes;(None, "__mul_", "return_type");copy_input
-;MUL;1;(TIME, ANY_NUM);TIME;_("Time multiplication");no;(None, "__time_mul", None);defined
-;SUB;1;(ANY_NUM, ANY_NUM);ANY_NUM;_("Subtraction");no;(None, "__sub_", "return_type");copy_input
-;SUB;1;(TIME, TIME);TIME;_("Time subtraction");no;(None, "__time_sub", None);defined
-;SUB;1;(DATE, DATE);TIME;_("Date subtraction");no;(None, "__time_sub", None);defined
-;SUB;1;(TOD, TIME);TOD;_("Time-of-day subtraction");no;(None, "__time_sub", None);defined
-;SUB;1;(TOD, TOD);TIME;_("Time-of-day subtraction");no;(None, "__time_sub", None);defined
-;SUB;1;(DT, TIME);DT;_("Date and time subtraction");no;(None, "__time_sub", None);defined
-;SUB;1;(DT, DT);TIME;_("Date and time subtraction");no;(None, "__time_sub", None);defined
-;DIV;1;(ANY_NUM, ANY_NUM);ANY_NUM;_("Division");no;(None, "__div_", "return_type");copy_input
-;DIV;1;(TIME, ANY_NUM);TIME;_("Time division");no;(None, "__time_div", None);defined
-;MOD;1;(ANY_NUM, ANY_NUM);ANY_NUM;_("Remainder (modulo)");no;(None, "__mod_", "return_type");copy_input
-;EXPT;1;(ANY_REAL, ANY_NUM);ANY_REAL;_("Exponent");no;(None, "__expt_", "IN1_type");copy_input
-;MOVE;1;(ANY);ANY;_("Assignment");no;(None, "__move_", "return_type");copy_input
-_("Bit-shift");SHL;1;(ANY_BIT, N);ANY_BIT;_("Shift left");no;(None, "__shl_", "IN_type");IN_type_symbol
-;SHR;1;(ANY_BIT, N);ANY_BIT;_("Shift right");no;(None, "__shr_", "IN_type");IN_type_symbol
-;ROR;1;(ANY_NBIT, N);ANY_NBIT;_("Rotate right");no;(None, "__ror_", "IN_type");IN_type_symbol
-;ROL;1;(ANY_NBIT, N);ANY_NBIT;_("Rotate left");no;(None, "__rol_", "IN_type");IN_type_symbol
-_("Bitwise");AND;1;(ANY_BIT, ANY_BIT);ANY_BIT;_("Bitwise AND");yes;(None, "__and_", "return_type");copy_input
-;OR;1;(ANY_BIT, ANY_BIT);ANY_BIT;_("Bitwise OR");yes;(None, "__or_", "return_type");copy_input
-;XOR;1;(ANY_BIT, ANY_BIT);ANY_BIT;_("Bitwise XOR");yes;(None, "__xor_", "return_type");copy_input
-;NOT;1;(ANY_BIT);ANY_BIT;_("Bitwise inverting");no;(None, "__not_", "return_type");IN_type_symbol
-_("Selection");SEL;0;(G, ANY, ANY);ANY;_("Binary selection (1 of 2)");no;(None, "__sel_", "IN0_type");copy_input
-;MAX;1;(ANY, ANY);ANY;_("Maximum");yes;(None, "__max_", "return_type");copy_input
-;MIN;1;(ANY, ANY);ANY;_("Minimum");yes;(None, "__min_", "return_type");copy_input
-;LIMIT;1;(MN, ANY, MX);ANY;_("Limitation");no;(None, "__limit_", "IN_type");IN_type_symbol
-;MUX;0;(K, ANY, ANY);ANY;_("Multiplexer (select 1 of N)");yes;(None, "__mux_", "return_type");copy_input
-_("Comparison");GT;1;(ANY, ANY);BOOL;_("Greater than");yes;(None, "__gt_", "common_type");defined
-;GE;1;(ANY, ANY);BOOL;_("Greater than or equal to");yes;(None, "__ge_", "common_type");defined
-;EQ;1;(ANY, ANY);BOOL;_("Equal to");yes;(None, "__eq_", "common_type");defined
-;LT;1;(ANY, ANY);BOOL;_("Less than");yes;(None, "__lt_", "common_type");defined
-;LE;1;(ANY, ANY);BOOL;_("Less than or equal to");yes;(None, "__le_", "common_type");defined
-;NE;1;(ANY, ANY);BOOL;_("Not equal to");yes;(None, "__ne_", "common_type");defined
-_("Character string");LEN;1;(STRING);INT;_("Length of string");no;(None, "__len", None);defined
-;LEFT;1;(STRING, L);STRING;_("string left of");no;(None, "__left", None);defined
-;RIGHT;1;(STRING, L);STRING;_("string right of");no;(None, "__right", None);defined
-;MID;1;(STRING, L, P);STRING;_("string from the middle");no;(None, "__mid", None);defined
-;CONCAT;1;(STRING, STRING);STRING;_("Concatenation");yes;(None, "__concat", None);defined
-;CONCAT;1;(DATE, TOD);DT;_("Time concatenation");no;(None, "__time_add", None);defined
-;INSERT;1;(STRING, STRING, P);STRING;_("Insertion (into)");no;(None, "__insert", None);defined
-;DELETE;1;(STRING, L, P);STRING;_("Deletion (within)");no;(None, "__delete", None);defined
-;REPLACE;1;(STRING, STRING, L, P);STRING;_("Replacement (within)");no;(None, "__replace", None);defined
-;FIND;1;(STRING, STRING);INT;_("Find position");no;(None, "__find", None);defined
+Type conversion;*_TO_**;1;(ANY);ANY;Data type conversion;no;ANY_TO_ANY_FORMAT_GEN(ANY_TO_ANY_LIST,fdecl);defined
+;TRUNC;1;(ANY_REAL);ANY_INT;Rounding up/down;no;("int", None, None);&search_constant_type_c::integer
+;BCD_TO_**;1;(ANY_BIT);ANY_INT;Conversion from BCD;no;ANY_TO_ANY_FORMAT_GEN(BCD_TO_ANY_LIST,fdecl);defined
+;*_TO_BCD;1;(ANY_INT);ANY_BIT;Conversion to BCD;no;ANY_TO_ANY_FORMAT_GEN(ANY_TO_BCD_LIST,fdecl);&search_constant_type_c::integer
+;DATE_AND_TIME_TO_TIME_OF_DAY;1;(DT);TOD;Conversion to time-of-day;no;(None, "__date_and_time_to_time_of_day", None);defined
+;DATE_AND_TIME_TO_DATE;1;(DT);DATE;Conversion to date;no;(None, "__date_and_time_to_date", None);defined
+Numerical;ABS;1;(ANY_NUM);ANY_NUM;Absolute number;no;(None, "__abs_", "IN_type");IN_type_symbol
+;SQRT;1;(ANY_REAL);ANY_REAL;Square root (base 2);no;(None, "__sqrt_", "IN_type");IN_type_symbol
+;LN;1;(ANY_REAL);ANY_REAL;Natural logarithm;no;(None, "__ln_", "IN_type");IN_type_symbol
+;LOG;1;(ANY_REAL);ANY_REAL;Logarithm to base 10;no;(None, "__log_", "IN_type");IN_type_symbol
+;EXP;1;(ANY_REAL);ANY_REAL;Exponentiation;no;(None, "__exp_", "IN_type");IN_type_symbol
+;SIN;1;(ANY_REAL);ANY_REAL;Sine;no;(None, "__sin_", "IN_type");IN_type_symbol
+;COS;1;(ANY_REAL);ANY_REAL;Cosine;no;(None, "__cos_", "IN_type");IN_type_symbol
+;TAN;1;(ANY_REAL);ANY_REAL;Tangent;no;(None, "__tan_", "IN_type");IN_type_symbol
+;ASIN;1;(ANY_REAL);ANY_REAL;Arc sine;no;(None, "__asin_", "IN_type");IN_type_symbol
+;ACOS;1;(ANY_REAL);ANY_REAL;Arc cosine;no;(None, "__acos_", "IN_type");IN_type_symbol
+;ATAN;1;(ANY_REAL);ANY_REAL;Arc tangent;no;(None, "__atan_", "IN_type");IN_type_symbol
+Arithmetic;ADD;1;(ANY_NUM, ANY_NUM);ANY_NUM;Addition;yes;(None, "__add_", "return_type");copy_input
+;ADD;1;(TIME, TIME);TIME;Time addition;no;(None, "__time_add", None);defined
+;ADD;1;(TOD, TIME);TOD;Time-of-day addition;no;(None, "__time_add", None);defined
+;ADD;1;(DT, TIME);DT;Date addition;no;(None, "__time_add", None);defined
+;MUL;1;(ANY_NUM, ANY_NUM);ANY_NUM;Multiplication;yes;(None, "__mul_", "return_type");copy_input
+;MUL;1;(TIME, ANY_NUM);TIME;Time multiplication;no;(None, "__time_mul", None);defined
+;SUB;1;(ANY_NUM, ANY_NUM);ANY_NUM;Subtraction;no;(None, "__sub_", "return_type");copy_input
+;SUB;1;(TIME, TIME);TIME;Time subtraction;no;(None, "__time_sub", None);defined
+;SUB;1;(DATE, DATE);TIME;Date subtraction;no;(None, "__time_sub", None);defined
+;SUB;1;(TOD, TIME);TOD;Time-of-day subtraction;no;(None, "__time_sub", None);defined
+;SUB;1;(TOD, TOD);TIME;Time-of-day subtraction;no;(None, "__time_sub", None);defined
+;SUB;1;(DT, TIME);DT;Date and time subtraction;no;(None, "__time_sub", None);defined
+;SUB;1;(DT, DT);TIME;Date and time subtraction;no;(None, "__time_sub", None);defined
+;DIV;1;(ANY_NUM, ANY_NUM);ANY_NUM;Division;no;(None, "__div_", "return_type");copy_input
+;DIV;1;(TIME, ANY_NUM);TIME;Time division;no;(None, "__time_div", None);defined
+;MOD;1;(ANY_NUM, ANY_NUM);ANY_NUM;Remainder (modulo);no;(None, "__mod_", "return_type");copy_input
+;EXPT;1;(ANY_REAL, ANY_NUM);ANY_REAL;Exponent;no;(None, "__expt_", "IN1_type");copy_input
+;MOVE;1;(ANY);ANY;Assignment;no;(None, "__move_", "return_type");copy_input
+Bit-shift;SHL;1;(ANY_BIT, N);ANY_BIT;Shift left;no;(None, "__shl_", "IN_type");IN_type_symbol
+;SHR;1;(ANY_BIT, N);ANY_BIT;Shift right;no;(None, "__shr_", "IN_type");IN_type_symbol
+;ROR;1;(ANY_NBIT, N);ANY_NBIT;Rotate right;no;(None, "__ror_", "IN_type");IN_type_symbol
+;ROL;1;(ANY_NBIT, N);ANY_NBIT;Rotate left;no;(None, "__rol_", "IN_type");IN_type_symbol
+Bitwise;AND;1;(ANY_BIT, ANY_BIT);ANY_BIT;Bitwise AND;yes;(None, "__and_", "return_type");copy_input
+;OR;1;(ANY_BIT, ANY_BIT);ANY_BIT;Bitwise OR;yes;(None, "__or_", "return_type");copy_input
+;XOR;1;(ANY_BIT, ANY_BIT);ANY_BIT;Bitwise EXOR;yes;(None, "__xor_", "return_type");copy_input
+;NOT;1;(ANY_BIT);ANY_BIT;Bitwise inverting;no;(None, "__not_", "return_type");IN_type_symbol
+Selection;SEL;0;(G, ANY, ANY);ANY;Binary selection (1 of 2);no;(None, "__sel_", "IN0_type");copy_input
+;MAX;1;(ANY, ANY);ANY;Maximum;yes;(None, "__max_", "return_type");copy_input
+;MIN;1;(ANY, ANY);ANY;Minimum;yes;(None, "__min_", "return_type");copy_input
+;LIMIT;1;(MN, ANY, MX);ANY;Limitation;no;(None, "__limit_", "IN_type");IN_type_symbol
+;MUX;0;(K, ANY, ANY);ANY;Multiplexer (select 1 of N);yes;(None, "__mux_", "return_type");copy_input
+Comparison;GT;1;(ANY, ANY);BOOL;Greater than;yes;(None, "__gt_", "common_type");defined
+;GE;1;(ANY, ANY);BOOL;Greater than or equal to;yes;(None, "__ge_", "common_type");defined
+;EQ;1;(ANY, ANY);BOOL;Equal to;yes;(None, "__eq_", "common_type");defined
+;LT;1;(ANY, ANY);BOOL;Less than;yes;(None, "__lt_", "common_type");defined
+;LE;1;(ANY, ANY);BOOL;Less than or equal to;yes;(None, "__le_", "common_type");defined
+;NE;1;(ANY, ANY);BOOL;Not equal to;yes;(None, "__ne_", "common_type");defined
+Character string;LEN;1;(STRING);INT;Length of string;no;(None, "__len", None);defined
+;LEFT;1;(STRING, L);STRING;string left of;no;(None, "__left", None);defined
+;RIGHT;1;(STRING, L);STRING;string right of;no;(None, "__right", None);defined
+;MID;1;(STRING, L, P);STRING;string from the middle;no;(None, "__mid", None);defined
+;CONCAT;1;(STRING, STRING);STRING;Concatenation;yes;(None, "__concat", None);defined
+;CONCAT;1;(DATE, TOD);DT;Time concatenation;no;(None, "__time_add", None);defined
+;INSERT;1;(STRING, STRING, P);STRING;Insertion (into);no;(None, "__insert", None);defined
+;DELETE;1;(STRING, L, P);STRING;Deletion (within);no;(None, "__delete", None);defined
+;REPLACE;1;(STRING, STRING, L, P);STRING;Replacement (within);no;(None, "__replace", None);defined
+;FIND;1;(STRING, STRING);INT;Find position;no;(None, "__find", None);defined