zerodds-idl-compose

The shared IDL composition pipeline: include paths, preprocess, parse, lower and register type objects — one call for every build-time consumer.

One call — compose — takes a path and produces the model plus its registered type objects, so a build.rs and the command-line tool see the same thing from the same file.

Where the steps are

The crate existed because only the CLI performed all of the steps below; build.rs scripts that called the parser directly got none of them. Four of them have since moved into the front end; the table shows where each step is now:

step where it is now
#include / #define expansion zerodds-idl-parse::preprocess
parse zerodds-idl-parse::parse_preprocessed
vendor key pragmas → @key apply_keylists in zerodds-idl-lower
default extensibility Ast::effective_extensibility
type objects zerodds-types::from_ast

Default extensibility used to be written as an explicit @final/@appendable onto every unannotated aggregate so each backend would agree. The model answers the question instead, in one place, and nothing is written into the tree — which is what stops two backends from disagreeing without either being wrong.

ComposeOptions::default_extensibility is still there, because XTypes 1.3 §7.3.1.2.1.8 provides for it. It fills silence and never overrules the source.

Include resolution

A quoted include resolves beside the including file first, then along the search list, and only last as written. An include that works because of where the build ran is one that breaks on another machine.

Position

zerodds-idl-compose

Die gemeinsame Pipeline zur Komposition von IDL: Suchpfade, Präprozessor, Parsen, Absenken und Registrieren der Typobjekte — ein Aufruf für jeden Nutzer zur Bauzeit.

Ein Aufruf — compose — nimmt einen Pfad und liefert das Modell samt seinen registrierten Typobjekten. So sehen ein build.rs und das Kommandozeilenwerkzeug aus derselben Datei dasselbe.

Wo die Schritte liegen

Die Crate entstand, weil nur die CLI alle der folgenden Schritte ausführte; build.rs-Skripte, die den Parser direkt aufriefen, bekamen keinen davon. Vier davon sind inzwischen ins Frontend gewandert; die Tabelle zeigt, wo jeder Schritt jetzt liegt:

Schritt wo er jetzt liegt
Expansion von #include / #define zerodds-idl-parse::preprocess
Parsen zerodds-idl-parse::parse_preprocessed
Key-Pragmas der Hersteller → @key apply_keylists in zerodds-idl-lower
Standard-Erweiterbarkeit Ast::effective_extensibility
Typobjekte zerodds-types::from_ast

Die Standard-Erweiterbarkeit wurde früher als explizites @final/@appendable an jedes nicht annotierte Aggregat geschrieben, damit alle Backends übereinstimmen. Jetzt beantwortet das Modell die Frage an einer Stelle, und nichts wird in den Baum geschrieben. Das verhindert, dass zwei Backends voneinander abweichen, ohne dass eines falsch ist.

ComposeOptions::default_extensibility gibt es weiterhin, weil XTypes 1.3 §7.3.1.2.1.8 sie vorsieht. Sie füllt eine fehlende Angabe und überstimmt nie die Quelle.

Auflösung von Includes

Ein Include in Anführungszeichen wird zuerst neben der einbindenden Datei gesucht, dann entlang der Suchliste und erst zuletzt so, wie es geschrieben steht. Ein Include, das nur wegen des Orts funktioniert, an dem der Build lief, bricht auf einer anderen Maschine.

Stellung