diff options
Diffstat (limited to 'docs/application/namespace.md')
| -rw-r--r-- | docs/application/namespace.md | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/docs/application/namespace.md b/docs/application/namespace.md index e9842cd..cd1f89e 100644 --- a/docs/application/namespace.md +++ b/docs/application/namespace.md @@ -5,29 +5,24 @@ ## Object Definitions ```c -typedef struct _kpl_export { - int32_t tree_weight; - struct _kpl_export *tree_left, *tree_right; - kpl_type *type; -} kpl_export; +#define KPL_TREE_HEADER() uint32_t tree_weight, module_id; struct _kpl_namespace_tree *tree_left, *tree_right; kpl_buffer *name + +typedef struct _kpl_namespace_tree { + KPL_TREE_HEADER(); +} kpl_namespace_tree_obj; typedef struct _kpl_namespace_native { - int32_t tree_weight; - struct _kpl_namespace_native *tree_left, *tree_right; - const char *name; - kpl_export *export_tree; + KPL_TREE_HEADER(); + kpl_type *export_var_tree; } kpl_namespace_native; static kpl_namespace_native *namespace_native_tree; typedef struct _kpl_namespace_module { - uint32_t module_id; - int32_t tree_weight; - struct _kpl_namespace_module *tree_left, *tree_right; - kpl_buffer *module_string, *module_name; - kpl_export *export_tree; + KPL_TREE_HEADER(); + kpl_buffer *body; + kpl_type *ast, *export_var_tree; kpl_mutex export_mutex; - kpl_type *ast; } kpl_namespace_module; static kpl_namespace_module *namespace_module_tree; @@ -73,7 +68,7 @@ Add a [Register](../lifecycle/register.md) task to `namespace_module_mutex` ### ``export` -Add exports directly to the namespaces `export_tree`, thread safe +Add exports directly to the namespaces `export_var_tree`, thread safe ## String/REPL @@ -94,7 +89,7 @@ Since the native modules are loaded statically the `native_module_tree` becomes 1. Add find namespace task to the `namespace_module_mutex`, the namespace not existing is an error 2. Add a get export task to the namespaces `export_mutex` 3. The `export_mutex` will not start processing it's queue until the namespace notifies that it's and unlocks its `export_mutex` -4. The importer will get a copy of the read only `export_tree` +4. The importer will get a copy of the read only `export_var_tree` # AVL Tree Storage and Lookup |
