diff --git a/src/clang_convert/accessor_working_input_files b/src/clang_convert/accessor_working_input_files index 65b843571..3b326f5ca 100644 --- a/src/clang_convert/accessor_working_input_files +++ b/src/clang_convert/accessor_working_input_files @@ -26,7 +26,7 @@ grib_accessor_class_change_alternative_row_scanning.cc grib_accessor_class_change_scanning_direction.cc grib_accessor_class_codetable_title.cc grib_accessor_class_codetable_units.cc -#grib_accessor_class_concept.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 diff --git a/src/clang_convert/ast_object/ast_parser.py b/src/clang_convert/ast_object/ast_parser.py index 9eac601d3..44a1c9b76 100755 --- a/src/clang_convert/ast_object/ast_parser.py +++ b/src/clang_convert/ast_object/ast_parser.py @@ -226,15 +226,16 @@ class AstParser: macro_expression = code_objects.CodeObjects() debug.line("parse_macro_instantiation", f"Found root_expanded_node, kind=[{root_expanded_node.kind}], parsing...") - # Remove the opening paren so it doesn't cause a double-parse of the top-level node (leading to odd results!) - if macro_node_tokens[0] == "(": - open_parens_literal = literal.Literal(macro_node_tokens.pop(0)) - macro_expression.add_code_object(open_parens_literal) + if len(macro_node_tokens) > 0: + # Remove the opening paren so it doesn't cause a double-parse of the top-level node (leading to odd results!) + if macro_node_tokens[0] == "(": + open_parens_literal = literal.Literal(macro_node_tokens.pop(0)) + macro_expression.add_code_object(open_parens_literal) - while len(macro_node_tokens) > 0: - converted_node, macro_node_tokens = self.convert_tokens(macro_node_tokens, root_expanded_node) - debug.line("parse_macro_instantiation", f"converted_node=[{debug.as_debug_string(converted_node)}]") - macro_expression.add_code_object(converted_node) + while len(macro_node_tokens) > 0: + converted_node, macro_node_tokens = self.convert_tokens(macro_node_tokens, root_expanded_node) + debug.line("parse_macro_instantiation", f"converted_node=[{debug.as_debug_string(converted_node)}]") + macro_expression.add_code_object(converted_node) macro_inst = macro_instantation.MacroInstantation(macro_name, macro_expression) debug.line("parse_macro_instantiation", f"FINAL MACRO INST=[{macro_inst.as_string()}]") diff --git a/src/clang_convert/code_object_converter/conversion_pack/conversion_data.py b/src/clang_convert/code_object_converter/conversion_pack/conversion_data.py index cb10f4d69..119f5accd 100755 --- a/src/clang_convert/code_object_converter/conversion_pack/conversion_data.py +++ b/src/clang_convert/code_object_converter/conversion_pack/conversion_data.py @@ -126,7 +126,7 @@ class ConversionData: def cppfuncsig_for_cppfuncname(self, cppfuncname): for mapping in self.all_mappings(): for entry in mapping.all_funcsig_mappings: - if entry.cppfuncsig != NONE_VALUE and entry.cppfuncsig.name == cppfuncname: + if entry.cppfuncsig and entry.cppfuncsig != NONE_VALUE and entry.cppfuncsig.name == cppfuncname: return entry.cppfuncsig return None 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 dbb237333..3cf2c2a92 100755 --- a/src/clang_convert/code_object_converter/variable_declaration_converter.py +++ b/src/clang_convert/code_object_converter/variable_declaration_converter.py @@ -21,6 +21,8 @@ class VariableDeclarationConverter(code_interface_converter.CodeInterfaceConvert cpp_value = conversion_funcs.convert_ccode_object(self._ccode_object.value, conversion_pack) + 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)}]") + 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 diff --git a/src/clang_convert/default/default_conversion_pack/default_conversion_validation.py b/src/clang_convert/default/default_conversion_pack/default_conversion_validation.py index 8651a9b9a..088320978 100755 --- a/src/clang_convert/default/default_conversion_pack/default_conversion_validation.py +++ b/src/clang_convert/default/default_conversion_pack/default_conversion_validation.py @@ -237,6 +237,7 @@ class DefaultConversionValidation(conversion_validation.ConversionValidation): # Override as required... def is_cppfunction_returning_container(self, cppfunc_object): cppname = arg_utils.extract_name(cppfunc_object) + if cppname: cppfuncsig = self._conversion_data.cppfuncsig_for_cppfuncname(cppname) if cppfuncsig and self._conversion_data.is_container_type(cppfuncsig.return_type.type): diff --git a/src/clang_convert/grib_accessor/supporting/data_member_mappings.py b/src/clang_convert/grib_accessor/supporting/data_member_mappings.py index f82598851..98686cc69 100755 --- a/src/clang_convert/grib_accessor/supporting/data_member_mappings.py +++ b/src/clang_convert/grib_accessor/supporting/data_member_mappings.py @@ -15,6 +15,7 @@ grib_accessor_base_data_members_map = { DataMember("const char*","set") : DataMember("std::string","set_"), # This is a conversion helper! DataMember("grib_loader*","loader") : DataMember("AccessorLoaderPtr","loader()"), + DataMember("grib_action*","creator") : DataMember("GribActionPtr","creator()"), } def add_data_member_mappings_to_conversion_data(conversion_data): diff --git a/src/clang_convert/grib_accessor/supporting/type_mappings.py b/src/clang_convert/grib_accessor/supporting/type_mappings.py index f06ad6408..95661912e 100755 --- a/src/clang_convert/grib_accessor/supporting/type_mappings.py +++ b/src/clang_convert/grib_accessor/supporting/type_mappings.py @@ -29,6 +29,7 @@ common_grib_funcbody_type_mappings = { "grib_context*" : NONE_VALUE, "grib_expression*" : "GribExpressionPtr", "grib_codetable*" : "GribCodeTablePtr", + "grib_action*" : "GribActionPtr" } grib_array_funcbody_type_mappings = { diff --git a/src/cpp/eccodes/accessor/AccessorData/AccessorData.h b/src/cpp/eccodes/accessor/AccessorData/AccessorData.h index 83ca25b90..eae639239 100644 --- a/src/cpp/eccodes/accessor/AccessorData/AccessorData.h +++ b/src/cpp/eccodes/accessor/AccessorData/AccessorData.h @@ -7,7 +7,7 @@ #include "GribCpp/GribType.h" #include "GribCpp/GribStatus.h" #include "GribStub/GribVirtualValueStub.h" - +#include "GribStub/GribActionStub.h" #include #include #include @@ -77,6 +77,7 @@ public: // Conversion helpers... AccessorLoaderPtr loader() const { return nullptr; } + GribActionPtr creator() const { return nullptr; } // Ideally these would be private, but that makes the conversion much harder so they are protected instead // This will be revisited later...