mirror of
https://github.com/cimgui/cimgui.git
synced 2025-12-01 14:01:40 +00:00
Compare commits
2 Commits
794f63b480
...
22bcd46a7c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
22bcd46a7c | ||
|
|
c4b7680882 |
10
README.md
10
README.md
@@ -17,6 +17,10 @@ Notes:
|
||||
* All naming is algorithmic except for those names that were coded in cimgui_overloads table (https://github.com/cimgui/cimgui/blob/master/generator/generator.lua#L60). In the official version this table is empty.
|
||||
* Current overloaded function names can be found in (https://github.com/cimgui/cimgui/blob/master/generator/output/overloads.txt)
|
||||
|
||||
#changes
|
||||
|
||||
* 10/11/2025: Functions returning and taking as argument no POD structs is now doing a conversion internally to allow ARM64 compilation.
|
||||
|
||||
# compilation
|
||||
|
||||
* clone
|
||||
@@ -60,7 +64,8 @@ Notes:
|
||||
* retref : is set if original return type is a reference. (will be a pointer in cimgui)
|
||||
* argsT : an array of collections (each one with type: argument type and name: the argument name, when the argument is a function pointer also ret: return type and signature: the function signature)
|
||||
* args : a string of argsT concatenated and separated by commas
|
||||
* call_args : a string with the argument names separated by commas for calling imgui function
|
||||
* call_args_old : a string with the argument names separated by commas for calling imgui function
|
||||
* call_args : call_args_old with conversion added.
|
||||
* defaults : a collection in which key is argument name and value is the default value.
|
||||
* manual : will be true if this function is hand-written (not generated)
|
||||
* skipped : will be true if this function is not generated (and not hand-written)
|
||||
@@ -70,7 +75,7 @@ Notes:
|
||||
* realdestructor : is set if the function is a destructor for a class
|
||||
* templated : is set if the function belongs to a templated class (ImVector)
|
||||
* templatedgen: is set if the function belongs to a struct generated from template (ImVector_ImWchar)
|
||||
* nonUDT : if present the original function was returning a user defined type so that signature has been changed to accept a pointer to the UDT as first argument.
|
||||
* nonUDT : if present the original function was returning a user defined type.
|
||||
* location : name of the header file and linenumber this function comes from. (imgui:000, internal:123, imgui_impl_xxx:123)
|
||||
* is_static_function : is setted when it is an struct static function.
|
||||
### structs_and_enums description
|
||||
@@ -91,7 +96,6 @@ Notes:
|
||||
* use whatever method is in ImGui c++ namespace in the original [imgui.h](https://github.com/ocornut/imgui/blob/master/imgui.h) by prepending `ig`
|
||||
* methods have the same parameter list and return values (where possible)
|
||||
* functions that belong to a struct have an extra first argument with a pointer to the struct.
|
||||
* where a function returns UDT (user defined type) by value some compilers complain so the function is generated accepting a pointer to the UDT type as the first argument (or second if belongs to a struct).
|
||||
* constructors return pointer to struct and has been named Struct_name_Struct_name
|
||||
# usage with backends
|
||||
|
||||
|
||||
3
cimgui.h
3
cimgui.h
@@ -3818,7 +3818,6 @@ struct SDL_Window;
|
||||
typedef union SDL_Event SDL_Event;
|
||||
#endif // CIMGUI_DEFINE_ENUMS_AND_STRUCTS
|
||||
|
||||
|
||||
#ifdef CIMGUI_DEFINE_ENUMS_AND_STRUCTS
|
||||
typedef struct ImTextureRef_c ImTextureRef;
|
||||
typedef struct ImVec2_c ImVec2;
|
||||
@@ -3860,6 +3859,8 @@ struct ImRect_c {
|
||||
ImVec2_c Max;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef CIMGUI_DEFINE_ENUMS_AND_STRUCTS
|
||||
typedef struct ImGuiTextFilter::ImGuiTextRange ImGuiTextRange;
|
||||
typedef ImStb::STB_TexteditState STB_TexteditState;
|
||||
|
||||
@@ -49,6 +49,7 @@ struct SDL_Window;
|
||||
typedef union SDL_Event SDL_Event;
|
||||
#endif // CIMGUI_DEFINE_ENUMS_AND_STRUCTS
|
||||
|
||||
PLACE_STRUCTS_C
|
||||
|
||||
#include "auto_funcs.h"
|
||||
|
||||
|
||||
@@ -1104,12 +1104,13 @@ local function get_nonPOD(FP)
|
||||
return nonPOD
|
||||
end
|
||||
local function recur_calc_depth(FP, structs, k,n)
|
||||
--print("recur_calc_depth",k,n)
|
||||
local struct = structs[k]
|
||||
local n1 = n
|
||||
for i,field in ipairs(struct) do
|
||||
local typ = field.type:gsub("const ","")
|
||||
typ = typ:gsub("*","")
|
||||
if FP.nP_used[typ] then
|
||||
if k~=typ and FP.nP_used[typ] then
|
||||
n1 = math.max(n1,recur_calc_depth(FP, structs, typ,n+1))
|
||||
end
|
||||
end
|
||||
@@ -1163,12 +1164,16 @@ local function gen_structs_c(FP)
|
||||
return table.concat(tabs_c,"\n").."\n"..table.concat(tabs,"\n")
|
||||
--return table.concat(tabs,"\n")
|
||||
end
|
||||
local function gen_field_conversion(tab, struct, FP, prefix)
|
||||
local function gen_field_conversion(tab, struct, FP, to,prefix)
|
||||
prefix = prefix or ""
|
||||
local structs = FP.structs_and_enums_table.structs
|
||||
for i,field in ipairs(struct) do
|
||||
local ftype = field.type:gsub("*","")
|
||||
if FP.nP_used[field.type] then
|
||||
gen_field_conversion(tab, structs[field.type],FP, prefix..field.name..".")
|
||||
gen_field_conversion(tab, structs[field.type],FP, to,prefix..field.name..".")
|
||||
elseif FP.nP_used[ftype] then
|
||||
local ftypec = field.type:gsub(ftype,not to and (ftype.."_c") or ftype)
|
||||
insert(tab, " dest."..prefix..field.name.." = reinterpret_cast<"..ftypec..">(src."..prefix..field.name..");")
|
||||
else
|
||||
insert(tab," dest."..prefix..field.name.." = src."..prefix..field.name..";")
|
||||
end
|
||||
@@ -1183,14 +1188,14 @@ local function genConversions(FP)
|
||||
insert(convers,"{")
|
||||
insert(convers," "..k.." dest;")
|
||||
local struct = structs[k]
|
||||
gen_field_conversion(convers,struct,FP)
|
||||
gen_field_conversion(convers,struct,FP, true)
|
||||
insert(convers," return dest;")
|
||||
insert(convers,"}")
|
||||
insert(convers,"static inline "..k.."_c ConvertFromCPP_"..k.."(const "..k.."& src)")
|
||||
insert(convers,"{")
|
||||
insert(convers," "..k.."_c dest;")
|
||||
local struct = structs[k]
|
||||
gen_field_conversion(convers,struct,FP)
|
||||
gen_field_conversion(convers,struct,FP, false)
|
||||
insert(convers," return dest;")
|
||||
insert(convers,"}")
|
||||
end)
|
||||
@@ -3128,8 +3133,8 @@ local function func_header_generate(FP)
|
||||
--outtabf = M.header_subs_nonPOD(FP,outtabf)
|
||||
local cfuncsstr = table.concat(outtab)..outtabf
|
||||
cfuncsstr = cfuncsstr:gsub("\n+","\n") --several empty lines to one empty line
|
||||
local structs_c = FP:gen_structs_c()
|
||||
return structs_c..cfuncsstr
|
||||
|
||||
return cfuncsstr
|
||||
end
|
||||
|
||||
M.func_header_generate = func_header_generate
|
||||
|
||||
@@ -286,7 +286,6 @@ local function cimgui_generation(parser)
|
||||
|
||||
|
||||
local tdt = parser:generate_templates()
|
||||
--local cstructsstr = "\n//7777estio es outpre\n"..outpre.."\n///////////////tdt\n"..tdt.."\n////////////////////outpost\n"..outpost
|
||||
local cstructsstr = outpre..tdt..outpost
|
||||
|
||||
if gdefines.IMGUI_HAS_DOCK then
|
||||
@@ -307,6 +306,7 @@ local function cimgui_generation(parser)
|
||||
cstructsstr = colapse_defines(cstructsstr, "IMGUI_ENABLE_FREETYPE")
|
||||
|
||||
hstrfile = hstrfile:gsub([[#include "imgui_structs%.h"]],cstructsstr)
|
||||
hstrfile = hstrfile:gsub([[PLACE_STRUCTS_C]],parser:gen_structs_c())
|
||||
local cfuncsstr = func_header_generate(parser)
|
||||
cfuncsstr = colapse_defines(cfuncsstr, "IMGUI_ENABLE_FREETYPE")
|
||||
hstrfile = hstrfile:gsub([[#include "auto_funcs%.h"]],cfuncsstr)
|
||||
|
||||
Reference in New Issue
Block a user