|
Loom C API
Public Loom compiler C API
|
In-memory output artifacts produced by compiler operations. More...
Go to the source code of this file.
Data Structures | |
| struct | loomc_artifact_t |
| Borrowed artifact view owned by a result object. More... | |
Typedefs | |
| typedef void(* | loomc_artifact_release_fn_t) (void *user_data, loomc_byte_span_t contents) |
| Callback used to release artifact contents transferred to a consumer. | |
Enumerations | |
| enum | loomc_artifact_kind_t { LOOMC_ARTIFACT_KIND_EXECUTABLE = 0 , LOOMC_ARTIFACT_KIND_TEXT = 1 , LOOMC_ARTIFACT_KIND_REPORT = 2 , LOOMC_ARTIFACT_KIND_MODULE = 3 , LOOMC_ARTIFACT_KIND_LAUNCH_CONFIG = 4 } |
| Artifact category. More... | |
Functions | |
| loomc_status_t | loomc_artifact_create_source (const loomc_artifact_t *artifact, loomc_source_format_t format, loomc_allocator_t allocator, loomc_source_t **out_source) |
| Creates an immutable source handle from an artifact. | |
| loomc_status_t | loomc_artifact_write_to_file (const loomc_artifact_t *artifact, FILE *file) |
| Writes artifact bytes to an open C FILE*. | |
| loomc_status_t | loomc_artifact_write_to_path (const loomc_artifact_t *artifact, loomc_string_view_t path, loomc_allocator_t allocator) |
| Writes artifact bytes to a filesystem path. | |
In-memory output artifacts produced by compiler operations.
Artifacts are structured objects, not filesystem side effects. They carry format, identity, and bytes so language bindings can expose native byte arrays or typed artifact objects.
Filesystem persistence is explicit and composable. JIT integrations can keep artifact bytes in memory for loading or cache lookup, while tools and release builds can write the same artifact object to a FILE* or path.
| typedef void(* loomc_artifact_release_fn_t) (void *user_data, loomc_byte_span_t contents) |
Callback used to release artifact contents transferred to a consumer.
| user_data | Caller-provided value passed to the consuming operation. |
| contents | Original artifact contents transferred to the consumer. |
The consuming operation documents when the callback runs. The callback is invoked exactly once after that operation accepts ownership of the bytes.
Artifact category.
| loomc_status_t loomc_artifact_create_source | ( | const loomc_artifact_t * | artifact, |
| loomc_source_format_t | format, | ||
| loomc_allocator_t | allocator, | ||
| loomc_source_t ** | out_source ) |
Creates an immutable source handle from an artifact.
| artifact | Artifact whose bytes should become source contents. |
| format | Source format for the returned handle. Unknown infers Loom text and bytecode from well-known Loom artifact format strings and leaves other artifact formats unknown. |
| allocator | Host allocator used for source-owned storage. |
| out_source | Receives one retained source on success. |
| loomc_status_t loomc_artifact_write_to_file | ( | const loomc_artifact_t * | artifact, |
| FILE * | file ) |
Writes artifact bytes to an open C FILE*.
| artifact | Artifact to write. |
| file | Open writable file handle, such as stdout. |
| loomc_status_t loomc_artifact_write_to_path | ( | const loomc_artifact_t * | artifact, |
| loomc_string_view_t | path, | ||
| loomc_allocator_t | allocator ) |
Writes artifact bytes to a filesystem path.
| artifact | Artifact to write. |
| path | Output file path. The path is a borrowed byte view and does not need to be NUL-terminated. |
| allocator | Host allocator used for transient file path/stream storage. |