From c46a2eded63f93e7e847791f54de90f7e8f27364 Mon Sep 17 00:00:00 2001 From: Victor Bombi Date: Tue, 27 Oct 2020 15:03:53 +0100 Subject: [PATCH] cpp2ffi: parseFunction receives nested namespace name (ImNodes needs it) --- generator/cpp2ffi.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/generator/cpp2ffi.lua b/generator/cpp2ffi.lua index 83b5084..6f1add9 100644 --- a/generator/cpp2ffi.lua +++ b/generator/cpp2ffi.lua @@ -1164,6 +1164,15 @@ function M.Parser() end return parnam end + local function get_parents_nameC(it) + local parnam = "" + while it.parent do + parnam = it.parent.name.."_"..parnam + it = it.parent + end + if parnam:sub(-1)=="_" then parnam = parnam:sub(1,-2) end + return parnam + end function par:gen_structs_and_enums() local outtab = {} local outtabpre = {} @@ -1228,7 +1237,7 @@ function M.Parser() if it.parent.re_name == "struct_re" or it.parent.re_name == "typedef_st_re" then stname = it.parent.name elseif it.parent.re_name == "namespace_re" then - namespace = it.parent.name + namespace = get_parents_nameC(it) --it.parent.name end end if it.item:match"^%s*template%s+<" then