mirror of
https://github.com/cimgui/cimgui.git
synced 2025-08-13 21:28:30 +01:00
take care of bit fields in struct_and_enums generation.
This commit is contained in:
@@ -109,7 +109,7 @@ end
|
|||||||
local function clean_spaces(cad)
|
local function clean_spaces(cad)
|
||||||
cad = strip(cad)
|
cad = strip(cad)
|
||||||
cad = cad:gsub("%s+"," ") --not more than one space
|
cad = cad:gsub("%s+"," ") --not more than one space
|
||||||
cad = cad:gsub("%s*([%(%),=])%s*","%1") --not spaces with ( , )
|
cad = cad:gsub("%s*([%(%),=:])%s*","%1") --not spaces with ( , ) or ( = ) or ( : )
|
||||||
return cad
|
return cad
|
||||||
end
|
end
|
||||||
function strsplit(str, pat)
|
function strsplit(str, pat)
|
||||||
@@ -915,9 +915,10 @@ function M.Parser()
|
|||||||
local typen,rest = line:match("%s*([^,]+)%s(%S+[,;])")
|
local typen,rest = line:match("%s*([^,]+)%s(%S+[,;])")
|
||||||
--local template_type = typen:match("/%*<(.+)>%*/")
|
--local template_type = typen:match("/%*<(.+)>%*/")
|
||||||
--if template_type then typen = typen:match("(.+)/%*") end
|
--if template_type then typen = typen:match("(.+)/%*") end
|
||||||
if not typen then -- Lets try Type*name
|
if not typen then -- Lets try Type*name
|
||||||
typen,rest = line:match("([^,]+%*)(%S+[,;])")
|
typen,rest = line:match("([^,]+%*)(%S+[,;])")
|
||||||
end
|
end
|
||||||
|
|
||||||
local template_type
|
local template_type
|
||||||
for k,v in pairs(self.templates) do
|
for k,v in pairs(self.templates) do
|
||||||
template_type = typen:match(k.."_(.+)")
|
template_type = typen:match(k.."_(.+)")
|
||||||
@@ -928,7 +929,8 @@ function M.Parser()
|
|||||||
template_type = template_type:gsub("Ptr","%*")
|
template_type = template_type:gsub("Ptr","%*")
|
||||||
end
|
end
|
||||||
for name in rest:gmatch("([^%s,;]+)%s?[,;]") do
|
for name in rest:gmatch("([^%s,;]+)%s?[,;]") do
|
||||||
table.insert(outtab,{type=typen,template_type=template_type,name=name})
|
local namebitfield,bitfield = name:match("([^:]+):(%d+)") --take care of bitfields
|
||||||
|
table.insert(outtab,{type=typen,template_type=template_type,name=namebitfield or name,bitfield=bitfield})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@@ -696,7 +696,7 @@ if structs_and_enums_table["structs"]["Pair"] then
|
|||||||
structs_and_enums_table["structs"]["Pair"][2]["name"] = ""
|
structs_and_enums_table["structs"]["Pair"][2]["name"] = ""
|
||||||
structs_and_enums_table["structs"]["Pair"][2]["type"] = structs_and_enums_table["structs"]["Pair"][2]["type"] .. "}"
|
structs_and_enums_table["structs"]["Pair"][2]["type"] = structs_and_enums_table["structs"]["Pair"][2]["type"] .. "}"
|
||||||
end
|
end
|
||||||
-- 1.72 and after
|
-- union in 1.72 and after
|
||||||
if structs_and_enums_table["structs"]["ImGuiStoragePair"] then
|
if structs_and_enums_table["structs"]["ImGuiStoragePair"] then
|
||||||
structs_and_enums_table["structs"]["ImGuiStoragePair"][2]["name"] = ""
|
structs_and_enums_table["structs"]["ImGuiStoragePair"][2]["name"] = ""
|
||||||
structs_and_enums_table["structs"]["ImGuiStoragePair"][2]["type"] = structs_and_enums_table["structs"]["ImGuiStoragePair"][2]["type"] .. "}"
|
structs_and_enums_table["structs"]["ImGuiStoragePair"][2]["type"] = structs_and_enums_table["structs"]["ImGuiStoragePair"][2]["type"] .. "}"
|
||||||
|
Reference in New Issue
Block a user