Reduct  v4.1.3-1-gd06c383
A functional and immutable language.
Loading...
Searching...
No Matches
module.h File Reference

Module system. More...

#include <reduct/defs.h>
#include <reduct/sync.h>
#include <stdbool.h>
#include <stddef.h>
Include dependency graph for module.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  reduct_module_t
 Module structure. More...
 
struct  reduct_module_global_t
 Global module state structure. More...
 

Macros

#define REDUCT_MODULE_ENTRY   "reduct_module_init"
 The name of the entry symbol for a Reduct module.
 
#define REDUCT_MODULE_PATHS_INITIAL   4
 Initial size of the module path array.
 
#define REDUCT_MODULE_PATHS_GROWTH   2
 Growth factor of the module path array.
 
#define REDUCT_MODULE_ID_NONE   ((reduct_module_id_t) - 1)
 Invalid handle value.
 

Typedefs

typedef reduct_handle_t(* reduct_module_init_fn) (struct reduct *reduct)
 Module initialization function type.
 
typedef uint16_t reduct_module_id_t
 Identifies a reduct_module_t within a Reduct structure.
 

Enumerations

enum  reduct_module_flags_t { REDUCT_MODULE_FLAG_NONE = 0 , REDUCT_MODULE_FLAG_BUFFER_OWNED = 1 << 0 , REDUCT_MODULE_FLAG_IS_LIBRARY = 1 << 1 }
 

Functions

REDUCT_API void reduct_module_global_init (reduct_module_global_t *global)
 Initialize the global module state.
 
REDUCT_API void reduct_module_global_deinit (reduct_module_global_t *global)
 Deinitialize the global module state.
 
REDUCT_API reduct_module_treduct_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_module_treduct_module_lookup (struct reduct *reduct, reduct_module_id_t id)
 Lookup a module structure by its ID.
 
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_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.
 
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.
 

Detailed Description

Module system.

Definition in file module.h.