From f1b55d57e5b8f24cd4f56036665f593c39d8a1af Mon Sep 17 00:00:00 2001 From: sonoro1234 Date: Thu, 4 Oct 2018 17:27:20 +0200 Subject: [PATCH] check arg detection failures --- generator/generator.lua | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/generator/generator.lua b/generator/generator.lua index 98c89a6..5794e0b 100644 --- a/generator/generator.lua +++ b/generator/generator.lua @@ -1125,7 +1125,31 @@ local function func_implementation(FP) --cppfile:close() return table.concat(outtab) end - +--only basic ending +local c_types = { + ["char"]=true, + ["int"]=true, + ["float"]=true, + ["double"]=true, + ["short"]=true, + ["long"]=true, + ["signed"]=true, + ["unsigned"]=true, + ["size_t"]=true, + ["ptrdiff_t"]=true, +} +local function check_arg_detection(fdefs,typedefs) + for k,defT in pairs(fdefs) do + for i,def in ipairs(defT) do + for j,arg in ipairs(def.argsT) do + --check name is not type, which happens in declaration without name + if c_types[arg.name] or typedefs[arg.name] then + print("bad argument name",arg.name, "in",def.funcname,def.args) + end + end + end + end +end --generate cimgui.cpp cimgui.h and auto versions depending on postfix local function cimgui_generation(postfix,STP,FP) --merge it in cimgui_template.h to cimgui.h @@ -1197,7 +1221,8 @@ local ovstr = pFP:compute_overloads() ADDnonUDT(pFP) save_data("./generated/overloads.txt",ovstr) typedefs_dict2 = cimgui_generation("_auto",pSTP,pFP) - +--check arg detection failure if no name in function declaration +check_arg_detection(pFP.defsT,typedefs_dict2) end ----------save fundefs in definitions.lua for using in bindings