|
Loom C API
Public Loom compiler C API
|
Immutable compiler products and their recursively published requests. More...
Go to the source code of this file.
Data Structures | |
| struct | loomc_request_root_t |
| Durable address of one root in a request's bytecode source. More... | |
| struct | loomc_request_binding_t |
| Provisional association between a parent requirement and a request root. More... | |
| struct | loomc_request_sink_t |
| Optional destination for streamed product requests. More... | |
Macros | |
| #define | LOOMC_REQUIREMENT_ORDINAL_INVALID UINT32_MAX |
| Invalid parent-product requirement ordinal. | |
| #define | LOOMC_REQUEST_ROOT_ORDINAL_INVALID UINT32_MAX |
| Invalid request-local root ordinal. | |
Typedefs | |
| typedef struct loomc_product_descriptor_t | loomc_product_descriptor_t |
| Opaque process-local identity for one product representation. | |
| typedef struct loomc_product_t | loomc_product_t |
| Immutable successful compiler product. | |
| typedef uint32_t | loomc_requirement_ordinal_t |
| Parent-product-local requirement ordinal. | |
| typedef uint32_t | loomc_request_root_ordinal_t |
| Request-local root ordinal. | |
| typedef struct loomc_request_t | loomc_request_t |
| Immutable independently compilable product request. | |
| typedef loomc_status_t(* | loomc_request_publish_fn_t) (void *user_data, loomc_request_t *request) |
| Accepts ownership of one published request at callback entry. | |
Functions | |
| void | loomc_product_retain (loomc_product_t *product) |
| Retains a product for another owner. | |
| void | loomc_product_release (loomc_product_t *product) |
| Releases a product. | |
| const loomc_product_descriptor_t * | loomc_product_descriptor (const loomc_product_t *product) |
| Returns the process-local descriptor identifying product. | |
| loomc_host_size_t | loomc_product_artifact_count (const loomc_product_t *product) |
| Returns the number of artifacts owned by product. | |
| const loomc_artifact_t * | loomc_product_artifact_at (const loomc_product_t *product, loomc_host_size_t ordinal) |
| Returns an artifact by product-local ordinal. | |
| loomc_host_size_t | loomc_product_export_count (const loomc_product_t *product) |
| Returns the number of roots exported by product. | |
| loomc_host_size_t | loomc_product_requirement_count (const loomc_product_t *product) |
| Returns the number of unresolved requirements in product. | |
| loomc_status_t | loomc_request_create (const loomc_product_descriptor_t *product_descriptor, loomc_source_t *source, const loomc_request_root_t *roots, loomc_host_size_t root_count, const loomc_request_binding_t *bindings, loomc_host_size_t binding_count, loomc_allocator_t allocator, loomc_request_t **out_request) |
| Creates an immutable request over ordinary Loom bytecode. | |
| void | loomc_request_retain (loomc_request_t *request) |
| Retains a request for another owner. | |
| void | loomc_request_release (loomc_request_t *request) |
| Releases a request. | |
| const loomc_product_descriptor_t * | loomc_request_product_descriptor (const loomc_request_t *request) |
| Returns the required product representation for request. | |
| loomc_source_t * | loomc_request_source (const loomc_request_t *request) |
| Returns the immutable bytecode source owned by request. | |
| loomc_host_size_t | loomc_request_root_count (const loomc_request_t *request) |
| Returns the number of canonical roots in request. | |
| bool | loomc_request_root_at (const loomc_request_t *request, loomc_request_root_ordinal_t ordinal, loomc_request_root_t *out_root) |
| Returns a request root by request-local ordinal. | |
| loomc_host_size_t | loomc_request_binding_count (const loomc_request_t *request) |
| Returns the number of provisional parent bindings in request. | |
| bool | loomc_request_binding_at (const loomc_request_t *request, loomc_host_size_t ordinal, loomc_request_binding_t *out_binding) |
| Returns a provisional parent binding by ordinal. | |
Immutable compiler products and their recursively published requests.
A product is the immutable value returned by a successful compiler operation. It owns that operation's artifacts and exposes the two ordinal spaces needed for composition: exported roots that may satisfy a parent binding and requirements that must be satisfied by child products or an embedding. Product-specific APIs project richer metadata from the same handle without changing its ownership model.
loomc_result_t and loomc_product_t deliberately answer different questions. A result reports whether an operation succeeded and carries its diagnostics. A product exists only on success and carries the immutable value produced by the operation.
A request is an independently compilable ordinary Loom bytecode source. It owns the exact source roots selected by its producer and the provisional bindings from requirements in the parent product to those roots. Requests retain no mutable module, workspace, link plan, or compiler analysis state.
Every request names the process-local product descriptor it expects a successful pipeline to produce. This is the open compilation route used by hosts: command programs, compiled modules, and future product families add descriptors without extending a central kind enumeration. Root operations remain the durable source contract and are validated by the selected product operation. Symbol strings, filenames, and target names do not participate in routing.
| typedef struct loomc_product_descriptor_t loomc_product_descriptor_t |
Opaque process-local identity for one product representation.
Descriptor pointers are stable for the lifetime of the process and may be compared by identity. They are never serialized. A request uses the descriptor to name its required successful representation while its source roots retain the durable operation contracts compiled by that route.
| typedef struct loomc_product_t loomc_product_t |
Immutable successful compiler product.
Product artifacts, exported roots, and requirements use product-local ordinals. An operation-specific API defines the metadata and meaning of each root and requirement. A request binding associates one requirement ordinal in a parent product with one root ordinal in a child request; the resulting child product preserves that request-root order as its exported root order.
| typedef loomc_status_t(* loomc_request_publish_fn_t) (void *user_data, loomc_request_t *request) |
Accepts ownership of one published request at callback entry.
| user_data | Callback-owned state. |
| request | Request reference transferred to the callback. |
| typedef struct loomc_request_t loomc_request_t |
Immutable independently compilable product request.
| const loomc_artifact_t * loomc_product_artifact_at | ( | const loomc_product_t * | product, |
| loomc_host_size_t | ordinal ) |
Returns an artifact by product-local ordinal.
| product | Product to inspect. |
| ordinal | Zero-based artifact ordinal. |
| loomc_host_size_t loomc_product_artifact_count | ( | const loomc_product_t * | product | ) |
Returns the number of artifacts owned by product.
| product | Product to inspect, or NULL. |
| const loomc_product_descriptor_t * loomc_product_descriptor | ( | const loomc_product_t * | product | ) |
Returns the process-local descriptor identifying product.
| product | Product to inspect, or NULL. |
| loomc_host_size_t loomc_product_export_count | ( | const loomc_product_t * | product | ) |
Returns the number of roots exported by product.
Export ordinals preserve the root order of the request or direct build that produced the product. Product-specific APIs expose root metadata.
| product | Product to inspect, or NULL. |
| void loomc_product_release | ( | loomc_product_t * | product | ) |
Releases a product.
| product | Product to release. Passing NULL is allowed. |
| loomc_host_size_t loomc_product_requirement_count | ( | const loomc_product_t * | product | ) |
Returns the number of unresolved requirements in product.
Requirements are addressed by loomc_requirement_ordinal_t. Their typed contracts are exposed by product-specific APIs; source requests carry the provisional child bindings needed by a composing host.
| product | Product to inspect, or NULL. |
| void loomc_product_retain | ( | loomc_product_t * | product | ) |
Retains a product for another owner.
| product | Product to retain. Passing NULL is allowed. |
| bool loomc_request_binding_at | ( | const loomc_request_t * | request, |
| loomc_host_size_t | ordinal, | ||
| loomc_request_binding_t * | out_binding ) |
Returns a provisional parent binding by ordinal.
| request | Request to inspect. |
| ordinal | Zero-based binding ordinal. |
| out_binding | Receives the binding when found. |
| loomc_host_size_t loomc_request_binding_count | ( | const loomc_request_t * | request | ) |
Returns the number of provisional parent bindings in request.
| request | Request to inspect, or NULL. |
| loomc_status_t loomc_request_create | ( | const loomc_product_descriptor_t * | product_descriptor, |
| loomc_source_t * | source, | ||
| const loomc_request_root_t * | roots, | ||
| loomc_host_size_t | root_count, | ||
| const loomc_request_binding_t * | bindings, | ||
| loomc_host_size_t | binding_count, | ||
| loomc_allocator_t | allocator, | ||
| loomc_request_t ** | out_request ) |
Creates an immutable request over ordinary Loom bytecode.
| product_descriptor | Process-lifetime descriptor for the required successful product representation. |
| source | Bytecode source retained by the request. |
| roots | Source-local roots copied in product export order. |
| root_count | Number of entries in roots; must be nonzero. |
| bindings | Optional parent-requirement bindings copied into the request. Entries must have strictly increasing requirement ordinals and refer to valid request-local roots. |
| binding_count | Number of entries in bindings. |
| allocator | Host allocator used for request and metadata storage. |
| out_request | Receives one retained request. |
Root addresses are validated against the bytecode source by the operation that consumes the request. This constructor performs no source indexing or module scan, so a caller may resolve human-readable names once through a link index and form many requests by exact ordinal.
| const loomc_product_descriptor_t * loomc_request_product_descriptor | ( | const loomc_request_t * | request | ) |
Returns the required product representation for request.
The descriptor is part of the immutable request contract. A pipeline selected for the request must produce a product with this descriptor on success. Descriptor identity is process-local and is never serialized into the request source.
| request | Request to inspect, or NULL. |
| void loomc_request_release | ( | loomc_request_t * | request | ) |
Releases a request.
| request | Request to release. Passing NULL is allowed. |
| void loomc_request_retain | ( | loomc_request_t * | request | ) |
Retains a request for another owner.
| request | Request to retain. Passing NULL is allowed. |
| bool loomc_request_root_at | ( | const loomc_request_t * | request, |
| loomc_request_root_ordinal_t | ordinal, | ||
| loomc_request_root_t * | out_root ) |
Returns a request root by request-local ordinal.
| request | Request to inspect. |
| ordinal | Request-local root ordinal. |
| out_root | Receives the root when found. |
| loomc_host_size_t loomc_request_root_count | ( | const loomc_request_t * | request | ) |
Returns the number of canonical roots in request.
| request | Request to inspect, or NULL. |
| loomc_source_t * loomc_request_source | ( | const loomc_request_t * | request | ) |
Returns the immutable bytecode source owned by request.
| request | Request to inspect. |