Compare commits

...

3 Commits

Author SHA1 Message Date
sonoro1234
944385687d add STB_TexteditState 2026-07-30 10:46:20 +02:00
sonoro1234
b705b2465a cpp2ffi: modify argsT skips _c, added size 2026-07-29 10:46:06 +02:00
sonoro1234
1531eea44a AddnonUDT: modify definitions argsT 2026-07-29 10:33:17 +02:00
9 changed files with 300 additions and 6 deletions

View File

@@ -3926,6 +3926,45 @@ struct ImFontAtlasBuilder
ImFontAtlasRectId PackIdMouseCursors; ImFontAtlasRectId PackIdMouseCursors;
ImFontAtlasRectId PackIdLinesTexData; ImFontAtlasRectId PackIdLinesTexData;
}; };
typedef struct StbUndoRecord StbUndoRecord;
struct StbUndoRecord
{
int where;
int insert_length;
int delete_length;
int char_storage;
};
typedef struct StbUndoState StbUndoState;
struct StbUndoState
{
StbUndoRecord undo_rec [99];
char undo_char[999];
short undo_point, redo_point;
int undo_char_point, redo_char_point;
};
struct STB_TexteditState
{
int cursor;
int select_start;
int select_end;
unsigned char insert_mode;
int row_count_per_page;
unsigned char cursor_at_end_of_line;
unsigned char initialized;
unsigned char has_preferred_x;
unsigned char single_line;
unsigned char padding1, padding2, padding3;
float preferred_x;
StbUndoState undostate;
};
typedef struct StbTexteditRow StbTexteditRow;
struct StbTexteditRow
{
float x0,x1;
float baseline_y_delta;
float ymin,ymax;
int num_chars;
};
#ifdef IMGUI_ENABLE_FREETYPE #ifdef IMGUI_ENABLE_FREETYPE
struct ImFontAtlas; struct ImFontAtlas;
struct ImFontLoader; struct ImFontLoader;

View File

@@ -1531,11 +1531,13 @@ local function ADDnonUDT(FP)
end end
--args --args
local caar,asp local caar,asp
local argsTN = {}
if #def.argsT > 0 then if #def.argsT > 0 then
caar = "(" caar = "("
asp = "(" asp = "("
for i,v in ipairs(def.argsT) do for i,v in ipairs(def.argsT) do
local name = v.name local name = v.name
argsTN[i] = deepcopy(v)
if v.ret then --function pointer if v.ret then --function pointer
local f_ = v.has_cdecl and "(__cdecl*" or "(*" local f_ = v.has_cdecl and "(__cdecl*" or "(*"
asp = asp .. v.ret .. f_ .. v.name .. ")" .. v.signature .. "," asp = asp .. v.ret .. f_ .. v.name .. ")" .. v.signature .. ","
@@ -1545,23 +1547,29 @@ local function ADDnonUDT(FP)
local typ2 = typ:gsub("*","") local typ2 = typ:gsub("*","")
--nonPOD arg -> convert --nonPOD arg -> convert
if FP.nP_args[v.type] then if FP.nP_args[v.type] then
local typ3 = v.type:gsub(typ,typ.."_c")
caar = caar .. "ConvertToCPP_"..typ.."("..name..")," caar = caar .. "ConvertToCPP_"..typ.."("..name.."),"
asp = asp .. v.type:gsub(typ,typ.."_c").." "..v.name.."," asp = asp .. typ3 .." "..v.name..","
--argsTN[i].type = typ3
--nonPOD* arg -> reinterpret_cast --nonPOD* arg -> reinterpret_cast
elseif FP.nP_args[typ2] then elseif FP.nP_args[typ2] then
local typ3 = v.type:gsub(typ2,typ2.."_c") local typ3 = v.type:gsub(typ2,typ2.."_c")
caar = caar .. "reinterpret_cast<"..v.type..">("..name..")," caar = caar .. "reinterpret_cast<"..v.type..">("..name.."),"
asp = asp .. typ3 .." "..v.name.."," asp = asp .. typ3 .." "..v.name..","
--argsTN[i].type = typ3
elseif v.type:match("std::string_view") then elseif v.type:match("std::string_view") then
argsTN[i].type = "const char*"
caar = caar ..name.."," caar = caar ..name..","
asp = asp .. "const char* "..v.name.."," asp = asp .. "const char* "..v.name..","
elseif v.type:match("std::string") then elseif v.type:match("std::string") then
argsTN[i].type = "const char*"
caar = caar .. "std::string("..name..")," caar = caar .. "std::string("..name.."),"
asp = asp .. "const char* "..v.name.."," asp = asp .. "const char* "..v.name..","
elseif v.type:match"std::function" then elseif v.type:match"std::function" then
local ca2,asp2,skip2 = get_std_function(v,def) local ca2,asp2,skip2 = get_std_function(v,def)
caar = caar .. ca2.."," caar = caar .. ca2..","
asp = asp .. asp2.."," asp = asp .. asp2..","
argsTN[i].type = asp2
if skip2 then skip = true end if skip2 then skip = true end
--skip = true --skip = true
elseif v.type:match("std::") then elseif v.type:match("std::") then
@@ -1575,11 +1583,13 @@ local function ADDnonUDT(FP)
local callname = "*"..name local callname = "*"..name
caar = caar .. callname .. "," caar = caar .. callname .. ","
asp = asp .. newt.." "..name .. "," asp = asp .. newt.." "..name .. ","
argsTN[i].type = newt
else else
local newt = v.type --v.type:gsub(typ2.."%s*%*",typ2.."_opq") local newt = v.type --v.type:gsub(typ2.."%s*%*",typ2.."_opq")
local callname = v.reftoptr and "*"..name or name local callname = v.reftoptr and "*"..name or name
caar = caar .. callname .. "," caar = caar .. callname .. ","
asp = asp .. newt.." "..name .. "," asp = asp .. newt.." "..name .. ","
argsTN[i].type = newt
end end
else else
local siz = v.type:match("(%[%d*%])") or "" local siz = v.type:match("(%[%d*%])") or ""
@@ -1587,6 +1597,7 @@ local function ADDnonUDT(FP)
asp = asp .. typ .. (v.name~="..." and " "..v.name or "") .. siz .. "," asp = asp .. typ .. (v.name~="..." and " "..v.name or "") .. siz .. ","
local callname = v.reftoptr and "*"..name or name local callname = v.reftoptr and "*"..name or name
caar = caar .. callname .. "," caar = caar .. callname .. ","
argsTN[i].type = typ .. siz
end end
end end
end end
@@ -1604,6 +1615,7 @@ local function ADDnonUDT(FP)
def.call_args_old = def.call_args def.call_args_old = def.call_args
def.call_args = caar def.call_args = caar
def.args = asp def.args = asp
def.argsT = argsTN
end end
end end
end end

View File

@@ -412,13 +412,14 @@ local headers = [[#include "]]..IMGUI_PATH..[[/imgui.h"
local headersT = {[[imgui]]} local headersT = {[[imgui]]}
if INTERNAL_GENERATION then if INTERNAL_GENERATION then
headers = headers .. [[#include "]]..IMGUI_PATH..[[/imgui_internal.h" headers = headers .. [[#include "]]..IMGUI_PATH..[[/imgui_internal.h"
]]
headers = headers .. [[#include "]]..IMGUI_PATH..[[/imstb_textedit.h"
]] ]]
headersT[#headersT + 1] = [[imgui_internal]] headersT[#headersT + 1] = [[imgui_internal]]
headersT[#headersT + 1] = [[imstb_textedit]] headersT[#headersT + 1] = [[imstb_textedit]]
end end
if FREETYPE_GENERATION then if FREETYPE_GENERATION then
headers = headers .. [[ headers = headers .. [[#include "]]..IMGUI_PATH..[[/misc/freetype/imgui_freetype.h"
#include "]]..IMGUI_PATH..[[/misc/freetype/imgui_freetype.h"
]] ]]
headersT[#headersT + 1] = [[imgui_freetype]] headersT[#headersT + 1] = [[imgui_freetype]]
end end

View File

@@ -30,6 +30,7 @@
"IMGUI_WINDOW_HARD_MIN_SIZE": "4.0f", "IMGUI_WINDOW_HARD_MIN_SIZE": "4.0f",
"IMSTB_TEXTEDIT_CHARTYPE": "char", "IMSTB_TEXTEDIT_CHARTYPE": "char",
"IMSTB_TEXTEDIT_GETWIDTH_NEWLINE": "(-1.0f)", "IMSTB_TEXTEDIT_GETWIDTH_NEWLINE": "(-1.0f)",
"IMSTB_TEXTEDIT_POSITIONTYPE": "int",
"IMSTB_TEXTEDIT_STRING": "ImGuiInputTextState", "IMSTB_TEXTEDIT_STRING": "ImGuiInputTextState",
"IMSTB_TEXTEDIT_UNDOCHARCOUNT": "999", "IMSTB_TEXTEDIT_UNDOCHARCOUNT": "999",
"IMSTB_TEXTEDIT_UNDOSTATECOUNT": "99", "IMSTB_TEXTEDIT_UNDOSTATECOUNT": "99",

View File

@@ -30,6 +30,7 @@ local t={
IMGUI_WINDOW_HARD_MIN_SIZE="4.0f", IMGUI_WINDOW_HARD_MIN_SIZE="4.0f",
IMSTB_TEXTEDIT_CHARTYPE="char", IMSTB_TEXTEDIT_CHARTYPE="char",
IMSTB_TEXTEDIT_GETWIDTH_NEWLINE="(-1.0f)", IMSTB_TEXTEDIT_GETWIDTH_NEWLINE="(-1.0f)",
IMSTB_TEXTEDIT_POSITIONTYPE="int",
IMSTB_TEXTEDIT_STRING="ImGuiInputTextState", IMSTB_TEXTEDIT_STRING="ImGuiInputTextState",
IMSTB_TEXTEDIT_UNDOCHARCOUNT="999", IMSTB_TEXTEDIT_UNDOCHARCOUNT="999",
IMSTB_TEXTEDIT_UNDOSTATECOUNT="99", IMSTB_TEXTEDIT_UNDOSTATECOUNT="99",

View File

@@ -5736,6 +5736,10 @@
"ImVec2ih": "imgui_internal:592", "ImVec2ih": "imgui_internal:592",
"ImVec4": "imgui:313", "ImVec4": "imgui:313",
"ImWcharClass": "imgui_internal:463", "ImWcharClass": "imgui_internal:463",
"STB_TexteditState": "imstb_textedit:342",
"StbTexteditRow": "imstb_textedit:389",
"StbUndoRecord": "imstb_textedit:324",
"StbUndoState": "imstb_textedit:333",
"stbrp_context_opaque": "imgui_internal:4281" "stbrp_context_opaque": "imgui_internal:4281"
}, },
"nonPOD": { "nonPOD": {
@@ -13540,6 +13544,136 @@
"type": "float" "type": "float"
} }
], ],
"STB_TexteditState": [
{
"name": "cursor",
"type": "int"
},
{
"name": "select_start",
"type": "int"
},
{
"name": "select_end",
"type": "int"
},
{
"name": "insert_mode",
"type": "unsigned char"
},
{
"name": "row_count_per_page",
"type": "int"
},
{
"name": "cursor_at_end_of_line",
"type": "unsigned char"
},
{
"name": "initialized",
"type": "unsigned char"
},
{
"name": "has_preferred_x",
"type": "unsigned char"
},
{
"name": "single_line",
"type": "unsigned char"
},
{
"name": "padding1",
"type": "unsigned char"
},
{
"name": "padding2",
"type": "unsigned char"
},
{
"name": "padding3",
"type": "unsigned char"
},
{
"name": "preferred_x",
"type": "float"
},
{
"name": "undostate",
"type": "StbUndoState"
}
],
"StbTexteditRow": [
{
"name": "x0",
"type": "float"
},
{
"name": "x1",
"type": "float"
},
{
"name": "baseline_y_delta",
"type": "float"
},
{
"name": "ymin",
"type": "float"
},
{
"name": "ymax",
"type": "float"
},
{
"name": "num_chars",
"type": "int"
}
],
"StbUndoRecord": [
{
"name": "where",
"type": "int"
},
{
"name": "insert_length",
"type": "int"
},
{
"name": "delete_length",
"type": "int"
},
{
"name": "char_storage",
"type": "int"
}
],
"StbUndoState": [
{
"name": "undo_rec[99]",
"size": 99,
"type": "StbUndoRecord"
},
{
"name": "undo_char[999]",
"size": 999,
"type": "char"
},
{
"name": "undo_point",
"type": "short"
},
{
"name": "redo_point",
"type": "short"
},
{
"name": "undo_char_point",
"type": "int"
},
{
"name": "redo_char_point",
"type": "int"
}
],
"stbrp_context_opaque": [ "stbrp_context_opaque": [
{ {
"name": "data[80]", "name": "data[80]",

View File

@@ -4579,6 +4579,10 @@ local t={
ImVec2ih="imgui_internal:592", ImVec2ih="imgui_internal:592",
ImVec4="imgui:313", ImVec4="imgui:313",
ImWcharClass="imgui_internal:463", ImWcharClass="imgui_internal:463",
STB_TexteditState="imstb_textedit:342",
StbTexteditRow="imstb_textedit:389",
StbUndoRecord="imstb_textedit:324",
StbUndoState="imstb_textedit:333",
stbrp_context_opaque="imgui_internal:4281"}, stbrp_context_opaque="imgui_internal:4281"},
nonPOD={ nonPOD={
ImBitArray=true, ImBitArray=true,
@@ -10444,6 +10448,102 @@ local t={
[4]={ [4]={
name="w", name="w",
type="float"}}, type="float"}},
STB_TexteditState={
[1]={
name="cursor",
type="int"},
[2]={
name="select_start",
type="int"},
[3]={
name="select_end",
type="int"},
[4]={
name="insert_mode",
type="unsigned char"},
[5]={
name="row_count_per_page",
type="int"},
[6]={
name="cursor_at_end_of_line",
type="unsigned char"},
[7]={
name="initialized",
type="unsigned char"},
[8]={
name="has_preferred_x",
type="unsigned char"},
[9]={
name="single_line",
type="unsigned char"},
[10]={
name="padding1",
type="unsigned char"},
[11]={
name="padding2",
type="unsigned char"},
[12]={
name="padding3",
type="unsigned char"},
[13]={
name="preferred_x",
type="float"},
[14]={
name="undostate",
type="StbUndoState"}},
StbTexteditRow={
[1]={
name="x0",
type="float"},
[2]={
name="x1",
type="float"},
[3]={
name="baseline_y_delta",
type="float"},
[4]={
name="ymin",
type="float"},
[5]={
name="ymax",
type="float"},
[6]={
name="num_chars",
type="int"}},
StbUndoRecord={
[1]={
name="where",
type="int"},
[2]={
name="insert_length",
type="int"},
[3]={
name="delete_length",
type="int"},
[4]={
name="char_storage",
type="int"}},
StbUndoState={
[1]={
name="undo_rec[99]",
size=99,
type="StbUndoRecord"},
[2]={
name="undo_char[999]",
size=999,
type="char"},
[3]={
name="undo_point",
type="short"},
[4]={
name="redo_point",
type="short"},
[5]={
name="undo_char_point",
type="int"},
[6]={
name="redo_char_point",
type="int"}},
stbrp_context_opaque={ stbrp_context_opaque={
[1]={ [1]={
name="data[80]", name="data[80]",

View File

@@ -224,6 +224,9 @@
"ImWchar16": "unsigned short", "ImWchar16": "unsigned short",
"ImWchar32": "unsigned int", "ImWchar32": "unsigned int",
"STB_TexteditState": "struct STB_TexteditState", "STB_TexteditState": "struct STB_TexteditState",
"StbTexteditRow": "struct StbTexteditRow",
"StbUndoRecord": "struct StbUndoRecord",
"StbUndoState": "struct StbUndoState",
"stbrp_context_opaque": "struct stbrp_context_opaque", "stbrp_context_opaque": "struct stbrp_context_opaque",
"stbrp_node": "struct stbrp_node", "stbrp_node": "struct stbrp_node",
"stbrp_node_im": "stbrp_node" "stbrp_node_im": "stbrp_node"

View File

@@ -224,6 +224,9 @@ local t={
ImWchar16="unsigned short", ImWchar16="unsigned short",
ImWchar32="unsigned int", ImWchar32="unsigned int",
STB_TexteditState="struct STB_TexteditState", STB_TexteditState="struct STB_TexteditState",
StbTexteditRow="struct StbTexteditRow",
StbUndoRecord="struct StbUndoRecord",
StbUndoState="struct StbUndoState",
stbrp_context_opaque="struct stbrp_context_opaque", stbrp_context_opaque="struct stbrp_context_opaque",
stbrp_node="struct stbrp_node", stbrp_node="struct stbrp_node",
stbrp_node_im="stbrp_node"} stbrp_node_im="stbrp_node"}