Expand description
IDL4 → C# 12.0 Source-Code-Generator (OMG IDL4-CSharp-Mapping, formal/2024-12-01).
Crate zerodds-idl-csharp — Foundation des Sprach-Bindings (Cluster C5.3-a).
Safety classification: SAFE (std-only). Reines Build-Zeit-Tool —
forbid(unsafe_code), kein no_std-Use-Case.
§Scope (C5.3-a / Phase 3.1-3.3)
- Phase 3.1: Header-Layout (
#nullable enable,using,namespace). - Phase 3.2: Primitive-Mapping (boolean → bool, octet → byte, char/wchar → char, short → short, ushort → ushort, long → int, ulong → uint, long long → long, ulong long → ulong, float/double, string → string).
- Phase 3.3: Aggregate-Types — struct →
record classmit init-only Properties, enum →enum, union → discriminated record, typedef →record class-Wrapper (Spec-konformes file-scoped using-alias kommt mit C5.3-b), sequence →IList<T>, array →T[], inheritance →record class : Parent.
§C5.3-b additions (this revision)
ISequence<T>/IBoundedSequence<T>runtime contract (seeruntime/Omg.Types.cs); codegen emits these instead of bareIList<T>.- Annotation-Bridge
@key|@id|@optional|@must_understand|@externalon members,@nested|@extensibility(...)on types — emitted as C# attributes fromOmg.Types. ITopicType<T>marker on every top-level (non-@nested) struct.
§Bewusst nicht im Crate
- Phase 3.4: DDS-CSharp-Integration (P/Invoke zu Rust-Core).
- Time/Duration/Status/QoS/Listener-Codegen.
- File-scoped namespace +
using <Alias> = <Type>;Top-Level-Form. - Bitset/Bitmask/Map/Fixed/Any/Interface/Valuetype.
§Beispiel
use zerodds_idl::config::ParserConfig;
use zerodds_idl_csharp::{generate_csharp, CsGenOptions};
let ast = zerodds_idl::parse(
"module M { struct S { long x; }; };",
&ParserConfig::default(),
)
.expect("parse");
let cs = generate_csharp(&ast, &CsGenOptions::default()).expect("gen");
assert!(cs.contains("namespace M"));
assert!(cs.contains("record class S"));Re-exports§
pub use error::CsGenError;
Modules§
- emitter
- AST-Walker, der C# 12.0-Quelltext emittiert.
- error
- Fehler-Typen fuer den IDL → C#-Codegen.
- keywords
- C#-Reserved-Words und Escaping-Logik.
- type_
map - Mapping IDL-Primitive → C#-Type-Strings.
Structs§
- CsGen
Options - Konfiguration des C#-Code-Generators.
Functions§
- generate_
csharp - Erzeugt einen vollstaendigen C# 12.0-Quelltext aus einer IDL-Specification.
- generate_
csharp_ with_ corba_ traits - Convenience-Variante mit aktiviertem
emit_corba_traits-Flag.