diff --git a/generator/generator.lua b/generator/generator.lua index a7f49db..f76471e 100644 --- a/generator/generator.lua +++ b/generator/generator.lua @@ -180,32 +180,24 @@ end local table_do_sorted = cpp2ffi.table_do_sorted local function generate_templates(code,codeimpool,templates) 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 - 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") - --end) - end + end) elseif ttype == "ImPool" then --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 ImPool_"..newte.." {ImVector_"..te.." Buf;ImGuiStorage Map;ImPoolIdx FreeIdx;} ImPool_"..newte..";\n") - --end) - end + end) 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 ImChunkStream_"..newte.." {ImVector_"..te.." Buf;} ImChunkStream_"..newte..";\n") - --end) - end + end) end - --end) - end + end) end --generate cimgui.cpp cimgui.h local function cimgui_generation(parser)