72 Commits
Author SHA1 Message Date
Clifford Yapp 5b0085612f Add structural metadata profile for API v2
Keep full descriptor metadata as the default and add an opt-in
structural profile for conversion-oriented late-bound API v2 users.
Strip descriptive and constraint text while retaining the complete
runtime descriptor graph.  Pass the profile through CMake and correct
the scanner's compact late-bound file lists.

AP242e4 full-to-structural measurements:

Generated output falls from 54,839 lines and 3,304,007 bytes to
29,993 lines and 1,525,897 bytes.  The packed schema source shrinks
68.1%.  The schema DSO falls from 2,178,296 to 720,120 bytes, and peak
compile RSS drops 6.8%.  File count and 49 ELF relocations are
unchanged.

The NIST AP242e4 sample still creates and validates all 10,609
instances with no errors or warnings and writes the same 949,685-byte
semantic result.  Twenty read/write runs improve from 4.76 to 4.71
seconds and peak RSS falls from 82,276 to 78,900 KiB.
2026-08-02 07:27:08 -04:00
Clifford Yapp 05c6adb716 Complete compact schema modules for API v2
Add stable entity, type, and attribute IDs through SchemaModule.  Make
late-bound compatibility names opt-in, table-drive rules and complex
metadata, and emit entity metadata directly into bounded chunks.

AP242e4 late-bound output changed as follows:

* generated files: 5,719 to 905 (-84.2%)
* generated lines: 254,220 to 123,552 (-51.4%)
* generated bytes: 13,942,523 to 9,804,680 (-29.7%)
* generation wall time: 2.74s to 0.56s (-79.6%)
* compile/link wall time: 157.68s to 37.02s (-76.5%)
* compile/link peak RSS: 593,320 KiB to 199,156 KiB (-66.4%)
* shared library size: 9,956,640 to 7,716,096 bytes (-22.5%)
* read/write wall time: 0.26s to 0.25s

ELF relocations increased from 28,843 to 39,719 due to descriptor-slot
tables.  The packed schema image stage is intended to remove this cost.

The real AP242 sample created and validated 10,609 instances with zero
errors and warnings.  Rewritten output matched except for its timestamp.
2026-08-02 06:15:25 -04:00
Clifford Yapp 6705c0f62b Implemented API v2 table-driven initialization and opt-in late-bound mode
- API v2 table-driven schema, entity, type, attribute, and inheritance
  initialization via include/clstepcore/ schemaInit.h.

- --late-bound/-T, producing descriptor-backed entities without
  generated early-bound entity classes.

- CMake controls:
    - SC_EXP2CXX_API_VERSION=2
    - SC_EXP2CXX_LATE_BOUND=ON

- Runtime late-bound construction and owned attribute storage in
  src/clstepcore/entityDescriptor.cc and src/clstepcore/STEPattribute.cc.

- Documentation and regression coverage, including incompatible option
  handling.

AP242e4 generated-output results:

 Mode                      Lines       Bytes
━━━━━━━━━━━━━━━━━━━━  ━━━━━━━━━━━  ━━━━━━━━━━
 Default v1            1,210,640    57.57 MB
────────────────────  ───────────  ──────────
 API v2 early-bound      509,001    25.20 MB
────────────────────  ───────────  ──────────
 API v2 late-bound       254,123    13.94 MB

The late-bound AP242 library compiled under C++11 and successfully
processed the BRL-CAD NIST sample: 10,609 instances
created and validated, with zero errors and warnings.
2026-08-02 06:15:25 -04:00
Clifford Yapp 6e18e57380 Implemented the first major API v2 scalability feature
Opt in with either:

exp2cxx --api-version 2 schema.exp

or:

cmake -DSC_EXP2CXX_API_VERSION=2 ...

Version 1 remains the default, and the regression test verifies default
output is byte-identical to explicit v1
output.

API v2 now provides:

- Compact SELECT classes backed by shared descriptor-driven runtime code
  instead of repeated generated parsing, assignment, and serialization
  bodies.

- Generic Set* and typed getter APIs in
  include/clstepcore/sdaiSelect.h:109.
- Dependency-bounded entity headers and source-owned dependencies in
  src/exp2cxx/classes_entity.c:968.
- Out-of-line entity creators.
- Unity chunks that no longer include the all-entity header.
- C++11 output; C++17 did not offer enough additional benefit for this
  tranche.

The command-line handling is in src/exp2cxx/fedex_main.c:85, while
compact SELECT generation begins in src/exp2cxx/selects.c:702.

Measured using the BRL-CAD ap242e4.exp, Release builds, eight parallel
jobs, and 64:8 unity chunks:

 Metric                           API v1    Final API v2    Reduction
━━━━━━━━━━━━━━━━━━━━━━━━  ━━━━━━━━━━━━━━━  ━━━━━━━━━━━━━━  ━━━━━━━━━━━
 Generated C++ lines           1,210,640         522,445        56.8%
────────────────────────  ───────────────  ──────────────  ───────────
 Generated bytes              57,566,051      27,202,644        52.7%
────────────────────────  ───────────────  ──────────────  ───────────
 Schema build wall time         183.22 s         88.31 s        51.8%
────────────────────────  ───────────────  ──────────────  ───────────
 Compiler CPU time              641.53 s        378.49 s        41.0%
────────────────────────  ───────────────  ──────────────  ───────────
 Peak RSS                  1,035,112 KiB     916,412 KiB        11.5%
────────────────────────  ───────────────  ──────────────  ───────────
 Object-file bytes            70,472,952      40,031,088        43.2%
────────────────────────  ───────────────  ──────────────  ───────────
 Shared-library text          34,361,400      19,420,467        43.5%
────────────────────────  ───────────────  ──────────────  ───────────
 Generation wall time             1.52 s          0.69 s        54.6%
2026-08-02 06:15:25 -04:00
Clifford Yapp 6040858231 exp2cxx: tune entity and type chunk limits independently
Schemas commonly contain many more entity implementations than type
implementations. Accept N:N chunk limits and use smaller defaults so
both kinds of generated unity files stay manageable.
2026-08-01 22:27:46 -04:00
Clifford Yapp 3113afd2a4 exp2cxx: generate bounded schema unity chunks
Generate schema source manifests and bounded unity translation
units, then make schema targets depend on the generated absolute
paths. This avoids oversized compiler inputs while retaining
unity-build performance.
2026-08-01 22:27:46 -04:00
Clifford Yapp 57a929cd71 Add adjustment per suggestion from TRThurman to make SCHEMA_CMLIST idempotent 2026-03-29 22:05:23 -04:00
Clifford Yapp 7dbda20be0 Remove base library from stepcode
Move specific pieces of logic still in use next to the individual parts
of the code that use them, and eliminate base from the code.
2022-09-26 20:52:17 +01:00
Clifford Yapp 0fd354cb39 Make sure BUFSIZ buffers have room for NULL
In case we do end up with buffers with contents at the BUFSIZ limit,
make sure we leave room to set a null termination char.  Not always
clear where these buffers might get used or re-used, so just bump their
size across the board.
2022-06-11 17:33:24 +01:00
Clifford Yapp 62be4c90c6 Use CMake 3.12 everywhere. 2021-08-15 09:22:59 +01:00
Chris HORLER 6cf5d1e860 CMake update
- variable usage, RPATHs, config header generation
 - remove the CMake core target
2021-08-15 09:22:29 +01:00
Clifford Yapp 4f20f391c6 Reverting develop back to commit 548fd82ad7 2021-08-04 16:04:32 -04:00
Cliff Yapp 725ec378c7 Remove unused file, line wrap scanner README 2020-12-14 16:00:58 -05:00
Cliff Yapp 44fb19669b Simplify relative directory settings 2020-12-14 15:43:54 -05:00
Chris HORLER 88e82d8faf reenable lemon / full build for integration test purposes 2020-07-21 23:22:48 +01:00
Chris HORLER 5ab50bb68f begin to modernise / simplify CMake code 2019-08-26 18:42:45 +01:00
Chris HORLER 85b76db65a use _WIN32 for Windows and _MSC_VER for compiler checks 2019-08-26 17:38:09 +01:00
Chris HORLER e934fa246c drop the Generic typedef 2019-08-07 20:30:32 +01:00
Mark Pictor 135adc76c8 fix warning, improve cmake messages 2015-07-26 20:49:04 -04:00
Mark Pictor 1aa78e7e48 make appveyor happier 2015-06-08 22:40:38 -04:00
Cliff Yapp 63298df542 Until we reach a final decision on what to do about the schema_scanner, handle the .exe case 2014-08-01 21:04:23 -04:00
Cliff Yapp e649757417 Install schema headers in locations that match the build tree hierarchy, so include directives will work both with in-build-tree and installed stepcode layouts. 2014-07-31 21:26:57 -04:00
Jason W. DeGraw 9aa3b4201f Add CMAKE_GENERATOR to schema scanner build
Command line configuration with MinGW on Windows was failing
in schemaScanner.cmake because the generator wasn't getting
passed through to the build of the scanner. This commit adds
the generator to the scanner build command and fixes #295.
2014-04-19 14:38:12 -04:00
Mark 2338dd11e1 increase schema scanner config/build timeouts
config is slow on windows and the 10s limit caused intermittent failures
2014-03-02 15:44:33 -05:00
Mark Pictor cd0d8b496b cannot treat the schema scanner source as a config file, so add /*WARNING*/ 2014-03-01 11:53:31 -05:00
Mark Pictor 38467bdca3 add build logic for unity builds (mostly in generated CMLists) 2014-03-01 11:53:30 -05:00
Mark Pictor 78d99f2f4e change generated CMLists ws to better match starseeker's ws 2014-03-01 11:53:30 -05:00
Mark Pictor 5c021b2b7f tests were broken because macro name changed
make two variables CACHE INTERNAL so that their values are available in other scopes (i.e. in test dirs)
2014-03-01 11:53:30 -05:00
Cliff Yapp f4ac673b71 whitespace and case changes on .cmake files 2014-03-01 11:53:30 -05:00
Cliff Yapp 44e02c957a whitespace changes 2014-03-01 11:53:30 -05:00
Cliff Yapp c0e74a9eef Add CMake footer comment to CMake files 2014-02-28 22:06:09 -05:00
Mark Pictor a7579f0bc9 remove helper function header - code moved to headers for individual types/entities 2014-02-28 22:02:07 -05:00
davyw 492f455598 allow schema scanner to build on windows 2014-02-28 22:02:07 -05:00
Mark Pictor 2ccc5ce360 add underscore to schema shortname for readability - Sdai -> Sdai_ 2014-02-28 22:02:07 -05:00
Mark Pictor 5043c035a3 renamed enums, selects don't get their own files 2014-02-28 22:02:07 -05:00
Mark Pictor 426e2b4ab3 add two cmake messages 2014-02-28 22:02:07 -05:00
starseeker c6f0c44a02 print file count, not list of all files, when generating. 2014-02-28 22:02:07 -05:00
starseeker 6533032fd9 workaround makefile corruption by changing how file lists are handled 2014-02-28 22:02:07 -05:00
Mark Pictor 4fd5dd9f74 improve cmake comments, user messages 2014-02-28 22:02:06 -05:00
Mark Pictor b320bfe3f7 generate a short schema name in the schema scanner
this name is one of:
* the schema file name without extension,
* the schema dir name if in sc/data/ and 3+ chars
* or the official schema name on the SCHEMA line.
2014-02-28 22:02:06 -05:00
Mark Pictor 34d917fb19 update scanner to match renamed schema macros file 2014-02-28 22:02:06 -05:00
Mark Pictor 86bae779b0 inching forward on schema scanner 2014-02-28 22:02:06 -05:00
Mark Pictor b15ba38edf try again to make msvc use same dir as other compilers 2014-02-28 22:02:06 -05:00
Mark Pictor 207d6c26c2 remove old message 2014-02-28 22:02:05 -05:00
Mark Pictor 993c40f6ad MSVC insists on putting schema_scanner.exe in a different dir 2014-02-28 22:02:05 -05:00
Mark Pictor a035292cf0 another TODO 2014-02-28 22:02:05 -05:00
Mark Pictor 427ecaf09f add schema scanner README 2014-02-28 22:02:05 -05:00
Mark Pictor b7a8ac4cbb make build/schema dir 2014-02-28 22:02:05 -05:00
Mark Pictor 2e6ee6695a cmake changes to match new behavior of scanner 2014-02-28 22:02:05 -05:00
Mark Pictor 86bf2dff99 maybe this will force MSVC to behave?
http://stackoverflow.com/questions/7229571/cmake-visual-studio-debug-folder
http://www.cmake.org/cmake/help/v2.8.8/cmake.html#prop_tgt:RUNTIME_OUTPUT_DIRECTORY_CONFIG
2014-02-28 22:02:05 -05:00