From 16846a206b7a4d44d84725ec5c5b4517ffe6f766 Mon Sep 17 00:00:00 2001 From: Victor Bombi Date: Sat, 30 May 2020 15:18:38 +0200 Subject: [PATCH] FnPtr changes to FnretvalPtr to allow 2 overloadings with different FnPtr, corrected checking equal ov_cimguiname --- generator/cpp2ffi.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/generator/cpp2ffi.lua b/generator/cpp2ffi.lua index 19cbc57..1f611a1 100644 --- a/generator/cpp2ffi.lua +++ b/generator/cpp2ffi.lua @@ -392,8 +392,10 @@ local function name_overloadsAlgo(v) return aa,bb end local function typetoStr(typ) + --print("typetoStr",typ) --typ = typ:gsub("[^%(%)]+%(%*?(.+)%).+","%1") -- funcs - typ = typ:gsub("[^%(%)]+%(%*?(.+)%).+","FnPtr") + --typ = typ:gsub("[^%(%)]+%(%*?(.+)%).+","FnPtr") + typ = typ:gsub("([^%(%)]+)%(%*?(.+)%).+","Fn%1Ptr") typ = typ:gsub("[%w_]+%[(%d*)%]","arr%1") typ = typ:gsub("%*","Ptr") typ = typ:gsub("void","") @@ -1199,7 +1201,7 @@ function M.Parser() end --check not two names are equal (produced by bad cimguiname_overload) for i=1,#v-1 do - for j=i+1,#v-1 do + for j=i+1,#v do if v[i].ov_cimguiname == v[j].ov_cimguiname then local t,tj = v[i],v[j] print("Error caused by Bad overloading "..t.ov_cimguiname.." of function ",t.funcname,t.signature,"conflicts with ",tj.funcname,tj.signature)