From 8dd51e48ea68e0f1d30cd1558fdbefe4dcdf52cf Mon Sep 17 00:00:00 2001 From: Matheus Catarino Date: Wed, 15 Jan 2025 11:23:42 -0300 Subject: [PATCH] ci: run wasm32-target betterC mode --- .github/workflows/build.yml | 2 +- src/cimgui/cimgui.d | 34 ++++++++++++---------------------- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ea31ba1..826275d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -55,4 +55,4 @@ jobs: - name: (Zig) Build Native run: zig build -Dimgui --summary all - name: (Zig + emsdk) Build Wasm - run: zig build -Dimgui -DzigCC --summary all -Dtarget=wasm32-emscripten-none -Doptimize=ReleaseSmall + run: zig build -Dimgui -DzigCC --summary all -Dtarget=wasm32-emscripten-none -Doptimize=ReleaseSmall -DbetterC diff --git a/src/cimgui/cimgui.d b/src/cimgui/cimgui.d index b0d6efa..37e6d3e 100644 --- a/src/cimgui/cimgui.d +++ b/src/cimgui/cimgui.d @@ -3,16 +3,6 @@ module cimgui.cimgui; // get dcimgui headers to module - @system (unsafe) functions by default public import cimgui.dcimgui; -version (D_BetterC) -{ - // No conflict with object.size_t (DRT) -} -else -{ - // replace object.size_t to cimgui.dcimgui.size_t - version (Windows) alias size_t = ulong; -} - scope ImGuiContext_t* CreateContext(scope const(ImFontAtlas_t)* shared_font_atlas) @trusted { return igCreateContext(cast(ImFontAtlas_t*) shared_font_atlas); @@ -2774,7 +2764,7 @@ void applyRequests( ImGuiSelectionExternalStorage_ApplyRequests(self, ms_io); } -size_t getTexID(scope const(ImDrawCmd_t)* self) @trusted +auto getTexID(scope const(ImDrawCmd_t)* self) @trusted { return ImDrawCmd_GetTexID(cast(ImDrawCmd_t*) self); } @@ -2819,7 +2809,7 @@ void popClipRect(scope const(ImDrawList_t)* self) @trusted ImDrawList_PopClipRect(cast(ImDrawList_t*) self); } -void pushTextureID(scope const(ImDrawList_t)* self, ulong texture_id) @trusted +void pushTextureID(scope const(ImDrawList_t)* self, size_t texture_id) @trusted { ImDrawList_PushTextureID(cast(ImDrawList_t*) self, texture_id); } @@ -3004,27 +2994,27 @@ void addConcavePolyFilled(scope ImDrawList_t* self, scope const(ImVec2_t)* point ImDrawList_AddConcavePolyFilled(self, cast(ImVec2_t*) points, num_points, col); } -void addImage(scope ImDrawList_t* self, ulong user_texture_id, const ImVec2_t p_min, const ImVec2_t p_max) @trusted +void addImage(scope ImDrawList_t* self, size_t user_texture_id, const ImVec2_t p_min, const ImVec2_t p_max) @trusted { ImDrawList_AddImage(self, user_texture_id, p_min, p_max); } -void addImageEx(scope ImDrawList_t* self, ulong user_texture_id, const ImVec2_t p_min, const ImVec2_t p_max, const ImVec2_t uv_min, const ImVec2_t uv_max, uint col) @trusted +void addImageEx(scope ImDrawList_t* self, size_t user_texture_id, const ImVec2_t p_min, const ImVec2_t p_max, const ImVec2_t uv_min, const ImVec2_t uv_max, uint col) @trusted { ImDrawList_AddImageEx(self, user_texture_id, p_min, p_max, uv_min, uv_max, col); } -void addImageQuad(scope ImDrawList_t* self, ulong user_texture_id, const ImVec2_t p1, const ImVec2_t p2, const ImVec2_t p3, const ImVec2_t p4) @trusted +void addImageQuad(scope ImDrawList_t* self, size_t user_texture_id, const ImVec2_t p1, const ImVec2_t p2, const ImVec2_t p3, const ImVec2_t p4) @trusted { ImDrawList_AddImageQuad(self, user_texture_id, p1, p2, p3, p4); } -void addImageQuadEx(scope ImDrawList_t* self, ulong user_texture_id, const ImVec2_t p1, const ImVec2_t p2, const ImVec2_t p3, const ImVec2_t p4, const ImVec2_t uv1, const ImVec2_t uv2, const ImVec2_t uv3, const ImVec2_t uv4, uint col) @trusted +void addImageQuadEx(scope ImDrawList_t* self, size_t user_texture_id, const ImVec2_t p1, const ImVec2_t p2, const ImVec2_t p3, const ImVec2_t p4, const ImVec2_t uv1, const ImVec2_t uv2, const ImVec2_t uv3, const ImVec2_t uv4, uint col) @trusted { ImDrawList_AddImageQuadEx(self, user_texture_id, p1, p2, p3, p4, uv1, uv2, uv3, uv4, col); } -void addImageRounded(scope ImDrawList_t* self, ulong user_texture_id, const ImVec2_t p_min, const ImVec2_t p_max, const ImVec2_t uv_min, const ImVec2_t uv_max, uint col, float rounding, int flags) @trusted +void addImageRounded(scope ImDrawList_t* self, size_t user_texture_id, const ImVec2_t p_min, const ImVec2_t p_max, const ImVec2_t uv_min, const ImVec2_t uv_max, uint col, float rounding, int flags) @trusted { ImDrawList_AddImageRounded(self, user_texture_id, p_min, p_max, uv_min, uv_max, col, rounding, flags); } @@ -3101,7 +3091,7 @@ extern (C) void addCallback(scope ImDrawList_t* self, void function(scope const( } extern (C) void addCallbackEx(scope ImDrawList_t* self, void function(scope const( - ImDrawList_t)* parent_list, scope const(ImDrawCmd_t)* cmd) callback, scope void* userdata, ulong userdata_size) @trusted + ImDrawList_t)* parent_list, scope const(ImDrawCmd_t)* cmd) callback, scope void* userdata, size_t userdata_size) @trusted { ImDrawList_AddCallbackEx(self, callback, userdata, userdata_size); } @@ -3206,7 +3196,7 @@ void onChangedVtxOffset(scope ImDrawList_t* self) @trusted ImDrawList__OnChangedVtxOffset(self); } -void setTextureID(scope ImDrawList_t* self, ulong texture_id) @trusted +void setTextureID(scope ImDrawList_t* self, size_t texture_id) @trusted { ImDrawList__SetTextureID(self, texture_id); } @@ -3251,12 +3241,12 @@ void clearGlyphRangesBuilder(scope const(ImFontGlyphRangesBuilder_t)* self) @tru ImFontGlyphRangesBuilder_Clear(cast(ImFontGlyphRangesBuilder_t*) self); } -bool getBit(scope const(ImFontGlyphRangesBuilder_t)* self, ulong n) @trusted +bool getBit(scope const(ImFontGlyphRangesBuilder_t)* self, size_t n) @trusted { return ImFontGlyphRangesBuilder_GetBit(cast(ImFontGlyphRangesBuilder_t*) self, n); } -void setBit(scope const(ImFontGlyphRangesBuilder_t)* self, ulong n) @trusted +void setBit(scope const(ImFontGlyphRangesBuilder_t)* self, size_t n) @trusted { ImFontGlyphRangesBuilder_SetBit(cast(ImFontGlyphRangesBuilder_t*) self, n); } @@ -3371,7 +3361,7 @@ bool isFontAtlasBuilt(scope const(ImFontAtlas_t)* self) @trusted return ImFontAtlas_IsBuilt(cast(ImFontAtlas_t*) self); } -void setTexID(scope const(ImFontAtlas_t)* self, ulong id) @trusted +void setTexID(scope const(ImFontAtlas_t)* self, size_t id) @trusted { ImFontAtlas_SetTexID(cast(ImFontAtlas_t*) self, id); }