Skip to content

Split public API headers into constants + data types - #355

Open
zzcgumn wants to merge 1 commit into
developfrom
chore/reorganise_headers
Open

Split public API headers into constants + data types#355
zzcgumn wants to merge 1 commit into
developfrom
chore/reorganise_headers

Conversation

@zzcgumn

@zzcgumn zzcgumn commented Aug 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add library/src/api/dds_constants.hpp (bridge dimensions moved from utility/constants.h, version/limit macros, RETURN_*/TEXT_* status codes, solver tuning constants, DLLEXPORT/STDCALL/EXTERN_C), on a dependency-free //library/src/api:dds_constants target.
  • Add library/src/api/dds_c_data_types.h — the six POD structs that cross the pure-C shim — and library/src/api/dds_data_types.hpp for every other legacy struct plus the internal search structures; the latter includes the former.
  • Reduce dll.h to the flat function declarations and make api/dds.h a thin internal aggregator; repoint ~30 internal headers/sources at the new data/constant headers so no internal code pulls in the external function-declaration surface. The flat-API implementation files now include <api/dll.h> explicitly.
  • Update the Visual Studio project file lists and the dds-public-api / constants-and-debug specs.

Test plan

  • bazel build //...
  • bazel test //... (93/93 pass, incl. jni/tests:export_set_test, python, wasm, web)
  • CI green on Linux + macOS toolchains

🤖 Generated with Claude Code

Extract three headers under library/src/api/ so internal solver code no
longer includes the external function-declaration surface:

- dds_constants.hpp: bridge dimensions (moved from utility/constants.h),
  DDS_VERSION / MAXNOOFBOARDS / MAXNOOFTABLES, the RETURN_* / TEXT_* status
  codes, solver tuning constants, HAND_ID, and the DLLEXPORT / STDCALL /
  EXTERN_C macros. Dependency-free (//library/src/api:dds_constants).
- dds_c_data_types.h: the six POD structs that cross the pure-C shim
  (Deal, FutureTricks, DdTableDeal, DdTableDealPBN, DdTableResults,
  ParResults). Included by dds_data_types.hpp.
- dds_data_types.hpp: every other legacy struct plus the internal search
  structures.

dll.h now carries only the flat function declarations; api/dds.h is a thin
internal aggregator of the two new data/constant headers. Internal headers
and sources include the new headers directly; the flat-API implementation
files (solve_board, solver_if, calc_tables, init, play_analyser, par) now
include <api/dll.h> explicitly. Updates the Visual Studio project file lists
and the dds-public-api / constants-and-debug specs.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ao718NCfVWPAT27E7bFBg3
@zzcgumn
zzcgumn requested a review from tameware August 29, 2026 20:00
@zzcgumn zzcgumn self-assigned this Aug 29, 2026
@tameware
tameware requested a lite review from Copilot August 29, 2026 21:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors DDS’s public header surface by separating compile-time constants and data types from the legacy flat C entry-point declarations, so internal solver code can depend on the data model/constants without implicitly pulling in the exported function-declaration surface.

Changes:

  • Introduces api/dds_constants.hpp (dependency-free target) and splits legacy structs into api/dds_c_data_types.h (pure-C-shim POD subset) + api/dds_data_types.hpp (remaining legacy + internal search structs).
  • Flattens api/dll.h to function declarations only (types/constants pulled from the new headers) and repoints many internal headers/sources to include the new data/constant headers directly.
  • Updates Bazel targets, Visual Studio project file lists, tests, and specs documentation to match the new header layering.

Reviewed changes

Copilot reviewed 49 out of 49 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
specs/dds-public-api.md Documents the new split between constants/types and function entry points.
specs/constants-and-debug.md Updates “dimensions live here” docs to point at api/dds_constants.hpp.
solution/DDS.vcxproj.filters Adds the new API headers to the VS filters list.
solution/DDS.vcxproj Adds the new API headers to the VS project includes.
library/tests/solve_board/trick_three_bug.cpp Ensures tests include the legacy entry-point declarations via <api/dll.h>.
library/tests/solve_board/analyse_play_consistency.cpp Ensures tests include the legacy entry-point declarations via <api/dll.h>.
library/src/utility/constants.h Removes bridge dimension definitions from utility tables header; includes <api/dds_constants.hpp>.
library/src/utility/BUILD.bazel Adds a dependency on the new //library/src/api:dds_constants target.
library/src/trans_table/trans_table.hpp Replaces dependency on <api/dll.h> with <api/dds_data_types.hpp>.
library/src/trans_table/trans_table_s.cpp Replaces dependency on <api/dds.h> with <api/dds_data_types.hpp>.
library/src/table_deal_validate.hpp Replaces dependency on <api/dll.h> with <api/dds_data_types.hpp>.
library/src/system/thread_data.hpp Replaces dependency on <api/dds.h> with <api/dds_data_types.hpp>.
library/src/system/system.hpp Replaces dependency on <api/dds.h> with <api/dds_data_types.hpp>.
library/src/system/scheduler.hpp Replaces dependency on <api/dds.h> with <api/dds_data_types.hpp>.
library/src/system/parallel_boards.cpp Replaces legacy API includes with <api/dds_data_types.hpp> for internal use.
library/src/system/memory.hpp Replaces dependency on <api/dds.h> with <api/dds_data_types.hpp>.
library/src/system/deal_fanout.hpp Replaces dependency on <api/dll.h> with <api/dds_data_types.hpp>.
library/src/solver_if.hpp Replaces dependency on <api/dds.h> with <api/dds_data_types.hpp>.
library/src/solver_if.cpp Makes legacy entry-point declarations explicit via <api/dll.h>.
library/src/solver_context/solver_context.cpp Replaces dependency on <api/dds.h> with <api/dds_data_types.hpp>.
library/src/solve_board.hpp Replaces dependency on <api/dll.h> with <api/dds_data_types.hpp>.
library/src/solve_board.cpp Makes legacy entry-point declarations explicit via <api/dll.h>.
library/src/quick_tricks.hpp Replaces dependency on <api/dds.h> with <api/dds_data_types.hpp>.
library/src/play_analyser.hpp Replaces dependency on <api/dll.h> with <api/dds_data_types.hpp>.
library/src/play_analyser.cpp Makes legacy entry-point declarations explicit via <api/dll.h>.
library/src/pbn.hpp Replaces dependency on <api/dll.h> with <api/dds_data_types.hpp>.
library/src/pbn.cpp Refactors includes to use <api/dds_data_types.hpp> + explicit <api/dll.h>.
library/src/par.cpp Switches to explicit legacy entry-point header <api/dll.h>.
library/src/par_validate.hpp Replaces dependency on <api/dll.h> with <api/dds_data_types.hpp>.
library/src/moves/moves.hpp Replaces dependency on <api/dds.h> with <api/dds_data_types.hpp>.
library/src/later_tricks.hpp Replaces dependency on <api/dds.h> with <api/dds_data_types.hpp>.
library/src/init.hpp Replaces dependency on <api/dds.h> with <api/dds_data_types.hpp>.
library/src/init.cpp Makes legacy entry-point declarations explicit via <api/dll.h>.
library/src/heuristic_sorting/heuristic_sorting.hpp Replaces dependency on <api/dds.h> with <api/dds_data_types.hpp>.
library/src/dump.hpp Replaces dependency on <api/dds.h> with <api/dds_data_types.hpp>.
library/src/calc_tables.hpp Replaces dependency on <api/dll.h> with <api/dds_data_types.hpp>.
library/src/calc_tables.cpp Makes legacy entry-point declarations explicit via <api/dll.h>.
library/src/api/solve_board.hpp Replaces dependency on <api/dds.h> with <api/dds_data_types.hpp>.
library/src/api/PBN.h Replaces dependency on <api/dll.h> with <api/dds_data_types.hpp>.
library/src/api/dll.h Reduces legacy flat C API header to function declarations + includes of constants/types.
library/src/api/dds.h Becomes a thin internal aggregator for constants + data model headers.
library/src/api/dds_data_types.hpp Adds internal/C++-side data model header (legacy structs + internal search structs).
library/src/api/dds_constants.hpp Adds dependency-free constants/macros header, including dimensions and status codes.
library/src/api/dds_c_data_types.h Adds the POD subset of structs used by the pure C ABI shim.
library/src/api/dds_c_api.h Updates the shim to include only the required POD types header.
library/src/api/calc_par.hpp Replaces dependency on <api/dds.h> with <api/dds_data_types.hpp>.
library/src/api/calc_dd_table.hpp Replaces dependency on <api/dds.h> with <api/dds_data_types.hpp>.
library/src/api/BUILD.bazel Adds the dds_constants target and includes the new headers in api_definitions.
library/src/ab_search.hpp Replaces dependency on <api/dds.h> with <api/dds_data_types.hpp>.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 11 to +15
NOTE: the *exported symbols* are a pure C ABI, but this header is not itself
compilable by a C front-end: it includes <api/dll.h>, whose flat API is
declared with C++ trailing-return syntax (auto ... -> int). Consume the ABI
by binding to the compiled library's symbols (FFM/ctypes/.NET) or by parsing
the headers with a C++ mode (jextract); do not #include this from a C
translation unit.
compilable by a C front-end: it pulls in <api/dds_c_data_types.h>, whose
shared macros and bridge dimensions are C++ constexpr / trailing-return
constructs. Consume the ABI by binding to the compiled library's symbols
(FFM/ctypes/.NET) or by parsing the headers with a C++ mode (jextract); do
#include <api/dds.h>
#include <api/dds_data_types.hpp>

using namespace std;
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