You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Update headergen
* Add changeset
* Fix linting issue
* Update docs
* Updatmp dir issue
* Update outputs for header gen
* Update docs with file directory changes
* Clarify primitive type table in c-proto-wire-mapping.md
- Define W32/W64 as the --word-size flag (target platform ABI)
- Note that plain char signedness is delegated to libclang at parse time
- Clarify that fixed-size arrays use Vec for ergonomics but the decoder
reads exactly N elements baked into the generated struct
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Handle failed disk writes
* Update docs
* Cargo fmt
* Update docs
* Fail loudly
* Revert to c based offsets
* Update reference doc
* Update tests
* Update to major
* Update docs
* Use i32:Max
* Update dockerfile with stale reference
* Add roundtrip tests
* Add example headers
* Update readme
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
-`mappers.rs` and `--out-mapping` CLI flag removed
10
+
-`decode_raw` / `encode_raw` now use **C struct ABI layout** (libclang field offsets, includes alignment padding) — the only correct interpretation for binary messages produced by C programs
- Four codec methods on every struct: `decode_raw`, `decode` (with endianness prefix), `encode_raw`, `encoded_size`
15
+
- C enums are now parsed and emitted as Rust `#[derive(prost::Enumeration)]` enums and proto3 `enum` blocks, following MOD-140 conventions (`{EnumName}Unspecified = 0`, sequential variants with `// c: N` comments, `{EnumName}Garbage = 2147483647`)
16
+
- Proto output restructured to per-header shards at `types/headers/{stem}.proto` with `package spear.v1.{stem};` and cross-header imports (mirrors PR #24 for `wsdl-gen`)
17
+
-`--out-proto` is now the proto tree root; shards are written under `types/headers/` within it
`header-gen` now registers inline nested struct and enum definitions (MOD-164).
6
+
7
+
Previously, types defined inline inside a parent struct (e.g. `struct Moon { ... } moon;` or `enum FlightPhase { ... } phase;`) were silently omitted from the registry, causing the emitter to generate decode calls referencing types that didn't exist. Now these nested types are discovered when their parent struct's fields are traversed and are registered with the same input-directory filter applied to top-level declarations.
8
+
9
+
All three inline-nesting patterns are supported: single nested struct field, fixed-size array of nested structs, and nested enum field.
- Types: `spear.v1.{schema_filename}` — derived mechanically from source file name, no manual config.
56
+
- Types: `spear.v1.{relative_stem}` — derived mechanically from the source file's path relative to the input directory (e.g. `net/messages.h` → `spear.v1.net.messages`). Directory structure is preserved so same-named files in different subdirectories produce distinct packages. No manual config.
57
57
- Messages: `spear.message.v1.{header_type}.{payload_type}` — transport (SLEMR/DCM) is excluded from package names. `spear` is used as the root over effort-specific names for long-term stability.
58
58
59
59
**Message naming**
@@ -158,7 +158,7 @@ C code comparing against XSD integer values can migrate using the `// xsd: N` co
158
158
159
159
**Versioning**
160
160
161
-
Version lives in the package path only — `spear.v1.{schema_filename}` for types, `spear.message.v1.{header_type}.{payload_type}` for messages. No version in individual message or type names. A version bump happens at the `messages/` layer when consumers would need to change their code. Non-breaking changes (adding an optional field) do not require a version bump.
161
+
Version lives in the package path only — `spear.v1.{relative_stem}` for types, `spear.message.v1.{header_type}.{payload_type}` for messages. No version in individual message or type names. A version bump happens at the `messages/` layer when consumers would need to change their code. Non-breaking changes (adding an optional field) do not require a version bump.
-`--out-mapping` — explicit `map_*()` functions from each Rust struct to its proto message
112
+
-`--out-rust` — `messages.rs` with `prost::Message` + serde derives, and `decode_raw`/`decode`/`encode_raw`/`encoded_size` methods using the C struct binary layout (field positions and struct size come from libclang — matches the in-memory ABI layout produced by the C compiler, including alignment padding). Also writes `review_report.txt` for constructs requiring manual review (bitfields, unions, unresolved types).
113
+
-`--out-proto` — per-header proto3 shards at `types/headers/{stem}.proto`, one per input `.h` file, with `package spear.v1.{stem};` and cross-header imports.
114
+
115
+
See [docs/c-proto-wire-mapping.md](docs/c-proto-wire-mapping.md) for the full type mapping table and wire format details.
114
116
115
117
**From the spear-dev container** (recommended — no system libclang install required):
`--word-size` controls how `long`/`unsigned long` are mapped:
144
+
`--word-size`is passed to clang as `-m32` (or left as native for 64-bit) so clang computes the correct ABI layout for the target. It also controls how `long`/`unsigned long` are mapped in the generated types:
145
145
-`32` → `i32`/`u32` (LP32/ILP32 ABI)
146
146
-`64` → `i64`/`u64` (LP64 ABI)
147
147
148
-
`--endian` controls the decode method emitted (`from_le_bytes` vs `from_be_bytes`).
148
+
`--endian`is passed to clang as `-mbig-endian` when set to `big`, so clang computes the correct target layout. It also controls the byte order used by `decode_raw`/`encode_raw` (passed as `same_endianness` to the `_codec` helpers).
149
149
150
150
`--include PATH` (repeatable) adds an extra clang include search path. Use this for
151
151
system headers or cross-compilation sysroots that your `--input` headers `#include`.
0 commit comments