stage4/generate_c/generate_c_inlinefcall.cc
changeset 380 b78e59ed4269
parent 355 30db860bd3bd
child 383 0b81b59f333b
equal deleted inserted replaced
379:7dc97c825bb8 380:b78e59ed4269
    22  * used in safety-critical situations without a full and competent review.
    22  * used in safety-critical situations without a full and competent review.
    23  */
    23  */
    24 
    24 
    25 
    25 
    26 #define INLINE_RESULT_TEMP_VAR "__res"
    26 #define INLINE_RESULT_TEMP_VAR "__res"
       
    27 #define INLINE_PARAM_COUNT "__PARAM_COUNT"
    27 
    28 
    28 class generate_c_inlinefcall_c: public generate_c_typedecl_c {
    29 class generate_c_inlinefcall_c: public generate_c_typedecl_c {
    29 
    30 
    30   public:
    31   public:
    31     typedef enum {
    32     typedef enum {
   518           if (tmp == NULL) ERROR;
   519           if (tmp == NULL) ERROR;
   519           int res = snprintf(tmp, 32, "%d", symbol->extensible_param_count);
   520           int res = snprintf(tmp, 32, "%d", symbol->extensible_param_count);
   520           if ((res >= 32) || (res < 0)) ERROR;
   521           if ((res >= 32) || (res < 0)) ERROR;
   521           identifier_c *param_value = new identifier_c(tmp);
   522           identifier_c *param_value = new identifier_c(tmp);
   522           uint_type_name_c *param_type  = new uint_type_name_c();
   523           uint_type_name_c *param_type  = new uint_type_name_c();
   523           identifier_c *param_name = new identifier_c("");
   524           identifier_c *param_name = new identifier_c(INLINE_PARAM_COUNT);
   524           ADD_PARAM_LIST(param_name, param_value, param_type, function_param_iterator_c::direction_in)
   525           ADD_PARAM_LIST(param_name, param_value, param_type, function_param_iterator_c::direction_in)
   525           found_first_extensible_parameter = true;
   526           found_first_extensible_parameter = true;
   526         }
   527         }
   527     
   528     
   528         symbol_c *param_type = fp_iterator.param_type();
   529         symbol_c *param_type = fp_iterator.param_type();
   700           if (tmp == NULL) ERROR;
   701           if (tmp == NULL) ERROR;
   701           int res = snprintf(tmp, 32, "%d", symbol->extensible_param_count);
   702           int res = snprintf(tmp, 32, "%d", symbol->extensible_param_count);
   702           if ((res >= 32) || (res < 0)) ERROR;
   703           if ((res >= 32) || (res < 0)) ERROR;
   703           identifier_c *param_value = new identifier_c(tmp);
   704           identifier_c *param_value = new identifier_c(tmp);
   704           uint_type_name_c *param_type  = new uint_type_name_c();
   705           uint_type_name_c *param_type  = new uint_type_name_c();
   705           identifier_c *param_name = new identifier_c("");
   706           identifier_c *param_name = new identifier_c(INLINE_PARAM_COUNT);
   706           ADD_PARAM_LIST(param_name, param_value, param_type, function_param_iterator_c::direction_in)
   707           ADD_PARAM_LIST(param_name, param_value, param_type, function_param_iterator_c::direction_in)
   707           found_first_extensible_parameter = true;
   708           found_first_extensible_parameter = true;
   708         }
   709         }
   709         
   710         
   710         if (fp_iterator.is_extensible_param()) {      
   711         if (fp_iterator.is_extensible_param()) {      
  1066           if (tmp == NULL) ERROR;
  1067           if (tmp == NULL) ERROR;
  1067           int res = snprintf(tmp, 32, "%d", symbol->extensible_param_count);
  1068           int res = snprintf(tmp, 32, "%d", symbol->extensible_param_count);
  1068           if ((res >= 32) || (res < 0)) ERROR;
  1069           if ((res >= 32) || (res < 0)) ERROR;
  1069           identifier_c *param_value = new identifier_c(tmp);
  1070           identifier_c *param_value = new identifier_c(tmp);
  1070           uint_type_name_c *param_type  = new uint_type_name_c();
  1071           uint_type_name_c *param_type  = new uint_type_name_c();
  1071           identifier_c *param_name = new identifier_c("");
  1072           identifier_c *param_name = new identifier_c(INLINE_PARAM_COUNT);
  1072           ADD_PARAM_LIST(param_name, param_value, param_type, function_param_iterator_c::direction_in)
  1073           ADD_PARAM_LIST(param_name, param_value, param_type, function_param_iterator_c::direction_in)
  1073           found_first_extensible_parameter = true;
  1074           found_first_extensible_parameter = true;
  1074         }
  1075         }
  1075     
  1076     
  1076         if (fp_iterator.is_extensible_param()) {      
  1077         if (fp_iterator.is_extensible_param()) {