2#define REDUCT_MODULE_H 1
26#define REDUCT_MODULE_ENTRY "reduct_module_init"
28#define REDUCT_MODULE_PATHS_INITIAL 4
29#define REDUCT_MODULE_PATHS_GROWTH 2
41#define REDUCT_MODULE_ID_NONE ((reduct_module_id_t) - 1)
47typedef enum reduct_module_flags
62typedef struct reduct_module
64 struct reduct_module*
prev;
143 size_t maxLen,
bool checkExistence);
REDUCT_API void reduct_module_global_deinit(reduct_module_global_t *global)
Deinitialize the global module state.
REDUCT_API reduct_module_t * reduct_module_lookup(struct reduct *reduct, reduct_module_id_t id)
Lookup a module structure by its ID.
REDUCT_API void reduct_module_resolve_path(struct reduct *reduct, const char *path, size_t pathLen, char *outPath, size_t maxLen, bool checkExistence)
Resolve a path relative to the current execution frame or import paths.
uint16_t reduct_module_id_t
Identifies a reduct_module_t within a Reduct structure.
REDUCT_API reduct_module_t * reduct_module_new(struct reduct *reduct, const char *buffer, size_t length, const char *path, reduct_module_flags_t flags)
Create a new module to track a buffer.
REDUCT_API reduct_handle_t reduct_module_import(struct reduct *reduct, reduct_handle_t path, reduct_handle_t compiler, reduct_handle_t compilerArgs)
Import a module from a given path.
REDUCT_API void reduct_module_add_path(struct reduct *reduct, const char *path)
Add a path to search when importing modules.
REDUCT_API void reduct_module_global_init(reduct_module_global_t *global)
Initialize the global module state.
reduct_handle_t(* reduct_module_init_fn)(struct reduct *reduct)
Module initialization function type.
@ REDUCT_MODULE_FLAG_BUFFER_OWNED
The buffer is owned by the module structure and should be freed.
@ REDUCT_MODULE_FLAG_NONE
@ REDUCT_MODULE_FLAG_IS_LIBRARY
The module is a loaded shared library.
Global module state structure.
reduct_module_id_t moduleNextId
reduct_module_t * moduleHead
reduct_rwmutex_t pathsMutex
reduct_rwmutex_t moduleMutex
struct reduct_module * prev
reduct_module_flags_t flags
reduct_lib_t lib
Loaded shared library handle, must have REDUCT_MODULE_FLAG_IS_LIBRARY set.
Read-Write Mutex structure.
Syncronization primitives.