cpp2ffi: hide genConversors and gen_structs_c

This commit is contained in:
sonoro1234
2025-11-09 12:15:04 +01:00
parent 3c9eda8f1f
commit 34550586d4
4 changed files with 8 additions and 9 deletions

View File

@@ -3818,6 +3818,7 @@ struct SDL_Window;
typedef union SDL_Event SDL_Event; typedef union SDL_Event SDL_Event;
#endif // CIMGUI_DEFINE_ENUMS_AND_STRUCTS #endif // CIMGUI_DEFINE_ENUMS_AND_STRUCTS
#ifdef CIMGUI_DEFINE_ENUMS_AND_STRUCTS #ifdef CIMGUI_DEFINE_ENUMS_AND_STRUCTS
typedef struct ImColor_c ImColor; typedef struct ImColor_c ImColor;
typedef struct ImRect_c ImRect; typedef struct ImRect_c ImRect;
@@ -3859,7 +3860,6 @@ struct ImVec4_c {
float w; float w;
}; };
#endif #endif
#ifndef CIMGUI_DEFINE_ENUMS_AND_STRUCTS #ifndef CIMGUI_DEFINE_ENUMS_AND_STRUCTS
typedef struct ImGuiTextFilter::ImGuiTextRange ImGuiTextRange; typedef struct ImGuiTextFilter::ImGuiTextRange ImGuiTextRange;
typedef ImStb::STB_TexteditState STB_TexteditState; typedef ImStb::STB_TexteditState STB_TexteditState;

View File

@@ -49,7 +49,6 @@ struct SDL_Window;
typedef union SDL_Event SDL_Event; typedef union SDL_Event SDL_Event;
#endif // CIMGUI_DEFINE_ENUMS_AND_STRUCTS #endif // CIMGUI_DEFINE_ENUMS_AND_STRUCTS
PLACE_STRUCTS_C
#include "auto_funcs.h" #include "auto_funcs.h"

View File

@@ -2990,7 +2990,9 @@ local function func_implementation(FP)
end end
until true until true
end end
return table.concat(outtab) local conversors = FP:genConversors()
local cimplem = conversors .. table.concat(outtab)
return cimplem
end end
M.func_implementation = func_implementation M.func_implementation = func_implementation
@@ -3086,7 +3088,7 @@ M.func_header_generate_funcs = func_header_generate_funcs
local function func_header_generate(FP) local function func_header_generate(FP)
local outtab = func_header_generate_structs(FP) local outtab = func_header_generate_structs(FP)
table.insert(outtab, 1, "#ifndef CIMGUI_DEFINE_ENUMS_AND_STRUCTS\n") table.insert(outtab, 1, "\n#ifndef CIMGUI_DEFINE_ENUMS_AND_STRUCTS\n")
table.insert(outtab,"#endif //CIMGUI_DEFINE_ENUMS_AND_STRUCTS\n") table.insert(outtab,"#endif //CIMGUI_DEFINE_ENUMS_AND_STRUCTS\n")
local outtabf = func_header_generate_funcs(FP) local outtabf = func_header_generate_funcs(FP)
@@ -3095,7 +3097,8 @@ local function func_header_generate(FP)
--outtabf = M.header_subs_nonPOD(FP,outtabf) --outtabf = M.header_subs_nonPOD(FP,outtabf)
local cfuncsstr = table.concat(outtab)..outtabf local cfuncsstr = table.concat(outtab)..outtabf
cfuncsstr = cfuncsstr:gsub("\n+","\n") --several empty lines to one empty line cfuncsstr = cfuncsstr:gsub("\n+","\n") --several empty lines to one empty line
return cfuncsstr local structs_c = FP:gen_structs_c()
return structs_c..cfuncsstr
end end
M.func_header_generate = func_header_generate M.func_header_generate = func_header_generate

View File

@@ -278,7 +278,7 @@ local function cimgui_generation(parser)
local hstrfile = read_data"./cimgui_template.h" local hstrfile = read_data"./cimgui_template.h"
hstrfile = hstrfile:gsub([[PLACE_STRUCTS_C]],parser:gen_structs_c()) --hstrfile = hstrfile:gsub([[PLACE_STRUCTS_C]],parser:gen_structs_c())
local outpre,outpost = parser.structs_and_enums[1],parser.structs_and_enums[2] local outpre,outpost = parser.structs_and_enums[1],parser.structs_and_enums[2]
cpp2ffi.prtable(parser.templates) cpp2ffi.prtable(parser.templates)
@@ -323,9 +323,6 @@ local function cimgui_generation(parser)
cimplem = colapse_defines(cimplem, "IMGUI_ENABLE_FREETYPE") cimplem = colapse_defines(cimplem, "IMGUI_ENABLE_FREETYPE")
local hstrfile = read_data"./cimgui_template.cpp" local hstrfile = read_data"./cimgui_template.cpp"
local conversors = parser:genConversors()
cimplem = conversors .. cimplem
hstrfile = hstrfile:gsub([[#include "auto_funcs%.cpp"]],cimplem) hstrfile = hstrfile:gsub([[#include "auto_funcs%.cpp"]],cimplem)
local ftdef = "" --FREETYPE_GENERATION and "#define IMGUI_ENABLE_FREETYPE\n" or "" local ftdef = "" --FREETYPE_GENERATION and "#define IMGUI_ENABLE_FREETYPE\n" or ""
save_data("./output/cimgui.cpp",cimgui_header, ftdef, hstrfile) save_data("./output/cimgui.cpp",cimgui_header, ftdef, hstrfile)