mirror of
https://github.com/cimgui/cimgui.git
synced 2025-08-11 12:18:30 +01:00
generator.lua: generate_templates with table_do_sorted for output consistency
This commit is contained in:
@@ -180,32 +180,24 @@ end
|
|||||||
local table_do_sorted = cpp2ffi.table_do_sorted
|
local table_do_sorted = cpp2ffi.table_do_sorted
|
||||||
local function generate_templates(code,codeimpool,templates)
|
local function generate_templates(code,codeimpool,templates)
|
||||||
table.insert(code,"\n"..[[typedef struct ImVector{int Size;int Capacity;void* Data;} ImVector;]].."\n")
|
table.insert(code,"\n"..[[typedef struct ImVector{int Size;int Capacity;void* Data;} ImVector;]].."\n")
|
||||||
for ttype,v in pairs(templates) do
|
table_do_sorted(templates , function (ttype, v)
|
||||||
--table_do_sorted(templates , function (ttype, v)
|
|
||||||
if ttype == "ImVector" then
|
if ttype == "ImVector" then
|
||||||
for te,newte in pairs(v) do
|
table_do_sorted(v, function(te,newte)
|
||||||
--table_do_sorted(v, function(te,newte)
|
|
||||||
table.insert(code,"typedef struct ImVector_"..newte.." {int Size;int Capacity;"..te.."* Data;} ImVector_"..newte..";\n")
|
table.insert(code,"typedef struct ImVector_"..newte.." {int Size;int Capacity;"..te.."* Data;} ImVector_"..newte..";\n")
|
||||||
--end)
|
end)
|
||||||
end
|
|
||||||
elseif ttype == "ImPool" then
|
elseif ttype == "ImPool" then
|
||||||
--declare ImGuiStorage
|
--declare ImGuiStorage
|
||||||
for te,newte in pairs(v) do
|
table_do_sorted(v, function(te, newte)
|
||||||
--table_do_sorted(v, function(te, newte)
|
|
||||||
table.insert(codeimpool,"typedef struct ImVector_"..newte.." {int Size;int Capacity;"..te.."* Data;} ImVector_"..newte..";\n")
|
table.insert(codeimpool,"typedef struct ImVector_"..newte.." {int Size;int Capacity;"..te.."* Data;} ImVector_"..newte..";\n")
|
||||||
table.insert(codeimpool,"typedef struct ImPool_"..newte.." {ImVector_"..te.." Buf;ImGuiStorage Map;ImPoolIdx FreeIdx;} ImPool_"..newte..";\n")
|
table.insert(codeimpool,"typedef struct ImPool_"..newte.." {ImVector_"..te.." Buf;ImGuiStorage Map;ImPoolIdx FreeIdx;} ImPool_"..newte..";\n")
|
||||||
--end)
|
end)
|
||||||
end
|
|
||||||
elseif ttype == "ImChunkStream" then
|
elseif ttype == "ImChunkStream" then
|
||||||
for te,newte in pairs(v) do
|
table_do_sorted(v, function(te,newte)
|
||||||
--table_do_sorted(v, function(te,newte)
|
|
||||||
table.insert(code,"typedef struct ImVector_"..newte.." {int Size;int Capacity;"..te.."* Data;} ImVector_"..newte..";\n")
|
table.insert(code,"typedef struct ImVector_"..newte.." {int Size;int Capacity;"..te.."* Data;} ImVector_"..newte..";\n")
|
||||||
table.insert(code,"typedef struct ImChunkStream_"..newte.." {ImVector_"..te.." Buf;} ImChunkStream_"..newte..";\n")
|
table.insert(code,"typedef struct ImChunkStream_"..newte.." {ImVector_"..te.." Buf;} ImChunkStream_"..newte..";\n")
|
||||||
--end)
|
end)
|
||||||
end
|
|
||||||
end
|
|
||||||
--end)
|
|
||||||
end
|
end
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
--generate cimgui.cpp cimgui.h
|
--generate cimgui.cpp cimgui.h
|
||||||
local function cimgui_generation(parser)
|
local function cimgui_generation(parser)
|
||||||
|
Reference in New Issue
Block a user