Expand description
IDL → C99 codegen mode (vendor spec zerodds-xcdr2-c-1.0).
For each IDL specification, this module emits:
- C99
typedef structdefinitions perstruct(with a module prefix in the type name, because C99 has no namespaces). - Static
zerodds_typesupport_ttables with XCDR2 encoder/ decoder/key-hash/free function pointers. - Inline body implementations of the encoders/decoders that produce the XCDR2 wire format (XTypes 1.3 §7.4) byte-exactly.
§Scope (rc1)
Supported:
- Structs with
@final/@appendable/@mutableextensibility. - Primitive types (boolean, octet, short/long/long long + unsigned, float, double).
string(unbounded).sequence<T>(unbounded; nested sequences allowed).- Nested modules → type-name prefix with
::(cross-language convention) and identifier prefix with_(C99-conformant). @keymembers → key-hash routine viaPlainCdr2BeKeyHolder.@id(N)for @mutable.
Out of scope (errors at the codegen level):
- Unions, enums, bitsets/bitmasks, typedefs, arrays, maps.
wstring,fixed,any.@optional/@external/@bit_bound.
§Invocation
use zerodds_idl::config::ParserConfig;
use zerodds_idl_cpp::{generate_c_header, CGenOptions};
let ast = zerodds_idl::parse("@final struct Point { long x; long y; };",
&ParserConfig::default()).unwrap();
let header = generate_c_header(&ast, &CGenOptions::default()).unwrap();
assert!(header.contains("typedef struct Point_s"));
assert!(header.contains("Point_typesupport"));Structs§
- CGen
Options - Codegen options (parallel to
CppGenOptions).
Functions§
- generate_
c_ header - Produces a complete C99 header from an IDL specification.