mirror of
https://github.com/cimgui/cimgui.git
synced 2025-08-10 20:08:31 +01:00
cpp2ffi: only generate typedef of structs when it is a vardef_re of struct, location get more defines (not only two words)
This commit is contained in:
@@ -1054,7 +1054,7 @@ function M.Parser()
|
|||||||
if not it.parent then
|
if not it.parent then
|
||||||
table.insert(outtabpre,it.item)
|
table.insert(outtabpre,it.item)
|
||||||
-- add typedef after struct name
|
-- add typedef after struct name
|
||||||
if it.re_name == "vardef_re" and it.item:match"struct" then
|
if it.re_name == "vardef_re" and it.item:match"^%s*struct" then
|
||||||
local stname = it.item:match("struct%s*(%S+)%s*;")
|
local stname = it.item:match("struct%s*(%S+)%s*;")
|
||||||
table.insert(typedefs_table,"typedef struct "..stname.." "..stname..";\n")
|
table.insert(typedefs_table,"typedef struct "..stname.." "..stname..";\n")
|
||||||
self.typedefs_dict[stname]="struct "..stname
|
self.typedefs_dict[stname]="struct "..stname
|
||||||
@@ -1504,7 +1504,7 @@ M.serializeTableF = function(t)
|
|||||||
end
|
end
|
||||||
--iterates lines from a gcc/clang -E in a specific location
|
--iterates lines from a gcc/clang -E in a specific location
|
||||||
local function location(file,locpathT,defines,COMPILER)
|
local function location(file,locpathT,defines,COMPILER)
|
||||||
local define_re = "^#define%s+([^%s]+)%s+([^%s]+)$"
|
local define_re = "^#define%s+([^%s]+)%s+(.+)$"
|
||||||
local number_re = "^-?[0-9]+u*$"
|
local number_re = "^-?[0-9]+u*$"
|
||||||
local hex_re = "0x[0-9a-fA-F]+u*$"
|
local hex_re = "0x[0-9a-fA-F]+u*$"
|
||||||
local location_re
|
local location_re
|
||||||
|
Reference in New Issue
Block a user