Split public API headers into constants + data types - #355
Open
zzcgumn wants to merge 1 commit into
Open
Conversation
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
Contributor
There was a problem hiding this comment.
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 intoapi/dds_c_data_types.h(pure-C-shim POD subset) +api/dds_data_types.hpp(remaining legacy + internal search structs). - Flattens
api/dll.hto 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
library/src/api/dds_constants.hpp(bridge dimensions moved fromutility/constants.h, version/limit macros,RETURN_*/TEXT_*status codes, solver tuning constants,DLLEXPORT/STDCALL/EXTERN_C), on a dependency-free//library/src/api:dds_constantstarget.library/src/api/dds_c_data_types.h— the six POD structs that cross the pure-C shim — andlibrary/src/api/dds_data_types.hppfor every other legacy struct plus the internal search structures; the latter includes the former.dll.hto the flat function declarations and makeapi/dds.ha 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.dds-public-api/constants-and-debugspecs.Test plan
bazel build //...bazel test //...(93/93 pass, incl.jni/tests:export_set_test, python, wasm, web)🤖 Generated with Claude Code