get template typenames

This commit is contained in:
sonoro1234
2019-02-12 18:52:00 +01:00
parent 0d864f94bd
commit 490effa341
2 changed files with 96 additions and 7 deletions

View File

@@ -230,13 +230,14 @@ local function func_header_generate(FP)
table.insert(outtab,"#endif //CIMGUI_DEFINE_ENUMS_AND_STRUCTS\n")
for _,t in ipairs(FP.funcdefs) do
if t.stname=="ImVector" then print(t.cimguiname) end
--if t.stname=="ImVector" then print(t.cimguiname) end
if t.cimguiname then
local cimf = FP.defsT[t.cimguiname]
local def = cimf[t.signature]
assert(def,t.signature..t.cimguiname)
local manual = FP.get_manuals(def)
if not manual then
--if FP.templates[t.stname] then print(t.cimguiname) end
local addcoment = def.comment or ""
local empty = def.args:match("^%(%)") --no args
if def.constructor then
@@ -245,7 +246,8 @@ local function func_header_generate(FP)
elseif def.destructor then
table.insert(outtab,"CIMGUI_API void "..def.ov_cimguiname..def.args..";"..addcoment.."\n")
else --not constructor
if t.stname=="ImVector" then print("2",t.cimguiname) end
--if t.stname=="ImVector" then print("2",t.cimguiname) end
if def.stname == "" then --ImGui namespace or top level
table.insert(outtab,"CIMGUI_API "..def.ret.." ".. def.ov_cimguiname ..(empty and "(void)" or def.args)..";"..addcoment.."\n")
else
@@ -441,11 +443,13 @@ local function generate_templates(code,templates)
end
--generate cimgui.cpp cimgui.h
local function cimgui_generation(parser)
cpp2ffi.prtable(parser.templates)
cpp2ffi.prtable(parser.typenames)
local hstrfile = read_data"./cimgui_template.h"
local outpre,outpost = parser:gen_structs_and_enums()
--parser.templates get completely defined here
--cpp2ffi.prtable(parser.templates)
local outtab = {}
generate_templates(outtab,parser.templates)
local cstructsstr = outpre..table.concat(outtab,"")..outpost