mirror of
https://github.com/cimgui/cimgui.git
synced 2025-08-14 05:38:29 +01:00
cpp2ffi: ImStr -> ImStrv
This commit is contained in:
@@ -503,7 +503,7 @@ local function typetoStr(typ)
|
|||||||
typ = typ:gsub("float","Float")
|
typ = typ:gsub("float","Float")
|
||||||
typ = typ:gsub("uInt","Uint")
|
typ = typ:gsub("uInt","Uint")
|
||||||
typ = typ:gsub("ImGui","")
|
typ = typ:gsub("ImGui","")
|
||||||
typ = typ:gsub("ImStr","STR")
|
--typ = typ:gsub("ImStr","STR")
|
||||||
typ = typ:gsub("Im","")
|
typ = typ:gsub("Im","")
|
||||||
typ = typ:gsub("[<>]","")
|
typ = typ:gsub("[<>]","")
|
||||||
return typ
|
return typ
|
||||||
@@ -792,7 +792,7 @@ local function ADDIMSTR_S(FP)
|
|||||||
--if isIMSTR return generate _S version
|
--if isIMSTR return generate _S version
|
||||||
local isIMSTR = false
|
local isIMSTR = false
|
||||||
for i,arg in ipairs(defT.argsT) do
|
for i,arg in ipairs(defT.argsT) do
|
||||||
if arg.type == "ImStr" then isIMSTR=true;break end
|
if arg.type == "ImStrv" then isIMSTR=true;break end
|
||||||
end
|
end
|
||||||
--if defT.ret=="ImVec2" or defT.ret=="ImVec4" or defT.ret=="ImColor" then
|
--if defT.ret=="ImVec2" or defT.ret=="ImVec4" or defT.ret=="ImColor" then
|
||||||
--if isIMSTR then print(t.cimguiname,defT.ov_cimguiname,defT.argsoriginal,"isIMSTR") end
|
--if isIMSTR then print(t.cimguiname,defT.ov_cimguiname,defT.argsoriginal,"isIMSTR") end
|
||||||
@@ -806,7 +806,7 @@ local function ADDIMSTR_S(FP)
|
|||||||
--then argsT table
|
--then argsT table
|
||||||
defT2.argsT = {}
|
defT2.argsT = {}
|
||||||
for k,v in ipairs(defT.argsT) do
|
for k,v in ipairs(defT.argsT) do
|
||||||
local typ = v.type == "ImStr" and "const char*" or v.type
|
local typ = v.type == "ImStrv" and "const char*" or v.type
|
||||||
table.insert(defT2.argsT,{type=typ,name=v.name})
|
table.insert(defT2.argsT,{type=typ,name=v.name})
|
||||||
end
|
end
|
||||||
--defaults table
|
--defaults table
|
||||||
@@ -814,13 +814,13 @@ local function ADDIMSTR_S(FP)
|
|||||||
for k,v in pairs(defT.defaults) do
|
for k,v in pairs(defT.defaults) do
|
||||||
defT2.defaults[k] = v
|
defT2.defaults[k] = v
|
||||||
end
|
end
|
||||||
defT2.args = defT2.args:gsub("ImStr","const char*")
|
defT2.args = defT2.args:gsub("ImStrv","const char*")
|
||||||
--recreate call_args for wrapping into ImStr
|
--recreate call_args for wrapping into ImStrv
|
||||||
local caar
|
local caar
|
||||||
if #defT.argsT > 0 then
|
if #defT.argsT > 0 then
|
||||||
caar = "("
|
caar = "("
|
||||||
for i,v in ipairs(defT.argsT) do
|
for i,v in ipairs(defT.argsT) do
|
||||||
local name = v.name --v.type == "ImStr" and "ImStr("..v.name..")" or v.name --wrap
|
local name = v.name
|
||||||
if v.ret then --function pointer
|
if v.ret then --function pointer
|
||||||
caar = caar .. name .. ","
|
caar = caar .. name .. ","
|
||||||
else
|
else
|
||||||
@@ -832,9 +832,9 @@ local function ADDIMSTR_S(FP)
|
|||||||
else
|
else
|
||||||
caar = "()"
|
caar = "()"
|
||||||
end
|
end
|
||||||
defT2.call_args = caar --:gsub("ImStr%(([^%(%)]+)%)","%1") --unwrap
|
defT2.call_args = caar
|
||||||
------------------
|
------------------
|
||||||
defT2.signature = defT.signature:gsub("ImStr","const char*") --.."_S"
|
defT2.signature = defT.signature:gsub("ImStrv","const char*") --.."_S"
|
||||||
defT2.ov_cimguiname = defT2.ov_cimguiname .. "_Strv"
|
defT2.ov_cimguiname = defT2.ov_cimguiname .. "_Strv"
|
||||||
defT2.isIMSTR_S = 1
|
defT2.isIMSTR_S = 1
|
||||||
-- check there is not an equal version in imgui_stname
|
-- check there is not an equal version in imgui_stname
|
||||||
|
Reference in New Issue
Block a user