Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Provisional API: This reference documents current compiler behavior. Compatibility is not yet promised.

src/meta-project.x

The project meta build.

Functions

FunctionSummary
Frontend.build_loadedBuilds one helper exposing the loaded files’ public functions.
Frontend.build_metaBuilds an independent helper for the meta functions inputs reach.
Frontend.prepare_metaBuilds the helper that runs the project meta functions inputs reach, or finds it in the cache, and makes it the one their translation calls.

Frontend

Frontend.build_loaded

MetaHelper Frontend.build_loaded(Frontend f, List filenames)

Builds one helper exposing the loaded files’ public functions. Main’s native signature stays inside the helper; argc/argv calls accept an Array of argument Strings through the data protocol.

Source: src/meta-project.x:92

Frontend.build_meta

MetaHelper Frontend.build_meta(Frontend f, List inputs)

Builds an independent helper for the meta functions inputs reach. The caller owns its lifetime. Uses the ordinary source, include, package, native object, and cache dependency handling.

Source: src/meta-project.x:85

Frontend.prepare_meta

void Frontend.prepare_meta(Frontend f, List inputs)

Builds the helper that runs the project meta functions inputs reach, or finds it in the cache, and makes it the one their translation calls. Inputs that reach none use no helper. A group or helper that does not build is reported at the first call that needs it.

Source: src/meta-project.x:78

Design notes

Before a translation starts, the bodied meta functions its inputs reach are compiled into one helper program linked against the runtime, which the translation then calls (src/meta-helper-client.x). They come from ordinary source units reached directly, by includes, or by packages. Meta code under the x2c root’s lib, src, and etc is the compiler’s own, linked into it.

Each reached source unit gets its own table and native object. Public functions link between units; static helpers stay with their provider. The helper is cached under the x2c cache root, keyed by the SHA-256 of those sources, the compiler stamp, the C compiler’s identity, and the flags, and is built again when a file its build read, x2c source or C header, changes.