diff --git a/cimgui.cpp b/cimgui.cpp index 1d8a8a0..e69424a 100644 --- a/cimgui.cpp +++ b/cimgui.cpp @@ -1,9 +1,17 @@ //This file is automatically generated by generator.lua from https://github.com/cimgui/cimgui //based on imgui.h file version "1.86" from Dear ImGui https://github.com/ocornut/imgui //with imgui_internal.h api - -#include "./imgui/imgui.h" +#ifdef IMGUI_ENABLE_FREETYPE +#ifndef CIMGUI_FREETYPE +#error "IMGUI_FREETYPE should be defined for Freetype linking" +#endif +#else #ifdef CIMGUI_FREETYPE +#error "IMGUI_FREETYPE should not be defined without freetype generated cimgui" +#endif +#endif +#include "./imgui/imgui.h" +#ifdef IMGUI_ENABLE_FREETYPE #include "./imgui/misc/freetype/imgui_freetype.h" #endif #include "./imgui/imgui_internal.h" diff --git a/cimgui.h b/cimgui.h index e459e0f..40dd31d 100644 --- a/cimgui.h +++ b/cimgui.h @@ -39,89 +39,65 @@ typedef unsigned __int64 ImU64; #ifdef CIMGUI_DEFINE_ENUMS_AND_STRUCTS -typedef struct ImGuiTableColumnSettings ImGuiTableColumnSettings; -typedef struct ImGuiTableCellData ImGuiTableCellData; -typedef struct ImGuiStackTool ImGuiStackTool; -typedef struct ImGuiStackLevelInfo ImGuiStackLevelInfo; -typedef struct ImGuiViewportP ImGuiViewportP; -typedef struct ImGuiListClipperData ImGuiListClipperData; -typedef struct ImGuiListClipperRange ImGuiListClipperRange; -typedef struct ImGuiPtrOrIndex ImGuiPtrOrIndex; -typedef struct ImGuiShrinkWidthItem ImGuiShrinkWidthItem; -typedef struct ImGuiWindowStackData ImGuiWindowStackData; -typedef struct ImGuiComboPreviewData ImGuiComboPreviewData; -typedef struct ImGuiDataTypeTempStorage ImGuiDataTypeTempStorage; -typedef struct ImVec2ih ImVec2ih; -typedef struct ImVec1 ImVec1; -typedef struct StbTexteditRow StbTexteditRow; -typedef struct STB_TexteditState STB_TexteditState; -typedef struct StbUndoState StbUndoState; -typedef struct StbUndoRecord StbUndoRecord; -typedef struct ImGuiWindowSettings ImGuiWindowSettings; -typedef struct ImGuiWindowTempData ImGuiWindowTempData; -typedef struct ImGuiWindow ImGuiWindow; -typedef struct ImGuiTableColumnsSettings ImGuiTableColumnsSettings; -typedef struct ImGuiTableSettings ImGuiTableSettings; -typedef struct ImGuiTableTempData ImGuiTableTempData; -typedef struct ImGuiTableColumn ImGuiTableColumn; -typedef struct ImGuiTable ImGuiTable; -typedef struct ImGuiTabItem ImGuiTabItem; -typedef struct ImGuiTabBar ImGuiTabBar; -typedef struct ImGuiStyleMod ImGuiStyleMod; -typedef struct ImGuiStackSizes ImGuiStackSizes; -typedef struct ImGuiSettingsHandler ImGuiSettingsHandler; -typedef struct ImGuiPopupData ImGuiPopupData; -typedef struct ImGuiOldColumns ImGuiOldColumns; -typedef struct ImGuiOldColumnData ImGuiOldColumnData; -typedef struct ImGuiNextItemData ImGuiNextItemData; -typedef struct ImGuiNextWindowData ImGuiNextWindowData; -typedef struct ImGuiMetricsConfig ImGuiMetricsConfig; -typedef struct ImGuiNavItemData ImGuiNavItemData; -typedef struct ImGuiMenuColumns ImGuiMenuColumns; -typedef struct ImGuiLastItemData ImGuiLastItemData; -typedef struct ImGuiInputTextState ImGuiInputTextState; -typedef struct ImGuiGroupData ImGuiGroupData; -typedef struct ImGuiDataTypeInfo ImGuiDataTypeInfo; -typedef struct ImGuiContextHook ImGuiContextHook; -typedef struct ImGuiColorMod ImGuiColorMod; -typedef struct ImDrawDataBuilder ImDrawDataBuilder; -typedef struct ImRect ImRect; -typedef struct ImBitVector ImBitVector; -typedef struct ImFontAtlasCustomRect ImFontAtlasCustomRect; -typedef struct ImDrawCmdHeader ImDrawCmdHeader; -typedef struct ImGuiStoragePair ImGuiStoragePair; -typedef struct ImGuiTextRange ImGuiTextRange; -typedef struct ImVec4 ImVec4; -typedef struct ImVec2 ImVec2; -typedef struct ImGuiViewport ImGuiViewport; -typedef struct ImGuiTextFilter ImGuiTextFilter; -typedef struct ImGuiTextBuffer ImGuiTextBuffer; -typedef struct ImGuiTableColumnSortSpecs ImGuiTableColumnSortSpecs; -typedef struct ImGuiTableSortSpecs ImGuiTableSortSpecs; -typedef struct ImGuiStyle ImGuiStyle; -typedef struct ImGuiStorage ImGuiStorage; -typedef struct ImGuiSizeCallbackData ImGuiSizeCallbackData; -typedef struct ImGuiPayload ImGuiPayload; -typedef struct ImGuiOnceUponAFrame ImGuiOnceUponAFrame; -typedef struct ImGuiListClipper ImGuiListClipper; -typedef struct ImGuiInputTextCallbackData ImGuiInputTextCallbackData; -typedef struct ImGuiIO ImGuiIO; -typedef struct ImGuiContext ImGuiContext; -typedef struct ImColor ImColor; -typedef struct ImFontGlyphRangesBuilder ImFontGlyphRangesBuilder; -typedef struct ImFontGlyph ImFontGlyph; -typedef struct ImFontConfig ImFontConfig; -typedef struct ImFontBuilderIO ImFontBuilderIO; -typedef struct ImFontAtlas ImFontAtlas; -typedef struct ImFont ImFont; -typedef struct ImDrawVert ImDrawVert; -typedef struct ImDrawListSplitter ImDrawListSplitter; -typedef struct ImDrawListSharedData ImDrawListSharedData; -typedef struct ImDrawList ImDrawList; -typedef struct ImDrawData ImDrawData; -typedef struct ImDrawCmd ImDrawCmd; -typedef struct ImDrawChannel ImDrawChannel; +typedef struct ImDrawChannel ImDrawChannel; +typedef struct ImDrawCmd ImDrawCmd; +typedef struct ImDrawData ImDrawData; +typedef struct ImDrawList ImDrawList; +typedef struct ImDrawListSharedData ImDrawListSharedData; +typedef struct ImDrawListSplitter ImDrawListSplitter; +typedef struct ImDrawVert ImDrawVert; +typedef struct ImFont ImFont; +typedef struct ImFontAtlas ImFontAtlas; +typedef struct ImFontBuilderIO ImFontBuilderIO; +typedef struct ImFontConfig ImFontConfig; +typedef struct ImFontGlyph ImFontGlyph; +typedef struct ImFontGlyphRangesBuilder ImFontGlyphRangesBuilder; +typedef struct ImColor ImColor; +typedef struct ImGuiContext ImGuiContext; +typedef struct ImGuiIO ImGuiIO; +typedef struct ImGuiInputTextCallbackData ImGuiInputTextCallbackData; +typedef struct ImGuiListClipper ImGuiListClipper; +typedef struct ImGuiOnceUponAFrame ImGuiOnceUponAFrame; +typedef struct ImGuiPayload ImGuiPayload; +typedef struct ImGuiSizeCallbackData ImGuiSizeCallbackData; +typedef struct ImGuiStorage ImGuiStorage; +typedef struct ImGuiStyle ImGuiStyle; +typedef struct ImGuiTableSortSpecs ImGuiTableSortSpecs; +typedef struct ImGuiTableColumnSortSpecs ImGuiTableColumnSortSpecs; +typedef struct ImGuiTextBuffer ImGuiTextBuffer; +typedef struct ImGuiTextFilter ImGuiTextFilter; +typedef struct ImGuiViewport ImGuiViewport; +typedef struct ImBitVector ImBitVector; +typedef struct ImRect ImRect; +typedef struct ImDrawDataBuilder ImDrawDataBuilder; +typedef struct ImGuiColorMod ImGuiColorMod; +typedef struct ImGuiContextHook ImGuiContextHook; +typedef struct ImGuiDataTypeInfo ImGuiDataTypeInfo; +typedef struct ImGuiGroupData ImGuiGroupData; +typedef struct ImGuiInputTextState ImGuiInputTextState; +typedef struct ImGuiLastItemData ImGuiLastItemData; +typedef struct ImGuiMenuColumns ImGuiMenuColumns; +typedef struct ImGuiNavItemData ImGuiNavItemData; +typedef struct ImGuiMetricsConfig ImGuiMetricsConfig; +typedef struct ImGuiNextWindowData ImGuiNextWindowData; +typedef struct ImGuiNextItemData ImGuiNextItemData; +typedef struct ImGuiOldColumnData ImGuiOldColumnData; +typedef struct ImGuiOldColumns ImGuiOldColumns; +typedef struct ImGuiPopupData ImGuiPopupData; +typedef struct ImGuiSettingsHandler ImGuiSettingsHandler; +typedef struct ImGuiStackSizes ImGuiStackSizes; +typedef struct ImGuiStyleMod ImGuiStyleMod; +typedef struct ImGuiTabBar ImGuiTabBar; +typedef struct ImGuiTabItem ImGuiTabItem; +typedef struct ImGuiTable ImGuiTable; +typedef struct ImGuiTableColumn ImGuiTableColumn; +typedef struct ImGuiTableTempData ImGuiTableTempData; +typedef struct ImGuiTableSettings ImGuiTableSettings; +typedef struct ImGuiTableColumnsSettings ImGuiTableColumnsSettings; +typedef struct ImGuiWindow ImGuiWindow; +typedef struct ImGuiWindowTempData ImGuiWindowTempData; +typedef struct ImGuiWindowSettings ImGuiWindowSettings; struct ImDrawChannel; struct ImDrawCmd; struct ImDrawData; @@ -203,113 +179,12 @@ typedef int (*ImGuiInputTextCallback)(ImGuiInputTextCallbackData* data); typedef void (*ImGuiSizeCallback)(ImGuiSizeCallbackData* data); typedef void* (*ImGuiMemAllocFunc)(size_t sz, void* user_data); typedef void (*ImGuiMemFreeFunc)(void* ptr, void* user_data); -typedef void (*ImDrawCallback)(const ImDrawList* parent_list, const ImDrawCmd* cmd); -struct ImBitVector; -struct ImRect; -struct ImDrawDataBuilder; -struct ImDrawListSharedData; -struct ImGuiColorMod; -struct ImGuiContext; -struct ImGuiContextHook; -struct ImGuiDataTypeInfo; -struct ImGuiGroupData; -struct ImGuiInputTextState; -struct ImGuiLastItemData; -struct ImGuiMenuColumns; -struct ImGuiNavItemData; -struct ImGuiMetricsConfig; -struct ImGuiNextWindowData; -struct ImGuiNextItemData; -struct ImGuiOldColumnData; -struct ImGuiOldColumns; -struct ImGuiPopupData; -struct ImGuiSettingsHandler; -struct ImGuiStackSizes; -struct ImGuiStyleMod; -struct ImGuiTabBar; -struct ImGuiTabItem; -struct ImGuiTable; -struct ImGuiTableColumn; -struct ImGuiTableTempData; -struct ImGuiTableSettings; -struct ImGuiTableColumnsSettings; -struct ImGuiWindow; -struct ImGuiWindowTempData; -struct ImGuiWindowSettings; -typedef int ImGuiLayoutType; -typedef int ImGuiActivateFlags; -typedef int ImGuiItemFlags; -typedef int ImGuiItemStatusFlags; -typedef int ImGuiOldColumnFlags; -typedef int ImGuiNavHighlightFlags; -typedef int ImGuiNavDirSourceFlags; -typedef int ImGuiNavMoveFlags; -typedef int ImGuiNextItemDataFlags; -typedef int ImGuiNextWindowDataFlags; -typedef int ImGuiScrollFlags; -typedef int ImGuiSeparatorFlags; -typedef int ImGuiTextFlags; -typedef int ImGuiTooltipFlags; -typedef void (*ImGuiErrorLogCallback)(void* user_data, const char* fmt, ...); -extern ImGuiContext* GImGui; -typedef FILE* ImFileHandle; -typedef int ImPoolIdx; -typedef void (*ImGuiContextHookCallback)(ImGuiContext* ctx, ImGuiContextHook* hook); -typedef ImS8 ImGuiTableColumnIdx; -typedef ImU8 ImGuiTableDrawChannelIdx; -typedef struct ImVector{int Size;int Capacity;void* Data;} ImVector; -typedef struct ImVector_ImGuiTableSettings {int Size;int Capacity;ImGuiTableSettings* Data;} ImVector_ImGuiTableSettings; -typedef struct ImChunkStream_ImGuiTableSettings {ImVector_ImGuiTableSettings Buf;} ImChunkStream_ImGuiTableSettings; -typedef struct ImVector_ImGuiWindowSettings {int Size;int Capacity;ImGuiWindowSettings* Data;} ImVector_ImGuiWindowSettings; -typedef struct ImChunkStream_ImGuiWindowSettings {ImVector_ImGuiWindowSettings Buf;} ImChunkStream_ImGuiWindowSettings; -typedef struct ImSpan_ImGuiTableCellData {ImGuiTableCellData* Data;ImGuiTableCellData* DataEnd;} ImSpan_ImGuiTableCellData; -typedef struct ImSpan_ImGuiTableColumn {ImGuiTableColumn* Data;ImGuiTableColumn* DataEnd;} ImSpan_ImGuiTableColumn; -typedef struct ImSpan_ImGuiTableColumnIdx {ImGuiTableColumnIdx* Data;ImGuiTableColumnIdx* DataEnd;} ImSpan_ImGuiTableColumnIdx; -typedef struct ImVector_ImDrawChannel {int Size;int Capacity;ImDrawChannel* Data;} ImVector_ImDrawChannel; -typedef struct ImVector_ImDrawCmd {int Size;int Capacity;ImDrawCmd* Data;} ImVector_ImDrawCmd; -typedef struct ImVector_ImDrawIdx {int Size;int Capacity;ImDrawIdx* Data;} ImVector_ImDrawIdx; -typedef struct ImVector_ImDrawListPtr {int Size;int Capacity;ImDrawList** Data;} ImVector_ImDrawListPtr; -typedef struct ImVector_ImDrawVert {int Size;int Capacity;ImDrawVert* Data;} ImVector_ImDrawVert; -typedef struct ImVector_ImFontPtr {int Size;int Capacity;ImFont** Data;} ImVector_ImFontPtr; -typedef struct ImVector_ImFontAtlasCustomRect {int Size;int Capacity;ImFontAtlasCustomRect* Data;} ImVector_ImFontAtlasCustomRect; -typedef struct ImVector_ImFontConfig {int Size;int Capacity;ImFontConfig* Data;} ImVector_ImFontConfig; -typedef struct ImVector_ImFontGlyph {int Size;int Capacity;ImFontGlyph* Data;} ImVector_ImFontGlyph; -typedef struct ImVector_ImGuiColorMod {int Size;int Capacity;ImGuiColorMod* Data;} ImVector_ImGuiColorMod; -typedef struct ImVector_ImGuiContextHook {int Size;int Capacity;ImGuiContextHook* Data;} ImVector_ImGuiContextHook; -typedef struct ImVector_ImGuiGroupData {int Size;int Capacity;ImGuiGroupData* Data;} ImVector_ImGuiGroupData; -typedef struct ImVector_ImGuiID {int Size;int Capacity;ImGuiID* Data;} ImVector_ImGuiID; -typedef struct ImVector_ImGuiItemFlags {int Size;int Capacity;ImGuiItemFlags* Data;} ImVector_ImGuiItemFlags; -typedef struct ImVector_ImGuiListClipperData {int Size;int Capacity;ImGuiListClipperData* Data;} ImVector_ImGuiListClipperData; -typedef struct ImVector_ImGuiListClipperRange {int Size;int Capacity;ImGuiListClipperRange* Data;} ImVector_ImGuiListClipperRange; -typedef struct ImVector_ImGuiOldColumnData {int Size;int Capacity;ImGuiOldColumnData* Data;} ImVector_ImGuiOldColumnData; -typedef struct ImVector_ImGuiOldColumns {int Size;int Capacity;ImGuiOldColumns* Data;} ImVector_ImGuiOldColumns; -typedef struct ImVector_ImGuiPopupData {int Size;int Capacity;ImGuiPopupData* Data;} ImVector_ImGuiPopupData; -typedef struct ImVector_ImGuiPtrOrIndex {int Size;int Capacity;ImGuiPtrOrIndex* Data;} ImVector_ImGuiPtrOrIndex; -typedef struct ImVector_ImGuiSettingsHandler {int Size;int Capacity;ImGuiSettingsHandler* Data;} ImVector_ImGuiSettingsHandler; -typedef struct ImVector_ImGuiShrinkWidthItem {int Size;int Capacity;ImGuiShrinkWidthItem* Data;} ImVector_ImGuiShrinkWidthItem; -typedef struct ImVector_ImGuiStackLevelInfo {int Size;int Capacity;ImGuiStackLevelInfo* Data;} ImVector_ImGuiStackLevelInfo; -typedef struct ImVector_ImGuiStoragePair {int Size;int Capacity;ImGuiStoragePair* Data;} ImVector_ImGuiStoragePair; -typedef struct ImVector_ImGuiStyleMod {int Size;int Capacity;ImGuiStyleMod* Data;} ImVector_ImGuiStyleMod; -typedef struct ImVector_ImGuiTabItem {int Size;int Capacity;ImGuiTabItem* Data;} ImVector_ImGuiTabItem; -typedef struct ImVector_ImGuiTableColumnSortSpecs {int Size;int Capacity;ImGuiTableColumnSortSpecs* Data;} ImVector_ImGuiTableColumnSortSpecs; -typedef struct ImVector_ImGuiTableTempData {int Size;int Capacity;ImGuiTableTempData* Data;} ImVector_ImGuiTableTempData; -typedef struct ImVector_ImGuiTextRange {int Size;int Capacity;ImGuiTextRange* Data;} ImVector_ImGuiTextRange; -typedef struct ImVector_ImGuiViewportPPtr {int Size;int Capacity;ImGuiViewportP** Data;} ImVector_ImGuiViewportPPtr; -typedef struct ImVector_ImGuiWindowPtr {int Size;int Capacity;ImGuiWindow** Data;} ImVector_ImGuiWindowPtr; -typedef struct ImVector_ImGuiWindowStackData {int Size;int Capacity;ImGuiWindowStackData* Data;} ImVector_ImGuiWindowStackData; -typedef struct ImVector_ImTextureID {int Size;int Capacity;ImTextureID* Data;} ImVector_ImTextureID; -typedef struct ImVector_ImU32 {int Size;int Capacity;ImU32* Data;} ImVector_ImU32; -typedef struct ImVector_ImVec2 {int Size;int Capacity;ImVec2* Data;} ImVector_ImVec2; -typedef struct ImVector_ImVec4 {int Size;int Capacity;ImVec4* Data;} ImVector_ImVec4; -typedef struct ImVector_ImWchar {int Size;int Capacity;ImWchar* Data;} ImVector_ImWchar; -typedef struct ImVector_char {int Size;int Capacity;char* Data;} ImVector_char; -typedef struct ImVector_float {int Size;int Capacity;float* Data;} ImVector_float; -typedef struct ImVector_unsigned_char {int Size;int Capacity;unsigned char* Data;} ImVector_unsigned_char; - +typedef struct ImVec2 ImVec2; struct ImVec2 { float x, y; }; +typedef struct ImVec4 ImVec4; struct ImVec4 { float x, y, z, w; @@ -855,6 +730,8 @@ struct ImGuiStyle float CircleTessellationMaxError; ImVec4 Colors[ImGuiCol_COUNT]; }; +typedef struct ImVector_ImWchar {int Size;int Capacity;ImWchar* Data;} ImVector_ImWchar; + struct ImGuiIO { ImGuiConfigFlags ConfigFlags; @@ -998,12 +875,19 @@ struct ImGuiTextRange const char* b; const char* e; }; +typedef struct ImGuiTextRange ImGuiTextRange; + +typedef struct ImVector_ImGuiTextRange {int Size;int Capacity;ImGuiTextRange* Data;} ImVector_ImGuiTextRange; + struct ImGuiTextFilter { char InputBuf[256]; ImVector_ImGuiTextRange Filters; int CountGrep; }; +typedef struct ImGuiTextRange ImGuiTextRange; +typedef struct ImVector_char {int Size;int Capacity;char* Data;} ImVector_char; + struct ImGuiTextBuffer { ImVector_char Buf; @@ -1013,14 +897,15 @@ struct ImGuiStoragePair ImGuiID key; union { int val_i; float val_f; void* val_p; }; }; +typedef struct ImGuiStoragePair ImGuiStoragePair; + +typedef struct ImVector_ImGuiStoragePair {int Size;int Capacity;ImGuiStoragePair* Data;} ImVector_ImGuiStoragePair; + struct ImGuiStorage { ImVector_ImGuiStoragePair Data; }; -typedef struct ImVector_ImGuiTabBar {int Size;int Capacity;ImGuiTabBar* Data;} ImVector_ImGuiTabBar; -typedef struct ImPool_ImGuiTabBar {ImVector_ImGuiTabBar Buf;ImGuiStorage Map;ImPoolIdx FreeIdx;} ImPool_ImGuiTabBar; -typedef struct ImVector_ImGuiTable {int Size;int Capacity;ImGuiTable* Data;} ImVector_ImGuiTable; -typedef struct ImPool_ImGuiTable {ImVector_ImGuiTable Buf;ImGuiStorage Map;ImPoolIdx FreeIdx;} ImPool_ImGuiTable; +typedef struct ImGuiStoragePair ImGuiStoragePair; struct ImGuiListClipper { int DisplayStart; @@ -1034,6 +919,7 @@ struct ImColor { ImVec4 Value; }; +typedef void (*ImDrawCallback)(const ImDrawList* parent_list, const ImDrawCmd* cmd); struct ImDrawCmd { ImVec4 ClipRect; @@ -1050,17 +936,24 @@ struct ImDrawVert ImVec2 uv; ImU32 col; }; +typedef struct ImDrawCmdHeader ImDrawCmdHeader; struct ImDrawCmdHeader { ImVec4 ClipRect; ImTextureID TextureId; unsigned int VtxOffset; }; +typedef struct ImVector_ImDrawCmd {int Size;int Capacity;ImDrawCmd* Data;} ImVector_ImDrawCmd; + +typedef struct ImVector_ImDrawIdx {int Size;int Capacity;ImDrawIdx* Data;} ImVector_ImDrawIdx; + struct ImDrawChannel { ImVector_ImDrawCmd _CmdBuffer; ImVector_ImDrawIdx _IdxBuffer; }; +typedef struct ImVector_ImDrawChannel {int Size;int Capacity;ImDrawChannel* Data;} ImVector_ImDrawChannel; + struct ImDrawListSplitter { int _Current; @@ -1090,6 +983,14 @@ typedef enum { ImDrawListFlags_AntiAliasedFill = 1 << 2, ImDrawListFlags_AllowVtxOffset = 1 << 3 }ImDrawListFlags_; +typedef struct ImVector_ImDrawVert {int Size;int Capacity;ImDrawVert* Data;} ImVector_ImDrawVert; + +typedef struct ImVector_ImVec4 {int Size;int Capacity;ImVec4* Data;} ImVector_ImVec4; + +typedef struct ImVector_ImTextureID {int Size;int Capacity;ImTextureID* Data;} ImVector_ImTextureID; + +typedef struct ImVector_ImVec2 {int Size;int Capacity;ImVec2* Data;} ImVector_ImVec2; + struct ImDrawList { ImVector_ImDrawCmd CmdBuffer; @@ -1150,10 +1051,13 @@ struct ImFontGlyph float X0, Y0, X1, Y1; float U0, V0, U1, V1; }; +typedef struct ImVector_ImU32 {int Size;int Capacity;ImU32* Data;} ImVector_ImU32; + struct ImFontGlyphRangesBuilder { ImVector_ImU32 UsedChars; }; +typedef struct ImFontAtlasCustomRect ImFontAtlasCustomRect; struct ImFontAtlasCustomRect { unsigned short Width, Height; @@ -1169,6 +1073,12 @@ typedef enum { ImFontAtlasFlags_NoMouseCursors = 1 << 1, ImFontAtlasFlags_NoBakedLines = 1 << 2 }ImFontAtlasFlags_; +typedef struct ImVector_ImFontPtr {int Size;int Capacity;ImFont** Data;} ImVector_ImFontPtr; + +typedef struct ImVector_ImFontAtlasCustomRect {int Size;int Capacity;ImFontAtlasCustomRect* Data;} ImVector_ImFontAtlasCustomRect; + +typedef struct ImVector_ImFontConfig {int Size;int Capacity;ImFontConfig* Data;} ImVector_ImFontConfig; + struct ImFontAtlas { ImFontAtlasFlags Flags; @@ -1193,6 +1103,10 @@ struct ImFontAtlas int PackIdMouseCursors; int PackIdLines; }; +typedef struct ImVector_float {int Size;int Capacity;float* Data;} ImVector_float; + +typedef struct ImVector_ImFontGlyph {int Size;int Capacity;ImFontGlyph* Data;} ImVector_ImFontGlyph; + struct ImFont { ImVector_float IndexAdvanceX; @@ -1227,6 +1141,55 @@ struct ImGuiViewport ImVec2 WorkPos; ImVec2 WorkSize; }; +struct ImBitVector; +struct ImRect; +struct ImDrawDataBuilder; +struct ImDrawListSharedData; +struct ImGuiColorMod; +struct ImGuiContext; +struct ImGuiContextHook; +struct ImGuiDataTypeInfo; +struct ImGuiGroupData; +struct ImGuiInputTextState; +struct ImGuiLastItemData; +struct ImGuiMenuColumns; +struct ImGuiNavItemData; +struct ImGuiMetricsConfig; +struct ImGuiNextWindowData; +struct ImGuiNextItemData; +struct ImGuiOldColumnData; +struct ImGuiOldColumns; +struct ImGuiPopupData; +struct ImGuiSettingsHandler; +struct ImGuiStackSizes; +struct ImGuiStyleMod; +struct ImGuiTabBar; +struct ImGuiTabItem; +struct ImGuiTable; +struct ImGuiTableColumn; +struct ImGuiTableTempData; +struct ImGuiTableSettings; +struct ImGuiTableColumnsSettings; +struct ImGuiWindow; +struct ImGuiWindowTempData; +struct ImGuiWindowSettings; +typedef int ImGuiLayoutType; +typedef int ImGuiActivateFlags; +typedef int ImGuiItemFlags; +typedef int ImGuiItemStatusFlags; +typedef int ImGuiOldColumnFlags; +typedef int ImGuiNavHighlightFlags; +typedef int ImGuiNavDirSourceFlags; +typedef int ImGuiNavMoveFlags; +typedef int ImGuiNextItemDataFlags; +typedef int ImGuiNextWindowDataFlags; +typedef int ImGuiScrollFlags; +typedef int ImGuiSeparatorFlags; +typedef int ImGuiTextFlags; +typedef int ImGuiTooltipFlags; +typedef void (*ImGuiErrorLogCallback)(void* user_data, const char* fmt, ...); +extern ImGuiContext* GImGui; +typedef struct StbUndoRecord StbUndoRecord; struct StbUndoRecord { int where; @@ -1234,6 +1197,7 @@ struct StbUndoRecord int delete_length; int char_storage; }; +typedef struct StbUndoState StbUndoState; struct StbUndoState { StbUndoRecord undo_rec [99]; @@ -1241,6 +1205,7 @@ struct StbUndoState short undo_point, redo_point; int undo_char_point, redo_char_point; }; +typedef struct STB_TexteditState STB_TexteditState; struct STB_TexteditState { int cursor; @@ -1256,6 +1221,7 @@ struct STB_TexteditState float preferred_x; StbUndoState undostate; }; +typedef struct StbTexteditRow StbTexteditRow; struct StbTexteditRow { float x0,x1; @@ -1263,10 +1229,13 @@ struct StbTexteditRow float ymin,ymax; int num_chars; }; +typedef FILE* ImFileHandle; +typedef struct ImVec1 ImVec1; struct ImVec1 { float x; }; +typedef struct ImVec2ih ImVec2ih; struct ImVec2ih { short x, y; @@ -1280,6 +1249,7 @@ struct ImBitVector { ImVector_ImU32 Storage; }; +typedef int ImPoolIdx; struct ImDrawListSharedData { ImVec2 TexUvWhitePixel; @@ -1294,6 +1264,8 @@ struct ImDrawListSharedData ImU8 CircleSegmentCounts[64]; const ImVec4* TexUvLines; }; +typedef struct ImVector_ImDrawListPtr {int Size;int Capacity;ImDrawList** Data;} ImVector_ImDrawListPtr; + struct ImDrawDataBuilder { ImVector_ImDrawListPtr Layers[2]; @@ -1422,6 +1394,7 @@ typedef enum { ImGuiPopupPositionPolicy_ComboBox, ImGuiPopupPositionPolicy_Tooltip }ImGuiPopupPositionPolicy; +typedef struct ImGuiDataTypeTempStorage ImGuiDataTypeTempStorage; struct ImGuiDataTypeTempStorage { ImU8 Data[8]; @@ -1448,6 +1421,7 @@ struct ImGuiStyleMod ImGuiStyleVar VarIdx; union { int BackupInt[2]; float BackupFloat[2]; }; }; +typedef struct ImGuiComboPreviewData ImGuiComboPreviewData; struct ImGuiComboPreviewData { ImRect PreviewRect; @@ -1572,22 +1546,26 @@ struct ImGuiStackSizes short SizeOfBeginPopupStack; short SizeOfDisabledStack; }; +typedef struct ImGuiWindowStackData ImGuiWindowStackData; struct ImGuiWindowStackData { ImGuiWindow* Window; ImGuiLastItemData ParentLastItemDataBackup; ImGuiStackSizes StackSizesOnBegin; }; +typedef struct ImGuiShrinkWidthItem ImGuiShrinkWidthItem; struct ImGuiShrinkWidthItem { int Index; float Width; }; +typedef struct ImGuiPtrOrIndex ImGuiPtrOrIndex; struct ImGuiPtrOrIndex { void* Ptr; int Index; }; +typedef struct ImGuiListClipperRange ImGuiListClipperRange; struct ImGuiListClipperRange { int Min; @@ -1596,6 +1574,9 @@ struct ImGuiListClipperRange ImS8 PosToIndexOffsetMin; ImS8 PosToIndexOffsetMax; }; +typedef struct ImGuiListClipperData ImGuiListClipperData; +typedef struct ImVector_ImGuiListClipperRange {int Size;int Capacity;ImGuiListClipperRange* Data;} ImVector_ImGuiListClipperRange; + struct ImGuiListClipperData { ImGuiListClipper* ListClipper; @@ -1683,6 +1664,8 @@ struct ImGuiOldColumnData ImGuiOldColumnFlags Flags; ImRect ClipRect; }; +typedef struct ImVector_ImGuiOldColumnData {int Size;int Capacity;ImGuiOldColumnData* Data;} ImVector_ImGuiOldColumnData; + struct ImGuiOldColumns { ImGuiID ID; @@ -1701,6 +1684,7 @@ struct ImGuiOldColumns ImVector_ImGuiOldColumnData Columns; ImDrawListSplitter Splitter; }; +typedef struct ImGuiViewportP ImGuiViewportP; struct ImGuiViewportP { ImGuiViewport _ImGuiViewport; @@ -1744,6 +1728,7 @@ struct ImGuiMetricsConfig int ShowWindowsRectsType; int ShowTablesRectsType; }; +typedef struct ImGuiStackLevelInfo ImGuiStackLevelInfo; struct ImGuiStackLevelInfo { ImGuiID ID; @@ -1751,6 +1736,9 @@ struct ImGuiStackLevelInfo bool QuerySuccess; char Desc[58]; }; +typedef struct ImGuiStackTool ImGuiStackTool; +typedef struct ImVector_ImGuiStackLevelInfo {int Size;int Capacity;ImGuiStackLevelInfo* Data;} ImVector_ImGuiStackLevelInfo; + struct ImGuiStackTool { int LastActiveFrame; @@ -1758,6 +1746,7 @@ struct ImGuiStackTool ImGuiID QueryId; ImVector_ImGuiStackLevelInfo Results; }; +typedef void (*ImGuiContextHookCallback)(ImGuiContext* ctx, ImGuiContextHook* hook); typedef enum { ImGuiContextHookType_NewFramePre, ImGuiContextHookType_NewFramePost, ImGuiContextHookType_EndFramePre, ImGuiContextHookType_EndFramePost, ImGuiContextHookType_RenderPre, ImGuiContextHookType_RenderPost, ImGuiContextHookType_Shutdown, ImGuiContextHookType_PendingRemoval_ }ImGuiContextHookType; struct ImGuiContextHook { @@ -1767,6 +1756,50 @@ struct ImGuiContextHook ImGuiContextHookCallback Callback; void* UserData; }; +typedef struct ImVector_ImGuiWindowPtr {int Size;int Capacity;ImGuiWindow** Data;} ImVector_ImGuiWindowPtr; + +typedef struct ImVector_ImGuiWindowStackData {int Size;int Capacity;ImGuiWindowStackData* Data;} ImVector_ImGuiWindowStackData; + +typedef struct ImVector_ImGuiColorMod {int Size;int Capacity;ImGuiColorMod* Data;} ImVector_ImGuiColorMod; + +typedef struct ImVector_ImGuiStyleMod {int Size;int Capacity;ImGuiStyleMod* Data;} ImVector_ImGuiStyleMod; + +typedef struct ImVector_ImGuiID {int Size;int Capacity;ImGuiID* Data;} ImVector_ImGuiID; + +typedef struct ImVector_ImGuiItemFlags {int Size;int Capacity;ImGuiItemFlags* Data;} ImVector_ImGuiItemFlags; + +typedef struct ImVector_ImGuiGroupData {int Size;int Capacity;ImGuiGroupData* Data;} ImVector_ImGuiGroupData; + +typedef struct ImVector_ImGuiPopupData {int Size;int Capacity;ImGuiPopupData* Data;} ImVector_ImGuiPopupData; + +typedef struct ImVector_ImGuiViewportPPtr {int Size;int Capacity;ImGuiViewportP** Data;} ImVector_ImGuiViewportPPtr; + +typedef struct ImVector_unsigned_char {int Size;int Capacity;unsigned char* Data;} ImVector_unsigned_char; + +typedef struct ImVector_ImGuiListClipperData {int Size;int Capacity;ImGuiListClipperData* Data;} ImVector_ImGuiListClipperData; + +typedef struct ImVector_ImGuiTableTempData {int Size;int Capacity;ImGuiTableTempData* Data;} ImVector_ImGuiTableTempData; + +typedef struct ImVector_ImGuiTable {int Size;int Capacity;ImGuiTable* Data;} ImVector_ImGuiTable; + +typedef struct ImPool_ImGuiTable {ImVector_ImGuiTable Buf;ImGuiStorage Map;ImPoolIdx FreeIdx;ImPoolIdx AliveCount;} ImPool_ImGuiTable; + +typedef struct ImVector_ImGuiTabBar {int Size;int Capacity;ImGuiTabBar* Data;} ImVector_ImGuiTabBar; + +typedef struct ImPool_ImGuiTabBar {ImVector_ImGuiTabBar Buf;ImGuiStorage Map;ImPoolIdx FreeIdx;ImPoolIdx AliveCount;} ImPool_ImGuiTabBar; + +typedef struct ImVector_ImGuiPtrOrIndex {int Size;int Capacity;ImGuiPtrOrIndex* Data;} ImVector_ImGuiPtrOrIndex; + +typedef struct ImVector_ImGuiShrinkWidthItem {int Size;int Capacity;ImGuiShrinkWidthItem* Data;} ImVector_ImGuiShrinkWidthItem; + +typedef struct ImVector_ImGuiSettingsHandler {int Size;int Capacity;ImGuiSettingsHandler* Data;} ImVector_ImGuiSettingsHandler; + +typedef struct ImChunkStream_ImGuiWindowSettings {ImVector_char Buf;} ImChunkStream_ImGuiWindowSettings; + +typedef struct ImChunkStream_ImGuiTableSettings {ImVector_char Buf;} ImChunkStream_ImGuiTableSettings; + +typedef struct ImVector_ImGuiContextHook {int Size;int Capacity;ImGuiContextHook* Data;} ImVector_ImGuiContextHook; + struct ImGuiContext { bool Initialized; @@ -2020,6 +2053,8 @@ struct ImGuiWindowTempData ImVector_float ItemWidthStack; ImVector_float TextWrapPosStack; }; +typedef struct ImVector_ImGuiOldColumns {int Size;int Capacity;ImGuiOldColumns* Data;} ImVector_ImGuiOldColumns; + struct ImGuiWindow { char* Name; @@ -2131,6 +2166,8 @@ struct ImGuiTabItem ImS16 IndexDuringLayout; bool WantClose; }; +typedef struct ImVector_ImGuiTabItem {int Size;int Capacity;ImGuiTabItem* Data;} ImVector_ImGuiTabItem; + struct ImGuiTabBar { ImVector_ImGuiTabItem Tabs; @@ -2165,6 +2202,8 @@ struct ImGuiTabBar ImVec2 BackupCursorPos; ImGuiTextBuffer TabsNames; }; +typedef ImS8 ImGuiTableColumnIdx; +typedef ImU8 ImGuiTableDrawChannelIdx; struct ImGuiTableColumn { ImGuiTableColumnFlags Flags; @@ -2209,11 +2248,20 @@ struct ImGuiTableColumn ImU8 SortDirectionsAvailMask : 4; ImU8 SortDirectionsAvailList; }; +typedef struct ImGuiTableCellData ImGuiTableCellData; struct ImGuiTableCellData { ImU32 BgColor; ImGuiTableColumnIdx Column; }; +typedef struct ImSpan_ImGuiTableColumn {ImGuiTableColumn* Data;ImGuiTableColumn* DataEnd;} ImSpan_ImGuiTableColumn; + +typedef struct ImSpan_ImGuiTableColumnIdx {ImGuiTableColumnIdx* Data;ImGuiTableColumnIdx* DataEnd;} ImSpan_ImGuiTableColumnIdx; + +typedef struct ImSpan_ImGuiTableCellData {ImGuiTableCellData* Data;ImGuiTableCellData* DataEnd;} ImSpan_ImGuiTableCellData; + +typedef struct ImVector_ImGuiTableColumnSortSpecs {int Size;int Capacity;ImGuiTableColumnSortSpecs* Data;} ImVector_ImGuiTableColumnSortSpecs; + struct ImGuiTable { ImGuiID ID; @@ -2335,6 +2383,7 @@ struct ImGuiTableTempData float HostBackupItemWidth; int HostBackupItemWidthStackSize; }; +typedef struct ImGuiTableColumnSettings ImGuiTableColumnSettings; struct ImGuiTableColumnSettings { float WidthOrWeight; diff --git a/generator/cpp2ffi.lua b/generator/cpp2ffi.lua index 3de608b..0defcdf 100644 --- a/generator/cpp2ffi.lua +++ b/generator/cpp2ffi.lua @@ -139,6 +139,7 @@ local function clean_spaces(cad) cad = strip(cad) cad = cad:gsub("%s+"," ") --not more than one space cad = cad:gsub("%s*([%(%),=:%+])%s*","%1") --not spaces with ( , ) or ( = ) or ( : ) or + + cad = cad:gsub("%s*(>>)%s*","%1") --name [] to name[] cad = cad:gsub("(%S)%s(%[)","%1%2") --clean %d * %d (could be done above but type*name should be treated different in other places) @@ -147,6 +148,22 @@ local function clean_spaces(cad) end ------------------------------------ +local function check_template(code) + local ttype,template = code:match("([^%s,%(%)]+)%s*<(.-)>") + local code2,te + if template then + te = template:gsub("%s*,%s*",",") + te = te:gsub(",","__") + te = te:gsub("%-","less") + te = te:gsub("%s","_") + te = te:gsub("%*","Ptr") + + code2 = code:gsub("(<[%w_%*%s]+>)([^%s%*])","%1 %2") + code2 = code2:gsub("<([^<>]-)>","_"..te) + end + return ttype,template,te,code2 +end +---------------------------------------- local function parse_enum_value(value, allenums,dontpost) local function clean(val) if type(val)=="string" then @@ -159,6 +176,7 @@ local function parse_enum_value(value, allenums,dontpost) if type(value)=="number" then return value elseif type(value)=="string" then + --print(value) --numbers local numval = tonumber(value) if numval then return numval end @@ -170,13 +188,13 @@ local function parse_enum_value(value, allenums,dontpost) value = value:gsub("^(%()",""):gsub("(%))$","") assert(not value:match("[%(%)]"),value) - local several,seps = strsplit(value,"([<>&|~%+]+)") + local several,seps = strsplit(value,"([<>&|~%+%-]+)") --M.prtable(value,several,seps) assert(#seps+1==#several) local i = 1 local ik = 1 - local sepk = {"~","<<",">>","&","^","|","+"} + local sepk = {"~","<<",">>","&","^","|","+","-"} while(#seps>0) do local sep = sepk[ik] local v = seps[i] @@ -206,6 +224,8 @@ local function parse_enum_value(value, allenums,dontpost) several[i] = bit.bor(val1,val2) elseif v=="+" then several[i] = val1 + val2 + elseif v=="-" then + several[i] = val1 - val2 else error("unknown operator "..v) end @@ -223,7 +243,7 @@ local function parse_enum_value(value, allenums,dontpost) end if #seps>0 or type(several[1])~="number" and not dontpost then --M.prtable("enline",enline) - print("parse_enum_value WARNING",value,several[1]) + print("parse_enum_value WARNING:",value,several[1]) --M.prtable(several,seps) --M.prtable("allenums",allenums) end @@ -278,6 +298,7 @@ local function getRE() local res = { function_re = "^([^;{}]+%b()[\n%s]*;)%s*", function_re = "^([^;{}=]+%b()[\n%s%w]*;)", --const at the end + function_re = "^([^;{}=]+%b()[\n%s%w%(%)_]*;)", --attribute(deprecated) struct_re = "^([^;{}]-struct[^;{}]-%b{}[%s%w_%(%)]*;)", enum_re = "^([^;{}]-enum[^;{}]-%b{}[%s%w_%(%)]*;)", union_re = "^([^;{}]-union[^;{}]-%b{}[%s%w_%(%)]*;)", @@ -324,7 +345,9 @@ local function parseItems(txt,linenumdict, itparent, dumpit) local re = res[re_name] local i,e = txt:find(re,ini) if i then + item = txt:sub(i,e) + --print("re_name",re_name,item) ------------------ --[[ --if re~=functionD_re then --skip defined functions @@ -377,12 +400,18 @@ local function parseItems(txt,linenumdict, itparent, dumpit) end if not loca then print("not loca",string.format("%q , %q ",itemold,itemfirstline),#itemfirstline) - for k,v in pairs(linenumdict) do - if k:match(itemfirstline) then - print(string.format("%q",k),#k) - end + -- for k,v in pairs(linenumdict) do + -- if k:match(itemfirstline) then + -- print(string.format("%q",k),#k) + -- end + -- end + --error"no entry in linenumdict" + --take locat from parent + if itparent.locat then + loca = itparent.locat + else + error"no entry in linenumdict" end - error"no entry in linenumdict" end else error"no linenumdict" @@ -601,20 +630,15 @@ local function parseFunction(self,stname,itt,namespace,locat) --- templates in args for i,ar in ipairs(argsTa) do --TODO several diferent templates - local ttype,template = ar:match("([^%s,%(%)]+)%s*<(.-)>") + local ttype,template,te,code2 = check_template(ar) --ar:match("([^%s,%(%)]+)%s*<(.-)>") - local te="" if template then if self.typenames[stname] ~= template then --rule out template typename - te = template:gsub("%s","_") - te = te:gsub("%*","Ptr") - - self.templates[ttype] = self.templates[ttype] or {} - self.templates[ttype][template] = te - te = "_"..te + self.templates[ttype] = self.templates[ttype] or {} + self.templates[ttype][template] = te end end - argsTa[i] = ar:gsub("<([%w_%*%s]+)>",te) --ImVector + argsTa[i] = te and code2 or ar --ar:gsub("<([%w_%*%s]+)>",te) --ImVector end --get typ, name and defaults @@ -1068,9 +1092,12 @@ function M.Parser() error("could not execute COMPILER "..err) end local defines = {} + local preprocessed = {}-- for line,loca,loca2 in M.location(pipe,names,defines,compiler) do self:insert(line, tostring(loca)..":"..tostring(loca2)) + table.insert(preprocessed,line)-- end + save_data("preprocesed.h",table.concat(preprocessed,"\n")) pipe:close() return defines end @@ -1140,7 +1167,8 @@ function M.Parser() local stname = it.item:match("struct%s+(%S+)") it.name = stname - local templa1,templa2 = it.item:match("^%s*template%s*<%s*(%S+)%s*(%S+)%s*>") + --local templa1,templa2 = it.item:match("^%s*template%s*<%s*(%S+)%s*(%S+)%s*>") + local templa2 = it.item:match("^%s*template%s*<%s*([^<>]+)%s*>") if templa1 or templa2 then print("template found",stname,templa1,templa2,"typename",typename) end if typename or templa2 then -- it is a struct template @@ -1183,8 +1211,25 @@ function M.Parser() printItems(items) end par.parseFunction = parseFunction - - function par:clean_structR1(itst) + local uniques = {} + local function check_unique_typedefs(l,uniques) + if not uniques[l] then + uniques[l] = true + return true + end + return false + end + function par:generate_templates() + local ttd = {} + M.table_do_sorted(self.templates , function (ttype, v) + --print("generate_templates",ttype,v) + M.table_do_sorted(v, function(te,newte) + table.insert(ttd,self:gentemplatetypedef(ttype,te,newte)) + end) + end) + return table.concat(ttd,"") + end + function par:clean_structR1(itst,doheader) local stru = itst.item local outtab = {} local commtab = {} @@ -1234,15 +1279,16 @@ function M.Parser() if not (it.re_name == "vardef_re" and it.item:match"static") then --skip static variables local it2 = it.item --:gsub("<([%w_]+)>","_%1") --templates --local ttype,template = it.item:match("([^%s,%(%)]+)%s*<(.+)>") - local ttype,template = it.item:match"([^%s,%(%)]+)%s*<(.+)>" + local ttype,template,te,code2 = check_template(it2) --it.item:match"([^%s,%(%)]+)%s*<(.+)>" if template then if self.typenames[ttype] ~= template then --rule out T (template typename) - local te = template:gsub("%s","_") - te = te:gsub("%*","Ptr") - self.templates[ttype] = self.templates[ttype] or {} - self.templates[ttype][template] = te - it2 = it2:gsub("(<[%w_%*%s]+>)([^%s])","%1 %2") --add if not present space after <> - it2 = it2:gsub("<([%w_%*%s]+)>","_"..te) + self.templates[ttype] = self.templates[ttype] or {} + self.templates[ttype][template] = te + it2=code2 + end + if doheader then + local templatetypedef = self:gentemplatetypedef(ttype, template,self.templates[ttype][template]) + predeclare = predeclare .. templatetypedef end end --clean mutable @@ -1263,7 +1309,15 @@ function M.Parser() table.insert(outtab,"\n "..it.name.." "..decl..";") table.insert(commtab,it.comments )--or "") end - local cleanst,structname,strtab,comstab,predec = self:clean_structR1(it) + local cleanst,structname,strtab,comstab,predec = self:clean_structR1(it,doheader) + if doheader then + local tst = "\ntypedef struct "..structname.." "..structname..";\n" + if check_unique_typedefs(tst,uniques) then + --table.insert(outtab,tst) + --print("xxxxxxxxxxxxxxxinsert typedef",structname) + cleanst = cleanst .. tst + end + end predeclare = predeclare .. predec .. cleanst elseif it.re_name == "enum_re" then --nop @@ -1293,20 +1347,48 @@ function M.Parser() if parnam~="" then parnam = parnam:sub(1,-3) end return parnam end + + function par:gen_structs_and_enums() + print"--------------gen_structs_and_enums" + --M.prtable(self.typenames) local outtab = {} local outtabpre = {} local typedefs_table = {} self.embeded_enums = {} + --local uniques = {} local processer = function(it) if it.re_name == "typedef_re" or it.re_name == "functypedef_re" or it.re_name == "vardef_re" then if not it.parent or it.parent.re_name=="namespace_re" then - table.insert(outtabpre,it.item) + local it2 = it.item + if it.re_name == "typedef_re" then + --check if it is templated + local ttype,template,te,code2 = check_template(it2) --it.item:match"([^%s,%(%)]+)%s*<(.+)>" + if template then + --if self.typenames[ttype] ~= template then --rule out T (template typename) + --self.templates[ttype] = self.templates[ttype] or {} + --self.templates[ttype][template] = te + --end + + --local templatetypedef = self:gentemplatetypedef(ttype, template,self.templates[ttype][template]) + --predeclare = predeclare .. templatetypedef + + local tdt = self:gentemplatetypedef(ttype,template,te) + it2 = tdt..code2 + end + + end + --table.insert(outtabpre,it2) + table.insert(outtab,it2) -- add typedef after struct name if it.re_name == "vardef_re" and it.item:match"^%s*struct" then local stname = it.item:match("struct%s*(%S+)%s*;") - table.insert(typedefs_table,"typedef struct "..stname.." "..stname..";\n") + --table.insert(typedefs_table,"typedef struct "..stname.." "..stname..";\n") + local tst = "\ntypedef struct "..stname.." "..stname..";" + if check_unique_typedefs(tst,uniques) then + table.insert(outtabpre,tst) + end self.typedefs_dict[stname]="struct "..stname if it.parent then --must be struct name; inside namespace local parname = get_parents_name(it) @@ -1349,16 +1431,21 @@ function M.Parser() print("unnamed enum",cl_item) end elseif it.re_name == "struct_re" or it.re_name == "typedef_st_re" then - local cleanst,structname,strtab,comstab,predec = self:clean_structR1(it) + local cleanst,structname,strtab,comstab,predec = self:clean_structR1(it,true) if not structname then print("NO NAME",cleanst,it.item) end --if not void stname or templated if structname and not self.typenames[structname] then + + --table.insert(typedefs_table,"typedef struct "..structname.." "..structname..";\n") + local tst = "\ntypedef struct "..structname.." "..structname..";" + if check_unique_typedefs(tst,uniques) then + table.insert(outtab,tst) + end + self.typedefs_dict[structname]="struct "..structname --dont insert child structs as they are inserted before parent struct if not (it.parent and it.parent.re_name == "struct_re") then table.insert(outtab,predec .. cleanst) end - table.insert(typedefs_table,"typedef struct "..structname.." "..structname..";\n") - self.typedefs_dict[structname]="struct "..structname end if it.parent then --and (it.parent.re_name == "struct_re" or it.parent.re_name == "typedef_st_re" then local embededst = (it.re_name == "struct_re" and it.item:match("struct%s+(%S+)")) @@ -1402,13 +1489,13 @@ function M.Parser() self:Listing(itemsarr,processer) - local uniques = {} - for i,l in ipairs(typedefs_table) do - if not uniques[l] then - uniques[l] = true - table.insert(outtabpre,1,l) - end - end + -- local uniques = {} + -- for i,l in ipairs(typedefs_table) do + -- if not uniques[l] then + -- uniques[l] = true + -- table.insert(outtabpre,1,l) + -- end + -- end --check arg detection failure if no name in function declaration check_arg_detection(self.defsT,self.typedefs_dict) local outtabprest, outtabst = table.concat(outtabpre,""),table.concat(outtab,"") @@ -1426,6 +1513,7 @@ function M.Parser() else --split type name1,name2; in several lines local typen,rest = line:match("%s*([^,]+)%s(%S+[,;])") + --print(typen,"rest:",rest) if not typen then -- Lets try Type*name typen,rest = line:match("([^,]+%*)(%S+[,;])") end @@ -1515,10 +1603,25 @@ function M.Parser() end par.enums_for_table = enums_for_table function par:gen_structs_and_enums_table() + print"--------------gen_structs_and_enums_table" local outtab = {enums={},structs={},locations={},enumtypes={}} self.typedefs_table = {} local enumsordered = {} unnamed_enum_counter = 0 + self.templated_structs = {} + --take cimgui templated_structs if given + if self.cimgui_inherited then + self.templated_structs = self.cimgui_inherited.templated_structs + self.templates_done = self.cimgui_inherited.templates_done + --M.prtable(self.typenames) + for k,v in pairs(self.cimgui_inherited.typenames) do + assert(not self.typenames[k]) + if self.typenames[k] then + print("typenames repeated",k,self.typenames[k],v) + end + self.typenames[k] = v + end + end local processer = function(it) if it.re_name == "typedef_re" or it.re_name == "functypedef_re" or it.re_name == "vardef_re" then @@ -1540,7 +1643,17 @@ function M.Parser() self:parse_struct_line(strtab[j],outtab.structs[structname],comstab[j]) end else - print("skipped unnamed or templated struct",structname) + --templated struct + if structname then + print("saving templated struct",structname) + self.templated_structs[structname] = {} + for j=3,#strtab-1 do + self:parse_struct_line(strtab[j],self.templated_structs[structname],comstab[j]) + end + --M.prtable(self.templated_structs[structname]) + else + print("skipped unnamed struct",structname) + end end elseif it.re_name == "namespace_re" or it.re_name == "union_re" or it.re_name == "functype_re" then --nop @@ -1552,7 +1665,16 @@ function M.Parser() self:Listing(itemsarr,processer) --calcule size of name[16+1] [xxx_COUNT] - local allenums = {} + local allenums = {} + --take cimgui struct_and_enums if given + if self.cimgui_inherited then + for k,v in pairs(self.cimgui_inherited.enums) do + for j,v2 in ipairs(v) do + allenums[v2.name] = v2.calc_value + --print(k,v.calc_value) + end + end + end --first calc_value in enums for i,enumname in ipairs(enumsordered) do --for enumname,enum in pairs(outtab.enums) do @@ -1616,6 +1738,7 @@ function M.Parser() --print(k,#v) table.insert(strt,string.format("%s\t%d",k,#v)) local typesc,post = name_overloadsAlgo(v) + --M.prtable(v) for i,t in ipairs(v) do --take overloaded name from manual table or algorythm t.ov_cimguiname = self.getCname_overload(t.stname,t.funcname,t.signature,t.namespace) or k..typetoStr(post[i]) @@ -1756,6 +1879,58 @@ function M.Parser() table.insert(self.funcdefs,v) end end + function par:gentemplatetypedef(ttype,te,newte) + --print("gentemplatetypedef",ttype,te,newte) + if not newte then return "" end + self.templates_done = self.templates_done or {} + self.templates_done[ttype] = self.templates_done[ttype] or {} + if self.templates_done[ttype][te] then return "" end + self.templates_done[ttype][te] = true + --return self:gen_template_typedef(ttype,te,newte) --given by user + return self:gen_template_typedef_auto(ttype,te,newte) + end + function par:gen_template_typedef_auto(ttype,te,newte) + assert(self.templated_structs[ttype],ttype) + local defi = self.templated_structs[ttype] + local Targ = strsplit(self.typenames[ttype],",") + local defa = {} + local tes = strsplit(te,",") + --get the only name of template arg + for i,arg in ipairs(Targ) do + Targ[i] = strip(arg) + defa[i] = Targ[i]:match"=(.+)" --get default + if defa[i] then defa[i] = strip(defa[i]) end + Targ[i] = Targ[i]:gsub("%s*=.+","") + Targ[i] = Targ[i]:match"%S+$" + end + + --assert(not Targ:match",") --still not several + local code = {} + local precode = {} + for i,v in ipairs(defi) do + local typ = v.type --:gsub(Targ,te) + local nam = v.name --:gsub(Targ,te) + for j,w in ipairs(Targ) do + local subs = tes[j] or defa[j] + typ = typ:gsub(w,subs) + nam = nam:gsub(w,subs) + end + --if typ still has template + local ttypet,templatet,tet,code2t = check_template(typ) + if templatet then + typ = code2t + table.insert(precode, self:gentemplatetypedef(ttypet,templatet,tet)) + end + --if name still has template + local ttypet,templatet,tet,code2t = check_template(nam) + if templatet then + nam = code2t + table.insert(precode, self:gentemplatetypedef(ttypet,templatet,tet)) + end + table.insert(code, typ.." "..nam..";") + end + return table.concat(precode).."\ntypedef struct "..ttype.."_"..newte.." {"..table.concat(code).."} "..ttype.."_"..newte..";\n" + end return par end @@ -2088,25 +2263,29 @@ end M.func_header_generate = func_header_generate --[=[ -- tests -local code = [[struct ImDrawListSharedData -{ - ImVec2 TexUvWhitePixel; - ImFont* Font; - float FontSize; - float CurveTessellationTol; - float CircleSegmentMaxError; - ImVec4 ClipRectFullscreen; - ImDrawListFlags InitialFlags; - ImVec2 ArcFastVtx[12 * 1]; - ImU8 CircleSegmentCounts[64]; - ImDrawListSharedData(); - void SetCircleSegmentMaxError(float max_error); -};]] -local code = [[static inline void ImQsort(void* base, size_t count, size_t size_of_element, int(__cdecl *compare_func)(void const*, void const*)) { if (count > 1) qsort(base, count, size_of_element, compare_func); } -]] +local code = [[ + + bool BeginPlot(const char* title_id, + const char* x_label, const char* y_label, + const ImVec2& size = ImVec2(-1,0), + ImPlotFlags flags = ImPlotFlags_None, + ImPlotAxisFlags x_flags = ImPlotAxisFlags_None, + ImPlotAxisFlags y_flags = ImPlotAxisFlags_None, + ImPlotAxisFlags y2_flags = ImPlotAxisFlags_AuxDefault, + ImPlotAxisFlags y3_flags = ImPlotAxisFlags_AuxDefault, + const char* y2_label = ((void *)0), + const char* y3_label = ((void *)0)) __attribute__( ( deprecated ) ); + +]] +local code = [[ + + bool BeginPlot(const char* title_id, const char* x_label, const char* y_label, const ImVec2& size = ImVec2(-1,0), ImPlotFlags flags = ImPlotFlags_None, ImPlotAxisFlags x_flags = ImPlotAxisFlags_None, ImPlotAxisFlags y_flags = ImPlotAxisFlags_None, ImPlotAxisFlags y2_flags = ImPlotAxisFlags_AuxDefault, ImPlotAxisFlags y3_flags = ImPlotAxisFlags_AuxDefault, const char* y2_label = ((void *)0), const char* y3_label = ((void *)0)) __attribute__( ( deprecated ) ) + ; + +]] local parser = M.Parser() for line in code:gmatch("[^\n]+") do - print("inserting",line) + --print("inserting",line) parser:insert(line,"11") end parser:do_parse() @@ -2114,5 +2293,19 @@ M.prtable(parser) --M.prtable(parser:gen_structs_and_enums_table()) --]=] --print(clean_spaces[[ImVec2 ArcFastVtx[12 * 1];]]) +--[=[ +local code = [[ImU32 Storage[(BITCOUNT + 31) >> 5];]] +--local code = [[ImU32 Storage[37 + 2];]] +local parser = M.Parser() +parser:insert(code,"11") +--parser:do_parse() +--M.prtable(parser) +local tab={} +print(type(code),code) +print(clean_spaces(code)) +parser:parse_struct_line(code,tab) +M.prtable(tab) +--]=] + return M diff --git a/generator/generator.lua b/generator/generator.lua index 96b29b2..72de4cf 100644 --- a/generator/generator.lua +++ b/generator/generator.lua @@ -248,36 +248,7 @@ local function repair_defaults(defsT,str_and_enu) end end -----------custom ImVector templates -local table_do_sorted = cpp2ffi.table_do_sorted -local function generate_templates(code,codeimpool,templates) - table.insert(code,"\n"..[[typedef struct ImVector{int Size;int Capacity;void* Data;} ImVector;]].."\n") - table_do_sorted(templates , function (ttype, v) - if ttype == "ImVector" then - table_do_sorted(v, function(te,newte) - table.insert(code,"typedef struct ImVector_"..newte.." {int Size;int Capacity;"..te.."* Data;} ImVector_"..newte..";\n") - end) - elseif ttype == "ImPool" then - --declare ImGuiStorage - table_do_sorted(v, function(te, newte) - table.insert(codeimpool,"typedef struct ImVector_"..newte.." {int Size;int Capacity;"..te.."* Data;} ImVector_"..newte..";\n") - table.insert(codeimpool,"typedef struct ImPool_"..newte.." {ImVector_"..te.." Buf;ImGuiStorage Map;ImPoolIdx FreeIdx;} ImPool_"..newte..";\n") - end) - elseif ttype == "ImChunkStream" then - table_do_sorted(v, function(te,newte) - table.insert(code,"typedef struct ImVector_"..newte.." {int Size;int Capacity;"..te.."* Data;} ImVector_"..newte..";\n") - table.insert(code,"typedef struct ImChunkStream_"..newte.." {ImVector_"..te.." Buf;} ImChunkStream_"..newte..";\n") - end) - elseif ttype == "ImSpan" then - table_do_sorted(v, function(te,newte) - table.insert(code,"typedef struct ImSpan_"..newte.." {"..te.."* Data;" ..te.."* DataEnd;} ImSpan_"..newte..";\n") - end) - else - print("generate_templates ttype not done",ttype) - error"generate templates" - end - end) -end + --generate cimgui.cpp cimgui.h local function cimgui_generation(parser) @@ -308,15 +279,9 @@ local function cimgui_generation(parser) cpp2ffi.prtable(parser.templates) cpp2ffi.prtable(parser.typenames) - local outtab = {} - local outtabpool = {} - generate_templates(outtab, outtabpool, parser.templates) - - --move outtabpool after ImGuiStorage definition - local outpost1, outpost2 = outpost:match("^(.+struct ImGuiStorage%s*\n%b{};\n)(.+)$") - outpost = outpost1..table.concat(outtabpool)..outpost2 - local cstructsstr = outpre..table.concat(outtab,"")..outpost --..(extra or "") + local tdt = parser:generate_templates() + local cstructsstr = outpre..tdt..outpost if gdefines.IMGUI_HAS_DOCK then cstructsstr = cstructsstr.."\n#define IMGUI_HAS_DOCK 1\n" @@ -381,6 +346,7 @@ local function parseImGuiHeader(header,names) parser.cname_overloads = cimgui_overloads parser.manuals = cimgui_manuals parser.UDTs = {"ImVec2","ImVec4","ImColor","ImRect"} + --parser.gen_template_typedef = gen_template_typedef --use auto local defines = parser:take_lines(CPRE..header,names,COMPILER) @@ -417,6 +383,10 @@ cimgui_generation(parser1) ----------save struct and enums lua table in structs_and_enums.lua for using in bindings local structs_and_enums_table = parser1.structs_and_enums_table +structs_and_enums_table.templated_structs = parser1.templated_structs +structs_and_enums_table.typenames = parser1.typenames +structs_and_enums_table.templates_done = parser1.templates_done + save_data("./output/structs_and_enums.lua",serializeTableF(structs_and_enums_table)) save_data("./output/typedefs_dict.lua",serializeTableF(parser1.typedefs_dict)) @@ -498,6 +468,10 @@ end ---[[ local json = require"json" save_data("./output/definitions.json",json.encode(json_prepare(parser1.defsT),{dict_on_empty={defaults=true}})) +--delete extra info for json +structs_and_enums_table.templated_structs = nil +structs_and_enums_table.typenames = nil +structs_and_enums_table.templates_done = nil save_data("./output/structs_and_enums.json",json.encode(structs_and_enums_table)) save_data("./output/typedefs_dict.json",json.encode(parser1.typedefs_dict)) if parser2 then diff --git a/generator/output/cimgui_impl.h b/generator/output/cimgui_impl.h index 1e42b1f..bd13b0b 100644 --- a/generator/output/cimgui_impl.h +++ b/generator/output/cimgui_impl.h @@ -1,7 +1,7 @@ -typedef struct SDL_Window SDL_Window; -typedef struct GLFWmonitor GLFWmonitor; -typedef struct GLFWwindow GLFWwindow; +typedef struct GLFWwindow GLFWwindow; +typedef struct GLFWmonitor GLFWmonitor; +typedef struct SDL_Window SDL_Window; struct GLFWwindow; struct GLFWmonitor; diff --git a/generator/output/definitions.json b/generator/output/definitions.json index f96b763..a3e81b8 100644 --- a/generator/output/definitions.json +++ b/generator/output/definitions.json @@ -551,7 +551,7 @@ ], "ImChunkStream_swap": [ { - "args": "(ImChunkStream* self,ImChunkStream* rhs)", + "args": "(ImChunkStream* self,ImChunkStream_T * rhs)", "argsT": [ { "name": "self", @@ -560,7 +560,7 @@ { "name": "rhs", "reftoptr": true, - "type": "ImChunkStream*" + "type": "ImChunkStream_T *" } ], "argsoriginal": "(ImChunkStream& rhs)", @@ -571,7 +571,7 @@ "location": "imgui_internal:675", "ov_cimguiname": "ImChunkStream_swap", "ret": "void", - "signature": "(ImChunkStream*)", + "signature": "(ImChunkStream_T *)", "stname": "ImChunkStream", "templated": true } @@ -11148,11 +11148,11 @@ "templated": true }, { - "args": "(const ImVector src)", + "args": "(const ImVector_T src)", "argsT": [ { "name": "src", - "type": "const ImVector" + "type": "const ImVector_T " } ], "argsoriginal": "(const ImVector& src)", @@ -11162,8 +11162,8 @@ "defaults": {}, "funcname": "ImVector", "location": "imgui:1708", - "ov_cimguiname": "ImVector_ImVector_Vector", - "signature": "(const ImVector)", + "ov_cimguiname": "ImVector_ImVector_Vector_T_", + "signature": "(const ImVector_T )", "stname": "ImVector", "templated": true } @@ -12010,7 +12010,7 @@ ], "ImVector_swap": [ { - "args": "(ImVector* self,ImVector* rhs)", + "args": "(ImVector* self,ImVector_T * rhs)", "argsT": [ { "name": "self", @@ -12019,7 +12019,7 @@ { "name": "rhs", "reftoptr": true, - "type": "ImVector*" + "type": "ImVector_T *" } ], "argsoriginal": "(ImVector& rhs)", @@ -12030,7 +12030,7 @@ "location": "imgui:1732", "ov_cimguiname": "ImVector_swap", "ret": "void", - "signature": "(ImVector*)", + "signature": "(ImVector_T *)", "stname": "ImVector", "templated": true } @@ -20612,7 +20612,7 @@ "cimguiname": "igImRsqrt", "defaults": {}, "funcname": "ImRsqrt", - "location": "imgui_internal:417", + "location": "imgui_internal:419", "ov_cimguiname": "igImRsqrt_Float", "ret": "float", "signature": "(float)", diff --git a/generator/output/definitions.lua b/generator/output/definitions.lua index e70b12d..10fee53 100644 --- a/generator/output/definitions.lua +++ b/generator/output/definitions.lua @@ -470,7 +470,7 @@ defs["ImChunkStream_size"][1]["templated"] = true defs["ImChunkStream_size"]["()const"] = defs["ImChunkStream_size"][1] defs["ImChunkStream_swap"] = {} defs["ImChunkStream_swap"][1] = {} -defs["ImChunkStream_swap"][1]["args"] = "(ImChunkStream* self,ImChunkStream* rhs)" +defs["ImChunkStream_swap"][1]["args"] = "(ImChunkStream* self,ImChunkStream_T * rhs)" defs["ImChunkStream_swap"][1]["argsT"] = {} defs["ImChunkStream_swap"][1]["argsT"][1] = {} defs["ImChunkStream_swap"][1]["argsT"][1]["name"] = "self" @@ -478,7 +478,7 @@ defs["ImChunkStream_swap"][1]["argsT"][1]["type"] = "ImChunkStream*" defs["ImChunkStream_swap"][1]["argsT"][2] = {} defs["ImChunkStream_swap"][1]["argsT"][2]["name"] = "rhs" defs["ImChunkStream_swap"][1]["argsT"][2]["reftoptr"] = true -defs["ImChunkStream_swap"][1]["argsT"][2]["type"] = "ImChunkStream*" +defs["ImChunkStream_swap"][1]["argsT"][2]["type"] = "ImChunkStream_T *" defs["ImChunkStream_swap"][1]["argsoriginal"] = "(ImChunkStream& rhs)" defs["ImChunkStream_swap"][1]["call_args"] = "(*rhs)" defs["ImChunkStream_swap"][1]["cimguiname"] = "ImChunkStream_swap" @@ -487,10 +487,10 @@ defs["ImChunkStream_swap"][1]["funcname"] = "swap" defs["ImChunkStream_swap"][1]["location"] = "imgui_internal:675" defs["ImChunkStream_swap"][1]["ov_cimguiname"] = "ImChunkStream_swap" defs["ImChunkStream_swap"][1]["ret"] = "void" -defs["ImChunkStream_swap"][1]["signature"] = "(ImChunkStream*)" +defs["ImChunkStream_swap"][1]["signature"] = "(ImChunkStream_T *)" defs["ImChunkStream_swap"][1]["stname"] = "ImChunkStream" defs["ImChunkStream_swap"][1]["templated"] = true -defs["ImChunkStream_swap"]["(ImChunkStream*)"] = defs["ImChunkStream_swap"][1] +defs["ImChunkStream_swap"]["(ImChunkStream_T *)"] = defs["ImChunkStream_swap"][1] defs["ImColor_HSV"] = {} defs["ImColor_HSV"][1] = {} defs["ImColor_HSV"][1]["args"] = "(ImColor *pOut,float h,float s,float v,float a)" @@ -9409,11 +9409,11 @@ defs["ImVector_ImVector"][1]["signature"] = "()" defs["ImVector_ImVector"][1]["stname"] = "ImVector" defs["ImVector_ImVector"][1]["templated"] = true defs["ImVector_ImVector"][2] = {} -defs["ImVector_ImVector"][2]["args"] = "(const ImVector src)" +defs["ImVector_ImVector"][2]["args"] = "(const ImVector_T src)" defs["ImVector_ImVector"][2]["argsT"] = {} defs["ImVector_ImVector"][2]["argsT"][1] = {} defs["ImVector_ImVector"][2]["argsT"][1]["name"] = "src" -defs["ImVector_ImVector"][2]["argsT"][1]["type"] = "const ImVector" +defs["ImVector_ImVector"][2]["argsT"][1]["type"] = "const ImVector_T " defs["ImVector_ImVector"][2]["argsoriginal"] = "(const ImVector& src)" defs["ImVector_ImVector"][2]["call_args"] = "(src)" defs["ImVector_ImVector"][2]["cimguiname"] = "ImVector_ImVector" @@ -9421,12 +9421,12 @@ defs["ImVector_ImVector"][2]["constructor"] = true defs["ImVector_ImVector"][2]["defaults"] = {} defs["ImVector_ImVector"][2]["funcname"] = "ImVector" defs["ImVector_ImVector"][2]["location"] = "imgui:1708" -defs["ImVector_ImVector"][2]["ov_cimguiname"] = "ImVector_ImVector_Vector" -defs["ImVector_ImVector"][2]["signature"] = "(const ImVector)" +defs["ImVector_ImVector"][2]["ov_cimguiname"] = "ImVector_ImVector_Vector_T_" +defs["ImVector_ImVector"][2]["signature"] = "(const ImVector_T )" defs["ImVector_ImVector"][2]["stname"] = "ImVector" defs["ImVector_ImVector"][2]["templated"] = true defs["ImVector_ImVector"]["()"] = defs["ImVector_ImVector"][1] -defs["ImVector_ImVector"]["(const ImVector)"] = defs["ImVector_ImVector"][2] +defs["ImVector_ImVector"]["(const ImVector_T )"] = defs["ImVector_ImVector"][2] defs["ImVector__grow_capacity"] = {} defs["ImVector__grow_capacity"][1] = {} defs["ImVector__grow_capacity"][1]["args"] = "(ImVector* self,int sz)" @@ -10151,7 +10151,7 @@ defs["ImVector_size_in_bytes"][1]["templated"] = true defs["ImVector_size_in_bytes"]["()const"] = defs["ImVector_size_in_bytes"][1] defs["ImVector_swap"] = {} defs["ImVector_swap"][1] = {} -defs["ImVector_swap"][1]["args"] = "(ImVector* self,ImVector* rhs)" +defs["ImVector_swap"][1]["args"] = "(ImVector* self,ImVector_T * rhs)" defs["ImVector_swap"][1]["argsT"] = {} defs["ImVector_swap"][1]["argsT"][1] = {} defs["ImVector_swap"][1]["argsT"][1]["name"] = "self" @@ -10159,7 +10159,7 @@ defs["ImVector_swap"][1]["argsT"][1]["type"] = "ImVector*" defs["ImVector_swap"][1]["argsT"][2] = {} defs["ImVector_swap"][1]["argsT"][2]["name"] = "rhs" defs["ImVector_swap"][1]["argsT"][2]["reftoptr"] = true -defs["ImVector_swap"][1]["argsT"][2]["type"] = "ImVector*" +defs["ImVector_swap"][1]["argsT"][2]["type"] = "ImVector_T *" defs["ImVector_swap"][1]["argsoriginal"] = "(ImVector& rhs)" defs["ImVector_swap"][1]["call_args"] = "(*rhs)" defs["ImVector_swap"][1]["cimguiname"] = "ImVector_swap" @@ -10168,10 +10168,10 @@ defs["ImVector_swap"][1]["funcname"] = "swap" defs["ImVector_swap"][1]["location"] = "imgui:1732" defs["ImVector_swap"][1]["ov_cimguiname"] = "ImVector_swap" defs["ImVector_swap"][1]["ret"] = "void" -defs["ImVector_swap"][1]["signature"] = "(ImVector*)" +defs["ImVector_swap"][1]["signature"] = "(ImVector_T *)" defs["ImVector_swap"][1]["stname"] = "ImVector" defs["ImVector_swap"][1]["templated"] = true -defs["ImVector_swap"]["(ImVector*)"] = defs["ImVector_swap"][1] +defs["ImVector_swap"]["(ImVector_T *)"] = defs["ImVector_swap"][1] defs["igAcceptDragDropPayload"] = {} defs["igAcceptDragDropPayload"][1] = {} defs["igAcceptDragDropPayload"][1]["args"] = "(const char* type,ImGuiDragDropFlags flags)" @@ -17483,7 +17483,7 @@ defs["igImRsqrt"][1]["call_args"] = "(x)" defs["igImRsqrt"][1]["cimguiname"] = "igImRsqrt" defs["igImRsqrt"][1]["defaults"] = {} defs["igImRsqrt"][1]["funcname"] = "ImRsqrt" -defs["igImRsqrt"][1]["location"] = "imgui_internal:417" +defs["igImRsqrt"][1]["location"] = "imgui_internal:419" defs["igImRsqrt"][1]["ov_cimguiname"] = "igImRsqrt_Float" defs["igImRsqrt"][1]["ret"] = "float" defs["igImRsqrt"][1]["signature"] = "(float)" diff --git a/generator/output/overloads.txt b/generator/output/overloads.txt index 0958084..5456ef3 100644 --- a/generator/output/overloads.txt +++ b/generator/output/overloads.txt @@ -75,7 +75,7 @@ ImVec4_ImVec4 2 2 nil ImVec4_ImVec4_Float (float,float,float,float) ImVector_ImVector 2 1 nil ImVector_ImVector_Nil () -2 nil ImVector_ImVector_Vector (const ImVector) +2 nil ImVector_ImVector_Vector_T_ (const ImVector_T ) ImVector_back 2 1 T* ImVector_back_Nil () 2 const T* ImVector_back__const ()const diff --git a/generator/output/structs_and_enums.lua b/generator/output/structs_and_enums.lua index a3f7fb9..c0e5ac5 100644 --- a/generator/output/structs_and_enums.lua +++ b/generator/output/structs_and_enums.lua @@ -6171,5 +6171,122 @@ defs["structs"]["StbUndoState"][5]["type"] = "int" defs["structs"]["StbUndoState"][6] = {} defs["structs"]["StbUndoState"][6]["name"] = "redo_char_point" defs["structs"]["StbUndoState"][6]["type"] = "int" +defs["templated_structs"] = {} +defs["templated_structs"]["ImBitArray"] = {} +defs["templated_structs"]["ImBitArray"][1] = {} +defs["templated_structs"]["ImBitArray"][1]["name"] = "Storage[(BITCOUNT+31)>>5]" +defs["templated_structs"]["ImBitArray"][1]["type"] = "ImU32" +defs["templated_structs"]["ImChunkStream"] = {} +defs["templated_structs"]["ImChunkStream"][1] = {} +defs["templated_structs"]["ImChunkStream"][1]["name"] = "Buf" +defs["templated_structs"]["ImChunkStream"][1]["template_type"] = "char" +defs["templated_structs"]["ImChunkStream"][1]["type"] = "ImVector_char" +defs["templated_structs"]["ImPool"] = {} +defs["templated_structs"]["ImPool"][1] = {} +defs["templated_structs"]["ImPool"][1]["name"] = "Buf" +defs["templated_structs"]["ImPool"][1]["type"] = "ImVector" +defs["templated_structs"]["ImPool"][2] = {} +defs["templated_structs"]["ImPool"][2]["name"] = "Map" +defs["templated_structs"]["ImPool"][2]["type"] = "ImGuiStorage" +defs["templated_structs"]["ImPool"][3] = {} +defs["templated_structs"]["ImPool"][3]["name"] = "FreeIdx" +defs["templated_structs"]["ImPool"][3]["type"] = "ImPoolIdx" +defs["templated_structs"]["ImPool"][4] = {} +defs["templated_structs"]["ImPool"][4]["name"] = "AliveCount" +defs["templated_structs"]["ImPool"][4]["type"] = "ImPoolIdx" +defs["templated_structs"]["ImSpan"] = {} +defs["templated_structs"]["ImSpan"][1] = {} +defs["templated_structs"]["ImSpan"][1]["name"] = "Data" +defs["templated_structs"]["ImSpan"][1]["type"] = "T*" +defs["templated_structs"]["ImSpan"][2] = {} +defs["templated_structs"]["ImSpan"][2]["name"] = "DataEnd" +defs["templated_structs"]["ImSpan"][2]["type"] = "T*" +defs["templated_structs"]["ImSpanAllocator"] = {} +defs["templated_structs"]["ImSpanAllocator"][1] = {} +defs["templated_structs"]["ImSpanAllocator"][1]["name"] = "BasePtr" +defs["templated_structs"]["ImSpanAllocator"][1]["type"] = "char*" +defs["templated_structs"]["ImSpanAllocator"][2] = {} +defs["templated_structs"]["ImSpanAllocator"][2]["name"] = "CurrOff" +defs["templated_structs"]["ImSpanAllocator"][2]["type"] = "int" +defs["templated_structs"]["ImSpanAllocator"][3] = {} +defs["templated_structs"]["ImSpanAllocator"][3]["name"] = "CurrIdx" +defs["templated_structs"]["ImSpanAllocator"][3]["type"] = "int" +defs["templated_structs"]["ImSpanAllocator"][4] = {} +defs["templated_structs"]["ImSpanAllocator"][4]["name"] = "Offsets[CHUNKS]" +defs["templated_structs"]["ImSpanAllocator"][4]["type"] = "int" +defs["templated_structs"]["ImSpanAllocator"][5] = {} +defs["templated_structs"]["ImSpanAllocator"][5]["name"] = "Sizes[CHUNKS]" +defs["templated_structs"]["ImSpanAllocator"][5]["type"] = "int" +defs["templated_structs"]["ImVector"] = {} +defs["templated_structs"]["ImVector"][1] = {} +defs["templated_structs"]["ImVector"][1]["name"] = "Size" +defs["templated_structs"]["ImVector"][1]["type"] = "int" +defs["templated_structs"]["ImVector"][2] = {} +defs["templated_structs"]["ImVector"][2]["name"] = "Capacity" +defs["templated_structs"]["ImVector"][2]["type"] = "int" +defs["templated_structs"]["ImVector"][3] = {} +defs["templated_structs"]["ImVector"][3]["name"] = "Data" +defs["templated_structs"]["ImVector"][3]["type"] = "T*" +defs["templates_done"] = {} +defs["templates_done"]["ImChunkStream"] = {} +defs["templates_done"]["ImChunkStream"]["ImGuiTableSettings"] = true +defs["templates_done"]["ImChunkStream"]["ImGuiWindowSettings"] = true +defs["templates_done"]["ImPool"] = {} +defs["templates_done"]["ImPool"]["ImGuiTabBar"] = true +defs["templates_done"]["ImPool"]["ImGuiTable"] = true +defs["templates_done"]["ImSpan"] = {} +defs["templates_done"]["ImSpan"]["ImGuiTableCellData"] = true +defs["templates_done"]["ImSpan"]["ImGuiTableColumn"] = true +defs["templates_done"]["ImSpan"]["ImGuiTableColumnIdx"] = true +defs["templates_done"]["ImVector"] = {} +defs["templates_done"]["ImVector"]["ImDrawChannel"] = true +defs["templates_done"]["ImVector"]["ImDrawCmd"] = true +defs["templates_done"]["ImVector"]["ImDrawIdx"] = true +defs["templates_done"]["ImVector"]["ImDrawList*"] = true +defs["templates_done"]["ImVector"]["ImDrawVert"] = true +defs["templates_done"]["ImVector"]["ImFont*"] = true +defs["templates_done"]["ImVector"]["ImFontAtlasCustomRect"] = true +defs["templates_done"]["ImVector"]["ImFontConfig"] = true +defs["templates_done"]["ImVector"]["ImFontGlyph"] = true +defs["templates_done"]["ImVector"]["ImGuiColorMod"] = true +defs["templates_done"]["ImVector"]["ImGuiContextHook"] = true +defs["templates_done"]["ImVector"]["ImGuiGroupData"] = true +defs["templates_done"]["ImVector"]["ImGuiID"] = true +defs["templates_done"]["ImVector"]["ImGuiItemFlags"] = true +defs["templates_done"]["ImVector"]["ImGuiListClipperData"] = true +defs["templates_done"]["ImVector"]["ImGuiListClipperRange"] = true +defs["templates_done"]["ImVector"]["ImGuiOldColumnData"] = true +defs["templates_done"]["ImVector"]["ImGuiOldColumns"] = true +defs["templates_done"]["ImVector"]["ImGuiPopupData"] = true +defs["templates_done"]["ImVector"]["ImGuiPtrOrIndex"] = true +defs["templates_done"]["ImVector"]["ImGuiSettingsHandler"] = true +defs["templates_done"]["ImVector"]["ImGuiShrinkWidthItem"] = true +defs["templates_done"]["ImVector"]["ImGuiStackLevelInfo"] = true +defs["templates_done"]["ImVector"]["ImGuiStoragePair"] = true +defs["templates_done"]["ImVector"]["ImGuiStyleMod"] = true +defs["templates_done"]["ImVector"]["ImGuiTabBar"] = true +defs["templates_done"]["ImVector"]["ImGuiTabItem"] = true +defs["templates_done"]["ImVector"]["ImGuiTable"] = true +defs["templates_done"]["ImVector"]["ImGuiTableColumnSortSpecs"] = true +defs["templates_done"]["ImVector"]["ImGuiTableTempData"] = true +defs["templates_done"]["ImVector"]["ImGuiTextRange"] = true +defs["templates_done"]["ImVector"]["ImGuiViewportP*"] = true +defs["templates_done"]["ImVector"]["ImGuiWindow*"] = true +defs["templates_done"]["ImVector"]["ImGuiWindowStackData"] = true +defs["templates_done"]["ImVector"]["ImTextureID"] = true +defs["templates_done"]["ImVector"]["ImU32"] = true +defs["templates_done"]["ImVector"]["ImVec2"] = true +defs["templates_done"]["ImVector"]["ImVec4"] = true +defs["templates_done"]["ImVector"]["ImWchar"] = true +defs["templates_done"]["ImVector"]["char"] = true +defs["templates_done"]["ImVector"]["float"] = true +defs["templates_done"]["ImVector"]["unsigned char"] = true +defs["typenames"] = {} +defs["typenames"]["ImBitArray"] = "int BITCOUNT" +defs["typenames"]["ImChunkStream"] = "T" +defs["typenames"]["ImPool"] = "T" +defs["typenames"]["ImSpan"] = "T" +defs["typenames"]["ImSpanAllocator"] = "int CHUNKS" +defs["typenames"]["ImVector"] = "T" return defs \ No newline at end of file