mirror of
https://github.com/cimgui/cimgui.git
synced 2025-08-16 14:28: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)
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"ImBitArrayForNamedKeys": "ImBitArray<ImGuiKey_NamedKey_COUNT,-ImGuiKey_NamedKey_BEGIN>",
|
"ImBitArrayForNamedKeys": "ImBitArray<ImGuiKey_NamedKey_COUNT, -ImGuiKey_NamedKey_BEGIN>",
|
||||||
"ImBitArrayPtr": "ImU32*",
|
"ImBitArrayPtr": "ImU32*",
|
||||||
"ImBitVector": "struct ImBitVector",
|
"ImBitVector": "struct ImBitVector",
|
||||||
"ImColor": "struct ImColor",
|
"ImColor": "struct ImColor",
|
||||||
"ImDrawCallback": "void(*)(const ImDrawList* parent_list,const ImDrawCmd* cmd);",
|
"ImDrawCallback": "void (*)(const ImDrawList* parent_list, const ImDrawCmd* cmd);",
|
||||||
"ImDrawChannel": "struct ImDrawChannel",
|
"ImDrawChannel": "struct ImDrawChannel",
|
||||||
"ImDrawCmd": "struct ImDrawCmd",
|
"ImDrawCmd": "struct ImDrawCmd",
|
||||||
"ImDrawCmdHeader": "struct ImDrawCmdHeader",
|
"ImDrawCmdHeader": "struct ImDrawCmdHeader",
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
"ImGuiConfigFlags": "int",
|
"ImGuiConfigFlags": "int",
|
||||||
"ImGuiContext": "struct ImGuiContext",
|
"ImGuiContext": "struct ImGuiContext",
|
||||||
"ImGuiContextHook": "struct ImGuiContextHook",
|
"ImGuiContextHook": "struct ImGuiContextHook",
|
||||||
"ImGuiContextHookCallback": "void(*)(ImGuiContext* ctx,ImGuiContextHook* hook);",
|
"ImGuiContextHookCallback": "void (*)(ImGuiContext* ctx, ImGuiContextHook* hook);",
|
||||||
"ImGuiDataAuthority": "int",
|
"ImGuiDataAuthority": "int",
|
||||||
"ImGuiDataType": "int",
|
"ImGuiDataType": "int",
|
||||||
"ImGuiDataTypeInfo": "struct ImGuiDataTypeInfo",
|
"ImGuiDataTypeInfo": "struct ImGuiDataTypeInfo",
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
"ImGuiDockNodeSettings": "struct ImGuiDockNodeSettings",
|
"ImGuiDockNodeSettings": "struct ImGuiDockNodeSettings",
|
||||||
"ImGuiDockRequest": "struct ImGuiDockRequest",
|
"ImGuiDockRequest": "struct ImGuiDockRequest",
|
||||||
"ImGuiDragDropFlags": "int",
|
"ImGuiDragDropFlags": "int",
|
||||||
"ImGuiErrorCallback": "void(*)(ImGuiContext* ctx,void* user_data,const char* msg);",
|
"ImGuiErrorCallback": "void (*)(ImGuiContext* ctx, void* user_data, const char* msg);",
|
||||||
"ImGuiErrorRecoveryState": "struct ImGuiErrorRecoveryState",
|
"ImGuiErrorRecoveryState": "struct ImGuiErrorRecoveryState",
|
||||||
"ImGuiFocusRequestFlags": "int",
|
"ImGuiFocusRequestFlags": "int",
|
||||||
"ImGuiFocusScopeData": "struct ImGuiFocusScopeData",
|
"ImGuiFocusScopeData": "struct ImGuiFocusScopeData",
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
"ImGuiInputEventMouseWheel": "struct ImGuiInputEventMouseWheel",
|
"ImGuiInputEventMouseWheel": "struct ImGuiInputEventMouseWheel",
|
||||||
"ImGuiInputEventText": "struct ImGuiInputEventText",
|
"ImGuiInputEventText": "struct ImGuiInputEventText",
|
||||||
"ImGuiInputFlags": "int",
|
"ImGuiInputFlags": "int",
|
||||||
"ImGuiInputTextCallback": "int(*)(ImGuiInputTextCallbackData* data);",
|
"ImGuiInputTextCallback": "int (*)(ImGuiInputTextCallbackData* data);",
|
||||||
"ImGuiInputTextCallbackData": "struct ImGuiInputTextCallbackData",
|
"ImGuiInputTextCallbackData": "struct ImGuiInputTextCallbackData",
|
||||||
"ImGuiInputTextDeactivateData": "struct ImGuiInputTextDeactivateData",
|
"ImGuiInputTextDeactivateData": "struct ImGuiInputTextDeactivateData",
|
||||||
"ImGuiInputTextDeactivatedState": "struct ImGuiInputTextDeactivatedState",
|
"ImGuiInputTextDeactivatedState": "struct ImGuiInputTextDeactivatedState",
|
||||||
@@ -93,8 +93,8 @@
|
|||||||
"ImGuiListClipperData": "struct ImGuiListClipperData",
|
"ImGuiListClipperData": "struct ImGuiListClipperData",
|
||||||
"ImGuiListClipperRange": "struct ImGuiListClipperRange",
|
"ImGuiListClipperRange": "struct ImGuiListClipperRange",
|
||||||
"ImGuiLocEntry": "struct ImGuiLocEntry",
|
"ImGuiLocEntry": "struct ImGuiLocEntry",
|
||||||
"ImGuiMemAllocFunc": "void*(*)(size_t sz,void* user_data);",
|
"ImGuiMemAllocFunc": "void* (*)(size_t sz, void* user_data);",
|
||||||
"ImGuiMemFreeFunc": "void(*)(void* ptr,void* user_data);",
|
"ImGuiMemFreeFunc": "void (*)(void* ptr, void* user_data);",
|
||||||
"ImGuiMenuColumns": "struct ImGuiMenuColumns",
|
"ImGuiMenuColumns": "struct ImGuiMenuColumns",
|
||||||
"ImGuiMetricsConfig": "struct ImGuiMetricsConfig",
|
"ImGuiMetricsConfig": "struct ImGuiMetricsConfig",
|
||||||
"ImGuiMouseButton": "int",
|
"ImGuiMouseButton": "int",
|
||||||
@@ -130,7 +130,7 @@
|
|||||||
"ImGuiSeparatorFlags": "int",
|
"ImGuiSeparatorFlags": "int",
|
||||||
"ImGuiSettingsHandler": "struct ImGuiSettingsHandler",
|
"ImGuiSettingsHandler": "struct ImGuiSettingsHandler",
|
||||||
"ImGuiShrinkWidthItem": "struct ImGuiShrinkWidthItem",
|
"ImGuiShrinkWidthItem": "struct ImGuiShrinkWidthItem",
|
||||||
"ImGuiSizeCallback": "void(*)(ImGuiSizeCallbackData* data);",
|
"ImGuiSizeCallback": "void (*)(ImGuiSizeCallbackData* data);",
|
||||||
"ImGuiSizeCallbackData": "struct ImGuiSizeCallbackData",
|
"ImGuiSizeCallbackData": "struct ImGuiSizeCallbackData",
|
||||||
"ImGuiSliderFlags": "int",
|
"ImGuiSliderFlags": "int",
|
||||||
"ImGuiStackLevelInfo": "struct ImGuiStackLevelInfo",
|
"ImGuiStackLevelInfo": "struct ImGuiStackLevelInfo",
|
||||||
@@ -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"
|
|
||||||
}
|
}
|
@@ -1,9 +1,9 @@
|
|||||||
local defs = {}
|
local defs = {}
|
||||||
defs["ImBitArrayForNamedKeys"] = "ImBitArray<ImGuiKey_NamedKey_COUNT,-ImGuiKey_NamedKey_BEGIN>"
|
defs["ImBitArrayForNamedKeys"] = "ImBitArray<ImGuiKey_NamedKey_COUNT, -ImGuiKey_NamedKey_BEGIN>"
|
||||||
defs["ImBitArrayPtr"] = "ImU32*"
|
defs["ImBitArrayPtr"] = "ImU32*"
|
||||||
defs["ImBitVector"] = "struct ImBitVector"
|
defs["ImBitVector"] = "struct ImBitVector"
|
||||||
defs["ImColor"] = "struct ImColor"
|
defs["ImColor"] = "struct ImColor"
|
||||||
defs["ImDrawCallback"] = "void(*)(const ImDrawList* parent_list,const ImDrawCmd* cmd);"
|
defs["ImDrawCallback"] = "void (*)(const ImDrawList* parent_list, const ImDrawCmd* cmd);"
|
||||||
defs["ImDrawChannel"] = "struct ImDrawChannel"
|
defs["ImDrawChannel"] = "struct ImDrawChannel"
|
||||||
defs["ImDrawCmd"] = "struct ImDrawCmd"
|
defs["ImDrawCmd"] = "struct ImDrawCmd"
|
||||||
defs["ImDrawCmdHeader"] = "struct ImDrawCmdHeader"
|
defs["ImDrawCmdHeader"] = "struct ImDrawCmdHeader"
|
||||||
@@ -39,7 +39,7 @@ defs["ImGuiCond"] = "int"
|
|||||||
defs["ImGuiConfigFlags"] = "int"
|
defs["ImGuiConfigFlags"] = "int"
|
||||||
defs["ImGuiContext"] = "struct ImGuiContext"
|
defs["ImGuiContext"] = "struct ImGuiContext"
|
||||||
defs["ImGuiContextHook"] = "struct ImGuiContextHook"
|
defs["ImGuiContextHook"] = "struct ImGuiContextHook"
|
||||||
defs["ImGuiContextHookCallback"] = "void(*)(ImGuiContext* ctx,ImGuiContextHook* hook);"
|
defs["ImGuiContextHookCallback"] = "void (*)(ImGuiContext* ctx, ImGuiContextHook* hook);"
|
||||||
defs["ImGuiDataAuthority"] = "int"
|
defs["ImGuiDataAuthority"] = "int"
|
||||||
defs["ImGuiDataType"] = "int"
|
defs["ImGuiDataType"] = "int"
|
||||||
defs["ImGuiDataTypeInfo"] = "struct ImGuiDataTypeInfo"
|
defs["ImGuiDataTypeInfo"] = "struct ImGuiDataTypeInfo"
|
||||||
@@ -54,7 +54,7 @@ defs["ImGuiDockNodeFlags"] = "int"
|
|||||||
defs["ImGuiDockNodeSettings"] = "struct ImGuiDockNodeSettings"
|
defs["ImGuiDockNodeSettings"] = "struct ImGuiDockNodeSettings"
|
||||||
defs["ImGuiDockRequest"] = "struct ImGuiDockRequest"
|
defs["ImGuiDockRequest"] = "struct ImGuiDockRequest"
|
||||||
defs["ImGuiDragDropFlags"] = "int"
|
defs["ImGuiDragDropFlags"] = "int"
|
||||||
defs["ImGuiErrorCallback"] = "void(*)(ImGuiContext* ctx,void* user_data,const char* msg);"
|
defs["ImGuiErrorCallback"] = "void (*)(ImGuiContext* ctx, void* user_data, const char* msg);"
|
||||||
defs["ImGuiErrorRecoveryState"] = "struct ImGuiErrorRecoveryState"
|
defs["ImGuiErrorRecoveryState"] = "struct ImGuiErrorRecoveryState"
|
||||||
defs["ImGuiFocusRequestFlags"] = "int"
|
defs["ImGuiFocusRequestFlags"] = "int"
|
||||||
defs["ImGuiFocusScopeData"] = "struct ImGuiFocusScopeData"
|
defs["ImGuiFocusScopeData"] = "struct ImGuiFocusScopeData"
|
||||||
@@ -73,7 +73,7 @@ defs["ImGuiInputEventMouseViewport"] = "struct ImGuiInputEventMouseViewport"
|
|||||||
defs["ImGuiInputEventMouseWheel"] = "struct ImGuiInputEventMouseWheel"
|
defs["ImGuiInputEventMouseWheel"] = "struct ImGuiInputEventMouseWheel"
|
||||||
defs["ImGuiInputEventText"] = "struct ImGuiInputEventText"
|
defs["ImGuiInputEventText"] = "struct ImGuiInputEventText"
|
||||||
defs["ImGuiInputFlags"] = "int"
|
defs["ImGuiInputFlags"] = "int"
|
||||||
defs["ImGuiInputTextCallback"] = "int(*)(ImGuiInputTextCallbackData* data);"
|
defs["ImGuiInputTextCallback"] = "int (*)(ImGuiInputTextCallbackData* data);"
|
||||||
defs["ImGuiInputTextCallbackData"] = "struct ImGuiInputTextCallbackData"
|
defs["ImGuiInputTextCallbackData"] = "struct ImGuiInputTextCallbackData"
|
||||||
defs["ImGuiInputTextDeactivateData"] = "struct ImGuiInputTextDeactivateData"
|
defs["ImGuiInputTextDeactivateData"] = "struct ImGuiInputTextDeactivateData"
|
||||||
defs["ImGuiInputTextDeactivatedState"] = "struct ImGuiInputTextDeactivatedState"
|
defs["ImGuiInputTextDeactivatedState"] = "struct ImGuiInputTextDeactivatedState"
|
||||||
@@ -93,8 +93,8 @@ defs["ImGuiListClipper"] = "struct ImGuiListClipper"
|
|||||||
defs["ImGuiListClipperData"] = "struct ImGuiListClipperData"
|
defs["ImGuiListClipperData"] = "struct ImGuiListClipperData"
|
||||||
defs["ImGuiListClipperRange"] = "struct ImGuiListClipperRange"
|
defs["ImGuiListClipperRange"] = "struct ImGuiListClipperRange"
|
||||||
defs["ImGuiLocEntry"] = "struct ImGuiLocEntry"
|
defs["ImGuiLocEntry"] = "struct ImGuiLocEntry"
|
||||||
defs["ImGuiMemAllocFunc"] = "void*(*)(size_t sz,void* user_data);"
|
defs["ImGuiMemAllocFunc"] = "void* (*)(size_t sz, void* user_data);"
|
||||||
defs["ImGuiMemFreeFunc"] = "void(*)(void* ptr,void* user_data);"
|
defs["ImGuiMemFreeFunc"] = "void (*)(void* ptr, void* user_data);"
|
||||||
defs["ImGuiMenuColumns"] = "struct ImGuiMenuColumns"
|
defs["ImGuiMenuColumns"] = "struct ImGuiMenuColumns"
|
||||||
defs["ImGuiMetricsConfig"] = "struct ImGuiMetricsConfig"
|
defs["ImGuiMetricsConfig"] = "struct ImGuiMetricsConfig"
|
||||||
defs["ImGuiMouseButton"] = "int"
|
defs["ImGuiMouseButton"] = "int"
|
||||||
@@ -130,7 +130,7 @@ defs["ImGuiSelectionUserData"] = "ImS64"
|
|||||||
defs["ImGuiSeparatorFlags"] = "int"
|
defs["ImGuiSeparatorFlags"] = "int"
|
||||||
defs["ImGuiSettingsHandler"] = "struct ImGuiSettingsHandler"
|
defs["ImGuiSettingsHandler"] = "struct ImGuiSettingsHandler"
|
||||||
defs["ImGuiShrinkWidthItem"] = "struct ImGuiShrinkWidthItem"
|
defs["ImGuiShrinkWidthItem"] = "struct ImGuiShrinkWidthItem"
|
||||||
defs["ImGuiSizeCallback"] = "void(*)(ImGuiSizeCallbackData* data);"
|
defs["ImGuiSizeCallback"] = "void (*)(ImGuiSizeCallbackData* data);"
|
||||||
defs["ImGuiSizeCallbackData"] = "struct ImGuiSizeCallbackData"
|
defs["ImGuiSizeCallbackData"] = "struct ImGuiSizeCallbackData"
|
||||||
defs["ImGuiSliderFlags"] = "int"
|
defs["ImGuiSliderFlags"] = "int"
|
||||||
defs["ImGuiStackLevelInfo"] = "struct ImGuiStackLevelInfo"
|
defs["ImGuiStackLevelInfo"] = "struct ImGuiStackLevelInfo"
|
||||||
@@ -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