Compare commits

...

6 Commits

Author SHA1 Message Date
sonoro1234
1e3cfe7157 cpp2ffi.lua: imgui-node-editor work 2 2026-04-25 15:32:39 +02:00
sonoro1234
0313c558fc cpp2ffi.lua: imgui-nodes-editor work 1 2026-04-25 08:45:55 +02:00
sonoro1234
ad70f13873 simplify generator.lua for modules 2026-04-20 10:37:57 +02:00
sonoro1234
a444aa6c50 cpp2ffi: class work 3 std::function wrapping 2026-04-17 18:15:27 +02:00
sonoro1234
fab34e3855 cpp2ffi: class work 2 2026-04-15 19:36:15 +02:00
sonoro1234
467262ef29 cpp2ffi: class work 1 2026-04-14 10:44:36 +02:00
8 changed files with 1670 additions and 135 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -286,6 +286,7 @@ local function cimgui_generation(parser)
local tdt = parser:generate_templates() local tdt = parser:generate_templates()
cpp2ffi.prtable("generate_templates",tdt)
local cstructsstr = outpre..tdt..outpost local cstructsstr = outpre..tdt..outpost
if gdefines.IMGUI_HAS_DOCK then if gdefines.IMGUI_HAS_DOCK then
@@ -379,16 +380,15 @@ end
local function parseImGuiHeader(header,names) local function parseImGuiHeader(header,names)
--prepare parser --prepare parser
local parser = cpp2ffi.Parser() local parser = cpp2ffi.Parser()
parser.modulename = "cimgui"
parser.getCname = function(stname,funcname,namespace) parser.getCname = function(stname,funcname,namespace)
local pre = (stname == "") and (namespace and (namespace=="ImGui" and "ig" or namespace.."_") or "ig") or stname.."_" local pre = (stname == "") and (namespace and (namespace=="ImGui" and "ig" or namespace.."_") or "ig") or stname.."_"
return pre..funcname return pre..funcname
end end
parser.cname_overloads = cimgui_overloads parser.cname_overloads = cimgui_overloads
--parser.manuals = cimgui_manuals
parser:set_manuals(cimgui_manuals, "cimgui") parser:set_manuals(cimgui_manuals, "cimgui")
parser.skipped = cimgui_skipped parser.skipped = cimgui_skipped
parser.UDTs = {"ImVec2","ImVec4","ImColor","ImRect"} --parser.UDTs = {"ImVec2","ImVec4","ImColor","ImRect"}
--parser.gen_template_typedef = gen_template_typedef --use auto --parser.gen_template_typedef = gen_template_typedef --use auto
parser.COMMENTS_GENERATION = COMMENTS_GENERATION parser.COMMENTS_GENERATION = COMMENTS_GENERATION
parser.CONSTRUCTORS_GENERATION = CONSTRUCTORS_GENERATION parser.CONSTRUCTORS_GENERATION = CONSTRUCTORS_GENERATION
@@ -457,7 +457,11 @@ if ff then
else else
backends_folder = IMGUI_PATH .. "/backends/" backends_folder = IMGUI_PATH .. "/backends/"
end end
local function getCname(stname,funcname, namespace)
if #stname == 0 then return funcname end --top level
local pre = stname.."_"
return pre..funcname
end
local parser2 local parser2
if #implementations > 0 then if #implementations > 0 then
@@ -489,9 +493,11 @@ if #implementations > 0 then
end end
end end
parser2.cimgui_inherited = dofile([[./output/structs_and_enums.lua]]) parser2.cimgui_inherited = dofile([[./output/structs_and_enums.lua]])
parser2.getCname = getCname
local defines = parser2:take_lines(CPRE..extra_defines..extra_includes..source, {locati}, COMPILER) local defines = parser2:take_lines(CPRE..extra_defines..extra_includes..source, {locati}, COMPILER)
local parser3 = cpp2ffi.Parser() local parser3 = cpp2ffi.Parser()
parser3.getCname = getCname
parser3.cimgui_inherited = dofile([[./output/structs_and_enums.lua]]) parser3.cimgui_inherited = dofile([[./output/structs_and_enums.lua]])
parser3:take_lines(CPRE..extra_defines..extra_includes..source, {locati}, COMPILER) parser3:take_lines(CPRE..extra_defines..extra_includes..source, {locati}, COMPILER)
parser3:do_parse() parser3:do_parse()
@@ -547,9 +553,5 @@ if parser2 then
save_data("./output/impl_definitions.json",json.encode(json_prepare(parser2.defsT),{dict_on_empty={defaults=true}})) save_data("./output/impl_definitions.json",json.encode(json_prepare(parser2.defsT),{dict_on_empty={defaults=true}}))
end end
--]] --]]
-------------------copy C files to repo root
copyfile("./output/cimgui.h", "../cimgui.h")
copyfile("./output/cimgui.cpp", "../cimgui.cpp")
os.remove("./output/cimgui.h")
os.remove("./output/cimgui.cpp")
print"all done!!" print"all done!!"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1576,6 +1576,7 @@
"defaults": {}, "defaults": {},
"funcname": "ImGui_ImplVulkanH_Window", "funcname": "ImGui_ImplVulkanH_Window",
"location": "imgui_impl_vulkan:260", "location": "imgui_impl_vulkan:260",
"namespace": "ImGui_ImplVulkanH_Window",
"ov_cimguiname": "ImGui_ImplVulkanH_Window_ImGui_ImplVulkanH_Window", "ov_cimguiname": "ImGui_ImplVulkanH_Window_ImGui_ImplVulkanH_Window",
"signature": "()", "signature": "()",
"stname": "ImGui_ImplVulkanH_Window" "stname": "ImGui_ImplVulkanH_Window"

View File

@@ -1360,6 +1360,7 @@ local t={
defaults={}, defaults={},
funcname="ImGui_ImplVulkanH_Window", funcname="ImGui_ImplVulkanH_Window",
location="imgui_impl_vulkan:260", location="imgui_impl_vulkan:260",
namespace="ImGui_ImplVulkanH_Window",
ov_cimguiname="ImGui_ImplVulkanH_Window_ImGui_ImplVulkanH_Window", ov_cimguiname="ImGui_ImplVulkanH_Window_ImGui_ImplVulkanH_Window",
signature="()", signature="()",
stname="ImGui_ImplVulkanH_Window"}, stname="ImGui_ImplVulkanH_Window"},

View File

@@ -5762,6 +5762,7 @@
"ImVec2i": true, "ImVec2i": true,
"ImVec4": true "ImVec4": true
}, },
"opaque_structs": [],
"structs": { "structs": {
"ImBitVector": [ "ImBitVector": [
{ {

View File

@@ -4617,6 +4617,7 @@ local t={
ImVec2=true, ImVec2=true,
ImVec2i=true, ImVec2i=true,
ImVec4=true}, ImVec4=true},
opaque_structs={},
structs={ structs={
ImBitVector={ ImBitVector={
[1]={ [1]={