From 899049782b638790afdb8585192437b12a5c7098 Mon Sep 17 00:00:00 2001 From: sonoro1234 Date: Wed, 19 Nov 2025 10:28:26 +0100 Subject: [PATCH] nonPOD_used 2 --- README.md | 5 +++-- generator/cpp2ffi.lua | 5 +++-- generator/generator.lua | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1af69b3..79859be 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,9 @@ Notes: * All naming is algorithmic except for those names that were coded in cimgui_overloads table (https://github.com/cimgui/cimgui/blob/master/generator/generator.lua#L60). In the official version this table is empty. * Current overloaded function names can be found in (https://github.com/cimgui/cimgui/blob/master/generator/output/overloads.txt) -#changes +# changes -* 10/11/2025: Functions returning and taking as argument no POD structs is now doing a conversion internally to allow ARM64 compilation. +* 10/11/2025: Functions returning and taking as argument no POD structs is now doing a conversion internally to allow ARM64 compilation. In structs_and_enums.json under key nonPOD_used we get a collection where keys are types non usable from C that appear as returns or args to funtions. value can be true or "inherited" when type comes from cimgui and appears in a cimgui extension (cimplot ...). The C names have suffix _c. # compilation @@ -91,6 +91,7 @@ Notes: * size : the number of array elements (when it is an array) * bitfield : the bitfield width (in case it is a bitfield) * under key locations we get the locations collection in which each key is the enum tagname or the struct name and the value is the name of the header file and line number this comes from. + * under key nonPOD_used we get a collection where keys are types non usable from C that appear as returns or args to funtions. value can be true or "inherited" when type comes from cimgui and appears in a cimgui extension (cimplot ...). The C names have suffix _c. # usage * use whatever method is in ImGui c++ namespace in the original [imgui.h](https://github.com/ocornut/imgui/blob/master/imgui.h) by prepending `ig` diff --git a/generator/cpp2ffi.lua b/generator/cpp2ffi.lua index 6379f10..c202267 100644 --- a/generator/cpp2ffi.lua +++ b/generator/cpp2ffi.lua @@ -1256,14 +1256,15 @@ local function get_nonPODused(FP) local all_type_nP = {} for k,v in pairs(typeargs) do local k2 = k:gsub("const ","") - all_type_nP[k2] = true + all_type_nP[k2] = nonPOD[k2]--true end for k,v in pairs(typeargs_ret) do local k2 = k:gsub("const ","") - all_type_nP[k2] = true + all_type_nP[k2] = nonPOD[k2]--true end FP.nP_used = all_type_nP --M.prtable("FP.nP_used",FP.nP_used) + FP.structs_and_enums_table.nonPOD_used = FP.nP_used FP.nP_args = typeargs FP.nP_ret = typeargs_ret --genConversions(FP) diff --git a/generator/generator.lua b/generator/generator.lua index 0266279..ea43028 100644 --- a/generator/generator.lua +++ b/generator/generator.lua @@ -437,7 +437,7 @@ local structs_and_enums_table = parser1.structs_and_enums_table structs_and_enums_table.templated_structs = parser1.templated_structs structs_and_enums_table.typenames = parser1.typenames structs_and_enums_table.templates_done = parser1.templates_done -structs_and_enums_table.nonPOD_used = parser1.nP_used +--structs_and_enums_table.nonPOD_used = parser1.nP_used save_data("./output/structs_and_enums.lua",serializeTableF(structs_and_enums_table)) save_data("./output/typedefs_dict.lua",serializeTableF(parser1.typedefs_dict))