mirror of
https://github.com/cimgui/cimgui.git
synced 2025-08-14 05:38:29 +01:00
cpp2ffi: move typedefs_dict to gen_structs_and_enums_table
This commit is contained in:
@@ -1292,7 +1292,7 @@ function M.Parser()
|
|||||||
self.typedefs_dict[key] = linet
|
self.typedefs_dict[key] = linet
|
||||||
elseif not line:match"typedef%s*struct" then --discard typedef struct
|
elseif not line:match"typedef%s*struct" then --discard typedef struct
|
||||||
print("typedef not found")
|
print("typedef not found")
|
||||||
print(key,value,line)
|
print(key,value,line,cdef[1],cdef[2])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1366,7 +1366,7 @@ function M.Parser()
|
|||||||
return table.concat(txtclean)
|
return table.concat(txtclean)
|
||||||
end
|
end
|
||||||
function par:parseItems()
|
function par:parseItems()
|
||||||
self:initTypedefsDict()
|
--self:initTypedefsDict()
|
||||||
|
|
||||||
self.linenumdict = {}
|
self.linenumdict = {}
|
||||||
local cdefs2 = {}
|
local cdefs2 = {}
|
||||||
@@ -1911,7 +1911,7 @@ function M.Parser()
|
|||||||
function par:gen_structs_and_enums_table()
|
function par:gen_structs_and_enums_table()
|
||||||
print"--------------gen_structs_and_enums_table"
|
print"--------------gen_structs_and_enums_table"
|
||||||
local outtab = {enums={},structs={},locations={},enumtypes={},struct_comments={},enum_comments={}}
|
local outtab = {enums={},structs={},locations={},enumtypes={},struct_comments={},enum_comments={}}
|
||||||
self.typedefs_table = {}
|
--self.typedefs_table = {}
|
||||||
local enumsordered = {}
|
local enumsordered = {}
|
||||||
unnamed_enum_counter = 0
|
unnamed_enum_counter = 0
|
||||||
self.templated_structs = {}
|
self.templated_structs = {}
|
||||||
@@ -1934,7 +1934,31 @@ function M.Parser()
|
|||||||
if it.re_name == "typedef_re" and not it.parent then
|
if it.re_name == "typedef_re" and not it.parent then
|
||||||
local typedefdef,typedefname = it.item:match"typedef(.+)%s([^%s;]+);$"
|
local typedefdef,typedefname = it.item:match"typedef(.+)%s([^%s;]+);$"
|
||||||
typedefname = strip(typedefname)
|
typedefname = strip(typedefname)
|
||||||
self.typedefs_table[typedefname] = strip(typedefdef)
|
--self.typedefs_table[typedefname] = strip(typedefdef)
|
||||||
|
self.typedefs_dict[typedefname] = strip(typedefdef)
|
||||||
|
elseif it.re_name == "functypedef_re" then
|
||||||
|
-- "^\n*%s*(typedef[%w%s%*_]+%([^*]*%*?%s*[%w_]+%s*%)%s*%b()%s*;)"
|
||||||
|
local key = it.item:match("%(%*([%w_]+)%)%([^%(%)]*%)")
|
||||||
|
if key then
|
||||||
|
local linet = it.item
|
||||||
|
linet = linet:gsub("[\n%s]+typedef ","")
|
||||||
|
linet = linet:gsub("%(%*("..key..")%)","(*)")
|
||||||
|
self.typedefs_dict[key] = linet
|
||||||
|
--print("functypedef_re",1,linet)--,clean_functypedef(line))
|
||||||
|
else
|
||||||
|
--try function typedef
|
||||||
|
key = it.item:match("%(([%w_]+)%)%([^%(%)]*%)")
|
||||||
|
if key then
|
||||||
|
local linet = it.item
|
||||||
|
linet = linet:gsub("typedef ","")
|
||||||
|
linet = linet:gsub("%(("..key..")%)","()")
|
||||||
|
self.typedefs_dict[key] = linet
|
||||||
|
print("functypedef_re",2, it.item)
|
||||||
|
else
|
||||||
|
print("func typedef not found")
|
||||||
|
print(it.item)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
elseif it.re_name == "enum_re" then
|
elseif it.re_name == "enum_re" then
|
||||||
enums_for_table(it, outtab, enumsordered)
|
enums_for_table(it, outtab, enumsordered)
|
||||||
|
@@ -201,8 +201,5 @@
|
|||||||
"ImWchar": "ImWchar16",
|
"ImWchar": "ImWchar16",
|
||||||
"ImWchar16": "unsigned short",
|
"ImWchar16": "unsigned short",
|
||||||
"ImWchar32": "unsigned int",
|
"ImWchar32": "unsigned int",
|
||||||
"STB_TexteditState": "struct STB_TexteditState",
|
"STB_TexteditState": "struct STB_TexteditState"
|
||||||
"const_iterator": "const value_type*",
|
|
||||||
"iterator": "value_type*",
|
|
||||||
"value_type": "T"
|
|
||||||
}
|
}
|
@@ -202,8 +202,5 @@ defs["ImWchar"] = "ImWchar16"
|
|||||||
defs["ImWchar16"] = "unsigned short"
|
defs["ImWchar16"] = "unsigned short"
|
||||||
defs["ImWchar32"] = "unsigned int"
|
defs["ImWchar32"] = "unsigned int"
|
||||||
defs["STB_TexteditState"] = "struct STB_TexteditState"
|
defs["STB_TexteditState"] = "struct STB_TexteditState"
|
||||||
defs["const_iterator"] = "const value_type*"
|
|
||||||
defs["iterator"] = "value_type*"
|
|
||||||
defs["value_type"] = "T"
|
|
||||||
|
|
||||||
return defs
|
return defs
|
Reference in New Issue
Block a user