mirror of
https://github.com/cimgui/cimgui.git
synced 2025-08-19 15:38:29 +01:00
comments to 10 multiples in structs and typedefs to begining
This commit is contained in:
116
cimgui/cimgui.h
116
cimgui/cimgui.h
@@ -34,49 +34,75 @@ typedef unsigned long long ImU64;
|
||||
|
||||
#ifdef CIMGUI_DEFINE_ENUMS_AND_STRUCTS
|
||||
/////////////// BEGIN AUTOGENERATED SEGMENT
|
||||
typedef struct ImFont ImFont;
|
||||
typedef struct ImFontAtlas ImFontAtlas;
|
||||
typedef struct CustomRect CustomRect;
|
||||
typedef struct GlyphRangesBuilder GlyphRangesBuilder;
|
||||
typedef struct ImFontGlyph ImFontGlyph;
|
||||
typedef struct ImFontConfig ImFontConfig;
|
||||
typedef struct ImDrawData ImDrawData;
|
||||
typedef struct ImDrawList ImDrawList;
|
||||
typedef struct ImDrawChannel ImDrawChannel;
|
||||
typedef struct ImDrawVert ImDrawVert;
|
||||
typedef struct ImDrawCmd ImDrawCmd;
|
||||
typedef struct ImGuiListClipper ImGuiListClipper;
|
||||
typedef struct ImColor ImColor;
|
||||
typedef struct ImGuiPayload ImGuiPayload;
|
||||
typedef struct ImGuiSizeCallbackData ImGuiSizeCallbackData;
|
||||
typedef struct ImGuiTextEditCallbackData ImGuiTextEditCallbackData;
|
||||
typedef struct ImGuiStorage ImGuiStorage;
|
||||
typedef struct Pair Pair;
|
||||
typedef struct ImGuiTextBuffer ImGuiTextBuffer;
|
||||
typedef struct ImGuiTextFilter ImGuiTextFilter;
|
||||
typedef struct TextRange TextRange;
|
||||
typedef struct ImGuiOnceUponAFrame ImGuiOnceUponAFrame;
|
||||
typedef struct ImGuiIO ImGuiIO;
|
||||
typedef struct ImGuiStyle ImGuiStyle;
|
||||
typedef struct ImVec4 ImVec4;
|
||||
typedef struct ImVec2 ImVec2;
|
||||
typedef struct ImGuiContext ImGuiContext;
|
||||
typedef struct ImGuiPayload ImGuiPayload;
|
||||
typedef struct ImGuiListClipper ImGuiListClipper;
|
||||
typedef struct ImGuiSizeCallbackData ImGuiSizeCallbackData;
|
||||
typedef struct ImGuiTextEditCallbackData ImGuiTextEditCallbackData;
|
||||
typedef struct ImGuiTextBuffer ImGuiTextBuffer;
|
||||
typedef struct ImGuiTextFilter ImGuiTextFilter;
|
||||
typedef struct ImGuiStyle ImGuiStyle;
|
||||
typedef struct ImGuiStorage ImGuiStorage;
|
||||
typedef struct ImGuiOnceUponAFrame ImGuiOnceUponAFrame;
|
||||
typedef struct ImGuiIO ImGuiIO;
|
||||
typedef struct ImColor ImColor;
|
||||
typedef struct ImFontConfig ImFontConfig;
|
||||
typedef struct ImFontAtlas ImFontAtlas;
|
||||
typedef struct ImFont ImFont;
|
||||
typedef struct ImDrawVert ImDrawVert;
|
||||
typedef struct ImDrawListSharedData ImDrawListSharedData;
|
||||
typedef struct ImDrawList ImDrawList;
|
||||
typedef struct ImDrawData ImDrawData;
|
||||
typedef struct ImDrawCmd ImDrawCmd;
|
||||
typedef struct ImDrawChannel ImDrawChannel;
|
||||
|
||||
struct ImDrawChannel; // Temporary storage for outputting drawing commands out of order, used by ImDrawList::ChannelsSplit()
|
||||
typedef struct ImDrawChannel ImDrawChannel;
|
||||
struct ImDrawCmd; // A single draw command within a parent ImDrawList (generally maps to 1 GPU draw call)
|
||||
typedef struct ImDrawCmd ImDrawCmd;
|
||||
struct ImDrawData; // All draw command lists required to render the frame
|
||||
typedef struct ImDrawData ImDrawData;
|
||||
struct ImDrawList; // A single draw command list (generally one per window)
|
||||
typedef struct ImDrawList ImDrawList;
|
||||
struct ImDrawListSharedData; // Data shared among multiple draw lists (typically owned by parent ImGui context, but you may create one yourself)
|
||||
typedef struct ImDrawListSharedData ImDrawListSharedData;
|
||||
struct ImDrawVert; // A single vertex (20 bytes by default, override layout with IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT)
|
||||
typedef struct ImDrawVert ImDrawVert;
|
||||
struct ImFont; // Runtime data for a single font within a parent ImFontAtlas
|
||||
typedef struct ImFont ImFont;
|
||||
struct ImFontAtlas; // Runtime data for multiple fonts, bake multiple fonts into a single texture, TTF/OTF font loader
|
||||
typedef struct ImFontAtlas ImFontAtlas;
|
||||
struct ImFontConfig; // Configuration data when adding a font or merging fonts
|
||||
typedef struct ImFontConfig ImFontConfig;
|
||||
struct ImColor; // Helper functions to create a color that can be converted to either u32 or float4
|
||||
typedef struct ImColor ImColor;
|
||||
struct ImGuiIO; // Main configuration and I/O between your application and ImGui
|
||||
typedef struct ImGuiIO ImGuiIO;
|
||||
struct ImGuiOnceUponAFrame; // Simple helper for running a block of code not more than once a frame, used by IMGUI_ONCE_UPON_A_FRAME macro
|
||||
typedef struct ImGuiOnceUponAFrame ImGuiOnceUponAFrame;
|
||||
struct ImGuiStorage; // Simple custom key value storage
|
||||
typedef struct ImGuiStorage ImGuiStorage;
|
||||
struct ImGuiStyle; // Runtime data for styling/colors
|
||||
typedef struct ImGuiStyle ImGuiStyle;
|
||||
struct ImGuiTextFilter; // Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]"
|
||||
typedef struct ImGuiTextFilter ImGuiTextFilter;
|
||||
struct ImGuiTextBuffer; // Text buffer for logging/accumulating text
|
||||
typedef struct ImGuiTextBuffer ImGuiTextBuffer;
|
||||
struct ImGuiTextEditCallbackData; // Shared state of ImGui::InputText() when using custom ImGuiTextEditCallback (rare/advanced use)
|
||||
typedef struct ImGuiTextEditCallbackData ImGuiTextEditCallbackData;
|
||||
struct ImGuiSizeCallbackData; // Structure used to constraint window size in custom ways when using custom ImGuiSizeCallback (rare/advanced use)
|
||||
typedef struct ImGuiSizeCallbackData ImGuiSizeCallbackData;
|
||||
struct ImGuiListClipper; // Helper to manually clip large list of items
|
||||
typedef struct ImGuiListClipper ImGuiListClipper;
|
||||
struct ImGuiPayload; // User data payload for drag and drop operations
|
||||
typedef struct ImGuiPayload ImGuiPayload;
|
||||
struct ImGuiContext; // ImGui context (opaque)
|
||||
typedef struct ImGuiContext ImGuiContext;
|
||||
typedef void* ImTextureID; // User data to identify a texture (this is whatever to you want it to be! read the FAQ about ImTextureID in imgui.cpp)
|
||||
typedef unsigned int ImU32; // 32-bit unsigned integer (typically used to store packed colors)
|
||||
typedef unsigned int ImGuiID; // Unique ID used by widgets (typically hashed from a stack of string)
|
||||
@@ -110,12 +136,10 @@ struct ImVec2
|
||||
{
|
||||
float x, y;
|
||||
};
|
||||
typedef struct ImVec2 ImVec2;
|
||||
struct ImVec4
|
||||
{
|
||||
float x, y, z, w;
|
||||
};
|
||||
typedef struct ImVec4 ImVec4;
|
||||
enum ImGuiWindowFlags_
|
||||
{
|
||||
ImGuiWindowFlags_NoTitleBar = 1 << 0, // Disable title-bar
|
||||
@@ -156,7 +180,7 @@ enum ImGuiInputTextFlags_
|
||||
ImGuiInputTextFlags_CallbackCompletion = 1 << 6, // Call user function on pressing TAB (for completion handling)
|
||||
ImGuiInputTextFlags_CallbackHistory = 1 << 7, // Call user function on pressing Up/Down arrows (for history handling)
|
||||
ImGuiInputTextFlags_CallbackAlways = 1 << 8, // Call user function every time. User code may query cursor position, modify text buffer.
|
||||
ImGuiInputTextFlags_CallbackCharFilter = 1 </*< 9, // Call user function to filter character. Modify data->*/EventChar to replace/filter input, or return 1 to discard character.
|
||||
ImGuiInputTextFlags_CallbackCharFilter = 1 << 9, // Call user function to filter character. Modify data->EventChar to replace/filter input, or return 1 to discard character.
|
||||
ImGuiInputTextFlags_AllowTabInput = 1 << 10, // Pressing TAB input a '\t' character into the text field
|
||||
ImGuiInputTextFlags_CtrlEnterForNewLine = 1 << 11, // In multi-line mode, unfocus with Enter, add new line with Ctrl+Enter (default is opposite: unfocus with Ctrl+Enter, add line with Enter).
|
||||
ImGuiInputTextFlags_NoHorizontalScroll = 1 << 12, // Disable following the cursor horizontally
|
||||
@@ -456,12 +480,11 @@ struct ImGuiStyle
|
||||
float CurveTessellationTol; // Tessellation tolerance when using PathBezierCurveTo() without a specific number of segments. Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality.
|
||||
ImVec4 Colors[ImGuiCol_COUNT];
|
||||
};
|
||||
typedef struct ImGuiStyle ImGuiStyle;
|
||||
struct ImGuiIO
|
||||
{
|
||||
ImGuiConfigFlags ConfigFlags; // = 0 // See ImGuiConfigFlags_ enum. Set by user/application. Gamepad/keyboard navigation options, etc.
|
||||
ImGuiBackendFlags BackendFlags; // = 0 // Set ImGuiBackendFlags_ enum. Set by imgui_impl_xxx files or custom back-end.
|
||||
ImVec2 DisplaySize; // /*<unset>*/ // Display size, in pixels. For clamping windows positions.
|
||||
ImVec2 DisplaySize; // <unset> // Display size, in pixels. For clamping windows positions.
|
||||
float DeltaTime; // = 1.0f/60.0f // Time elapsed since last frame, in seconds.
|
||||
float IniSavingRate; // = 5.0f // Maximum time between saving positions/sizes to .ini file, in seconds.
|
||||
const char* IniFilename; // = "imgui.ini" // Path to .ini file. NULL to disable .ini saving.
|
||||
@@ -469,17 +492,17 @@ struct ImGuiIO
|
||||
float MouseDoubleClickTime; // = 0.30f // Time for a double-click, in seconds.
|
||||
float MouseDoubleClickMaxDist; // = 6.0f // Distance threshold to stay in to validate a double-click, in pixels.
|
||||
float MouseDragThreshold; // = 6.0f // Distance threshold before considering we are dragging.
|
||||
int KeyMap[ImGuiKey_COUNT]; // /*<unset>*/ // Map of indices into the KeysDown[512] entries array which represent your "native" keyboard state.
|
||||
int KeyMap[ImGuiKey_COUNT]; // <unset> // Map of indices into the KeysDown[512] entries array which represent your "native" keyboard state.
|
||||
float KeyRepeatDelay; // = 0.250f // When holding a key/button, time before it starts repeating, in seconds (for buttons in Repeat mode, etc.).
|
||||
float KeyRepeatRate; // = 0.050f // When holding a key/button, rate at which it repeats, in seconds.
|
||||
void* UserData; // = NULL // Store your own data for retrieval by callbacks.
|
||||
ImFontAtlas* Fonts; // /*<auto>*/ // Load and assemble one or more fonts into a single tightly packed texture. Output to Fonts array.
|
||||
ImFontAtlas* Fonts; // <auto> // Load and assemble one or more fonts into a single tightly packed texture. Output to Fonts array.
|
||||
float FontGlobalScale; // = 1.0f // Global scale all fonts
|
||||
bool FontAllowUserScaling; // = false // Allow user scaling text of individual window with CTRL+Wheel.
|
||||
ImFont* FontDefault; // = NULL // Font to use on NewFrame(). Use NULL to uses Fonts->Fonts[0].
|
||||
ImVec2 DisplayFramebufferScale; // = (1.0f,1.0f) // For retina display or other situations where window coordinates are different from framebuffer coordinates. User storage only, presently not used by ImGui.
|
||||
ImVec2 DisplayVisibleMin; // /*<unset>*/ (0.0f,0.0f) // If you use DisplaySize as a virtual space larger than your screen, set DisplayVisibleMin/Max to the visible area.
|
||||
ImVec2 DisplayVisibleMax; // /*<unset>*/ (0.0f,0.0f) // If the values are the same, we defaults to Min=(0.0f) and Max=DisplaySize
|
||||
ImVec2 DisplayVisibleMin; // <unset> (0.0f,0.0f) // If you use DisplaySize as a virtual space larger than your screen, set DisplayVisibleMin/Max to the visible area.
|
||||
ImVec2 DisplayVisibleMax; // <unset> (0.0f,0.0f) // If the values are the same, we defaults to Min=(0.0f) and Max=DisplaySize
|
||||
bool OptMacOSXBehaviors; // = defined(__APPLE__) // OS X style: Text editing cursor movement using Alt instead of Ctrl, Shortcuts using Cmd/Super instead of Ctrl, Line/Text Start and End using Cmd+Arrows instead of Home/End, Double click selects by word instead of selecting whole text, Multi-selection in lists uses Cmd/Super instead of Ctrl
|
||||
bool OptCursorBlink; // = true // Enable blinking cursor, for users who consider it annoying.
|
||||
const char* (*GetClipboardTextFn)(void* user_data);
|
||||
@@ -526,7 +549,6 @@ struct ImGuiIO
|
||||
float NavInputsDownDuration[ImGuiNavInput_COUNT];
|
||||
float NavInputsDownDurationPrev[ImGuiNavInput_COUNT];
|
||||
};
|
||||
typedef struct ImGuiIO ImGuiIO;
|
||||
struct ImVector
|
||||
{
|
||||
int Size;
|
||||
@@ -538,24 +560,20 @@ struct ImGuiOnceUponAFrame
|
||||
{
|
||||
int RefFrame;
|
||||
};
|
||||
typedef struct ImGuiOnceUponAFrame ImGuiOnceUponAFrame;
|
||||
struct ImGuiTextFilter
|
||||
{
|
||||
char InputBuf[256];
|
||||
ImVector/*<TextRange>*/ Filters;
|
||||
int CountGrep;
|
||||
};
|
||||
typedef struct ImGuiTextFilter ImGuiTextFilter;
|
||||
struct ImGuiTextBuffer
|
||||
{
|
||||
ImVector/*<char>*/ Buf;
|
||||
};
|
||||
typedef struct ImGuiTextBuffer ImGuiTextBuffer;
|
||||
struct ImGuiStorage
|
||||
{
|
||||
ImVector/*<Pair>*/ Data;
|
||||
};
|
||||
typedef struct ImGuiStorage ImGuiStorage;
|
||||
struct ImGuiTextEditCallbackData
|
||||
{
|
||||
ImGuiInputTextFlags EventFlag; // One of ImGuiInputTextFlags_Callback* // Read-only
|
||||
@@ -572,7 +590,6 @@ struct ImGuiTextEditCallbackData
|
||||
int SelectionStart; // // Read-write (== to SelectionEnd when no selection)
|
||||
int SelectionEnd; // // Read-write
|
||||
};
|
||||
typedef struct ImGuiTextEditCallbackData ImGuiTextEditCallbackData;
|
||||
struct ImGuiSizeCallbackData
|
||||
{
|
||||
void* UserData; // Read-only. What user passed to SetNextWindowSizeConstraints()
|
||||
@@ -580,7 +597,6 @@ struct ImGuiSizeCallbackData
|
||||
ImVec2 CurrentSize; // Read-only. Current window size.
|
||||
ImVec2 DesiredSize; // Read-write. Desired size, based on user's mouse position. Write to this field to restrain resizing.
|
||||
};
|
||||
typedef struct ImGuiSizeCallbackData ImGuiSizeCallbackData;
|
||||
struct ImGuiPayload
|
||||
{
|
||||
const void* Data; // Data (copied and owned by dear imgui)
|
||||
@@ -592,19 +608,16 @@ struct ImGuiPayload
|
||||
bool Preview; // Set when AcceptDragDropPayload() was called and mouse has been hovering the target item (nb: handle overlapping drag targets)
|
||||
bool Delivery; // Set when AcceptDragDropPayload() was called and mouse button is released over the target item.
|
||||
};
|
||||
typedef struct ImGuiPayload ImGuiPayload;
|
||||
struct ImColor
|
||||
{
|
||||
ImVec4 Value;
|
||||
};
|
||||
typedef struct ImColor ImColor;
|
||||
struct ImGuiListClipper
|
||||
{
|
||||
float StartPosY;
|
||||
float ItemsHeight;
|
||||
int ItemsCount, StepNo, DisplayStart, DisplayEnd;
|
||||
};
|
||||
typedef struct ImGuiListClipper ImGuiListClipper;
|
||||
typedef void (*ImDrawCallback)(const ImDrawList* parent_list, const ImDrawCmd* cmd);
|
||||
struct ImDrawCmd
|
||||
{
|
||||
@@ -614,7 +627,6 @@ struct ImDrawCmd
|
||||
ImDrawCallback UserCallback; // If != NULL, call the function instead of rendering the vertices. clip_rect and texture_id will be set normally.
|
||||
void* UserCallbackData; // The draw callback code can access this.
|
||||
};
|
||||
typedef struct ImDrawCmd ImDrawCmd;
|
||||
typedef unsigned short ImDrawIdx;
|
||||
struct ImDrawVert
|
||||
{
|
||||
@@ -622,13 +634,11 @@ struct ImDrawVert
|
||||
ImVec2 uv;
|
||||
ImU32 col;
|
||||
};
|
||||
typedef struct ImDrawVert ImDrawVert;
|
||||
struct ImDrawChannel
|
||||
{
|
||||
ImVector/*<ImDrawCmd>*/ CmdBuffer;
|
||||
ImVector/*<ImDrawIdx>*/ IdxBuffer;
|
||||
};
|
||||
typedef struct ImDrawChannel ImDrawChannel;
|
||||
enum ImDrawCornerFlags_
|
||||
{
|
||||
ImDrawCornerFlags_TopLeft = 1 << 0, // 0x1
|
||||
@@ -655,8 +665,8 @@ struct ImDrawList
|
||||
const ImDrawListSharedData* _Data; // Pointer to shared draw data (you can use ImGui::GetDrawListSharedData() to get the one from current ImGui context)
|
||||
const char* _OwnerName; // Pointer to owner window's name for debugging
|
||||
unsigned int _VtxCurrentIdx; // [Internal] == VtxBuffer.Size
|
||||
ImDrawVert* _VtxWritePtr; // [Internal] point within VtxBuffer.Data after each add command (to avoid using the ImVector/*<>*/ operators too much)
|
||||
ImDrawIdx* _IdxWritePtr; // [Internal] point within IdxBuffer.Data after each add command (to avoid using the ImVector/*<>*/ operators too much)
|
||||
ImDrawVert* _VtxWritePtr; // [Internal] point within VtxBuffer.Data after each add command (to avoid using the ImVector<> operators too much)
|
||||
ImDrawIdx* _IdxWritePtr; // [Internal] point within IdxBuffer.Data after each add command (to avoid using the ImVector<> operators too much)
|
||||
ImVector/*<ImVec4>*/ _ClipRectStack; // [Internal]
|
||||
ImVector/*<ImTextureID>*/ _TextureIdStack; // [Internal]
|
||||
ImVector/*<ImVec2>*/ _Path; // [Internal] current path building
|
||||
@@ -664,7 +674,6 @@ struct ImDrawList
|
||||
int _ChannelsCount; // [Internal] number of active channels (1+)
|
||||
ImVector/*<ImDrawChannel>*/ _Channels; // [Internal] draw channels for columns API (not resized down so _ChannelsCount may be smaller than _Channels.Size)
|
||||
};
|
||||
typedef struct ImDrawList ImDrawList;
|
||||
struct ImDrawData
|
||||
{
|
||||
bool Valid; // Only valid after Render() is called and before the next NewFrame() is called.
|
||||
@@ -673,7 +682,6 @@ struct ImDrawData
|
||||
int TotalIdxCount; // For convenience, sum of all ImDrawList's IdxBuffer.Size
|
||||
int TotalVtxCount; // For convenience, sum of all ImDrawList's VtxBuffer.Size
|
||||
};
|
||||
typedef struct ImDrawData ImDrawData;
|
||||
struct ImFontConfig
|
||||
{
|
||||
void* FontData; // // TTF/OTF data
|
||||
@@ -693,7 +701,6 @@ struct ImFontConfig
|
||||
char Name[40]; // Name (strictly to ease debugging)
|
||||
ImFont* DstFont;
|
||||
};
|
||||
typedef struct ImFontConfig ImFontConfig;
|
||||
struct ImFontGlyph
|
||||
{
|
||||
ImWchar Codepoint; // 0x0000..0xFFFF
|
||||
@@ -701,7 +708,6 @@ struct ImFontGlyph
|
||||
float X0, Y0, X1, Y1; // Glyph corners
|
||||
float U0, V0, U1, V1; // Texture coordinates
|
||||
};
|
||||
typedef struct ImFontGlyph ImFontGlyph;
|
||||
enum ImFontAtlasFlags_
|
||||
{
|
||||
ImFontAtlasFlags_NoPowerOfTwoHeight = 1 << 0, // Don't round the height to next power of two
|
||||
@@ -724,10 +730,9 @@ struct ImFontAtlas
|
||||
ImVector/*<ImFontConfig>*/ ConfigData; // Internal data
|
||||
int CustomRectIds[1]; // Identifiers of custom texture rectangle used by ImFontAtlas/ImDrawList
|
||||
};
|
||||
typedef struct ImFontAtlas ImFontAtlas;
|
||||
struct ImFont
|
||||
{
|
||||
float FontSize; // /*<user set>*/ // Height of characters, set during loading (don't change after loading)
|
||||
float FontSize; // <user set> // Height of characters, set during loading (don't change after loading)
|
||||
float Scale; // = 1.f // Base font scale, multiplied by the per-window font scale which you can adjust with SetFontScale()
|
||||
ImVec2 DisplayOffset; // = (0.f,0.f) // Offset font rendering by xx pixels
|
||||
ImVector/*<ImFontGlyph>*/ Glyphs; // // All glyphs.
|
||||
@@ -743,13 +748,10 @@ struct ImFont
|
||||
bool DirtyLookupTables;
|
||||
int MetricsTotalSurface; // // Total surface in pixels to get an idea of the font rasterization/texture cost (not exact, we approximate the cost of padding between glyphs)
|
||||
};
|
||||
typedef struct ImFont ImFont;
|
||||
struct GlyphRangesBuilder
|
||||
{
|
||||
ImVector/*<unsigned char>*/ UsedChars;
|
||||
};
|
||||
typedef struct GlyphRangesBuilder GlyphRangesBuilder;
|
||||
|
||||
struct CustomRect
|
||||
{
|
||||
unsigned int ID;
|
||||
@@ -759,22 +761,16 @@ typedef struct GlyphRangesBuilder GlyphRangesBuilder;
|
||||
ImVec2 GlyphOffset;
|
||||
ImFont* Font;
|
||||
};
|
||||
typedef struct CustomRect CustomRect;
|
||||
|
||||
struct TextRange
|
||||
{
|
||||
const char* b;
|
||||
const char* e;
|
||||
};
|
||||
typedef struct TextRange TextRange;
|
||||
|
||||
struct Pair
|
||||
{
|
||||
ImGuiID key;
|
||||
union { int val_i; float val_f; void* val_p; };
|
||||
};
|
||||
typedef struct Pair Pair;
|
||||
|
||||
//////////////// END AUTOGENERATED SEGMENT
|
||||
|
||||
#endif // CIMGUI_DEFINE_ENUMS_AND_STRUCTS
|
||||
|
@@ -110,7 +110,10 @@ local function clean_spaces(cad)
|
||||
cad = cad:gsub("%s*([%(%),=])%s*","%1") --not spaces with ( , )
|
||||
return cad
|
||||
end
|
||||
|
||||
local function split_comment(line)
|
||||
local comment = line:match("(%s*//.*)") or ""
|
||||
return line:gsub("%s*//.*",""),comment
|
||||
end
|
||||
local function get_manuals(def)
|
||||
return cimgui_manuals[def.ov_cimguiname] or cimgui_manuals[def.cimguiname]
|
||||
end
|
||||
@@ -143,12 +146,11 @@ local function struct_parser()
|
||||
|
||||
--drop initial comments
|
||||
if line:match(initial_comment_re) then
|
||||
--print("coment:",line)
|
||||
return
|
||||
end
|
||||
|
||||
local linecommented = line
|
||||
line = line:gsub("%s*//.*","")
|
||||
local line,comment = split_comment(line)
|
||||
--local linecommented = line
|
||||
|
||||
--if in_function discard
|
||||
if in_functionst then
|
||||
@@ -174,9 +176,9 @@ local function struct_parser()
|
||||
elseif line:match("public:") then
|
||||
--nothing
|
||||
else
|
||||
local linea = linecommented:gsub("%S+",{class="struct",mutable=""})
|
||||
local linea = line:gsub("%S+",{class="struct",mutable=""})
|
||||
linea = linea:gsub("(%b<>)","/%*%1%*/") --comment template parameters
|
||||
table.insert(structcdefs,linea)
|
||||
table.insert(structcdefs,linea..comment)
|
||||
--]]
|
||||
end
|
||||
return
|
||||
@@ -442,7 +444,7 @@ local function gen_structs_and_enums(cdefs)
|
||||
local struct_op_close_re = "%b{}"
|
||||
local structnames = {}
|
||||
local innerstructs = {}
|
||||
|
||||
local typedefs_table = {}
|
||||
local outtab = {}
|
||||
-- Output the file
|
||||
table.insert(outtab,"/////////////// BEGIN AUTOGENERATED SEGMENT\n")
|
||||
@@ -450,8 +452,12 @@ local function gen_structs_and_enums(cdefs)
|
||||
|
||||
for i,line in ipairs(cdefs) do
|
||||
repeat -- simulating continue with break
|
||||
local linecom = line
|
||||
line = line:gsub("%s*//.*","")
|
||||
-- separate comments from code and try to add them with same tab
|
||||
local line, comment = split_comment(line)
|
||||
local linelen = #line
|
||||
local desired_linelen = math.max(math.ceil(linelen/10)*10,40)
|
||||
local spaces_to_add = desired_linelen - linelen
|
||||
local linecom = line..string.rep(" ",spaces_to_add)..comment
|
||||
|
||||
if line:match(namespace_re) then
|
||||
in_namespace = true
|
||||
@@ -497,7 +503,7 @@ typedef struct ImVector ImVector;]])
|
||||
table.insert(outtab,linecom.."\n")
|
||||
local struct_closed_name = line:match(struct_closed_re)
|
||||
if struct_closed_name then
|
||||
table.insert(outtab,"typedef struct "..struct_closed_name.." "..struct_closed_name..";\n")
|
||||
table.insert(typedefs_table,"typedef struct "..struct_closed_name.." "..struct_closed_name..";\n")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -511,12 +517,14 @@ typedef struct ImVector ImVector;]])
|
||||
st[#st + 1] = line
|
||||
if line:match(struct_closing_re) and not line:match(struct_op_close_re) then
|
||||
local structname = structnames[#structnames]
|
||||
st[#st + 1] = string.format("typedef struct %s %s;\n",structname,structname)
|
||||
--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))
|
||||
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(outtab,"typedef struct "..structname.." "..structname..";\n")
|
||||
table.insert(typedefs_table,"typedef struct "..structname.." "..structname..";\n")
|
||||
structnames[#structnames] = nil
|
||||
end
|
||||
end
|
||||
@@ -529,9 +537,11 @@ typedef struct ImVector ImVector;]])
|
||||
table.insert(outtab,line.."\n")
|
||||
end
|
||||
end
|
||||
--table.insert(outtab,"#endif //IMGUI_STRUCTS_INCLUDED\n")
|
||||
|
||||
table.insert(outtab,"//////////////// END AUTOGENERATED SEGMENT \n")
|
||||
--hfile:close()
|
||||
for i,l in ipairs(typedefs_table) do
|
||||
table.insert(outtab,2,l)
|
||||
end
|
||||
return outtab
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user