diff options
Diffstat (limited to 'docs/application')
| -rw-r--r-- | docs/application/index.md | 2 | ||||
| -rw-r--r-- | docs/application/interface.md | 6 | ||||
| -rw-r--r-- | docs/application/memory.md | 2 | ||||
| -rw-r--r-- | docs/application/name.md | 27 | ||||
| -rw-r--r-- | docs/application/namespace.md | 12 | ||||
| -rw-r--r-- | docs/application/type.md | 14 |
6 files changed, 41 insertions, 22 deletions
diff --git a/docs/application/index.md b/docs/application/index.md index c6153b6..e31ecff 100644 --- a/docs/application/index.md +++ b/docs/application/index.md @@ -42,7 +42,7 @@ 1. ##### [Register](../lifecycle/register.md) 2. ##### [Parse](../lifecycle/parse.md) -3. ##### Scan +3. ##### [Scan](../lifecycle/scan.md) 4. ##### Scope 5. ##### Import 6. ##### Check diff --git a/docs/application/interface.md b/docs/application/interface.md index b60da5e..6f33f61 100644 --- a/docs/application/interface.md +++ b/docs/application/interface.md @@ -42,4 +42,10 @@ typedef struct { typedef struct { any value, info; } kpl_result; + +typdef struct { + uint16_t slab_index, array_index; +} kpl_ptr; + +#define KPL_PTR_NULL (kpl_ptr) { .slab_index = UINT16_MAX, .array_index = UINT16_MAX } ``` diff --git a/docs/application/memory.md b/docs/application/memory.md index a7eab83..f5f457c 100644 --- a/docs/application/memory.md +++ b/docs/application/memory.md @@ -50,7 +50,7 @@ typedef struct _kpl_slab { uint32_t obj_size, byte_index; kpl_slab_obj *pool; kpl_mutex mutex; - uint8_t byte_array[MAX_SIZE]; + uint8_t byte_array[]; } kpl_slab; ``` diff --git a/docs/application/name.md b/docs/application/name.md index 3c00aa0..d605b81 100644 --- a/docs/application/name.md +++ b/docs/application/name.md @@ -7,8 +7,29 @@ Each word representing a var, symbol or type gets an `NAME_IDENTIFIER` -> `kpl_n ## Object Definitions ```c -typedef struct _kpl_name { - KPL_ALLOC_TREE_HEADER(struct _kpl_name); - char c_str[]; +#define KPL_LETTER_COUNT 26 + +#define KPL_NAME_COUNT 43 + +#define KPL_NAME_SIZE 44 + +typedef struct { + kpl_ptr underscore, lowercase[KPL_LETTER_COUNT], uppercase[KPL_LETTER_COUNT]; + char name[KPL_NAME_SIZE]; +} kpl_name_node; + +typedef strcut { + kpl_name_node array[UINT16_MAX]; +} kpl_name_array; + +typedef strcut { + uint16_t slab_index, array_index; + kpl_mutex mutex; + kpl_ptr root; + kpl_name_array *slab[UINT16_MAX]; } kpl_name; ``` + +## Usage + +The only operation into the trie is a findsert with a pointer to a string and its length, returning a pointer to the found or inserted node diff --git a/docs/application/namespace.md b/docs/application/namespace.md index cbf768d..7cb6a3c 100644 --- a/docs/application/namespace.md +++ b/docs/application/namespace.md @@ -25,10 +25,10 @@ typedef enum : uint8_t { typedef struct _kpl_namespace_module { KPL_SLAB_TREE_HEADER(struct _kpl_namespace_module); kpl_type_ptr ast; - kpl_name *name_tree; kpl_buffer *module_name, *module_string; + kpl_task *_Atomic task; kpl_export *export_tree; - kpl_mutex mutex; + kpl_mutex export_mutex; } kpl_namespace_module; static kpl_namespace_module *namespace_module_tree; @@ -37,9 +37,8 @@ kpl_mutex namespace_module_mutex; typedef struct _kpl_namespace_string { kpl_type_ptr ast; - kpl_name *name_tree; kpl_buffer *string; - kpl_mutex mutex; + kpl_task *_Atomic task; } kpl_namespace_string; static kpl_namespace_string namespace_string @@ -98,5 +97,6 @@ Since the native modules are loaded statically the `native_module_tree` becomes ### Import ``import` 1. Add find namespace task to the `namespace_module_mutex`, the namespace not existing is an error -2. Add task to the namespaces `mutex` -3. The task will resume the importer +2. Add a get export task to the namespaces `export_mutex` +3. The `export_mutex` will not start processing it's queue until the `task` field is `NULL` +4. The importer will get a copy of the read only `export_tree` diff --git a/docs/application/type.md b/docs/application/type.md index c985b35..5377cf6 100644 --- a/docs/application/type.md +++ b/docs/application/type.md @@ -5,16 +5,6 @@ ## Object Definitions ```c -#define KPL_TYPE_BLOCK_ARRAY_SIZE UINT16_MAX - -#define KPL_TYPE_BLOCKS_SIZE UINT16_MAX - -typedef struct { - uint16_t slab_index, slab_array_index; -} kpl_type_ptr; - -static const kpl_type_ptr kpl_type_ptr_null = { UINT16_MAX, UINT16_MAX }; - typedef enum : uint8_t { // ... } kpl_type_template; @@ -35,9 +25,11 @@ typedef struct { uint8_t qualifiers; uint16_t modifiers; _Atomic int32_t ref_count; + kpl_namespace_module *module; + uint32_t token_line, token_position, token_length; kpl_ptr self; kpl_type_body body; } kpl_type; -// TODO slab store for kpl_type_ptr +// TODO SLAB WITH POOL ``` |
