Skip to content

build: match dasImgui's ImWchar width, then comment hygiene sweep - #27

Merged
borisbat merged 3 commits into
masterfrom
bbatkin/comment-hygiene
Jul 21, 2026
Merged

build: match dasImgui's ImWchar width, then comment hygiene sweep#27
borisbat merged 3 commits into
masterfrom
bbatkin/comment-hygiene

Conversation

@borisbat

Copy link
Copy Markdown
Owner

Two commits: a build fix that this repo needed regardless, then the hygiene sweep.

1. IMGUI_USE_WCHAR32=1 — why the module would not link

dasImgui compiles imgui with IMGUI_USE_WCHAR32=1, so ImWchar is unsigned int there. This module never set it, so ImWchar was unsigned short here and every ImWchar-taking imgui symbol mangled differently on the two sides.

It surfaced as a single unresolved external, which reads like an imgui version skew — it isn't:

wanted    ?FindGlyph@ImFontBaked@@QEAAPEAUImFontGlyph@@G@Z    G = unsigned short
exported  ?FindGlyph@ImFontBaked@@QEAAPEAUImFontGlyph@@I@Z    I = unsigned int

The symbol was in dasModuleImgui.lib the whole time. This module already mirrors IMGUI_DISABLE_OBSOLETE_FUNCTIONS and IMGUI_API from dasImgui; IMGUI_USE_WCHAR32 was simply missed.

With it, dasModuleImplot builds and the module loads — lint goes from 43 of 44 files skipped to 1. Everything below only became visible because of this fix.

2. Comment hygiene

daslang PR #3504 turned STYLE014/STYLE015 on by default for any path containing /daslib/. We're moving external module repos to comment hygiene across the board, so this opts in explicitly rather than depending on where a file sits.

All 44 .das files gain options _comment_hygiene = true, and 22 flagged blocks are trimmed. Load-bearing facts survive:

  • the implot-must-load-after-dasImgui constraint
  • why the fps overload exists at all (gen2 trailing-block sugar can't see through a default parameter before the block)
  • the screen-px vs plot-data-coords split, and the BeginPlot/EndPlot capture window
  • plot_bar_groups' row-major values[item*group_count+group] layout
  • the PlotToPixels-not-GetItemRect rationale — a drag tool submits no ImGui item, so a captured rect would be stale
  • the press-before-hover / HoveredId race in the playwright helpers

Two structural moves avoided cutting anything. Section dividers fused to the prose beneath them were split with a blank line — a divider and its prose count as one block, so splitting costs no words. And a 7-line block inside a def private (cap 1) was hoisted above the def, where the cap is 3, keeping the EndPlot-render ordering and the issue-#9 owned-copy quirk fully intact.

No suppressions needed.

Verification

44 files, 3 issue(s), 0 error(s), 1 skipped

The 3 are STYLE030, byte-identical to baseline — nothing outside scope moved.

Probe-tested first, with a declaration above the test block (otherwise it's exempt as module-leading and STYLE014 never fires). A second probe confirmed require lines don't count as the first declaration, which is what let the skipped bind file's header be correctly left alone.

bind/bind_implot.das stays skipped — it needs a daslang built with dasClangBind. Skipped means unverified, so it was hand-reviewed: three comment blocks, two at cap, one module-leading and exempt. No changes needed; it got only its options line.

All 44 files remain CRLF. No code changed — comments, one options line per file, and one field docstring reworded in place.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Gkkfmcb1RhM3vNR3M35Avh

borisbat and others added 2 commits July 21, 2026 12:49
dasImgui compiles imgui with IMGUI_USE_WCHAR32=1, so ImWchar is
unsigned int there. This module did not set it, so ImWchar was
unsigned short here and every ImWchar-taking imgui symbol mangled
differently on the two sides.

It surfaced as a single unresolved external, which reads like an imgui
version skew but is not:

  wanted   ?FindGlyph@ImFontBaked@@QEAAPEAUImFontGlyph@@g@Z   (G = unsigned short)
  exported ?FindGlyph@ImFontBaked@@QEAAPEAUImFontGlyph@@i@Z   (I = unsigned int)

The symbol was in dasModuleImgui.lib the whole time. This module
already mirrors IMGUI_DISABLE_OBSOLETE_FUNCTIONS and IMGUI_API from
dasImgui; IMGUI_USE_WCHAR32 was simply missed.

With this, dasModuleImplot builds and the module loads -- lint goes
from 43 of 44 files skipped to 1.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gkkfmcb1RhM3vNR3M35Avh
…/015 caps

daslang PR #3504 turned STYLE014/STYLE015 on by default for any path
containing /daslib/. External module repos are moving to comment
hygiene across the board, so this opts in explicitly rather than
relying on where a file happens to sit.

All 44 .das files gain options _comment_hygiene = true, and 22 flagged
blocks are trimmed. Load-bearing facts survive: the implot-after-
dasImgui load-order constraint, the gen2 trailing-block-sugar reason
the fps overload exists, the screen-px vs plot-data-coords split, the
BeginPlot/EndPlot capture window, the row-major
values[item*group_count+group] layout, the PlotToPixels-not-
GetItemRect rationale (a drag tool submits no ImGui item, so a
captured rect would be stale), and the press-before-hover HoveredId
race in the playwright helpers.

Two structural moves avoided cutting anything. Section dividers fused
to the prose below them were split with a blank line -- a divider and
its prose count as one block, so splitting costs no words. And a
7-line block inside a def private (cap 1) was hoisted above the def,
where the cap is 3, keeping the EndPlot-render ordering and the
issue-#9 owned-copy quirk intact.

No suppressions were needed. No code changed -- comments, one options
line per file, and one field docstring reworded in place.

Verified: 44 files, 3 issues, 0 errors, 1 skipped. The 3 are STYLE030,
byte-identical to baseline. The skipped file is bind/bind_implot.das,
which needs a daslang built with dasClangBind; it was hand-reviewed
and needed no comment change -- its only long block is module-leading
and exempt, confirmed by probing the linter rather than assuming.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gkkfmcb1RhM3vNR3M35Avh
Copilot AI review requested due to automatic review settings July 21, 2026 19:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Build configuration and daslang-source hygiene updates for dasImguiImplot: aligns ImGui ABI expectations with dasImgui (ImWchar width) and explicitly opts all .das sources into comment-hygiene mode, with accompanying comment-block trimming.

Changes:

  • Add IMGUI_USE_WCHAR32=1 to the standalone shared-module build to match dasImgui’s ImWchar width and prevent link/mangling mismatches.
  • Enable options _comment_hygiene = true across the module’s .das sources.
  • Trim/reflow several documentation/comment blocks to comply with comment hygiene rules.

Reviewed changes

Copilot reviewed 45 out of 45 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
CMakeLists.txt Define IMGUI_USE_WCHAR32=1 for the shared-module build to match dasImgui ABI.
bind/bind_implot.das Enable comment hygiene option.
daslib/imgui_implot_app.das Enable comment hygiene option; reflow doc comments.
daslib/imgui_implot_boost.das Enable comment hygiene option.
daslib/imgui_implot_boost_v2.das Enable comment hygiene option; reflow/trim doc comments around snapshot/legend/drag tools.
daslib/imgui_implot_playwright.das Enable comment hygiene option; reflow/trim doc comments for drag/legend helpers.
utils/implot2rst.das Enable comment hygiene option for doc generator script.
examples/tutorial/bar_groups_and_pie.das Enable comment hygiene option.
examples/tutorial/colormaps_and_style.das Enable comment hygiene option.
examples/tutorial/drag_tools.das Enable comment hygiene option.
examples/tutorial/heatmap_histogram.das Enable comment hygiene option.
examples/tutorial/line_plot.das Enable comment hygiene option.
examples/tutorial/multi_axes.das Enable comment hygiene option.
examples/tutorial/multi_series.das Enable comment hygiene option.
examples/tutorial/query_and_hover.das Enable comment hygiene option.
examples/tutorial/realtime_scroll.das Enable comment hygiene option.
examples/tutorial/shaded_and_stairs.das Enable comment hygiene option.
examples/tutorial/subplots.das Enable comment hygiene option.
tests/integration/record_bar_groups_and_pie.das Enable comment hygiene option.
tests/integration/record_colormaps_and_style.das Enable comment hygiene option.
tests/integration/record_drag_tools.das Enable comment hygiene option.
tests/integration/record_heatmap_histogram.das Enable comment hygiene option.
tests/integration/record_line_plot.das Enable comment hygiene option.
tests/integration/record_multi_axes.das Enable comment hygiene option.
tests/integration/record_multi_series.das Enable comment hygiene option.
tests/integration/record_query_and_hover.das Enable comment hygiene option.
tests/integration/record_realtime_scroll.das Enable comment hygiene option.
tests/integration/record_shaded_and_stairs.das Enable comment hygiene option.
tests/integration/record_subplots.das Enable comment hygiene option; reflow explanatory comment.
tests/integration/test_axis_limits.das Enable comment hygiene option.
tests/integration/test_bar_groups_and_pie.das Enable comment hygiene option.
tests/integration/test_colormaps.das Enable comment hygiene option.
tests/integration/test_drag_tools.das Enable comment hygiene option.
tests/integration/test_heatmap_histogram.das Enable comment hygiene option.
tests/integration/test_line_plot.das Enable comment hygiene option.
tests/integration/test_multi_axes.das Enable comment hygiene option; reflow legend-label comment.
tests/integration/test_multi_series.das Enable comment hygiene option.
tests/integration/test_plot_hover.das Enable comment hygiene option.
tests/integration/test_plot_snapshot.das Enable comment hygiene option.
tests/integration/test_query_and_hover.das Enable comment hygiene option.
tests/integration/test_realtime_scroll.das Enable comment hygiene option.
tests/integration/test_shaded_and_stairs.das Enable comment hygiene option.
tests/integration/test_stats_items.das Enable comment hygiene option.
tests/integration/test_subplots.das Enable comment hygiene option.
tests/integration/test_v1_scopes.das Enable comment hygiene option.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread CMakeLists.txt
Comment on lines 115 to +122
target_compile_definitions(dasModuleImplot PRIVATE
DAS_MOD_EXPORTS DAS_ENABLE_DLL=1
IMGUI_DISABLE_OBSOLETE_FUNCTIONS=1
IMPLOT_DISABLE_OBSOLETE_FUNCTIONS=1
IMGUI_API=${IMGUI_IMPORT_ATTR}
# Must match dasImgui's ImWchar width, or ImWchar-taking imgui symbols mangle as
# unsigned short here and unsigned int there, and the link fails on FindGlyph.
IMGUI_USE_WCHAR32=1
test_v1_scopes.das failed with error[30341] too many matching
functions or generics PopStyleVar. imgui and implot bind 20 names in
common, and imgui_implot_boost.das called 13 of them unqualified.

Nine could not resolve at all. EndDragDropSource and EndDragDropTarget
take no arguments, so imgui::EndDragDropTarget and
implot::EndDragDropTarget are indistinguishable at the call site, and
likewise for PopStyleVar(1) / PopStyleColor(1) which take only an int.

The other four resolved by accident: PushStyleVar(idx, value) and
PushStyleColor(idx, col) disambiguate on ImPlotStyleVar / ImPlotCol in
the first argument. They are qualified here too, so each push/pop pair
is explicitly the same module rather than relying on an argument type
to pick the stack. That pairing is the real invariant -- every one of
these sits between an implot-only Begin (BeginDragDropSourceItem,
BeginDragDropTargetPlot / Axis / Legend) or an implot Push, so popping
imgui's stack would unbalance both.

Reproduced locally with -project_root over a modules/ tree holding
dasImgui and dasImguiImplot side by side, which is the layout daspkg
install --global produces in CI. Under plain -load_module the file
compiles clean, which is why this never showed up in local linting.

After: the file that failed now passes, and the repo compiles clean
through the same scan path -- 44 files, 3 issues, 0 errors.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gkkfmcb1RhM3vNR3M35Avh
@borisbat
borisbat merged commit 422636b into master Jul 21, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants