200 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
200 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
201 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
201 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
202 if (!search_expression_type->is_same_type(left_type, right_type)) |
202 if (!search_expression_type->is_same_type(left_type, right_type)) |
203 ERROR; |
203 ERROR; |
204 if (search_expression_type->is_time_type(left_type)) |
204 if (search_expression_type->is_time_type(left_type)) |
205 return print_compare_function("__compare_timespec", "==", symbol->l_exp, symbol->r_exp); |
205 return print_compare_function("__eq_", left_type, symbol->l_exp, symbol->r_exp); |
206 return print_binary_expression(symbol->l_exp, symbol->r_exp, " == "); |
206 return print_binary_expression(symbol->l_exp, symbol->r_exp, " == "); |
207 } |
207 } |
208 |
208 |
209 void *visit(notequ_expression_c *symbol) { |
209 void *visit(notequ_expression_c *symbol) { |
210 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
210 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
211 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
211 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
212 if (!search_expression_type->is_same_type(left_type, right_type)) |
212 if (!search_expression_type->is_same_type(left_type, right_type)) |
213 ERROR; |
213 ERROR; |
214 if (search_expression_type->is_time_type(left_type)) |
214 if (search_expression_type->is_time_type(left_type)) |
215 return print_compare_function("__compare_timespec", "!=", symbol->l_exp, symbol->r_exp); |
215 return print_compare_function("__ne_", left_type, symbol->l_exp, symbol->r_exp); |
216 return print_binary_expression(symbol->l_exp, symbol->r_exp, " != "); |
216 return print_binary_expression(symbol->l_exp, symbol->r_exp, " != "); |
217 } |
217 } |
218 |
218 |
219 void *visit(lt_expression_c *symbol) { |
219 void *visit(lt_expression_c *symbol) { |
220 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
220 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
221 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
221 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
222 if (!search_expression_type->is_same_type(left_type, right_type)) |
222 if (!search_expression_type->is_same_type(left_type, right_type)) |
223 ERROR; |
223 ERROR; |
224 if (search_expression_type->is_time_type(left_type)) |
224 if (search_expression_type->is_time_type(left_type)) |
225 return print_compare_function("__compare_timespec", "<", symbol->l_exp, symbol->r_exp); |
225 return print_compare_function("__lt_", left_type, symbol->l_exp, symbol->r_exp); |
226 return print_binary_expression(symbol->l_exp, symbol->r_exp, " < "); |
226 return print_binary_expression(symbol->l_exp, symbol->r_exp, " < "); |
227 } |
227 } |
228 |
228 |
229 void *visit(gt_expression_c *symbol) { |
229 void *visit(gt_expression_c *symbol) { |
230 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
230 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
231 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
231 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
232 if (!search_expression_type->is_same_type(left_type, right_type)) |
232 if (!search_expression_type->is_same_type(left_type, right_type)) |
233 ERROR; |
233 ERROR; |
234 if (search_expression_type->is_time_type(left_type)) |
234 if (search_expression_type->is_time_type(left_type)) |
235 return print_compare_function("__compare_timespec", ">", symbol->l_exp, symbol->r_exp); |
235 return print_compare_function("__gt_", left_type, symbol->l_exp, symbol->r_exp); |
236 return print_binary_expression(symbol->l_exp, symbol->r_exp, " > "); |
236 return print_binary_expression(symbol->l_exp, symbol->r_exp, " > "); |
237 } |
237 } |
238 |
238 |
239 void *visit(le_expression_c *symbol) { |
239 void *visit(le_expression_c *symbol) { |
240 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
240 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
241 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
241 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
242 if (!search_expression_type->is_same_type(left_type, right_type)) |
242 if (!search_expression_type->is_same_type(left_type, right_type)) |
243 ERROR; |
243 ERROR; |
244 if (search_expression_type->is_time_type(left_type)) |
244 if (search_expression_type->is_time_type(left_type)) |
245 return print_compare_function("__compare_timespec", "<=", symbol->l_exp, symbol->r_exp); |
245 return print_compare_function("__le_", left_type, symbol->l_exp, symbol->r_exp); |
246 return print_binary_expression(symbol->l_exp, symbol->r_exp, " <= "); |
246 return print_binary_expression(symbol->l_exp, symbol->r_exp, " <= "); |
247 } |
247 } |
248 |
248 |
249 void *visit(ge_expression_c *symbol) { |
249 void *visit(ge_expression_c *symbol) { |
250 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
250 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
251 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
251 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
252 if (!search_expression_type->is_same_type(left_type, right_type)) |
252 if (!search_expression_type->is_same_type(left_type, right_type)) |
253 ERROR; |
253 ERROR; |
254 if (search_expression_type->is_time_type(left_type)) |
254 if (search_expression_type->is_time_type(left_type)) |
255 return print_compare_function("__compare_timespec", ">=", symbol->l_exp, symbol->r_exp); |
255 return print_compare_function("__ge_", left_type, symbol->l_exp, symbol->r_exp); |
256 return print_binary_expression(symbol->l_exp, symbol->r_exp, " >= "); |
256 return print_binary_expression(symbol->l_exp, symbol->r_exp, " >= "); |
257 } |
257 } |
258 |
258 |
259 void *visit(add_expression_c *symbol) { |
259 void *visit(add_expression_c *symbol) { |
260 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
260 symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); |
261 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
261 symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); |
262 if ((typeid(*left_type) == typeid(time_type_name_c) && typeid(*right_type) == typeid(time_type_name_c)) || |
262 if ((typeid(*left_type) == typeid(time_type_name_c) && typeid(*right_type) == typeid(time_type_name_c)) || |
263 (typeid(*left_type) == typeid(tod_type_name_c) && typeid(*right_type) == typeid(time_type_name_c)) || |
263 (typeid(*left_type) == typeid(tod_type_name_c) && typeid(*right_type) == typeid(time_type_name_c)) || |
264 (typeid(*left_type) == typeid(dt_type_name_c) && typeid(*right_type) == typeid(time_type_name_c))) |
264 (typeid(*left_type) == typeid(dt_type_name_c) && typeid(*right_type) == typeid(time_type_name_c))) |
265 return print_binary_function("__add_timespec", symbol->l_exp, symbol->r_exp); |
265 return print_binary_function("__time_add", symbol->l_exp, symbol->r_exp); |
266 if (!search_expression_type->is_same_type(left_type, right_type)) |
266 if (!search_expression_type->is_same_type(left_type, right_type)) |
267 ERROR; |
267 ERROR; |
268 if (search_expression_type->is_integer_type(left_type) || search_expression_type->is_real_type(left_type)) |
268 if (search_expression_type->is_integer_type(left_type) || search_expression_type->is_real_type(left_type)) |
269 return print_binary_expression(symbol->l_exp, symbol->r_exp, " + "); |
269 return print_binary_expression(symbol->l_exp, symbol->r_exp, " + "); |
270 ERROR; |
270 ERROR; |