mirror of
https://github.com/cimgui/cimgui.git
synced 2025-08-11 20:28:30 +01:00
let FLT_MAX be a string in definitions.lua to use after igGET_FLT_MAX to get compiler value
This commit is contained in:
@@ -78,6 +78,7 @@ local cimgui_overloads = {
|
|||||||
local cimgui_header =
|
local cimgui_header =
|
||||||
[[//This file is automatically generated by generator.lua from https://github.com/cimgui/cimgui
|
[[//This file is automatically generated by generator.lua from https://github.com/cimgui/cimgui
|
||||||
//based on imgui.h file version XXX from Dear ImGui https://github.com/ocornut/imgui]]
|
//based on imgui.h file version XXX from Dear ImGui https://github.com/ocornut/imgui]]
|
||||||
|
local gdefines = {} --for FLT_MAX and others
|
||||||
--------------------------------------------------------------------------
|
--------------------------------------------------------------------------
|
||||||
--helper functions
|
--helper functions
|
||||||
--------------------------------------------------------------------------
|
--------------------------------------------------------------------------
|
||||||
@@ -1203,6 +1204,50 @@ local function check_arg_detection(fdefs,typedefs)
|
|||||||
end
|
end
|
||||||
print"-----------------end check arg detection-----------------------"
|
print"-----------------end check arg detection-----------------------"
|
||||||
end
|
end
|
||||||
|
local function get_defines(t)
|
||||||
|
local pipe,err = io.popen([[gcc -E -dM -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS -DIMGUI_API="" -DIMGUI_IMPL_API="" ../imgui/imgui.h]],"r")
|
||||||
|
local defines = {}
|
||||||
|
while true do
|
||||||
|
local line = pipe:read"*l"
|
||||||
|
if not line then break end
|
||||||
|
local key,value = line:match([[#define%s+(%S+)%s+(.+)]])
|
||||||
|
if not key or not value then
|
||||||
|
--print(line)
|
||||||
|
else
|
||||||
|
defines[key]=value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
pipe:close()
|
||||||
|
--require"anima.utils"
|
||||||
|
--prtable(defines)
|
||||||
|
--FLT_MAX
|
||||||
|
local ret = {}
|
||||||
|
for i,v in ipairs(t) do
|
||||||
|
local aa = defines[v]
|
||||||
|
while true do
|
||||||
|
local tmp = defines[aa]
|
||||||
|
if not tmp then
|
||||||
|
break
|
||||||
|
else
|
||||||
|
aa = tmp
|
||||||
|
end
|
||||||
|
end
|
||||||
|
ret[v] = aa
|
||||||
|
end
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
--subtitution of FLT_MAX value for FLT_MAX
|
||||||
|
local function set_defines(fdefs)
|
||||||
|
for k,defT in pairs(fdefs) do
|
||||||
|
for i,def in ipairs(defT) do
|
||||||
|
for name,default in pairs(def.defaults) do
|
||||||
|
if default == gdefines.FLT_MAX then
|
||||||
|
def.defaults[name] = "FLT_MAX"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
--generate cimgui.cpp cimgui.h and auto versions depending on postfix
|
--generate cimgui.cpp cimgui.h and auto versions depending on postfix
|
||||||
local function cimgui_generation(postfix,STP,FP)
|
local function cimgui_generation(postfix,STP,FP)
|
||||||
--merge it in cimgui_template.h to cimgui.h
|
--merge it in cimgui_template.h to cimgui.h
|
||||||
@@ -1247,6 +1292,11 @@ while true do
|
|||||||
end
|
end
|
||||||
pipe:close()
|
pipe:close()
|
||||||
cimgui_header = cimgui_header:gsub("XXX",imgui_version)
|
cimgui_header = cimgui_header:gsub("XXX",imgui_version)
|
||||||
|
print("IMGUI_VERSION",imgui_version)
|
||||||
|
--get some defines----------------------------
|
||||||
|
if HAVE_GCC then
|
||||||
|
gdefines = get_defines{"IMGUI_VERSION","FLT_MAX"}
|
||||||
|
end
|
||||||
--first without gcc
|
--first without gcc
|
||||||
---[[
|
---[[
|
||||||
print"------------------generation without precompiler------------------------"
|
print"------------------generation without precompiler------------------------"
|
||||||
@@ -1296,6 +1346,7 @@ check_arg_detection(pFP.defsT,typedefs_dict2)
|
|||||||
end
|
end
|
||||||
|
|
||||||
----------save fundefs in definitions.lua for using in bindings
|
----------save fundefs in definitions.lua for using in bindings
|
||||||
|
set_defines(pFP.defsT)
|
||||||
save_data("./output/definitions.lua",serializeTable("defs",pFP.defsT),"\nreturn defs")
|
save_data("./output/definitions.lua",serializeTable("defs",pFP.defsT),"\nreturn defs")
|
||||||
|
|
||||||
----------save struct and enums lua table in structs_and_enums.lua for using in bindings
|
----------save struct and enums lua table in structs_and_enums.lua for using in bindings
|
||||||
|
File diff suppressed because one or more lines are too long
@@ -2574,8 +2574,8 @@ defs["igPlotLines"][1]["ov_cimguiname"] = "igPlotLines"
|
|||||||
defs["igPlotLines"][1]["defaults"] = {}
|
defs["igPlotLines"][1]["defaults"] = {}
|
||||||
defs["igPlotLines"][1]["defaults"]["overlay_text"] = "((void *)0)"
|
defs["igPlotLines"][1]["defaults"]["overlay_text"] = "((void *)0)"
|
||||||
defs["igPlotLines"][1]["defaults"]["values_offset"] = "0"
|
defs["igPlotLines"][1]["defaults"]["values_offset"] = "0"
|
||||||
defs["igPlotLines"][1]["defaults"]["scale_max"] = "3.40282346638528859812e+38F"
|
defs["igPlotLines"][1]["defaults"]["scale_max"] = "FLT_MAX"
|
||||||
defs["igPlotLines"][1]["defaults"]["scale_min"] = "3.40282346638528859812e+38F"
|
defs["igPlotLines"][1]["defaults"]["scale_min"] = "FLT_MAX"
|
||||||
defs["igPlotLines"][1]["defaults"]["stride"] = "sizeof(float)"
|
defs["igPlotLines"][1]["defaults"]["stride"] = "sizeof(float)"
|
||||||
defs["igPlotLines"][1]["defaults"]["graph_size"] = "ImVec2(0,0)"
|
defs["igPlotLines"][1]["defaults"]["graph_size"] = "ImVec2(0,0)"
|
||||||
defs["igPlotLines"][1]["signature"] = "(const char*,const float*,int,int,const char*,float,float,ImVec2,int)"
|
defs["igPlotLines"][1]["signature"] = "(const char*,const float*,int,int,const char*,float,float,ImVec2,int)"
|
||||||
@@ -2622,8 +2622,8 @@ defs["igPlotLines"][2]["ov_cimguiname"] = "igPlotLinesFnPtr"
|
|||||||
defs["igPlotLines"][2]["defaults"] = {}
|
defs["igPlotLines"][2]["defaults"] = {}
|
||||||
defs["igPlotLines"][2]["defaults"]["overlay_text"] = "((void *)0)"
|
defs["igPlotLines"][2]["defaults"]["overlay_text"] = "((void *)0)"
|
||||||
defs["igPlotLines"][2]["defaults"]["values_offset"] = "0"
|
defs["igPlotLines"][2]["defaults"]["values_offset"] = "0"
|
||||||
defs["igPlotLines"][2]["defaults"]["scale_max"] = "3.40282346638528859812e+38F"
|
defs["igPlotLines"][2]["defaults"]["scale_max"] = "FLT_MAX"
|
||||||
defs["igPlotLines"][2]["defaults"]["scale_min"] = "3.40282346638528859812e+38F"
|
defs["igPlotLines"][2]["defaults"]["scale_min"] = "FLT_MAX"
|
||||||
defs["igPlotLines"][2]["defaults"]["graph_size"] = "ImVec2(0,0)"
|
defs["igPlotLines"][2]["defaults"]["graph_size"] = "ImVec2(0,0)"
|
||||||
defs["igPlotLines"][2]["signature"] = "(const char*,float(*)(void*,int),void*,int,int,const char*,float,float,ImVec2)"
|
defs["igPlotLines"][2]["signature"] = "(const char*,float(*)(void*,int),void*,int,int,const char*,float,float,ImVec2)"
|
||||||
defs["igPlotLines"][2]["cimguiname"] = "igPlotLines"
|
defs["igPlotLines"][2]["cimguiname"] = "igPlotLines"
|
||||||
@@ -2997,8 +2997,8 @@ defs["igPlotHistogram"][1]["ov_cimguiname"] = "igPlotHistogramFloatPtr"
|
|||||||
defs["igPlotHistogram"][1]["defaults"] = {}
|
defs["igPlotHistogram"][1]["defaults"] = {}
|
||||||
defs["igPlotHistogram"][1]["defaults"]["overlay_text"] = "((void *)0)"
|
defs["igPlotHistogram"][1]["defaults"]["overlay_text"] = "((void *)0)"
|
||||||
defs["igPlotHistogram"][1]["defaults"]["values_offset"] = "0"
|
defs["igPlotHistogram"][1]["defaults"]["values_offset"] = "0"
|
||||||
defs["igPlotHistogram"][1]["defaults"]["scale_max"] = "3.40282346638528859812e+38F"
|
defs["igPlotHistogram"][1]["defaults"]["scale_max"] = "FLT_MAX"
|
||||||
defs["igPlotHistogram"][1]["defaults"]["scale_min"] = "3.40282346638528859812e+38F"
|
defs["igPlotHistogram"][1]["defaults"]["scale_min"] = "FLT_MAX"
|
||||||
defs["igPlotHistogram"][1]["defaults"]["stride"] = "sizeof(float)"
|
defs["igPlotHistogram"][1]["defaults"]["stride"] = "sizeof(float)"
|
||||||
defs["igPlotHistogram"][1]["defaults"]["graph_size"] = "ImVec2(0,0)"
|
defs["igPlotHistogram"][1]["defaults"]["graph_size"] = "ImVec2(0,0)"
|
||||||
defs["igPlotHistogram"][1]["signature"] = "(const char*,const float*,int,int,const char*,float,float,ImVec2,int)"
|
defs["igPlotHistogram"][1]["signature"] = "(const char*,const float*,int,int,const char*,float,float,ImVec2,int)"
|
||||||
@@ -3045,8 +3045,8 @@ defs["igPlotHistogram"][2]["ov_cimguiname"] = "igPlotHistogramFnPtr"
|
|||||||
defs["igPlotHistogram"][2]["defaults"] = {}
|
defs["igPlotHistogram"][2]["defaults"] = {}
|
||||||
defs["igPlotHistogram"][2]["defaults"]["overlay_text"] = "((void *)0)"
|
defs["igPlotHistogram"][2]["defaults"]["overlay_text"] = "((void *)0)"
|
||||||
defs["igPlotHistogram"][2]["defaults"]["values_offset"] = "0"
|
defs["igPlotHistogram"][2]["defaults"]["values_offset"] = "0"
|
||||||
defs["igPlotHistogram"][2]["defaults"]["scale_max"] = "3.40282346638528859812e+38F"
|
defs["igPlotHistogram"][2]["defaults"]["scale_max"] = "FLT_MAX"
|
||||||
defs["igPlotHistogram"][2]["defaults"]["scale_min"] = "3.40282346638528859812e+38F"
|
defs["igPlotHistogram"][2]["defaults"]["scale_min"] = "FLT_MAX"
|
||||||
defs["igPlotHistogram"][2]["defaults"]["graph_size"] = "ImVec2(0,0)"
|
defs["igPlotHistogram"][2]["defaults"]["graph_size"] = "ImVec2(0,0)"
|
||||||
defs["igPlotHistogram"][2]["signature"] = "(const char*,float(*)(void*,int),void*,int,int,const char*,float,float,ImVec2)"
|
defs["igPlotHistogram"][2]["signature"] = "(const char*,float(*)(void*,int),void*,int,int,const char*,float,float,ImVec2)"
|
||||||
defs["igPlotHistogram"][2]["cimguiname"] = "igPlotHistogram"
|
defs["igPlotHistogram"][2]["cimguiname"] = "igPlotHistogram"
|
||||||
|
Reference in New Issue
Block a user