mirror of https://github.com/ecmwf/eccodes.git
Bits fully compiling
This commit is contained in:
parent
4968fa42ed
commit
b926aa3dc0
|
@ -1,106 +1,118 @@
|
|||
# Start the line with # to exclude the file
|
||||
#
|
||||
# Working conversions
|
||||
# LEVEL 1
|
||||
#
|
||||
# grib_accessor_class_gen.cc
|
||||
#
|
||||
#
|
||||
# LEVEL 2
|
||||
#
|
||||
grib_accessor_class_abstract_long_vector.cc
|
||||
grib_accessor_class_abstract_vector.cc
|
||||
grib_accessor_class_ascii.cc
|
||||
grib_accessor_class_bit.cc
|
||||
grib_accessor_class_bitmap.cc
|
||||
grib_accessor_class_bits.cc
|
||||
grib_accessor_class_bytes.cc
|
||||
grib_accessor_class_double.cc
|
||||
grib_accessor_class_long.cc
|
||||
grib_accessor_class_proj_string.cc
|
||||
#
|
||||
# WORK IN PROGRESS...
|
||||
#
|
||||
#grib_accessor_class_bits.cc
|
||||
#
|
||||
# Not-working conversions!
|
||||
#
|
||||
#grib_accessor_class_bits_per_value.cc
|
||||
#grib_accessor_class_blob.cc
|
||||
#grib_accessor_class_budgdate.cc
|
||||
#grib_accessor_class_bufr_data_array.cc
|
||||
#grib_accessor_class_bufr_data_element.cc
|
||||
#grib_accessor_class_bufr_elements_table.cc
|
||||
#grib_accessor_class_bufr_extract_area_subsets.cc
|
||||
#grib_accessor_class_bufr_extract_datetime_subsets.cc
|
||||
#grib_accessor_class_bufr_extract_subsets.cc
|
||||
#grib_accessor_class_bufr_group.cc
|
||||
#grib_accessor_class_bufr_simple_thinning.cc
|
||||
#grib_accessor_class_bufr_string_values.cc
|
||||
#grib_accessor_class_bufrdc_expanded_descriptors.cc
|
||||
#grib_accessor_class_change_alternative_row_scanning.cc
|
||||
#grib_accessor_class_change_scanning_direction.cc
|
||||
#grib_accessor_class_check_internal_version.cc
|
||||
#grib_accessor_class_closest_date.cc
|
||||
#grib_accessor_class_codeflag.cc
|
||||
#grib_accessor_class_codetable.cc
|
||||
#grib_accessor_class_codetable_title.cc
|
||||
#grib_accessor_class_codetable_units.cc
|
||||
#grib_accessor_class_concept.cc
|
||||
#grib_accessor_class_data_apply_bitmap.cc
|
||||
#grib_accessor_class_data_apply_boustrophedonic.cc
|
||||
#grib_accessor_class_data_apply_boustrophedonic_bitmap.cc
|
||||
#grib_accessor_class_data_secondary_bitmap.cc
|
||||
#grib_accessor_class_data_shsimple_packing.cc
|
||||
#grib_accessor_class_dictionary.cc
|
||||
#grib_accessor_class_g1_half_byte_codeflag.cc
|
||||
#grib_accessor_class_g2_mars_labeling.cc
|
||||
#grib_accessor_class_g2step_range.cc
|
||||
#grib_accessor_class_gaussian_grid_name.cc
|
||||
#grib_accessor_class_gds_not_present_bitmap.cc
|
||||
#grib_accessor_class_group.cc
|
||||
#grib_accessor_class_hash_array.cc
|
||||
#grib_accessor_class_headers_only.cc
|
||||
#grib_accessor_class_ifs_param.cc
|
||||
#grib_accessor_class_iterator.cc
|
||||
#grib_accessor_class_label.cc
|
||||
#grib_accessor_class_md5.cc
|
||||
#grib_accessor_class_message_copy.cc
|
||||
#grib_accessor_class_nearest.cc
|
||||
#grib_accessor_class_non_alpha.cc
|
||||
#grib_accessor_class_number_of_values_data_raw_packing.cc
|
||||
#grib_accessor_class_pack_bufr_values.cc
|
||||
#grib_accessor_class_packing_type.cc
|
||||
#grib_accessor_class_position.cc
|
||||
#grib_accessor_class_raw.cc
|
||||
#grib_accessor_class_section.cc
|
||||
#grib_accessor_class_section_pointer.cc
|
||||
#grib_accessor_class_smart_table_column.cc
|
||||
#grib_accessor_class_step_human_readable.cc
|
||||
#grib_accessor_class_to_double.cc
|
||||
#grib_accessor_class_to_integer.cc
|
||||
#grib_accessor_class_to_string.cc
|
||||
#grib_accessor_class_transient_darray.cc
|
||||
#grib_accessor_class_uint16.cc
|
||||
#grib_accessor_class_uint32.cc
|
||||
#grib_accessor_class_uint32_little_endian.cc
|
||||
#grib_accessor_class_uint64.cc
|
||||
#grib_accessor_class_uint64_little_endian.cc
|
||||
#grib_accessor_class_uint8.cc
|
||||
#grib_accessor_class_unpack_bufr_values.cc
|
||||
#grib_accessor_class_values.cc
|
||||
#grib_accessor_class_variable.cc
|
||||
#grib_accessor_class_when.cc
|
||||
#
|
||||
# LEVEL 3
|
||||
#
|
||||
grib_accessor_class_abstract_vector.cc
|
||||
grib_accessor_class_bit.cc
|
||||
grib_accessor_class_bitmap.cc
|
||||
#grib_accessor_class_bits_per_value.cc
|
||||
#grib_accessor_class_budgdate.cc
|
||||
#grib_accessor_class_bufr_group.cc
|
||||
#grib_accessor_class_bufr_string_values.cc
|
||||
#grib_accessor_class_bufr_string_values.cc
|
||||
#grib_accessor_class_bufrdc_expanded_descriptors.cc
|
||||
#grib_accessor_class_check_internal_version.cc
|
||||
#grib_accessor_class_closest_date.cc
|
||||
#grib_accessor_class_constant.cc
|
||||
#grib_accessor_class_count_file.cc
|
||||
#grib_accessor_class_count_missing.cc
|
||||
#grib_accessor_class_count_total.cc
|
||||
#grib_accessor_class_data_apply_bitmap.cc
|
||||
#grib_accessor_class_data_apply_boustrophedonic.cc
|
||||
#grib_accessor_class_data_apply_boustrophedonic_bitmap.cc
|
||||
#grib_accessor_class_data_ccsds_packing.cc
|
||||
#grib_accessor_class_data_complex_packing.cc
|
||||
#grib_accessor_class_data_dummy_field.cc
|
||||
#grib_accessor_class_data_g1complex_packing.cc
|
||||
#grib_accessor_class_data_g1second_order_constant_width_packing.cc
|
||||
#grib_accessor_class_data_g1second_order_general_extended_packing.cc
|
||||
#grib_accessor_class_data_g1second_order_general_packing.cc
|
||||
#grib_accessor_class_data_g1second_order_row_by_row_packing.cc
|
||||
#grib_accessor_class_data_g1secondary_bitmap.cc
|
||||
#grib_accessor_class_data_g1shsimple_packing.cc
|
||||
#grib_accessor_class_data_g1simple_packing.cc
|
||||
#grib_accessor_class_data_g22order_packing.cc
|
||||
#grib_accessor_class_data_g2bifourier_packing.cc
|
||||
#grib_accessor_class_data_g2complex_packing.cc
|
||||
#grib_accessor_class_data_g2secondary_bitmap.cc
|
||||
#grib_accessor_class_data_g2shsimple_packing.cc
|
||||
#grib_accessor_class_data_g2simple_packing.cc
|
||||
#grib_accessor_class_data_g2simple_packing_with_preprocessing.cc
|
||||
#grib_accessor_class_data_jpeg2000_packing.cc
|
||||
#grib_accessor_class_data_png_packing.cc
|
||||
#grib_accessor_class_data_raw_packing.cc
|
||||
#grib_accessor_class_data_run_length_packing.cc
|
||||
#grib_accessor_class_data_secondary_bitmap.cc
|
||||
#grib_accessor_class_data_sh_packed.cc
|
||||
#grib_accessor_class_data_sh_unpacked.cc
|
||||
#grib_accessor_class_data_shsimple_packing.cc
|
||||
#grib_accessor_class_data_simple_packing.cc
|
||||
#grib_accessor_class_decimal_precision.cc
|
||||
#grib_accessor_class_dictionary.cc
|
||||
#grib_accessor_class_dirty.cc
|
||||
#grib_accessor_class_divdouble.cc
|
||||
#grib_accessor_class_element.cc
|
||||
#grib_accessor_class_evaluate.cc
|
||||
#grib_accessor_class_expanded_descriptors.cc
|
||||
#grib_accessor_class_from_scale_factor_scaled_value.cc
|
||||
#grib_accessor_class_g1_half_byte_codeflag.cc
|
||||
#grib_accessor_class_g1_message_length.cc
|
||||
#grib_accessor_class_g1_section4_length.cc
|
||||
#grib_accessor_class_g1bitmap.cc
|
||||
#grib_accessor_class_g1date.cc
|
||||
#grib_accessor_class_g1day_of_the_year_date.cc
|
||||
#grib_accessor_class_g1end_of_interval_monthly.cc
|
||||
#grib_accessor_class_g1fcperiod.cc
|
||||
#grib_accessor_class_g1forecastmonth.cc
|
||||
#grib_accessor_class_g1monthlydate.cc
|
||||
#grib_accessor_class_g1number_of_coded_values_sh_complex.cc
|
||||
#grib_accessor_class_g1number_of_coded_values_sh_simple.cc
|
||||
#grib_accessor_class_g1step_range.cc
|
||||
#grib_accessor_class_g1verificationdate.cc
|
||||
#grib_accessor_class_g2_aerosol.cc
|
||||
#grib_accessor_class_g2_chemical.cc
|
||||
#grib_accessor_class_g2_eps.cc
|
||||
#grib_accessor_class_g2_mars_labeling.cc
|
||||
#grib_accessor_class_g2bitmap.cc
|
||||
#grib_accessor_class_g2bitmap_present.cc
|
||||
#grib_accessor_class_g2date.cc
|
||||
#grib_accessor_class_g2end_step.cc
|
||||
|
@ -108,104 +120,101 @@ grib_accessor_class_proj_string.cc
|
|||
#grib_accessor_class_g2latlon.cc
|
||||
#grib_accessor_class_g2level.cc
|
||||
#grib_accessor_class_g2lon.cc
|
||||
#grib_accessor_class_g2step_range.cc
|
||||
#grib_accessor_class_gaussian_grid_name.cc
|
||||
#grib_accessor_class_gds_is_present.cc
|
||||
#grib_accessor_class_gds_not_present_bitmap.cc
|
||||
#grib_accessor_class_getenv.cc
|
||||
#grib_accessor_class_global_gaussian.cc
|
||||
#grib_accessor_class_group.cc
|
||||
#grib_accessor_class_gts_header.cc
|
||||
#grib_accessor_class_hash_array.cc
|
||||
#grib_accessor_class_headers_only.cc
|
||||
#grib_accessor_class_ibmfloat.cc
|
||||
#grib_accessor_class_ieeefloat.cc
|
||||
#grib_accessor_class_ifs_param.cc
|
||||
#grib_accessor_class_iterator.cc
|
||||
#grib_accessor_class_julian_date.cc
|
||||
#grib_accessor_class_julian_day.cc
|
||||
#grib_accessor_class_ksec1expver.cc
|
||||
#grib_accessor_class_label.cc
|
||||
#grib_accessor_class_latitudes.cc
|
||||
#grib_accessor_class_latlon_increment.cc
|
||||
#grib_accessor_class_latlonvalues.cc
|
||||
#grib_accessor_class_library_version.cc
|
||||
#grib_accessor_class_local_definition.cc
|
||||
#grib_accessor_class_long_vector.cc
|
||||
#grib_accessor_class_longitudes.cc
|
||||
#grib_accessor_class_lookup.cc
|
||||
#grib_accessor_class_mars_param.cc
|
||||
#grib_accessor_class_mars_step.cc
|
||||
#grib_accessor_class_md5.cc
|
||||
#grib_accessor_class_message.cc
|
||||
#grib_accessor_class_message_copy.cc
|
||||
#grib_accessor_class_nearest.cc
|
||||
#grib_accessor_class_non_alpha.cc
|
||||
#grib_accessor_class_number_of_coded_values.cc
|
||||
#grib_accessor_class_number_of_points.cc
|
||||
#grib_accessor_class_number_of_points_gaussian.cc
|
||||
#grib_accessor_class_number_of_values.cc
|
||||
#grib_accessor_class_number_of_values_data_raw_packing.cc
|
||||
#grib_accessor_class_octahedral_gaussian.cc
|
||||
#grib_accessor_class_octet_number.cc
|
||||
#grib_accessor_class_offset_file.cc
|
||||
#grib_accessor_class_offset_values.cc
|
||||
#grib_accessor_class_pack_bufr_values.cc
|
||||
#grib_accessor_class_packing_type.cc
|
||||
#grib_accessor_class_pad.cc
|
||||
#grib_accessor_class_padding.cc
|
||||
#grib_accessor_class_padto.cc
|
||||
#grib_accessor_class_padtoeven.cc
|
||||
#grib_accessor_class_padtomultiple.cc
|
||||
#grib_accessor_class_position.cc
|
||||
#grib_accessor_class_raw.cc
|
||||
#grib_accessor_class_rdbtime_guess_date.cc
|
||||
#grib_accessor_class_reference_value_error.cc
|
||||
#grib_accessor_class_round.cc
|
||||
#grib_accessor_class_scale.cc
|
||||
#grib_accessor_class_scale_values.cc
|
||||
#grib_accessor_class_second_order_bits_per_value.cc
|
||||
#grib_accessor_class_section.cc
|
||||
#grib_accessor_class_section_length.cc
|
||||
#grib_accessor_class_section_padding.cc
|
||||
#grib_accessor_class_section_pointer.cc
|
||||
#grib_accessor_class_select_step_template.cc
|
||||
#grib_accessor_class_sexagesimal2decimal.cc
|
||||
#grib_accessor_class_signed.cc
|
||||
#grib_accessor_class_signed_bits.cc
|
||||
#grib_accessor_class_simple_packing_error.cc
|
||||
#grib_accessor_class_size.cc
|
||||
#grib_accessor_class_smart_table.cc
|
||||
#grib_accessor_class_smart_table_column.cc
|
||||
#grib_accessor_class_spd.cc
|
||||
#grib_accessor_class_spectral_truncation.cc
|
||||
#grib_accessor_class_sprintf.cc
|
||||
#grib_accessor_class_statistics.cc
|
||||
#grib_accessor_class_statistics_spectral.cc
|
||||
#grib_accessor_class_step_human_readable.cc
|
||||
#grib_accessor_class_step_in_units.cc
|
||||
#grib_accessor_class_sum.cc
|
||||
#grib_accessor_class_suppressed.cc
|
||||
#grib_accessor_class_time.cc
|
||||
#grib_accessor_class_to_double.cc
|
||||
#grib_accessor_class_to_integer.cc
|
||||
#grib_accessor_class_to_string.cc
|
||||
#grib_accessor_class_transient.cc
|
||||
#grib_accessor_class_transient_darray.cc
|
||||
#grib_accessor_class_trim.cc
|
||||
#grib_accessor_class_uint16.cc
|
||||
#grib_accessor_class_uint32.cc
|
||||
#grib_accessor_class_uint32_little_endian.cc
|
||||
#grib_accessor_class_uint64.cc
|
||||
#grib_accessor_class_uint64_little_endian.cc
|
||||
#grib_accessor_class_uint8.cc
|
||||
#grib_accessor_class_unexpanded_descriptors.cc
|
||||
#grib_accessor_class_unpack_bufr_values.cc
|
||||
#grib_accessor_class_unsigned.cc
|
||||
#grib_accessor_class_unsigned_bits.cc
|
||||
#grib_accessor_class_validity_date.cc
|
||||
#grib_accessor_class_validity_time.cc
|
||||
#grib_accessor_class_values.cc
|
||||
#grib_accessor_class_variable.cc
|
||||
#
|
||||
# LEVEL 4
|
||||
#
|
||||
#grib_accessor_class_codeflag.cc
|
||||
#grib_accessor_class_codetable.cc
|
||||
#grib_accessor_class_data_complex_packing.cc
|
||||
#grib_accessor_class_data_g1second_order_constant_width_packing.cc
|
||||
#grib_accessor_class_data_g1second_order_general_extended_packing.cc
|
||||
#grib_accessor_class_data_g1second_order_general_packing.cc
|
||||
#grib_accessor_class_data_g1second_order_row_by_row_packing.cc
|
||||
#grib_accessor_class_data_g1simple_packing.cc
|
||||
#grib_accessor_class_data_g2bifourier_packing.cc
|
||||
#grib_accessor_class_data_g2simple_packing.cc
|
||||
#grib_accessor_class_data_jpeg2000_packing.cc
|
||||
#grib_accessor_class_data_sh_packed.cc
|
||||
#grib_accessor_class_data_sh_unpacked.cc
|
||||
#grib_accessor_class_g1bitmap.cc
|
||||
#grib_accessor_class_g1day_of_the_year_date.cc
|
||||
#grib_accessor_class_g1end_of_interval_monthly.cc
|
||||
#grib_accessor_class_g1fcperiod.cc
|
||||
#grib_accessor_class_g2_aerosol.cc
|
||||
#grib_accessor_class_g2_chemical.cc
|
||||
#grib_accessor_class_g2_eps.cc
|
||||
#grib_accessor_class_g2bitmap.cc
|
||||
#grib_accessor_class_local_definition.cc
|
||||
#grib_accessor_class_pad.cc
|
||||
#grib_accessor_class_padto.cc
|
||||
#grib_accessor_class_padtoeven.cc
|
||||
#grib_accessor_class_padtomultiple.cc
|
||||
#grib_accessor_class_round.cc
|
||||
#grib_accessor_class_section_length.cc
|
||||
#grib_accessor_class_section_padding.cc
|
||||
#grib_accessor_class_select_step_template.cc
|
||||
#grib_accessor_class_smart_table.cc
|
||||
#grib_accessor_class_statistics.cc
|
||||
#grib_accessor_class_statistics_spectral.cc
|
||||
#grib_accessor_class_vector.cc
|
||||
#grib_accessor_class_when.cc
|
||||
#
|
||||
# LEVEL 5
|
||||
#
|
||||
#grib_accessor_class_data_dummy_field.cc
|
||||
#grib_accessor_class_data_g1complex_packing.cc
|
||||
#grib_accessor_class_data_g2complex_packing.cc
|
||||
#grib_accessor_class_data_g2simple_packing_with_preprocessing.cc
|
||||
#grib_accessor_class_g1_message_length.cc
|
||||
#grib_accessor_class_g1_section4_length.cc
|
||||
|
|
|
@ -12,6 +12,7 @@ from code_object.unary_operation import UnaryOperation
|
|||
from code_object.unary_expression import UnaryExpression
|
||||
from code_object.paren_expression import ParenExpression
|
||||
from utils.string_funcs import strip_semicolon
|
||||
from code_object.cast_expression import CastExpression
|
||||
|
||||
# Try to extract a name value from the object, else return ""
|
||||
def extract_name(cpp_obj):
|
||||
|
@ -45,6 +46,9 @@ def extract_name(cpp_obj):
|
|||
elif isinstance(cpp_obj, ParenExpression):
|
||||
# expression will a paren_expression, so we need to recurse!
|
||||
cppname = extract_name(cpp_obj.expression)
|
||||
elif isinstance(cpp_obj, CastExpression):
|
||||
# expression will a CodeInterface, so we need to recurse!
|
||||
cppname = extract_name(cpp_obj.expression)
|
||||
|
||||
if not isinstance(cppname, str):
|
||||
debug.line("extract_name", f"** Could not extract string name. cppname type=[{type(cppname)}] value=[{debug.as_debug_string(cppname)}]")
|
||||
|
|
|
@ -72,7 +72,9 @@ class ContainerUtils:
|
|||
def cname_to_cpp_container(self, cname, conversion_data):
|
||||
|
||||
buf_map = self.clength_to_buffer_mapping(cname, conversion_data)
|
||||
debug.line("cname_to_cpp_container", f"[1] buf_map=[{buf_map}]")
|
||||
if buf_map:
|
||||
debug.line("cname_to_cpp_container", f"[2] buf_map.cbuffer=[{buf_map.cbuffer}] buf_map.clength=[{buf_map.clength}] buf_map.cpp_container=[{debug.as_debug_string(buf_map.cpp_container)}]")
|
||||
return self.create_cpp_container_length_arg(buf_map.cpp_container.name)
|
||||
|
||||
return self.cname_to_cpp_container_buffer(cname, conversion_data)
|
|
@ -7,6 +7,8 @@ import code_object.arg as arg
|
|||
from code_object.code_interface import NONE_VALUE
|
||||
import code_object_converter.conversion_pack.arg_utils as arg_utils
|
||||
import re
|
||||
import code_object.array_access as array_access
|
||||
import code_object.literal as literal
|
||||
|
||||
class FunctionCallConverter(code_interface_converter.CodeInterfaceConverter):
|
||||
def __init__(self, ccode_object) -> None:
|
||||
|
@ -51,11 +53,21 @@ class FunctionCallConverter(code_interface_converter.CodeInterfaceConverter):
|
|||
else:
|
||||
# Check if we have a container arg
|
||||
cpp_arg_name = arg_utils.extract_name(cpp_arg_entry)
|
||||
debug.line("create_cpp_code_object", f"FunctionCallConverter [4] cpp_arg_name=[{cpp_arg_name}] cpp_arg_entry=[{debug.as_debug_string(cpp_arg_entry)}]")
|
||||
|
||||
if cpp_arg_name:
|
||||
cpp_container_arg = conversion_pack.container_utils.cname_to_cpp_container(cpp_arg_name, conversion_pack.conversion_data)
|
||||
debug.line("create_cpp_code_object", f"FunctionCallConverter [5] cpp_container_arg=[{debug.as_debug_string(cpp_container_arg)}] for cpp_arg_name=[{cpp_arg_name}]")
|
||||
if cpp_container_arg:
|
||||
cpp_arg_entry = cpp_container_arg
|
||||
|
||||
cpparg = arg_utils.to_cpparg(cpp_arg_entry, conversion_pack.conversion_data)
|
||||
if cpparg:
|
||||
if conversion_pack.conversion_data.is_container_type(cpparg.decl_spec.type) and not conversion_pack.conversion_data.is_container_type(mapping.cppfuncsig.args[i].decl_spec.type):
|
||||
cpp_arg_entry = array_access.ArrayAccess(literal.Literal(cpparg.name), literal.Literal("0"))
|
||||
debug.line("create_cpp_code_object", f"FunctionCallConverter [6] MISMATCH: cpparg=[{debug.as_debug_string(cpparg)}] is a container, C++ function arg=[{debug.as_debug_string(mapping.cppfuncsig.args[i])}] is NOT! Passing index 0, cpp_arg_entry=[{debug.as_debug_string(cpp_arg_entry)}]")
|
||||
|
||||
debug.line("create_cpp_code_object", f"ADDING cpp_arg_entry=[{debug.as_debug_string(cpp_arg_entry)}] arg_entry=[{debug.as_debug_string(arg_entry)}]")
|
||||
cpp_args.append(cpp_arg_entry)
|
||||
|
||||
cppfunction_call = function_call.FunctionCall(mapping.cppfuncsig.name, cpp_args)
|
||||
|
@ -63,7 +75,7 @@ class FunctionCallConverter(code_interface_converter.CodeInterfaceConverter):
|
|||
debug.line("create_cpp_code_object", f"cppfunction_call NOW EQUALS [{debug.as_debug_string(cppfunction_call)}]")
|
||||
|
||||
else:
|
||||
debug.line("create_cpp_code_object", f"FunctionCallConverter [4]")
|
||||
debug.line("create_cpp_code_object", f"FunctionCallConverter [7]")
|
||||
# 2. Perform a manual conversion
|
||||
cpp_name = conversion_funcs.convert_ccode_object(cfunction_call.name, conversion_pack)
|
||||
cpp_args = []
|
||||
|
|
|
@ -14,6 +14,7 @@ import code_object.paren_expression as paren_expression
|
|||
import code_object.array_access as array_access
|
||||
from code_object_converter.conversion_utils import as_commented_out_code
|
||||
from utils.string_funcs import is_number
|
||||
import code_object.cast_expression as cast_expression
|
||||
|
||||
# Pass this to the conversion_data object to be accessed by the conversion routines
|
||||
class DefaultConversionValidation(conversion_validation.ConversionValidation):
|
||||
|
@ -74,6 +75,18 @@ class DefaultConversionValidation(conversion_validation.ConversionValidation):
|
|||
# Just return the passed in value!
|
||||
return calling_arg_value
|
||||
|
||||
def validate_cast_expression(self, ccast_expression, cppcast_expression):
|
||||
cpparg = arg_utils.to_cpparg(cppcast_expression, self._conversion_data)
|
||||
if cpparg and self._conversion_data.is_container_type(cpparg.decl_spec.type):
|
||||
cpparray_access = array_access.ArrayAccess(literal.Literal(cpparg.name), literal.Literal("0"))
|
||||
updated_cppcast_expression = cast_expression.CastExpression(cppcast_expression.cast_type,
|
||||
cppcast_expression.cast_value,
|
||||
cpparray_access)
|
||||
debug.line("validate_cast_expression", f"Updated container to access first element. updated_cppcast_expression=[{debug.as_debug_string(updated_cppcast_expression)}]")
|
||||
return updated_cppcast_expression
|
||||
|
||||
return cppcast_expression
|
||||
|
||||
def validate_unary_expression(self, cunary_expression, cppunary_expression):
|
||||
debug.line("validate_unary_operation", f"cppunary_expression.keyword=[{debug.as_debug_string(cppunary_expression.keyword)}] cppunary_expression.expression=[{debug.as_debug_string(cppunary_expression.expression)}]")
|
||||
|
||||
|
@ -185,6 +198,18 @@ class DefaultConversionValidation(conversion_validation.ConversionValidation):
|
|||
cpparray_access = array_access.ArrayAccess(literal.Literal(cpparg.name), cppright)
|
||||
return cpparray_access
|
||||
|
||||
elif cppbinary_op.is_arithmetic:
|
||||
cpparg = arg_utils.to_cpparg(cppleft, self._conversion_data)
|
||||
if cpparg and self._conversion_data.is_container_type(cpparg.decl_spec.type):
|
||||
# We'll assume the arithmetic is against index 0
|
||||
cpparray_access = array_access.ArrayAccess(literal.Literal(cpparg.name), literal.Literal("0"))
|
||||
updated_cppbinary_operation = binary_operation.BinaryOperation(cpparray_access,
|
||||
cppbinary_op,
|
||||
cppright)
|
||||
debug.line("validate_binary_operation", f"Updated container to access first element. updated_cppbinary_operation=[{debug.as_debug_string(updated_cppbinary_operation)}]")
|
||||
|
||||
return updated_cppbinary_operation
|
||||
|
||||
return cppbinary_operation
|
||||
|
||||
def validate_variable_declaration(self, cvariable_declaration, cppvariable_declaration):
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
|
||||
import utils.debug as debug
|
||||
import grib_accessor.grib_accessor_conversion_pack.conversion_pack_updates.base_conversion_pack_updates as base_conversion_pack_updates
|
||||
from code_object.arg import Arg
|
||||
from code_object_converter.conversion_pack.funcsig_mapping import FuncSigMapping
|
||||
from code_object_converter.conversion_pack.arg_indexes import ArgIndexes
|
||||
from code_object.funcsig import FuncSig
|
||||
from code_object.code_interface import NONE_VALUE
|
||||
|
||||
class BitsConversionPackUpdates(base_conversion_pack_updates.BaseConversionPackUpdates):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
|
||||
self._all_function_arg_mappings.update({
|
||||
Arg("unsigned char*","p") : Arg("AccessorDataPointer","p"),
|
||||
Arg("int","type") : Arg("GribType","type"),
|
||||
})
|
|
@ -113,15 +113,18 @@ class GribAccessorConversionValidation(default_conversion_validation.DefaultConv
|
|||
|
||||
def apply_special_function_call_conversions(self, cfunction_call, cppfunction_call):
|
||||
|
||||
if cfunction_call.name == "grib_arguments_get_name":
|
||||
# Convert grib_arguments_get_XXX calls
|
||||
grib_arguments_get_cname = "grib_arguments_get_"
|
||||
if cfunction_call.name.startswith(grib_arguments_get_cname):
|
||||
cpptype = cfunction_call.name[len(grib_arguments_get_cname):]
|
||||
if cpptype == "name":
|
||||
cpptype = "std::string"
|
||||
elif cpptype == "expression":
|
||||
cpptype = "GribExpressionPtr"
|
||||
|
||||
arg_string = strip_semicolon(cfunction_call.args[2].as_string())
|
||||
arg_entry = literal.Literal(f"initData.args[{arg_string}].second")
|
||||
return function_call.FunctionCall(f"std::get<std::string>", [arg_entry])
|
||||
|
||||
if cfunction_call.name == "grib_arguments_get_long":
|
||||
arg_string = strip_semicolon(cfunction_call.args[2].as_string())
|
||||
arg_entry = literal.Literal(f"initData.args[{arg_string}].second")
|
||||
return function_call.FunctionCall(f"std::get<long>", [arg_entry])
|
||||
return function_call.FunctionCall(f"std::get<{cpptype}>", [arg_entry])
|
||||
|
||||
# If we're calling grib_XXX which is a virtual member function, and the first argument is "a", then we're actually calling ourself!
|
||||
if cfunction_call.name.startswith("grib_"):
|
||||
|
|
Loading…
Reference in New Issue