mirror of
https://github.com/cimgui/cimgui.git
synced 2025-08-11 04:18:29 +01:00
use loadstring for parsing size of struct members, clean spaces around +
This commit is contained in:
@@ -129,7 +129,7 @@ end
|
||||
local function clean_spaces(cad)
|
||||
cad = strip(cad)
|
||||
cad = cad:gsub("%s+"," ") --not more than one space
|
||||
cad = cad:gsub("%s*([%(%),=:])%s*","%1") --not spaces with ( , ) or ( = ) or ( : )
|
||||
cad = cad:gsub("%s*([%(%),=:%+])%s*","%1") --not spaces with ( , ) or ( = ) or ( : ) or +
|
||||
return cad
|
||||
end
|
||||
|
||||
@@ -1017,7 +1017,6 @@ function M.Parser()
|
||||
if not typen then -- Lets try Type*name
|
||||
typen,rest = line:match("([^,]+%*)(%S+[,;])")
|
||||
end
|
||||
|
||||
local template_type
|
||||
for k,v in pairs(self.templates) do
|
||||
template_type = typen:match(k.."_(.+)")
|
||||
@@ -1138,13 +1137,13 @@ function M.Parser()
|
||||
t.size = tonumber(val)
|
||||
elseif allenums[val] then
|
||||
t.size = allenums[val]
|
||||
elseif val:match"%+" then
|
||||
local s1,s2 = val:match("(%d+)%s*%+%s*(%d+)")
|
||||
t.size = s1+s2
|
||||
else
|
||||
print("Error size is",val)
|
||||
local f,err = loadstring("estevalor="..val)
|
||||
if not f then print("error on loadstring",err,"with val:",val) end
|
||||
f()
|
||||
t.size = estevalor
|
||||
end
|
||||
assert(t.size)
|
||||
assert(t.size,val)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@@ -3796,7 +3796,7 @@
|
||||
},
|
||||
{
|
||||
"name": "TempBuffer[1024*3+1]",
|
||||
"size": 4,
|
||||
"size": 3073,
|
||||
"type": "char"
|
||||
}
|
||||
],
|
||||
|
@@ -2940,7 +2940,7 @@ defs["structs"]["ImGuiContext"][173]["name"] = "WantTextInputNextFrame"
|
||||
defs["structs"]["ImGuiContext"][173]["type"] = "int"
|
||||
defs["structs"]["ImGuiContext"][174] = {}
|
||||
defs["structs"]["ImGuiContext"][174]["name"] = "TempBuffer[1024*3+1]"
|
||||
defs["structs"]["ImGuiContext"][174]["size"] = 4
|
||||
defs["structs"]["ImGuiContext"][174]["size"] = 3073
|
||||
defs["structs"]["ImGuiContext"][174]["type"] = "char"
|
||||
defs["structs"]["ImGuiDataTypeInfo"] = {}
|
||||
defs["structs"]["ImGuiDataTypeInfo"][1] = {}
|
||||
|
Reference in New Issue
Block a user