83typedef enum loomc_source_format_e {
95typedef enum loomc_source_storage_e {
#define LOOMC_API_EXPORT
Exports a public Loom C API symbol from a shared library build.
Definition base.h:34
size_t loomc_host_size_t
Host allocation and container size type.
Definition base.h:45
loomc_structure_type_t
Structure type values used by extensible public descriptors.
Definition base.h:181
#define LOOMC_API_PTR
Marks a public callback function pointer type.
Definition base.h:38
struct iree_status_handle_t * loomc_status_t
Opaque status handle.
Definition base.h:55
loomc_status_t loomc_source_create_from_file(FILE *file, const loomc_source_load_options_t *options, loomc_allocator_t allocator, loomc_source_t **out_source)
Creates an immutable source by reading an open file.
loomc_source_storage_t
Storage policy for source bytes.
Definition source.h:95
@ LOOMC_SOURCE_STORAGE_COPY
Source bytes are copied into storage owned by the source.
Definition source.h:100
@ LOOMC_SOURCE_STORAGE_BORROWED
Source bytes are borrowed from the caller for the lifetime of the source.
Definition source.h:97
@ LOOMC_SOURCE_STORAGE_EXTERNAL
Source bytes are owned externally and released by a caller callback.
Definition source.h:103
loomc_string_view_t loomc_source_identifier(const loomc_source_t *source)
Returns the source identifier.
void loomc_source_release(loomc_source_t *source)
Releases source from one owner.
void(* loomc_source_release_fn_t)(void *user_data, loomc_byte_span_t contents)
Callback used to release externally owned source bytes.
Definition source.h:115
struct loomc_source_t loomc_source_t
Immutable source handle.
Definition source.h:80
loomc_source_format_t loomc_source_format(const loomc_source_t *source)
Returns the source format.
loomc_byte_span_t loomc_source_contents(const loomc_source_t *source)
Returns the source contents.
void loomc_source_retain(loomc_source_t *source)
Retains source for another owner.
loomc_status_t loomc_source_create_from_path(loomc_string_view_t path, const loomc_source_load_options_t *options, loomc_allocator_t allocator, loomc_source_t **out_source)
Creates an immutable source by reading a filesystem path.
loomc_source_format_t
Source byte format.
Definition source.h:83
@ LOOMC_SOURCE_FORMAT_UNKNOWN
Source format is unknown and must be inferred by the consumer.
Definition source.h:85
@ LOOMC_SOURCE_FORMAT_TEXT
Textual .loom source.
Definition source.h:88
@ LOOMC_SOURCE_FORMAT_BYTECODE
Binary .loombc source.
Definition source.h:91
loomc_status_t loomc_source_create(const loomc_source_options_t *options, loomc_allocator_t allocator, loomc_source_t **out_source)
Creates an immutable source handle.
Status codes and rich infrastructure error reporting.
Host allocator used for persistent Loom object storage.
Definition base.h:375
Non-owning view over immutable bytes.
Definition base.h:128
Source load options for host file and path constructors.
Definition source.h:158
loomc_source_format_t format
Loaded source format.
Definition source.h:170
loomc_string_view_t identifier
Stable identifier used in diagnostics and cache keys.
Definition source.h:176
loomc_host_size_t structure_size
Size of this structure in bytes.
Definition source.h:164
const void * next
Reserved extension chain. Must be NULL.
Definition source.h:167
loomc_structure_type_t type
Structure type.
Definition source.h:161
Source creation options.
Definition source.h:123
loomc_source_format_t format
Input source format.
Definition source.h:135
loomc_source_storage_t storage
Storage policy for contents.
Definition source.h:144
loomc_structure_type_t type
Structure type.
Definition source.h:126
const void * next
Extension chain for future source options.
Definition source.h:132
loomc_string_view_t identifier
Stable identifier used in diagnostics and cache keys.
Definition source.h:138
void * release_user_data
User data passed to release.
Definition source.h:150
loomc_source_release_fn_t release
Callback used when storage is LOOMC_SOURCE_STORAGE_EXTERNAL.
Definition source.h:147
loomc_host_size_t structure_size
Size of this structure in bytes.
Definition source.h:129
loomc_byte_span_t contents
Input bytes.
Definition source.h:141
Non-owning string view over bytes that need not be NUL-terminated.
Definition base.h:63