From 477f60f82242473d0a01ba053390e1ec8f51612d Mon Sep 17 00:00:00 2001 From: Victor Bombi Date: Mon, 7 Sep 2020 12:28:06 +0200 Subject: [PATCH] cpp2ffi: implement func templates by ftemplate_list --- generator/cpp2ffi.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/generator/cpp2ffi.lua b/generator/cpp2ffi.lua index 81de478..35a202d 100644 --- a/generator/cpp2ffi.lua +++ b/generator/cpp2ffi.lua @@ -1083,7 +1083,17 @@ function M.Parser() namespace = it.parent.name end end - self:parseFunction(stname,it.item,namespace,it.locat) + if it.item:match"^%s*template%s+<" then + local ttype,fun = it.item:match"^%s*template%s+<%s*typename%s+([^>]+)%s*>%s*(.+)$" + if self.ftemplate_list then + for iT,vT in ipairs(self.ftemplate_list[ttype]) do + local funT = fun:gsub(ttype,vT) + self:parseFunction(stname,funT,namespace,it.locat) + end + end + else + self:parseFunction(stname,it.item,namespace,it.locat) + end else print("not processed",it.re_name,it.item:sub(1,20)) end