From 50d54a15cb7d0a2d8291c20f32b328a591c3719a Mon Sep 17 00:00:00 2001 From: kevstone Date: Tue, 13 Feb 2024 19:32:25 +0000 Subject: [PATCH] boustrophedonic accessors convert --- src/clang_convert/accessor_working_input_files | 4 ++-- .../code_object_converter/cast_expression_converter.py | 7 +++++++ .../variable_declaration_converter.py | 3 +++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/clang_convert/accessor_working_input_files b/src/clang_convert/accessor_working_input_files index 915ffb5a8..71ea8f8ed 100644 --- a/src/clang_convert/accessor_working_input_files +++ b/src/clang_convert/accessor_working_input_files @@ -28,8 +28,8 @@ 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_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 diff --git a/src/clang_convert/code_object_converter/cast_expression_converter.py b/src/clang_convert/code_object_converter/cast_expression_converter.py index 7f0ed9025..1594a536b 100755 --- a/src/clang_convert/code_object_converter/cast_expression_converter.py +++ b/src/clang_convert/code_object_converter/cast_expression_converter.py @@ -3,6 +3,8 @@ import utils.debug as debug import code_object.cast_expression as cast_expression import code_object_converter.code_interface_converter as code_interface_converter import code_object_converter.conversion_funcs as conversion_funcs +from code_object.code_interface import NONE_VALUE +from code_object_converter.conversion_utils import as_commented_out_code class CastExpressionConverter(code_interface_converter.CodeInterfaceConverter): def __init__(self, ccode_object) -> None: @@ -15,5 +17,10 @@ class CastExpressionConverter(code_interface_converter.CodeInterfaceConverter): cpp_cast_value = conversion_funcs.convert_ccode_object(self._ccode_object.cast_value, conversion_pack) cpp_expression = conversion_funcs.convert_ccode_object(self._ccode_object.expression, conversion_pack) + if cpp_expression == NONE_VALUE: + debug.line("create_cpp_code_object", f"cpp_expression=[{debug.as_debug_string(cpp_expression)}] => returning [NONE_VALUE]") + return NONE_VALUE + + cppcast_expression = cast_expression.CastExpression(cpp_cast_type, cpp_cast_value, cpp_expression) return conversion_pack.conversion_validation.validate_cast_expression(self._ccode_object, cppcast_expression) diff --git a/src/clang_convert/code_object_converter/variable_declaration_converter.py b/src/clang_convert/code_object_converter/variable_declaration_converter.py index 3cf2c2a92..fcf079c99 100755 --- a/src/clang_convert/code_object_converter/variable_declaration_converter.py +++ b/src/clang_convert/code_object_converter/variable_declaration_converter.py @@ -23,6 +23,9 @@ class VariableDeclarationConverter(code_interface_converter.CodeInterfaceConvert debug.line("create_cpp_code_object", f"VariableDeclarationConverter [1] cpp_value=[{debug.as_debug_string(cpp_value)}] for self._ccode_object.value=[{debug.as_debug_string(self._ccode_object.value)}]") + if cpp_value == NONE_VALUE: + return as_commented_out_code(self._ccode_object, f"Removed invalid value") + cpp_variable_declaration = variable_declaration.VariableDeclaration(cpp_variable, cpp_value) return conversion_pack.conversion_validation.validate_variable_declaration(self._ccode_object, cpp_variable_declaration) \ No newline at end of file