142 void generate_inline(symbol_c *function_name, |
144 void generate_inline(symbol_c *function_name, |
143 symbol_c *function_type_prefix, |
145 symbol_c *function_type_prefix, |
144 symbol_c *function_type_suffix, |
146 symbol_c *function_type_suffix, |
145 std::list<FUNCTION_PARAM*> param_list, |
147 std::list<FUNCTION_PARAM*> param_list, |
146 function_declaration_c *f_decl = NULL) { |
148 function_declaration_c *f_decl = NULL) { |
147 std::list<FUNCTION_PARAM*>::iterator pt; |
149 |
|
150 std::list<FUNCTION_PARAM*>::iterator pt; |
|
151 generating_inlinefunction = true; |
148 |
152 |
149 fcall_number++; |
153 fcall_number++; |
150 function_type_prefix = search_expression_type->default_literal_type(function_type_prefix); |
154 function_type_prefix = search_expression_type->default_literal_type(function_type_prefix); |
151 if (function_type_suffix) { |
155 if (function_type_suffix) { |
152 function_type_suffix = search_expression_type->default_literal_type(function_type_suffix); |
156 function_type_suffix = search_expression_type->default_literal_type(function_type_suffix); |
364 /*********************/ |
370 /*********************/ |
365 /* B 1.4 - Variables */ |
371 /* B 1.4 - Variables */ |
366 /*********************/ |
372 /*********************/ |
367 void *visit(symbolic_variable_c *symbol) { |
373 void *visit(symbolic_variable_c *symbol) { |
368 unsigned int vartype; |
374 unsigned int vartype; |
369 if (wanted_variablegeneration == complextype_base_vg) |
375 if (generating_inlinefunction) { |
370 generate_c_base_c::visit(symbol); |
376 if (wanted_variablegeneration == complextype_base_vg) |
371 else if (wanted_variablegeneration == complextype_suffix_vg) |
377 generate_c_base_c::visit(symbol); |
372 return NULL; |
378 else if (wanted_variablegeneration == complextype_suffix_vg) |
373 else |
379 return NULL; |
374 print_getter(symbol); |
380 else |
|
381 print_getter(symbol); |
|
382 } |
375 return NULL; |
383 return NULL; |
376 } |
384 } |
377 |
385 |
378 /********************************************/ |
386 /********************************************/ |
379 /* B.1.4.1 Directly Represented Variables */ |
387 /* B.1.4.1 Directly Represented Variables */ |
380 /********************************************/ |
388 /********************************************/ |
381 // direct_variable: direct_variable_token {$$ = new direct_variable_c($1);}; |
389 // direct_variable: direct_variable_token {$$ = new direct_variable_c($1);}; |
382 void *visit(direct_variable_c *symbol) { |
390 void *visit(direct_variable_c *symbol) { |
383 TRACE("direct_variable_c"); |
391 TRACE("direct_variable_c"); |
384 /* Do not use print_token() as it will change everything into uppercase */ |
392 if (generating_inlinefunction) { |
385 if (strlen(symbol->value) == 0) ERROR; |
393 /* Do not use print_token() as it will change everything into uppercase */ |
386 s4o.print(GET_LOCATED); |
394 if (strlen(symbol->value) == 0) ERROR; |
387 s4o.print("("); |
395 s4o.print(GET_LOCATED); |
388 this->print_variable_prefix(); |
396 s4o.print("("); |
389 s4o.printlocation(symbol->value + 1); |
397 this->print_variable_prefix(); |
390 s4o.print(")"); |
398 s4o.printlocation(symbol->value + 1); |
|
399 s4o.print(")"); |
|
400 } |
391 return NULL; |
401 return NULL; |
392 } |
402 } |
393 |
403 |
394 /*************************************/ |
404 /*************************************/ |
395 /* B.1.4.2 Multi-element Variables */ |
405 /* B.1.4.2 Multi-element Variables */ |
396 /*************************************/ |
406 /*************************************/ |
397 |
407 |
398 // SYM_REF2(structured_variable_c, record_variable, field_selector) |
408 // SYM_REF2(structured_variable_c, record_variable, field_selector) |
399 void *visit(structured_variable_c *symbol) { |
409 void *visit(structured_variable_c *symbol) { |
400 TRACE("structured_variable_c"); |
410 TRACE("structured_variable_c"); |
401 switch (wanted_variablegeneration) { |
411 if (generating_inlinefunction) { |
402 case complextype_base_vg: |
412 switch (wanted_variablegeneration) { |
403 symbol->record_variable->accept(*this); |
413 case complextype_base_vg: |
404 break; |
414 symbol->record_variable->accept(*this); |
405 case complextype_suffix_vg: |
415 break; |
406 symbol->record_variable->accept(*this); |
416 case complextype_suffix_vg: |
407 s4o.print("."); |
417 symbol->record_variable->accept(*this); |
408 symbol->field_selector->accept(*this); |
418 s4o.print("."); |
409 break; |
419 symbol->field_selector->accept(*this); |
410 default: |
420 break; |
411 print_getter(symbol); |
421 default: |
412 break; |
422 print_getter(symbol); |
|
423 break; |
|
424 } |
413 } |
425 } |
414 return NULL; |
426 return NULL; |
415 } |
427 } |
416 |
428 |
417 /* subscripted_variable '[' subscript_list ']' */ |
429 /* subscripted_variable '[' subscript_list ']' */ |
418 //SYM_REF2(array_variable_c, subscripted_variable, subscript_list) |
430 //SYM_REF2(array_variable_c, subscripted_variable, subscript_list) |
419 void *visit(array_variable_c *symbol) { |
431 void *visit(array_variable_c *symbol) { |
420 switch (wanted_variablegeneration) { |
432 if (generating_inlinefunction) { |
421 case complextype_base_vg: |
433 switch (wanted_variablegeneration) { |
422 symbol->subscripted_variable->accept(*this); |
434 case complextype_base_vg: |
423 break; |
435 symbol->subscripted_variable->accept(*this); |
424 case complextype_suffix_vg: |
436 break; |
425 symbol->subscripted_variable->accept(*this); |
437 case complextype_suffix_vg: |
426 |
438 symbol->subscripted_variable->accept(*this); |
427 current_array_type = search_varfb_instance_type->get_type_id(symbol->subscripted_variable); |
439 |
428 if (current_array_type == NULL) ERROR; |
440 current_array_type = search_varfb_instance_type->get_type_id(symbol->subscripted_variable); |
429 |
441 if (current_array_type == NULL) ERROR; |
430 s4o.print(".table"); |
442 |
431 symbol->subscript_list->accept(*this); |
443 s4o.print(".table"); |
432 |
444 symbol->subscript_list->accept(*this); |
433 current_array_type = NULL; |
445 |
434 break; |
446 current_array_type = NULL; |
435 default: |
447 break; |
436 print_getter(symbol); |
448 default: |
437 break; |
449 print_getter(symbol); |
|
450 break; |
|
451 } |
438 } |
452 } |
439 return NULL; |
453 return NULL; |
440 } |
454 } |
441 |
455 |
442 /****************************************/ |
456 /****************************************/ |