mirror of
https://github.com/cimgui/cimgui.git
synced 2025-08-10 20:08:31 +01:00
add typedef struct any any;
This commit is contained in:
@@ -1 +1 @@
|
||||
{"ImDrawCornerFlags":"int","ImWchar":"unsigned short","ImGuiColumnsFlags":"int","ImGuiTextEditCallback":"int(*)(ImGuiTextEditCallbackData *data);","ImGuiTreeNodeFlags":"int","ImGuiFocusedFlags":"int","ImGuiSizeCallback":"void(*)(ImGuiSizeCallbackData* data);","ImU64":"unsigned long long","ImS64":"signed long long","ImDrawListFlags":"int","ImGuiBackendFlags":"int","ImGuiMouseCursor":"int","ImDrawIdx":"unsigned short","ImGuiColorEditFlags":"int","ImDrawCallback":"void(*)(const ImDrawList* parent_list,const ImDrawCmd* cmd);","const_iterator":"const value_type*","ImGuiDir":"int","ImGuiSelectableFlags":"int","value_type":"T","ImGuiCond":"int","ImU32":"unsigned int","ImS32":"signed int","ImGuiDragDropFlags":"int","ImGuiID":"unsigned int","ImGuiNavInput":"int","ImGuiCol":"int","ImTextureID":"void*","ImGuiStyleVar":"int","ImFontAtlasFlags":"int","ImGuiConfigFlags":"int","ImGuiDataType":"int","ImGuiInputTextFlags":"int","iterator":"value_type*","ImGuiKey":"int","ImGuiHoveredFlags":"int","ImGuiWindowFlags":"int","ImGuiComboFlags":"int"}
|
||||
{"ImGuiColumnsFlags":"int","ImFontConfig":"struct ImFontConfig","ImS32":"signed int","ImGuiTreeNodeFlags":"int","ImGuiFocusedFlags":"int","ImGuiHoveredFlags":"int","ImU64":"unsigned long long","ImGuiID":"unsigned int","ImGuiStyle":"struct ImGuiStyle","ImDrawData":"struct ImDrawData","ImDrawListFlags":"int","ImGuiBackendFlags":"int","ImDrawList":"struct ImDrawList","ImDrawListSharedData":"struct ImDrawListSharedData","ImGuiColorEditFlags":"int","ImGuiDir":"int","ImFontAtlas":"struct ImFontAtlas","ImGuiCol":"int","ImGuiOnceUponAFrame":"struct ImGuiOnceUponAFrame","value_type":"T","iterator":"value_type*","ImGuiTextFilter":"struct ImGuiTextFilter","ImDrawIdx":"unsigned short","ImGuiComboFlags":"int","ImDrawCornerFlags":"int","ImWchar":"unsigned short","const_iterator":"const value_type*","ImDrawVert":"struct ImDrawVert","GlyphRangesBuilder":"struct GlyphRangesBuilder","ImGuiTextEditCallback":"int(*)(ImGuiTextEditCallbackData *data);","ImVec4":"struct ImVec4","ImGuiSizeCallback":"void(*)(ImGuiSizeCallbackData* data);","ImGuiConfigFlags":"int","ImGuiTextBuffer":"struct ImGuiTextBuffer","ImGuiContext":"struct ImGuiContext","ImColor":"struct ImColor","ImGuiTextEditCallbackData":"struct ImGuiTextEditCallbackData","ImVec2":"struct ImVec2","ImFontGlyph":"struct ImFontGlyph","Pair":"struct Pair","ImGuiWindowFlags":"int","ImGuiKey":"int","ImGuiListClipper":"struct ImGuiListClipper","ImGuiInputTextFlags":"int","ImDrawChannel":"struct ImDrawChannel","ImGuiDataType":"int","ImGuiStorage":"struct ImGuiStorage","ImGuiCond":"int","ImU32":"unsigned int","ImGuiStyleVar":"int","ImGuiSelectableFlags":"int","ImFont":"struct ImFont","ImGuiNavInput":"int","ImGuiIO":"struct ImGuiIO","ImTextureID":"void*","TextRange":"struct TextRange","ImGuiMouseCursor":"int","CustomRect":"struct CustomRect","ImFontAtlasFlags":"int","ImGuiPayload":"struct ImGuiPayload","ImDrawCmd":"struct ImDrawCmd","ImGuiSizeCallbackData":"struct ImGuiSizeCallbackData","ImDrawCallback":"void(*)(const ImDrawList* parent_list,const ImDrawCmd* cmd);","ImGuiDragDropFlags":"int","ImS64":"signed long long"}
|
@@ -1,40 +1,68 @@
|
||||
local defs = {}
|
||||
defs["ImDrawCornerFlags"] = "int"
|
||||
defs["ImWchar"] = "unsigned short"
|
||||
defs["ImGuiColumnsFlags"] = "int"
|
||||
defs["ImGuiTextEditCallback"] = "int(*)(ImGuiTextEditCallbackData *data);"
|
||||
defs["ImFontConfig"] = "struct ImFontConfig"
|
||||
defs["ImS32"] = "signed int"
|
||||
defs["ImGuiTreeNodeFlags"] = "int"
|
||||
defs["ImGuiFocusedFlags"] = "int"
|
||||
defs["ImGuiSizeCallback"] = "void(*)(ImGuiSizeCallbackData* data);"
|
||||
defs["ImGuiHoveredFlags"] = "int"
|
||||
defs["ImU64"] = "unsigned long long"
|
||||
defs["ImS64"] = "signed long long"
|
||||
defs["ImGuiID"] = "unsigned int"
|
||||
defs["ImGuiStyle"] = "struct ImGuiStyle"
|
||||
defs["ImDrawData"] = "struct ImDrawData"
|
||||
defs["ImDrawListFlags"] = "int"
|
||||
defs["ImGuiBackendFlags"] = "int"
|
||||
defs["ImGuiMouseCursor"] = "int"
|
||||
defs["ImDrawIdx"] = "unsigned short"
|
||||
defs["ImDrawList"] = "struct ImDrawList"
|
||||
defs["ImDrawListSharedData"] = "struct ImDrawListSharedData"
|
||||
defs["ImGuiColorEditFlags"] = "int"
|
||||
defs["ImDrawCallback"] = "void(*)(const ImDrawList* parent_list,const ImDrawCmd* cmd);"
|
||||
defs["const_iterator"] = "const value_type*"
|
||||
defs["ImGuiDir"] = "int"
|
||||
defs["ImGuiSelectableFlags"] = "int"
|
||||
defs["ImFontAtlas"] = "struct ImFontAtlas"
|
||||
defs["ImGuiCol"] = "int"
|
||||
defs["ImGuiOnceUponAFrame"] = "struct ImGuiOnceUponAFrame"
|
||||
defs["value_type"] = "T"
|
||||
defs["iterator"] = "value_type*"
|
||||
defs["ImGuiTextFilter"] = "struct ImGuiTextFilter"
|
||||
defs["ImDrawIdx"] = "unsigned short"
|
||||
defs["ImGuiComboFlags"] = "int"
|
||||
defs["ImDrawCornerFlags"] = "int"
|
||||
defs["ImWchar"] = "unsigned short"
|
||||
defs["const_iterator"] = "const value_type*"
|
||||
defs["ImDrawVert"] = "struct ImDrawVert"
|
||||
defs["GlyphRangesBuilder"] = "struct GlyphRangesBuilder"
|
||||
defs["ImGuiTextEditCallback"] = "int(*)(ImGuiTextEditCallbackData *data);"
|
||||
defs["ImVec4"] = "struct ImVec4"
|
||||
defs["ImGuiSizeCallback"] = "void(*)(ImGuiSizeCallbackData* data);"
|
||||
defs["ImGuiConfigFlags"] = "int"
|
||||
defs["ImGuiTextBuffer"] = "struct ImGuiTextBuffer"
|
||||
defs["ImGuiContext"] = "struct ImGuiContext"
|
||||
defs["ImColor"] = "struct ImColor"
|
||||
defs["ImGuiTextEditCallbackData"] = "struct ImGuiTextEditCallbackData"
|
||||
defs["ImVec2"] = "struct ImVec2"
|
||||
defs["ImFontGlyph"] = "struct ImFontGlyph"
|
||||
defs["Pair"] = "struct Pair"
|
||||
defs["ImGuiWindowFlags"] = "int"
|
||||
defs["ImGuiKey"] = "int"
|
||||
defs["ImGuiListClipper"] = "struct ImGuiListClipper"
|
||||
defs["ImGuiInputTextFlags"] = "int"
|
||||
defs["ImDrawChannel"] = "struct ImDrawChannel"
|
||||
defs["ImGuiDataType"] = "int"
|
||||
defs["ImGuiStorage"] = "struct ImGuiStorage"
|
||||
defs["ImGuiCond"] = "int"
|
||||
defs["ImU32"] = "unsigned int"
|
||||
defs["ImS32"] = "signed int"
|
||||
defs["ImGuiDragDropFlags"] = "int"
|
||||
defs["ImGuiID"] = "unsigned int"
|
||||
defs["ImGuiNavInput"] = "int"
|
||||
defs["ImGuiCol"] = "int"
|
||||
defs["ImTextureID"] = "void*"
|
||||
defs["ImGuiStyleVar"] = "int"
|
||||
defs["ImGuiSelectableFlags"] = "int"
|
||||
defs["ImFont"] = "struct ImFont"
|
||||
defs["ImGuiNavInput"] = "int"
|
||||
defs["ImGuiIO"] = "struct ImGuiIO"
|
||||
defs["ImTextureID"] = "void*"
|
||||
defs["TextRange"] = "struct TextRange"
|
||||
defs["ImGuiMouseCursor"] = "int"
|
||||
defs["CustomRect"] = "struct CustomRect"
|
||||
defs["ImFontAtlasFlags"] = "int"
|
||||
defs["ImGuiConfigFlags"] = "int"
|
||||
defs["ImGuiDataType"] = "int"
|
||||
defs["ImGuiInputTextFlags"] = "int"
|
||||
defs["iterator"] = "value_type*"
|
||||
defs["ImGuiKey"] = "int"
|
||||
defs["ImGuiHoveredFlags"] = "int"
|
||||
defs["ImGuiWindowFlags"] = "int"
|
||||
defs["ImGuiComboFlags"] = "int"
|
||||
defs["ImGuiPayload"] = "struct ImGuiPayload"
|
||||
defs["ImDrawCmd"] = "struct ImDrawCmd"
|
||||
defs["ImGuiSizeCallbackData"] = "struct ImGuiSizeCallbackData"
|
||||
defs["ImDrawCallback"] = "void(*)(const ImDrawList* parent_list,const ImDrawCmd* cmd);"
|
||||
defs["ImGuiDragDropFlags"] = "int"
|
||||
defs["ImS64"] = "signed long long"
|
||||
|
||||
return defs
|
@@ -172,7 +172,13 @@ local function serializeTable(name, value, saved)
|
||||
|
||||
return table.concat(string_table)
|
||||
end
|
||||
|
||||
--merge tables
|
||||
function mergeT(t1,t2)
|
||||
for k,v in pairs(t2) do
|
||||
t1[k] = v
|
||||
end
|
||||
return t1
|
||||
end
|
||||
local function save_data(filename,...)
|
||||
local file = io.open(filename,"w")
|
||||
for i=1, select('#', ...) do
|
||||
@@ -649,6 +655,7 @@ local function gen_structs_and_enums(cdefs)
|
||||
local structnames = {}
|
||||
local innerstructs = {}
|
||||
local typedefs_table = {}
|
||||
local typedefs_dict = {}
|
||||
|
||||
local outtab = {}
|
||||
-- Output the file
|
||||
@@ -709,6 +716,7 @@ typedef struct ImVector ImVector;]])
|
||||
local struct_closed_name = line:match(struct_closed_re)
|
||||
if struct_closed_name then
|
||||
table.insert(typedefs_table,"typedef struct "..struct_closed_name.." "..struct_closed_name..";\n")
|
||||
typedefs_dict[struct_closed_name] = "struct "..struct_closed_name
|
||||
end
|
||||
end
|
||||
|
||||
@@ -724,12 +732,14 @@ typedef struct ImVector ImVector;]])
|
||||
local structname = structnames[#structnames]
|
||||
--st[#st + 1] = string.format("typedef struct %s %s;\n",structname,structname)
|
||||
table.insert(typedefs_table,string.format("typedef struct %s %s;\n",structname,structname))
|
||||
typedefs_dict[structname] = "struct "..structname
|
||||
structnames[#structnames] = nil
|
||||
end
|
||||
elseif line:match(struct_closing_re) and not line:match(struct_op_close_re) then
|
||||
local structname = structnames[#structnames]
|
||||
--table.insert(outtab,"typedef struct "..structname.." "..structname..";\n")
|
||||
table.insert(typedefs_table,"typedef struct "..structname.." "..structname..";\n")
|
||||
typedefs_dict[structname] = "struct "..structname
|
||||
structnames[#structnames] = nil
|
||||
end
|
||||
end
|
||||
@@ -753,7 +763,7 @@ typedef struct ImVector ImVector;]])
|
||||
end
|
||||
local cstructsstr = table.concat(outtab)
|
||||
cstructsstr = cstructsstr:gsub("\n+","\n") --several empty lines to one empty line
|
||||
return cstructsstr
|
||||
return cstructsstr, typedefs_dict
|
||||
end
|
||||
|
||||
local function func_header_impl_generate(FP)
|
||||
@@ -891,7 +901,7 @@ local function cimgui_generation(postfix,STP,FP)
|
||||
local hfile = io.open("./cimgui_template.h","r")
|
||||
local hstrfile = hfile:read"*a"
|
||||
hfile:close()
|
||||
local cstructsstr = gen_structs_and_enums(STP.lines)
|
||||
local cstructsstr,typedefs_dict = gen_structs_and_enums(STP.lines)
|
||||
--for not gcc parsing
|
||||
if postfix == "" then
|
||||
cstructsstr = "typedef unsigned short ImDrawIdx;\ntypedef void* ImTextureID;\n"..cstructsstr
|
||||
@@ -910,6 +920,7 @@ local function cimgui_generation(postfix,STP,FP)
|
||||
hstrfile = hstrfile:gsub([[#include "auto_funcs%.cpp"]],cimplem)
|
||||
hstrfile = hstrfile:gsub([[#include "cimgui%.h"]],[[#include "cimgui]]..postfix..[[.h"]])
|
||||
save_data("./generated/cimgui"..postfix..".cpp",hstrfile)
|
||||
return typedefs_dict
|
||||
end
|
||||
--------------------------------------------------------
|
||||
-----------------------------do it----------------------
|
||||
@@ -933,7 +944,7 @@ FP:compute_overloads()
|
||||
cimgui_generation("",STP,FP)
|
||||
|
||||
--then gcc
|
||||
local pFP,pSTP
|
||||
local pFP,pSTP,typedefs_dict2
|
||||
|
||||
if HAVE_GCC then
|
||||
local pipe,err = io.popen([[gcc -E -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS -DIMGUI_API="" -DIMGUI_IMPL_API="" ../imgui/imgui.h]],"r")
|
||||
@@ -953,7 +964,7 @@ end
|
||||
pipe:close()
|
||||
local ovstr = pFP:compute_overloads()
|
||||
save_data("./generated/overloads.txt",ovstr)
|
||||
cimgui_generation("_auto",pSTP,pFP)
|
||||
typedefs_dict2 = cimgui_generation("_auto",pSTP,pFP)
|
||||
|
||||
end
|
||||
|
||||
@@ -963,6 +974,7 @@ save_data("./generated/definitions.lua",serializeTable("defs",pFP.defsT),"\nretu
|
||||
----------save struct and enums lua table in structs_and_enums.lua for using in bindings
|
||||
local structs_and_enums_table,typedefs_dict = gen_structs_and_enums_table(pSTP.lines)
|
||||
save_data("./generated/structs_and_enums.lua",serializeTable("defs",structs_and_enums_table),"\nreturn defs")
|
||||
typedefs_dict = mergeT(typedefs_dict,typedefs_dict2)
|
||||
save_data("./generated/typedefs_dict.lua",serializeTable("defs",typedefs_dict),"\nreturn defs")
|
||||
--=================================Now implementations
|
||||
|
||||
|
Reference in New Issue
Block a user