Page
Maestro Common API
This document is a standalone reference for the common public Maestro API surface shared by compile-time and runtime APIs.
Related API docs:
Canonical headers:
../../include/maestro/common.h../../include/maestro/maestro.h
Purpose
common.h contains the shared public types, constants, enums, and
function typedefs used by both the compile and runtime APIs.
It does not expose concrete struct layouts for public opaque types.
Numeric Types
maestro_int_t
typedef int64_t maestro_int_t;
The public integer type used by the API.
maestro_float_t
typedef float maestro_float_t;
The public floating-point type used by the API.
Build and Artifact Constants
MAESTRO_MAGIC_STRING
#define MAESTRO_MAGIC_STRING "maestro"
The default string used to derive the default artifact magic.
MAESTRO_VERSION
#define MAESTRO_VERSION 1U
The public library/artifact version constant.
MAESTRO_DLL_INIT_SYMBOL
#define MAESTRO_DLL_INIT_SYMBOL "maestro_dll_init"
The required exported symbol name for POSIX .so runtime extension
libraries.
MAESTRO_DEFAULT_MAGIC
extern const uint8_t MAESTRO_DEFAULT_MAGIC[32];
The default 256-bit artifact magic used by the linker and loader.
Status Codes
The common status codes are:
MAESTRO_OKMAESTRO_ERR_PARSEMAESTRO_ERR_LINKMAESTRO_ERR_LOADMAESTRO_ERR_VALIDATEMAESTRO_ERR_RUNTIMEMAESTRO_ERR_NOMEMMAESTRO_ERR_CAPABILITY
These are shared across the public API.
VM Logging Flags
The public VM logging flags are:
MAESTRO_VLOG_ERRORMAESTRO_VLOG_WARNMAESTRO_VLOG_INFOMAESTRO_VLOG_DEBUG
These are used with the runtime context logging configuration.
Validation Error Flags
The public validation flags are:
MAESTRO_VERR_IMAGEMAESTRO_VERR_OUTPUTMAESTRO_VERR_ALLOCMAESTRO_VERR_CAPMAESTRO_VERR_FN
These are returned by the runtime validation API.
Public Value Type Tags
The public runtime value type tags are:
MAESTRO_VAL_INVALIDMAESTRO_VAL_INTMAESTRO_VAL_FLOATMAESTRO_VAL_STRINGMAESTRO_VAL_LISTMAESTRO_VAL_OBJECTMAESTRO_VAL_SYMBOLMAESTRO_VAL_BOOLMAESTRO_VAL_REFMAESTRO_VAL_STATEMAESTRO_VAL_MACROMAESTRO_VAL_PROGRAMMAESTRO_VAL_BUILTIN
These are primarily consumed through the runtime helper/accessor APIs.
Public AST Node Type Tags
The public AST node type tags are:
MAESTRO_AST_INVALIDMAESTRO_AST_INTMAESTRO_AST_FLOATMAESTRO_AST_STRINGMAESTRO_AST_IDENTMAESTRO_AST_SYMBOLMAESTRO_AST_FORMMAESTRO_AST_JSON
These exist as part of the shared public type model even though the AST containers themselves are opaque.
Opaque Public Types
The common API forward-declares the opaque public types:
maestro_ctxmaestro_valuemaestro_astmaestro_astsmaestro_ast_nodemaestro_ast_kv
These are defined internally, not in the public API.
Function Typedefs
maestro_output
typedef int (*maestro_output)(maestro_ctx *ctx, const char *msg);
The public callback type used for:
- program-visible
print - program-visible
log - VM logging
maestro_fn
typedef int (*maestro_fn)(maestro_ctx *ctx, maestro_value **args,
size_t argc, maestro_value **result);
The public callback type used for external function bindings.
The callback receives borrowed input argument handles for the duration
of the call and returns a runtime-owned result handle through
result.
maestro_dll_init_fn
typedef int (*maestro_dll_init_fn)(maestro_ctx *ctx);
The public initializer typedef for .so extension libraries.
The initializer is resolved from MAESTRO_DLL_INIT_SYMBOL and is
expected to register external function bindings with
maestro_register_fn().
maestro_alloc_fn
typedef void *(*maestro_alloc_fn)(size_t size);
The public allocator callback type.
maestro_free_fn
typedef void (*maestro_free_fn)(void *ptr);
The public deallocator callback type.
See Also
- Compile-side API:
api-compile.md - Runtime-side API:
api-runtime.md