138 complextype_suffix_vg, |
137 complextype_suffix_vg, |
139 fparam_output_vg |
138 fparam_output_vg |
140 } variablegeneration_t; |
139 } variablegeneration_t; |
141 |
140 |
142 private: |
141 private: |
143 /* The initial value that should be given to the IL default variable |
142 /* Label to which the current IL jump operation should jump to... */ |
144 * imediately after a parenthesis is opened. |
143 /* This variable is used to pass data from the |
145 * This variable is only used to pass data from the |
144 * il_jump_operation_c visitor |
146 * il_expression_c visitor to the simple_instr_list_c visitor. |
145 * to the il jump operator visitors (i.e. JMP_operator_c, |
147 * |
146 * JMPC_operator_c, JMPCN_operator_c, ...) |
148 * e.g.: |
|
149 * LD var1 |
|
150 * AND ( var2 |
|
151 * OR var3 |
|
152 * ) |
|
153 * |
|
154 * In the above code sample, the line 'AND ( var2' constitutes |
|
155 * an il_expression_c, where var2 should be loaded into the |
|
156 * il default variable before continuing with the expression |
|
157 * inside the parenthesis. |
|
158 * Unfortunately, only the simple_instr_list_c may do the |
|
159 * initial laoding of the var2 bariable following the parenthesis, |
|
160 * so the il_expression_c visitor will have to pass 'var2' as a |
|
161 * parameter to the simple_instr_list_c visitor. |
|
162 * Ergo, the existance of the following parameter...! |
|
163 */ |
147 */ |
164 symbol_c *il_default_variable_init_value; |
148 symbol_c *jump_label; |
165 |
149 |
|
150 /* the data type of the IL implicit variable... */ |
|
151 #define IL_DEFVAR_T VAR_LEADER "IL_DEFVAR_T" |
|
152 /* The name of the IL implicit variable... */ |
|
153 #define IL_DEFVAR VAR_LEADER "IL_DEFVAR" |
|
154 /* The name of the variable used to pass the result of a |
|
155 * parenthesised instruction list to the immediately preceding |
|
156 * scope ... |
|
157 */ |
|
158 #define IL_DEFVAR_BACK VAR_LEADER "IL_DEFVAR_BACK" |
|
159 |
|
160 il_default_variable_c implicit_variable_current; /* the current implicit variable, with the datatype resulting from the previous IL operation */ |
|
161 il_default_variable_c implicit_variable_result; /* the resulting implicit variable, with the datatype resulting from the current IL operation */ |
|
162 il_default_variable_c implicit_variable_result_back; |
|
163 |
166 /* Operand to the IL operation currently being processed... */ |
164 /* Operand to the IL operation currently being processed... */ |
167 /* These variables are used to pass data from the |
165 /* These variables are used to pass data from the |
168 * il_simple_operation_c and il_expression_c visitors |
166 * il_simple_operation_c and il_expression_c visitors |
169 * to the il operator visitors (i.e. LD_operator_c, |
167 * to the il operator visitors (i.e. LD_operator_c, |
170 * LDN_operator_c, ST_operator_c, STN_operator_c, ...) |
168 * LDN_operator_c, ST_operator_c, STN_operator_c, ...) |
171 */ |
169 */ |
172 symbol_c *current_operand; |
170 symbol_c *current_operand; |
173 symbol_c *current_operand_type; |
|
174 |
|
175 /* Label to which the current IL jump operation should jump to... */ |
|
176 /* This variable is used to pass data from the |
|
177 * il_jump_operation_c visitor |
|
178 * to the il jump operator visitors (i.e. JMP_operator_c, |
|
179 * JMPC_operator_c, JMPCN_operator_c, ...) |
|
180 */ |
|
181 symbol_c *jump_label; |
|
182 |
|
183 /* The result of the comparison IL operations (GT, EQ, LT, ...) |
|
184 * is a boolean variable. |
|
185 * This class keeps track of the current data type stored in the |
|
186 * il default variable. This is usually done by keeping a reference |
|
187 * to the data type of the last operand. Nevertheless, in the case of |
|
188 * the comparison IL operators, the data type of the result (a boolean) |
|
189 * is not the data type of the operand. We therefore need an object |
|
190 * of the boolean data type to keep as a reference of the current |
|
191 * data type. |
|
192 * The following object is it... |
|
193 */ |
|
194 bool_type_name_c bool_type; |
|
195 lint_type_name_c lint_type; |
|
196 lword_type_name_c lword_type; |
|
197 lreal_type_name_c lreal_type; |
|
198 |
|
199 /* the data type of the IL default variable... */ |
|
200 #define IL_DEFVAR_T VAR_LEADER "IL_DEFVAR_T" |
|
201 /* The name of the IL default variable... */ |
|
202 #define IL_DEFVAR VAR_LEADER "IL_DEFVAR" |
|
203 /* The name of the variable used to pass the result of a |
|
204 * parenthesised instruction list to the immediately preceding |
|
205 * scope ... |
|
206 */ |
|
207 #define IL_DEFVAR_BACK VAR_LEADER "IL_DEFVAR_BACK" |
|
208 il_default_variable_c default_variable_name; |
|
209 il_default_variable_c default_variable_back_name; |
|
210 |
171 |
211 /* When calling a function block, we must first find it's type, |
172 /* When calling a function block, we must first find it's type, |
212 * by searching through the declarations of the variables currently |
173 * by searching through the declarations of the variables currently |
213 * in scope. |
174 * in scope. |
214 * This class does just that... |
175 * This class does just that... |
351 il_fb_call.accept(*this); |
318 il_fb_call.accept(*this); |
352 return NULL; |
319 return NULL; |
353 } |
320 } |
354 |
321 |
355 /* A helper function... */ |
322 /* A helper function... */ |
356 void *CMP_operator(symbol_c *o, const char *operation) { |
323 void *CMP_operator(symbol_c *operand, const char *operation) { |
357 if (NULL == o) ERROR; |
324 if (NULL == operand) ERROR; |
358 if (NULL == this->default_variable_name.current_type) ERROR; |
325 if (NULL == operand->datatype) ERROR; |
359 |
326 if (NULL == this->implicit_variable_current.datatype) ERROR; |
360 symbol_c *backup = this->default_variable_name.current_type; |
327 |
361 this->default_variable_name.current_type = &(this->bool_type); |
328 this->implicit_variable_result.accept(*this); |
362 this->default_variable_name.accept(*this); |
|
363 this->default_variable_name.current_type = backup; |
|
364 |
|
365 s4o.print(" = "); |
329 s4o.print(" = "); |
366 s4o.print(operation); |
330 s4o.print(operation); |
367 this->default_variable_name.current_type->accept(*this); |
331 operand->datatype->accept(*this); |
|
332 /* NOTE: we are calling a standard Function: |
|
333 * 1st parameter: EN (enable) |
|
334 * 2nd parameter: ENO (enable output) |
|
335 * 3rd parameter: number of operands we will be passing (required because we are calling an extensible standard function!) |
|
336 * 4th parameter: the left hand side of the comparison expression (in out case, the IL implicit variable) |
|
337 * 4th parameter: the right hand side of the comparison expression (in out case, current operand) |
|
338 */ |
368 s4o.print("(__BOOL_LITERAL(TRUE), NULL, 2, "); |
339 s4o.print("(__BOOL_LITERAL(TRUE), NULL, 2, "); |
369 this->default_variable_name.accept(*this); |
340 this->implicit_variable_current.accept(*this); |
370 s4o.print(", "); |
341 s4o.print(", "); |
371 o->accept(*this); |
342 operand->accept(*this); |
372 s4o.print(")"); |
343 s4o.print(")"); |
373 |
344 |
374 /* the data type resulting from this operation... */ |
|
375 this->default_variable_name.current_type = &(this->bool_type); |
|
376 return NULL; |
345 return NULL; |
377 } |
346 } |
378 |
347 |
379 |
348 |
380 /* A helper function... */ |
349 /* A helper function... */ |
381 void C_modifier(void) { |
350 void C_modifier(void) { |
382 if (get_datatype_info_c::is_BOOL_compatible(default_variable_name.current_type)) { |
351 if (!get_datatype_info_c::is_BOOL_compatible(implicit_variable_current.datatype)) ERROR; |
383 s4o.print("if ("); |
352 s4o.print("if ("); |
384 this->default_variable_name.accept(*this); |
353 this->implicit_variable_current.accept(*this); |
385 s4o.print(") "); |
354 s4o.print(") "); |
386 } |
|
387 else {ERROR;} |
|
388 } |
355 } |
389 |
356 |
390 /* A helper function... */ |
357 /* A helper function... */ |
391 void CN_modifier(void) { |
358 void CN_modifier(void) { |
392 if (get_datatype_info_c::is_BOOL_compatible(default_variable_name.current_type)) { |
359 if (!get_datatype_info_c::is_BOOL_compatible(implicit_variable_current.datatype)) ERROR; |
393 s4o.print("if (!"); |
360 s4o.print("if (!"); |
394 this->default_variable_name.accept(*this); |
361 this->implicit_variable_current.accept(*this); |
395 s4o.print(") "); |
362 s4o.print(") "); |
396 } |
363 } |
397 else {ERROR;} |
364 |
398 } |
|
399 |
|
400 void BYTE_operator_result_type(void) { |
|
401 if (get_datatype_info_c::is_ANY_INT_literal(this->default_variable_name.current_type)) { |
|
402 if (get_datatype_info_c::is_ANY_INT_literal(this->current_operand_type)) |
|
403 this->default_variable_name.current_type = &(this->lword_type); |
|
404 else |
|
405 this->default_variable_name.current_type = this->current_operand_type; |
|
406 } |
|
407 else if (get_datatype_info_c::is_ANY_INT_literal(this->current_operand_type)) |
|
408 this->current_operand_type = this->default_variable_name.current_type; |
|
409 } |
|
410 |
|
411 void NUM_operator_result_type(void) { |
|
412 if (get_datatype_info_c::is_ANY_REAL_literal(this->default_variable_name.current_type)) { |
|
413 if (get_datatype_info_c::is_ANY_INT_literal(this->current_operand_type) || |
|
414 get_datatype_info_c::is_ANY_REAL_literal(this->current_operand_type)) |
|
415 this->default_variable_name.current_type = &(this->lreal_type); |
|
416 else |
|
417 this->default_variable_name.current_type = this->current_operand_type; |
|
418 } |
|
419 else if (get_datatype_info_c::is_ANY_INT_literal(this->default_variable_name.current_type)) { |
|
420 if (get_datatype_info_c::is_ANY_INT_literal(this->current_operand_type)) |
|
421 this->default_variable_name.current_type = &(this->lint_type); |
|
422 else if (get_datatype_info_c::is_ANY_REAL_literal(this->current_operand_type)) |
|
423 this->default_variable_name.current_type = &(this->lreal_type); |
|
424 else |
|
425 this->default_variable_name.current_type = this->current_operand_type; |
|
426 } |
|
427 else if (get_datatype_info_c::is_ANY_INT_literal(this->current_operand_type) || |
|
428 get_datatype_info_c::is_ANY_REAL_literal(this->current_operand_type)) |
|
429 this->current_operand_type = this->default_variable_name.current_type; |
|
430 } |
|
431 |
365 |
432 void *print_getter(symbol_c *symbol) { |
366 void *print_getter(symbol_c *symbol) { |
433 unsigned int vartype = search_var_instance_decl->get_vartype(symbol); |
367 unsigned int vartype = search_var_instance_decl->get_vartype(symbol); |
434 if (wanted_variablegeneration == fparam_output_vg) { |
368 if (wanted_variablegeneration == fparam_output_vg) { |
435 if (vartype == search_var_instance_decl_c::external_vt) |
369 if (vartype == search_var_instance_decl_c::external_vt) |
1042 s4o.print(",\n"+s4o.indent_spaces); |
942 s4o.print(",\n"+s4o.indent_spaces); |
1043 s4o.print(FB_FUNCTION_PARAM); |
943 s4o.print(FB_FUNCTION_PARAM); |
1044 } |
944 } |
1045 |
945 |
1046 s4o.print(")"); |
946 s4o.print(")"); |
1047 /* the data type returned by the function, and stored in the il default variable... */ |
|
1048 default_variable_name.current_type = return_data_type; |
|
1049 |
947 |
1050 CLEAR_PARAM_LIST() |
948 CLEAR_PARAM_LIST() |
1051 |
949 |
1052 return NULL; |
950 return NULL; |
1053 } |
951 } |
1054 |
952 |
1055 |
953 |
1056 /* | il_expr_operator '(' [il_operand] eol_list [simple_instr_list] ')' */ |
954 /* | il_expr_operator '(' [il_operand] eol_list [simple_instr_list] ')' */ |
1057 //SYM_REF4(il_expression_c, il_expr_operator, il_operand, simple_instr_list, unused) |
955 //SYM_REF4(il_expression_c, il_expr_operator, il_operand, simple_instr_list, unused) |
1058 void *visit(il_expression_c *symbol) { |
956 void *visit(il_expression_c *symbol) { |
1059 /* We will be recursevely interpreting an instruction list, |
957 LD_operator_c *tmp_LD_operator = NULL; |
1060 * so we store a backup of the data type of the value currently stored |
958 il_simple_operation_c *tmp_il_simple_operation = NULL; |
1061 * in the default variable, and set the current data type to NULL |
959 il_simple_instruction_c *tmp_il_simple_instruction = NULL; |
|
960 |
|
961 /* We will be recursevely interpreting an instruction list, so we store a backup of the implicit_variable_result/current. |
|
962 * Notice that they will be overwriten while processing the parenthsized instruction list. |
1062 */ |
963 */ |
1063 symbol_c *old_current_default_variable_data_type = this->default_variable_name.current_type; |
964 il_default_variable_c old_implicit_variable_current = this->implicit_variable_current; |
1064 this->default_variable_name.current_type = NULL; |
965 il_default_variable_c old_implicit_variable_result = this->implicit_variable_result; |
1065 |
966 |
1066 /* Pass the symbol->il_operand to the simple_instr_list visitor |
967 /* If the symbol->il_operand is not NULL, then we instantiate a 'LD' operation and insert it into the simple_instr_list |
1067 * using the il_default_variable_init_value parameter... |
968 * (i.e. add an equivalent LD operation to the Abstract Syntax Tree), and let it be handled like any other LD operation! |
1068 * Note that the simple_instr_list_c visitor will set this parameter |
969 */ |
1069 * to NULL as soon as it does not require it any longer, |
970 if (NULL != symbol->il_operand) { |
1070 * so we don't do it here again after the |
971 tmp_LD_operator = new LD_operator_c(); |
1071 * symbol->simple_instr_list->accept(*this); |
972 if (NULL == tmp_LD_operator) ERROR; |
1072 * returns... |
973 /* copy all the location, datatpe, etc.. data from symbol->il_operand to the new object! */ |
1073 */ |
974 *((symbol_c *)tmp_LD_operator) = *(symbol->il_operand); |
1074 this->il_default_variable_init_value = symbol->il_operand; |
975 |
|
976 tmp_il_simple_operation = new il_simple_operation_c(tmp_LD_operator, symbol->il_operand); |
|
977 if (NULL == tmp_il_simple_operation) ERROR; |
|
978 /* copy all the location, datatpe, etc.. data from symbol->il_operand to the new object! */ |
|
979 *((symbol_c *)tmp_il_simple_operation) = *(symbol->il_operand); |
|
980 |
|
981 tmp_il_simple_instruction = new il_simple_instruction_c(tmp_il_simple_operation); |
|
982 if (NULL == tmp_il_simple_instruction) ERROR; |
|
983 /* copy all the location, datatpe, etc.. data from symbol->il_operand to the new object! */ |
|
984 *((symbol_c *)tmp_il_simple_instruction) = *(symbol->il_operand); |
|
985 |
|
986 if (NULL == symbol->simple_instr_list) { |
|
987 symbol->simple_instr_list = new simple_instr_list_c(); |
|
988 if (NULL == symbol->simple_instr_list) ERROR; |
|
989 /* copy all the location, datatpe, etc.. data from symbol->il_operand to the new object! */ |
|
990 *((symbol_c *)symbol->simple_instr_list) = *(symbol->il_operand); |
|
991 } |
|
992 list_c *tmp_list = dynamic_cast <list_c *>(symbol->simple_instr_list); |
|
993 if (NULL == tmp_list) ERROR; |
|
994 tmp_list->insert_element(tmp_il_simple_instruction, 0); |
|
995 } |
1075 |
996 |
1076 /* Now do the parenthesised instructions... */ |
997 /* Now do the parenthesised instructions... */ |
1077 /* NOTE: the following code line will get the variable |
998 /* NOTE: the following code line will overwrite the variables implicit_variable_current and implicit_variable_result */ |
1078 * this->default_variable_name.current_type updated! |
|
1079 */ |
|
1080 symbol->simple_instr_list->accept(*this); |
999 symbol->simple_instr_list->accept(*this); |
1081 |
1000 |
|
1001 /* delete/undo any changes made to the AST above */ |
|
1002 if (NULL != symbol->il_operand) { |
|
1003 delete tmp_LD_operator; |
|
1004 delete tmp_il_simple_operation; |
|
1005 delete tmp_il_simple_instruction; |
|
1006 list_c *tmp_list = dynamic_cast <list_c *>(symbol->simple_instr_list); |
|
1007 if (NULL == tmp_list) ERROR; |
|
1008 delete tmp_list->elements[0]; |
|
1009 tmp_list->remove_element(0); |
|
1010 if (0 == tmp_list->n) { |
|
1011 delete symbol->simple_instr_list; |
|
1012 symbol->simple_instr_list = NULL; |
|
1013 } |
|
1014 } |
|
1015 |
1082 /* Now do the operation, using the previous result! */ |
1016 /* Now do the operation, using the previous result! */ |
1083 /* NOTE: The result of the previous instruction list will be stored |
1017 /* NOTE: The result of the previous instruction list in the parenthesis will be stored |
1084 * in a variable named IL_DEFVAR_BACK. This is done in the visitor |
1018 * in a variable named IL_DEFVAR_BACK. This is done in the visitor |
1085 * to instruction_list_c objects... |
1019 * to instruction_list_c objects... |
1086 */ |
1020 */ |
1087 this->current_operand = &(this->default_variable_back_name); |
1021 this->implicit_variable_result_back.datatype = symbol->simple_instr_list->datatype; |
1088 this->current_operand_type = this->default_variable_back_name.current_type; |
1022 this->current_operand = &(this->implicit_variable_result_back); |
1089 |
1023 |
1090 this->default_variable_name.current_type = old_current_default_variable_data_type; |
1024 this->implicit_variable_current = old_implicit_variable_current; |
1091 if (NULL == this->current_operand_type) ERROR; |
1025 this->implicit_variable_result = old_implicit_variable_result; |
1092 |
1026 |
1093 symbol->il_expr_operator->accept(*this); |
1027 symbol->il_expr_operator->accept(*this); |
1094 |
1028 |
1095 this->current_operand = NULL; |
1029 this->current_operand = NULL; |
1096 this->current_operand_type = NULL; |
1030 this->implicit_variable_result_back.datatype = NULL; |
1097 this->default_variable_back_name.current_type = NULL; |
1031 return NULL; |
1098 return NULL; |
1032 } |
1099 } |
1033 |
1100 |
1034 |
1101 /* il_jump_operator label */ |
1035 /* il_jump_operator label */ |
1102 // SYM_REF2(il_jump_operation_c, il_jump_operator, label) |
1036 // SYM_REF2(il_jump_operation_c, il_jump_operator, label) |
1103 void *visit(il_jump_operation_c *symbol) { |
1037 void *visit(il_jump_operation_c *symbol) { |
1104 /* Pass the symbol->label to the il_jump_operation visitor |
1038 /* Pass the symbol->label to the il_jump_operation visitor using the jump_label parameter... */ |
1105 * using the jump_label parameter... |
|
1106 */ |
|
1107 this->jump_label = symbol->label; |
1039 this->jump_label = symbol->label; |
1108 symbol->il_jump_operator->accept(*this); |
1040 symbol->il_jump_operator->accept(*this); |
1109 this->jump_label = NULL; |
1041 this->jump_label = NULL; |
1110 |
1042 return NULL; |
1111 return NULL; |
1043 } |
1112 } |
1044 |
1113 |
1045 |
1114 /* il_call_operator prev_declared_fb_name |
1046 /* il_call_operator prev_declared_fb_name |
1115 * | il_call_operator prev_declared_fb_name '(' ')' |
1047 * | il_call_operator prev_declared_fb_name '(' ')' |
1116 * | il_call_operator prev_declared_fb_name '(' eol_list ')' |
1048 * | il_call_operator prev_declared_fb_name '(' eol_list ')' |
1117 * | il_call_operator prev_declared_fb_name '(' il_operand_list ')' |
1049 * | il_call_operator prev_declared_fb_name '(' il_operand_list ')' |
1500 * } |
1423 * } |
1501 * __IL_DEFVAR.INTvar &= __IL_DEFVAR_BACK.INTvar; |
1424 * __IL_DEFVAR.INTvar &= __IL_DEFVAR_BACK.INTvar; |
1502 * |
1425 * |
1503 * } |
1426 * } |
1504 * |
1427 * |
1505 * The intial value of the il default variable (in the above |
1428 * NOTE 2: |
1506 * example 'var2') is passed to this simple_instr_list_c visitor |
1429 * If the intial value of the il implicit variable (in the above |
1507 * using the il_default_variable_init_value parameter. |
1430 * example 'var2') exists, then the il_expression_c will insert an equivalent |
1508 * Since it is possible to have parenthesis inside other parenthesis |
1431 * LD operation into the parenthesized instruction list- This means we do not |
1509 * recursively, we reset the il_default_variable_init_value to NULL |
1432 * need to do anything here to handle this special situation! |
1510 * as soon as we no longer require it, as it may be used once again |
|
1511 * in the line |
|
1512 * print_list(symbol, s4o.indent_spaces, ";\n" + s4o.indent_spaces, ";\n"); |
|
1513 * |
|
1514 */ |
1433 */ |
1515 |
1434 |
1516 /* Declare the default variable, that will store the result of the IL operations... */ |
1435 /* Declare the IL implicit variable, that will store the result of the IL operations... */ |
1517 s4o.print("{\n"); |
1436 s4o.print("{\n"); |
1518 s4o.indent_right(); |
1437 s4o.indent_right(); |
1519 |
1438 declare_implicit_variable(); |
1520 s4o.print(s4o.indent_spaces); |
1439 |
1521 s4o.print(IL_DEFVAR_T); |
|
1522 s4o.print(" "); |
|
1523 this->default_variable_name.accept(*this); |
|
1524 s4o.print(";\n\n"); |
|
1525 |
|
1526 /* Check whether we should initiliase the il default variable... */ |
|
1527 if (NULL != this->il_default_variable_init_value) { |
|
1528 /* Yes, we must... */ |
|
1529 /* We will do it by instatiating a LD operator, and having this |
|
1530 * same generate_c_il_c class visiting it! |
|
1531 */ |
|
1532 LD_operator_c ld_oper; |
|
1533 il_simple_operation_c il_simple_oper(&ld_oper, this->il_default_variable_init_value); |
|
1534 |
|
1535 s4o.print(s4o.indent_spaces); |
|
1536 il_simple_oper.accept(*this); |
|
1537 s4o.print(";\n"); |
|
1538 } |
|
1539 |
|
1540 /* this parameter no longer required... */ |
|
1541 this->il_default_variable_init_value = NULL; |
|
1542 |
|
1543 print_list(symbol, s4o.indent_spaces, ";\n" + s4o.indent_spaces, ";\n"); |
1440 print_list(symbol, s4o.indent_spaces, ";\n" + s4o.indent_spaces, ";\n"); |
1544 |
1441 |
1545 /* copy the result in the default variable to the variable |
1442 /* copy the result in the IL implicit variable to the variable |
1546 * used to pass the data out to the scope enclosing |
1443 * used to pass the data out to the scope enclosing the current scope! |
1547 * the current scope! |
|
1548 * |
|
1549 * We also need to update the data type currently stored within |
|
1550 * the variable used to pass the data to the outside scope... |
|
1551 */ |
1444 */ |
1552 this->default_variable_back_name.current_type = this->default_variable_name.current_type; |
1445 this->implicit_variable_result_back.datatype = symbol->datatype; |
|
1446 this->implicit_variable_result .datatype = symbol->datatype; |
|
1447 |
1553 s4o.print("\n"); |
1448 s4o.print("\n"); |
1554 s4o.print(s4o.indent_spaces); |
1449 s4o.print(s4o.indent_spaces); |
1555 this->default_variable_back_name.accept(*this); |
1450 this->implicit_variable_result_back.accept(*this); |
1556 s4o.print(" = "); |
1451 s4o.print(" = "); |
1557 this->default_variable_name.accept(*this); |
1452 this->implicit_variable_result.accept(*this); |
1558 s4o.print(";\n"); |
1453 s4o.print(";\n"); |
1559 |
1454 |
1560 s4o.indent_left(); |
1455 s4o.indent_left(); |
1561 s4o.print(s4o.indent_spaces); |
1456 s4o.print(s4o.indent_spaces); |
1562 s4o.print("}\n"); |
1457 s4o.print("}\n"); |
1563 s4o.print(s4o.indent_spaces); |
1458 s4o.print(s4o.indent_spaces); |
1564 return NULL; |
1459 return NULL; |
1565 } |
1460 } |
1566 |
1461 |
|
1462 |
1567 // SYM_REF1(il_simple_instruction_c, il_simple_instruction, symbol_c *prev_il_instruction;) |
1463 // SYM_REF1(il_simple_instruction_c, il_simple_instruction, symbol_c *prev_il_instruction;) |
1568 void *visit(il_simple_instruction_c *symbol) { |
1464 void *visit(il_simple_instruction_c *symbol) {return symbol->il_simple_instruction->accept(*this);} |
1569 return symbol->il_simple_instruction->accept(*this); |
|
1570 } |
|
1571 |
|
1572 |
1465 |
1573 /* | il_initial_param_list il_param_instruction */ |
1466 /* | il_initial_param_list il_param_instruction */ |
1574 // SYM_LIST(il_param_list_c) |
1467 // SYM_LIST(il_param_list_c) |
1575 void *visit(il_param_list_c *symbol) {ERROR; return NULL;} // should never get called! |
1468 void *visit(il_param_list_c *symbol) {ERROR; return NULL;} // should never get called! |
1576 |
1469 |
1577 /* il_assign_operator il_operand |
1470 /* il_assign_operator il_operand |
1578 * | il_assign_operator '(' eol_list simple_instr_list ')' |
1471 * | il_assign_operator '(' eol_list simple_instr_list ')' |
1579 */ |
1472 */ |
1580 // SYM_REF4(il_param_assignment_c, il_assign_operator, il_operand, simple_instr_list, unused) |
1473 // SYM_REF4(il_param_assignment_c, il_assign_operator, il_operand, simple_instr_list, unused) |
1581 void *visit(il_param_assignment_c *symbol) {ERROR; return NULL;} // should never get called! |
1474 void *visit(il_param_assignment_c *symbol) {ERROR; return NULL;} // should never get called! |
1582 |
1475 |
1583 /* il_assign_out_operator variable */ |
1476 /* il_assign_out_operator variable */ |
1584 // SYM_REF2(il_param_out_assignment_c, il_assign_out_operator, variable); |
1477 // SYM_REF2(il_param_out_assignment_c, il_assign_out_operator, variable); |
1585 void *visit(il_param_out_assignment_c *symbol) {ERROR; return NULL;} // should never get called! |
1478 void *visit(il_param_out_assignment_c *symbol) {ERROR; return NULL;} // should never get called! |
|
1479 |
1586 |
1480 |
1587 /*******************/ |
1481 /*******************/ |
1588 /* B 2.2 Operators */ |
1482 /* B 2.2 Operators */ |
1589 /*******************/ |
1483 /*******************/ |
1590 |
1484 |
1591 void *visit(LD_operator_c *symbol) { |
1485 void *visit(LD_operator_c *symbol) { |
1592 if (wanted_variablegeneration != expression_vg) { |
1486 if (wanted_variablegeneration != expression_vg) { |
1593 s4o.print("LD"); |
1487 s4o.print("LD"); |
1594 return NULL; |
1488 return NULL; |
1595 } |
1489 } |
1596 |
1490 XXX_operator(&(this->implicit_variable_result), " = ", this->current_operand); |
1597 /* the data type resulting from this operation... */ |
1491 return NULL; |
1598 this->default_variable_name.current_type = this->current_operand_type; |
1492 } |
1599 XXX_operator(&(this->default_variable_name), " = ", this->current_operand); |
1493 |
1600 return NULL; |
1494 |
1601 } |
1495 void *visit(LDN_operator_c *symbol) { |
1602 |
1496 XXX_operator(&(this->implicit_variable_result), get_datatype_info_c::is_BOOL_compatible(this->current_operand->datatype)?" = !":" = ~", this->current_operand); |
1603 void *visit(LDN_operator_c *symbol) { |
1497 return NULL; |
1604 /* the data type resulting from this operation... */ |
1498 } |
1605 this->default_variable_name.current_type = this->current_operand_type; |
1499 |
1606 XXX_operator(&(this->default_variable_name), |
1500 |
1607 get_datatype_info_c::is_BOOL_compatible(this->current_operand_type)?" = !":" = ~", |
1501 void *visit(ST_operator_c *symbol) { |
1608 this->current_operand); |
|
1609 return NULL; |
|
1610 } |
|
1611 |
|
1612 void *visit(ST_operator_c *symbol) { |
|
1613 symbol_c *operand_type = search_varfb_instance_type->get_type_id(this->current_operand); |
|
1614 if (get_datatype_info_c::is_ANY_INT_literal(this->default_variable_name.current_type) || |
|
1615 get_datatype_info_c::is_ANY_REAL_literal(this->default_variable_name.current_type)) |
|
1616 this->default_variable_name.current_type = this->current_operand_type; |
|
1617 if (this->is_variable_prefix_null()) { |
1502 if (this->is_variable_prefix_null()) { |
1618 this->current_operand->accept(*this); |
1503 this->current_operand->accept(*this); |
1619 s4o.print(" = "); |
1504 s4o.print(" = "); |
1620 print_check_function(operand_type, (symbol_c*)&(this->default_variable_name)); |
1505 print_check_function(this->current_operand->datatype, (symbol_c*)&(this->implicit_variable_current)); |
1621 } |
1506 } |
1622 else { |
1507 else { |
1623 print_setter(this->current_operand, operand_type, (symbol_c*)&(this->default_variable_name)); |
1508 print_setter(this->current_operand, this->current_operand->datatype, (symbol_c*)&(this->implicit_variable_current)); |
1624 } |
1509 } |
1625 /* the data type resulting from this operation is unchanged. */ |
1510 return NULL; |
1626 return NULL; |
1511 } |
1627 } |
1512 |
1628 |
1513 |
1629 void *visit(STN_operator_c *symbol) { |
1514 void *visit(STN_operator_c *symbol) { |
1630 symbol_c *operand_type = search_varfb_instance_type->get_type_id(this->current_operand); |
|
1631 if (get_datatype_info_c::is_ANY_INT_literal(this->default_variable_name.current_type)) |
|
1632 this->default_variable_name.current_type = this->current_operand_type; |
|
1633 |
|
1634 if (this->is_variable_prefix_null()) { |
1515 if (this->is_variable_prefix_null()) { |
1635 this->current_operand->accept(*this); |
1516 this->current_operand->accept(*this); |
1636 s4o.print(" = "); |
1517 s4o.print(" = "); |
1637 if (get_datatype_info_c::is_BOOL_compatible(this->current_operand_type)) |
1518 if (get_datatype_info_c::is_BOOL_compatible(this->current_operand->datatype)) |
1638 s4o.print("!"); |
1519 s4o.print("!"); |
1639 else |
1520 else |
1640 s4o.print("~"); |
1521 s4o.print("~"); |
1641 this->default_variable_name.accept(*this); |
1522 this->implicit_variable_current.accept(*this); |
1642 } |
1523 } |
1643 else { |
1524 else { |
1644 print_setter(this->current_operand, operand_type, (symbol_c*)&(this->default_variable_name), NULL, NULL, true); |
1525 print_setter(this->current_operand, this->current_operand->datatype, (symbol_c*)&(this->implicit_variable_current), NULL, NULL, true); |
1645 } |
1526 } |
1646 /* the data type resulting from this operation is unchanged. */ |
1527 return NULL; |
1647 return NULL; |
1528 } |
1648 } |
1529 |
1649 |
1530 |
1650 void *visit(NOT_operator_c *symbol) { |
1531 void *visit(NOT_operator_c *symbol) { |
1651 /* NOTE: the standard allows syntax in which the NOT operator is followed by an optional <il_operand> |
1532 /* NOTE: the standard allows syntax in which the NOT operator is followed by an optional <il_operand> |
1652 * NOT [<il_operand>] |
1533 * NOT [<il_operand>] |
1653 * However, it does not define the semantic of the NOT operation when the <il_operand> is specified. |
1534 * However, it does not define the semantic of the NOT operation when the <il_operand> is specified. |
1654 * We therefore consider it an error if an il_operand is specified! |
1535 * We therefore consider it an error if an il_operand is specified! |
1655 * The error is caught in stage 3! |
1536 * The error is caught in stage 3! |
1656 */ |
1537 */ |
1657 if ((NULL != this->current_operand) || (NULL != this->current_operand_type)) ERROR; |
1538 if (NULL != this->current_operand) ERROR; |
1658 XXX_operator(&(this->default_variable_name), |
1539 XXX_operator(&(this->implicit_variable_result), get_datatype_info_c::is_BOOL_compatible(symbol->datatype)?" = !":" = ~", &(this->implicit_variable_current)); |
1659 get_datatype_info_c::is_BOOL_compatible(this->default_variable_name.current_type)?" = !":" = ~", |
1540 return NULL; |
1660 &(this->default_variable_name)); |
1541 } |
1661 /* the data type resulting from this operation is unchanged. */ |
1542 |
1662 return NULL; |
|
1663 } |
|
1664 |
1543 |
1665 void *visit(S_operator_c *symbol) { |
1544 void *visit(S_operator_c *symbol) { |
1666 if (wanted_variablegeneration != expression_vg) { |
1545 if (wanted_variablegeneration != expression_vg) { |
1667 s4o.print("LD"); |
1546 s4o.print("LD"); |
1668 return NULL; |
1547 return NULL; |
1669 } |
1548 } |
1670 |
1549 |
1671 if ((NULL == this->current_operand) || (NULL == this->current_operand_type)) ERROR; |
1550 if ((NULL == this->current_operand) || (NULL == this->current_operand->datatype)) ERROR; |
1672 |
1551 |
1673 C_modifier(); |
1552 C_modifier(); |
1674 this->current_operand->accept(*this); |
1553 this->current_operand->accept(*this); |
1675 s4o.print(" = __"); |
1554 s4o.print(" = __"); |
1676 if (get_datatype_info_c::is_BOOL_compatible(this->current_operand_type)) |
1555 if (get_datatype_info_c::is_BOOL_compatible(this->current_operand->datatype)) { |
1677 s4o.print("BOOL_LITERAL(TRUE)"); |
1556 s4o.print("BOOL_LITERAL(TRUE)"); |
1678 else if (get_datatype_info_c::is_ANY_INT_compatible(this->current_operand_type)) { |
1557 } else if (get_datatype_info_c::is_ANY_INT_compatible(this->current_operand->datatype)) { |
1679 this->current_operand_type->accept(*this); |
1558 this->current_operand->datatype->accept(*this); |
1680 s4o.print("_LITERAL(1)"); |
1559 s4o.print("_LITERAL(1)"); |
1681 } |
1560 } else |
1682 else |
|
1683 ERROR; |
1561 ERROR; |
1684 /* the data type resulting from this operation is unchanged! */ |
1562 return NULL; |
1685 return NULL; |
1563 } |
1686 } |
1564 |
1687 |
1565 |
1688 void *visit(R_operator_c *symbol) { |
1566 void *visit(R_operator_c *symbol) { |
1689 if (wanted_variablegeneration != expression_vg) { |
1567 if (wanted_variablegeneration != expression_vg) { |
1690 s4o.print("LD"); |
1568 s4o.print("LD"); |
1691 return NULL; |
1569 return NULL; |
1692 } |
1570 } |
1693 |
1571 |
1694 if ((NULL == this->current_operand) || (NULL == this->current_operand_type)) ERROR; |
1572 if ((NULL == this->current_operand) || (NULL == this->current_operand->datatype)) ERROR; |
1695 |
1573 |
1696 C_modifier(); |
1574 C_modifier(); |
1697 this->current_operand->accept(*this); |
1575 this->current_operand->accept(*this); |
1698 s4o.print(" = __"); |
1576 s4o.print(" = __"); |
1699 if (get_datatype_info_c::is_BOOL_compatible(this->current_operand_type)) |
1577 if (get_datatype_info_c::is_BOOL_compatible(this->current_operand->datatype)) { |
1700 s4o.print("BOOL_LITERAL(FALSE)"); |
1578 s4o.print("BOOL_LITERAL(FALSE)"); |
1701 else if (get_datatype_info_c::is_ANY_INT_compatible(this->current_operand_type)) { |
1579 } else if (get_datatype_info_c::is_ANY_INT_compatible(this->current_operand->datatype)) { |
1702 this->current_operand_type->accept(*this); |
1580 this->current_operand->datatype->accept(*this); |
1703 s4o.print("_LITERAL(0)"); |
1581 s4o.print("_LITERAL(0)"); |
1704 } |
1582 } else |
1705 else |
|
1706 ERROR; |
1583 ERROR; |
1707 /* the data type resulting from this operation is unchanged! */ |
1584 /* the data type resulting from this operation is unchanged! */ |
1708 return NULL; |
1585 return NULL; |
1709 } |
1586 } |
1710 |
1587 |
1711 void *visit(S1_operator_c *symbol) {return XXX_CAL_operator("S1", this->current_operand);} |
1588 |
1712 void *visit(R1_operator_c *symbol) {return XXX_CAL_operator("R1", this->current_operand);} |
1589 void *visit( S1_operator_c *symbol) {return XXX_CAL_operator( "S1", this->current_operand);} |
|
1590 void *visit( R1_operator_c *symbol) {return XXX_CAL_operator( "R1", this->current_operand);} |
1713 void *visit(CLK_operator_c *symbol) {return XXX_CAL_operator("CLK", this->current_operand);} |
1591 void *visit(CLK_operator_c *symbol) {return XXX_CAL_operator("CLK", this->current_operand);} |
1714 void *visit(CU_operator_c *symbol) {return XXX_CAL_operator("CU", this->current_operand);} |
1592 void *visit( CU_operator_c *symbol) {return XXX_CAL_operator( "CU", this->current_operand);} |
1715 void *visit(CD_operator_c *symbol) {return XXX_CAL_operator("CD", this->current_operand);} |
1593 void *visit( CD_operator_c *symbol) {return XXX_CAL_operator( "CD", this->current_operand);} |
1716 void *visit(PV_operator_c *symbol) {return XXX_CAL_operator("PV", this->current_operand);} |
1594 void *visit( PV_operator_c *symbol) {return XXX_CAL_operator( "PV", this->current_operand);} |
1717 void *visit(IN_operator_c *symbol) {return XXX_CAL_operator("IN", this->current_operand);} |
1595 void *visit( IN_operator_c *symbol) {return XXX_CAL_operator( "IN", this->current_operand);} |
1718 void *visit(PT_operator_c *symbol) {return XXX_CAL_operator("PT", this->current_operand);} |
1596 void *visit( PT_operator_c *symbol) {return XXX_CAL_operator( "PT", this->current_operand);} |
1719 |
1597 |
1720 void *visit(AND_operator_c *symbol) { |
1598 void *visit(AND_operator_c *symbol) { |
1721 if (get_datatype_info_c::is_ANY_BIT_compatible(this->default_variable_name.current_type)) { |
1599 if (!get_datatype_info_c::is_ANY_BIT_compatible(symbol->datatype)) ERROR; |
1722 BYTE_operator_result_type(); |
1600 XXX_operator(&(this->implicit_variable_result), " &= ", this->current_operand); |
1723 XXX_operator(&(this->default_variable_name), " &= ", this->current_operand); |
|
1724 /* the data type resulting from this operation... */ |
|
1725 this->default_variable_name.current_type = this->current_operand_type; |
|
1726 } |
|
1727 else {ERROR;} |
|
1728 return NULL; |
1601 return NULL; |
1729 } |
1602 } |
1730 |
1603 |
1731 void *visit(OR_operator_c *symbol) { |
1604 void *visit(OR_operator_c *symbol) { |
1732 if (get_datatype_info_c::is_ANY_BIT_compatible(this->default_variable_name.current_type)) { |
1605 if (!get_datatype_info_c::is_ANY_BIT_compatible(symbol->datatype)) ERROR; |
1733 BYTE_operator_result_type(); |
1606 XXX_operator(&(this->implicit_variable_result), " |= ", this->current_operand); |
1734 XXX_operator(&(this->default_variable_name), " |= ", this->current_operand); |
|
1735 /* the data type resulting from this operation... */ |
|
1736 this->default_variable_name.current_type = this->current_operand_type; |
|
1737 } |
|
1738 else {ERROR;} |
|
1739 return NULL; |
1607 return NULL; |
1740 } |
1608 } |
1741 |
1609 |
1742 void *visit(XOR_operator_c *symbol) { |
1610 void *visit(XOR_operator_c *symbol) { |
1743 if (get_datatype_info_c::is_ANY_BIT_compatible(this->default_variable_name.current_type)) { |
1611 if (!get_datatype_info_c::is_ANY_BIT_compatible(symbol->datatype)) ERROR; |
1744 BYTE_operator_result_type(); |
1612 // '^' is a bit by bit exclusive OR !! Also seems to work with boolean types! |
1745 // '^' is a bit by bit exclusive OR !! Also seems to work with boolean types! |
1613 XXX_operator(&(this->implicit_variable_result), " ^= ", this->current_operand); |
1746 XXX_operator(&(this->default_variable_name), " ^= ", this->current_operand); |
|
1747 /* the data type resulting from this operation... */ |
|
1748 this->default_variable_name.current_type = this->current_operand_type; |
|
1749 } |
|
1750 else {ERROR;} |
|
1751 return NULL; |
1614 return NULL; |
1752 } |
1615 } |
1753 |
1616 |
1754 void *visit(ANDN_operator_c *symbol) { |
1617 void *visit(ANDN_operator_c *symbol) { |
1755 if (get_datatype_info_c::is_ANY_BIT_compatible(this->default_variable_name.current_type)) { |
1618 if (!get_datatype_info_c::is_ANY_BIT_compatible(symbol->datatype)) ERROR; |
1756 BYTE_operator_result_type(); |
1619 XXX_operator(&(this->implicit_variable_result), get_datatype_info_c::is_BOOL_compatible(this->current_operand->datatype)?" &= !":" &= ~", this->current_operand); |
1757 XXX_operator(&(this->default_variable_name), |
|
1758 get_datatype_info_c::is_BOOL_compatible(this->current_operand_type)?" &= !":" &= ~", |
|
1759 this->current_operand); |
|
1760 /* the data type resulting from this operation... */ |
|
1761 this->default_variable_name.current_type = this->current_operand_type; |
|
1762 } |
|
1763 else {ERROR;} |
|
1764 return NULL; |
1620 return NULL; |
1765 } |
1621 } |
1766 |
1622 |
1767 void *visit(ORN_operator_c *symbol) { |
1623 void *visit(ORN_operator_c *symbol) { |
1768 if (get_datatype_info_c::is_ANY_BIT_compatible(this->default_variable_name.current_type)) { |
1624 if (!get_datatype_info_c::is_ANY_BIT_compatible(symbol->datatype)) ERROR; |
1769 BYTE_operator_result_type(); |
1625 XXX_operator(&(this->implicit_variable_result), get_datatype_info_c::is_BOOL_compatible(this->current_operand->datatype)?" |= !":" |= ~", this->current_operand); |
1770 XXX_operator(&(this->default_variable_name), |
|
1771 get_datatype_info_c::is_BOOL_compatible(this->current_operand_type)?" |= !":" |= ~", |
|
1772 this->current_operand); |
|
1773 /* the data type resulting from this operation... */ |
|
1774 this->default_variable_name.current_type = this->current_operand_type; |
|
1775 } |
|
1776 else {ERROR;} |
|
1777 return NULL; |
1626 return NULL; |
1778 } |
1627 } |
1779 |
1628 |
1780 void *visit(XORN_operator_c *symbol) { |
1629 void *visit(XORN_operator_c *symbol) { |
1781 if (get_datatype_info_c::is_ANY_BIT_compatible(this->default_variable_name.current_type)) { |
1630 if (!get_datatype_info_c::is_ANY_BIT_compatible(symbol->datatype)) ERROR; |
1782 BYTE_operator_result_type(); |
1631 // bit by bit exclusive OR !! Also seems to work with boolean types! |
1783 XXX_operator(&(this->default_variable_name), |
1632 XXX_operator(&(this->implicit_variable_result), get_datatype_info_c::is_BOOL_compatible(this->current_operand->datatype)?" ^= !":" ^= ~", this->current_operand); |
1784 // bit by bit exclusive OR !! Also seems to work with boolean types! |
1633 return NULL; |
1785 get_datatype_info_c::is_BOOL_compatible(this->current_operand_type)?" ^= !":" ^= ~", |
1634 } |
1786 this->current_operand); |
|
1787 /* the data type resulting from this operation... */ |
|
1788 this->default_variable_name.current_type = this->current_operand_type; |
|
1789 } |
|
1790 else {ERROR;} |
|
1791 return NULL; |
|
1792 } |
|
1793 |
|
1794 |
1635 |
1795 void *visit(ADD_operator_c *symbol) { |
1636 void *visit(ADD_operator_c *symbol) { |
1796 if (get_datatype_info_c::is_TIME_compatible (symbol->datatype) || |
1637 if (get_datatype_info_c::is_TIME_compatible(symbol->datatype) || get_datatype_info_c::is_ANY_DATE_compatible (symbol->datatype)) |
1797 get_datatype_info_c::is_ANY_DATE_compatible (symbol->datatype)) { |
1638 XXX_function(&(this->implicit_variable_result), "__time_add", &(this->implicit_variable_current), this->current_operand); |
1798 XXX_function("__time_add", &(this->default_variable_name), this->current_operand); |
1639 else XXX_operator(&(this->implicit_variable_result), " += ", this->current_operand); |
1799 /* the data type resulting from this operation... */ |
|
1800 this->default_variable_name.current_type = this->current_operand_type; |
|
1801 } else { |
|
1802 NUM_operator_result_type(); |
|
1803 XXX_operator(&(this->default_variable_name), " += ", this->current_operand); |
|
1804 /* the data type resulting from this operation... */ |
|
1805 this->default_variable_name.current_type = this->current_operand_type; |
|
1806 } |
|
1807 return NULL; |
1640 return NULL; |
1808 } |
1641 } |
1809 |
1642 |
1810 void *visit(SUB_operator_c *symbol) { |
1643 void *visit(SUB_operator_c *symbol) { |
1811 if (get_datatype_info_c::is_TIME_compatible (symbol->datatype) || |
1644 if (get_datatype_info_c::is_TIME_compatible(symbol->datatype) || get_datatype_info_c::is_ANY_DATE_compatible (symbol->datatype)) |
1812 get_datatype_info_c::is_ANY_DATE_compatible (symbol->datatype)) { |
1645 XXX_function(&(this->implicit_variable_result), "__time_sub", &(this->implicit_variable_current), this->current_operand); |
1813 XXX_function("__time_sub", &(this->default_variable_name), this->current_operand); |
1646 else XXX_operator(&(this->implicit_variable_result), " -= ", this->current_operand); |
1814 /* the data type resulting from this operation... */ |
|
1815 this->default_variable_name.current_type = this->current_operand_type; |
|
1816 } else { |
|
1817 NUM_operator_result_type(); |
|
1818 XXX_operator(&(this->default_variable_name), " -= ", this->current_operand); |
|
1819 /* the data type resulting from this operation... */ |
|
1820 this->default_variable_name.current_type = this->current_operand_type; |
|
1821 } |
|
1822 return NULL; |
1647 return NULL; |
1823 } |
1648 } |
1824 |
1649 |
1825 void *visit(MUL_operator_c *symbol) { |
1650 void *visit(MUL_operator_c *symbol) { |
1826 if (get_datatype_info_c::is_TIME_compatible (symbol->datatype)) { |
1651 if (get_datatype_info_c::is_TIME_compatible(symbol->datatype)) |
1827 XXX_function("__time_mul", &(this->default_variable_name), this->current_operand); |
1652 XXX_function(&(this->implicit_variable_result), "__time_mul", &(this->implicit_variable_current), this->current_operand); |
1828 /* the data type resulting from this operation is unchanged! */ |
1653 else XXX_operator(&(this->implicit_variable_result), " *= ", this->current_operand); |
1829 } else { |
|
1830 NUM_operator_result_type(); |
|
1831 XXX_operator(&(this->default_variable_name), " *= ", this->current_operand); |
|
1832 /* the data type resulting from this operation... */ |
|
1833 this->default_variable_name.current_type = this->current_operand_type; |
|
1834 } |
|
1835 return NULL; |
1654 return NULL; |
1836 } |
1655 } |
1837 |
1656 |
1838 void *visit(DIV_operator_c *symbol) { |
1657 void *visit(DIV_operator_c *symbol) { |
1839 if (get_datatype_info_c::is_TIME_compatible (symbol->datatype)) { |
1658 if (get_datatype_info_c::is_TIME_compatible(symbol->datatype)) |
1840 XXX_function("__time_div", &(this->default_variable_name), this->current_operand); |
1659 XXX_function(&(this->implicit_variable_result), "__time_div", &(this->implicit_variable_current), this->current_operand); |
1841 /* the data type resulting from this operation is unchanged! */ |
1660 else XXX_operator(&(this->implicit_variable_result), " /= ", this->current_operand); |
1842 } else { |
1661 return NULL; |
1843 NUM_operator_result_type(); |
1662 } |
1844 XXX_operator(&(this->default_variable_name), " /= ", this->current_operand); |
1663 |
1845 /* the data type resulting from this operation... */ |
1664 void *visit(MOD_operator_c *symbol) {XXX_operator(&(this->implicit_variable_result), " %= ", this->current_operand); return NULL;} |
1846 this->default_variable_name.current_type = this->current_operand_type; |
|
1847 return NULL; |
|
1848 } |
|
1849 return NULL; |
|
1850 } |
|
1851 |
|
1852 void *visit(MOD_operator_c *symbol) { |
|
1853 NUM_operator_result_type(); |
|
1854 XXX_operator(&(this->default_variable_name), " %= ", this->current_operand); |
|
1855 /* the data type resulting from this operation... */ |
|
1856 this->default_variable_name.current_type = this->current_operand_type; |
|
1857 return NULL; |
|
1858 } |
|
1859 |
1665 |
1860 void *visit(GT_operator_c *symbol) {CMP_operator(this->current_operand, "GT_"); return NULL;} |
1666 void *visit(GT_operator_c *symbol) {CMP_operator(this->current_operand, "GT_"); return NULL;} |
1861 void *visit(GE_operator_c *symbol) {CMP_operator(this->current_operand, "GE_"); return NULL;} |
1667 void *visit(GE_operator_c *symbol) {CMP_operator(this->current_operand, "GE_"); return NULL;} |
1862 void *visit(EQ_operator_c *symbol) {CMP_operator(this->current_operand, "EQ_"); return NULL;} |
1668 void *visit(EQ_operator_c *symbol) {CMP_operator(this->current_operand, "EQ_"); return NULL;} |
1863 void *visit(LT_operator_c *symbol) {CMP_operator(this->current_operand, "LT_"); return NULL;} |
1669 void *visit(LT_operator_c *symbol) {CMP_operator(this->current_operand, "LT_"); return NULL;} |