From 7df3d08d8dd0d81f24f0788b44efd37883d3c1c8 Mon Sep 17 00:00:00 2001 From: nodist Date: Sat, 6 Jun 2026 15:42:50 -0400 Subject: start io and remove print op --- docs/application/buffer.md | 2 ++ docs/application/index.md | 3 ++- docs/application/interface.md | 4 ++-- docs/application/io.md | 5 +++++ docs/application/namespace.md | 21 +++++++++++---------- docs/application/queue.md | 14 ++++++++++++++ docs/application/thread.md | 16 +++++++++++----- docs/application/type.md | 4 ++-- docs/index.md | 4 ++-- docs/language/operators.md | 8 +------- docs/type_system/fn.md | 9 +++++++-- docs/type_system/name.md | 2 +- mkdocs.yml | 1 + 13 files changed, 61 insertions(+), 32 deletions(-) create mode 100644 docs/application/io.md diff --git a/docs/application/buffer.md b/docs/application/buffer.md index d72eb8a..230c2d6 100644 --- a/docs/application/buffer.md +++ b/docs/application/buffer.md @@ -12,3 +12,5 @@ typedef struct _kpl_buffer { uint8_t bytes; } kpl_buffer; ``` + +## Unicode Methods diff --git a/docs/application/index.md b/docs/application/index.md index 7d97cda..2717005 100644 --- a/docs/application/index.md +++ b/docs/application/index.md @@ -4,7 +4,7 @@ # Requirements -* Linux X64 +* Linux X64 with io_uring (6+) * GNU Make * GCC with -std=gnu99 -fhardened (14+) @@ -14,6 +14,7 @@ * ##### [Type](./type.md) * ##### [Pool](./pool.md) * ##### [Thread](./thread.md) +* ##### [Io](./io.md) * ##### [Tuple](./tuple.md) * ##### [Buffer](./buffer.md) * ##### [Map](./map.md) diff --git a/docs/application/interface.md b/docs/application/interface.md index 5042bb4..8a5dc69 100644 --- a/docs/application/interface.md +++ b/docs/application/interface.md @@ -28,10 +28,10 @@ typedef bool kpl_any_eq_fn(const kpl_any a, const kpl_any b); typedef ssize_t kpl_any_cmp_fn(const kpl_any a, const kpl_any b); -typedef int32_t kpl_any_print_fn(const kpl_any a, FILE *file, size_t idnt, uint32_t print_opts); - typedef void kpl_any_free_fn(kpl_any a); +// TODO write + typedef struct { // TODO } kpl_interface; diff --git a/docs/application/io.md b/docs/application/io.md new file mode 100644 index 0000000..50e21ff --- /dev/null +++ b/docs/application/io.md @@ -0,0 +1,5 @@ +# Io + +--- + +All IO is done through lib_uring diff --git a/docs/application/namespace.md b/docs/application/namespace.md index f49ebf1..6891376 100644 --- a/docs/application/namespace.md +++ b/docs/application/namespace.md @@ -5,33 +5,34 @@ ## Object Definitions ```c +typedef struct _kpl_export { + POOL_HEADER(_kpl_export); + _Atomic int32_t ref_count; + kpl_buffer *name; + kpl_class *class; +} kpl_export; + typedef struct _kpl_native_namespace { POOL_HEADER(_kpl_native_namespace); kpl_buffer *name; - kpl_map *exports; - pthread_mutex_t mutex; + kpl_export *exports; } kpl_native_namespace; -``` -```c typedef struct _kpl_file_namespace { POOL_HEADER(_kpl_file_namespace); __Atomic int16_t children; uint16_t flags; + kpl_queue *parents; kpl_buffer *file_name, *file_string; - kpl_map *parents, *exports; + kpl_export *exports; // TODO AST - kpl_interface *interface; kpl_task *task; - pthread_mutex_t mutex; } kpl_file_namespace; -``` -```c typedef struct _kpl_string_namespace { + _Atomic int16_t children; kpl_buffer *string; // TODO AST - kpl_interface *interface; kpl_task *task; } kpl_string_namespace; ``` diff --git a/docs/application/queue.md b/docs/application/queue.md index 86c4009..21ec995 100644 --- a/docs/application/queue.md +++ b/docs/application/queue.md @@ -1,3 +1,17 @@ # Queue --- + +```c +typedef struct _kpl_queue_item { + POOL_HEADER(_kpl_queue_item); + kpl_interface *interface; + kpl_class class; +} kpl_queue_item; + +typedef struct _kpl_queue { + POOL_HEADER(_kpl_queue); + uint32_t length; + kpl_queue_item *head, *tail; +} kpl_queue; +``` diff --git a/docs/application/thread.md b/docs/application/thread.md index 4ee5688..56d8566 100644 --- a/docs/application/thread.md +++ b/docs/application/thread.md @@ -9,18 +9,14 @@ typedef struct _kpl_task kpl_task; typedef void kpl_task_fn(kpl_task *t); -#ifndef KPL_TASK_STATE_SIZE -#define KPL_TASK_STATE_SIZE 20 -#endif - typedef struct _kpl_task { POOL_HEADER(kpl_task); _Atomic bool join_ready; uint16_t worker_id; kpl_task_fn *fn; + kpl_tuple *state; kpl_interface *ret_interface; kpl_result ret; - kpl_class state[KPL_TASK_STATE_SIZE]; } kpl_task; typedef struct { @@ -43,6 +39,16 @@ pthread_cond_t async_cond; kpl_thread threads[KPL_MAX_THREADS]; ``` +## Task State + +```text +0 -> length +native : arguments +process : arguments, locals +closure : arguments, locals, closure function +iterator : arguments, locals, iterator functions, iterator function index +``` + ## Per Process Task Queue ## Asynchronous Task Queue diff --git a/docs/application/type.md b/docs/application/type.md index 4cc2fc8..eae1425 100644 --- a/docs/application/type.md +++ b/docs/application/type.md @@ -2,6 +2,6 @@ --- -## Object Definitions +## Allocation -## Allocator +## Object Definitions diff --git a/docs/index.md b/docs/index.md index b0b2baa..d298e04 100644 --- a/docs/index.md +++ b/docs/index.md @@ -31,8 +31,8 @@ readFile("filename", callback(data)) // langauge equivalent // Do Soemthing Fn[name; callback] $ ( - ( read ) : `use "io" - callback `sync read `sync name + ( read; open ) : `use "io" + callback `sync read `sync open `sync name ) `async ("filename"; callback) // Continue while readFile is running ``` diff --git a/docs/language/operators.md b/docs/language/operators.md index 7bfdd17..dbf17ea 100644 --- a/docs/language/operators.md +++ b/docs/language/operators.md @@ -10,18 +10,12 @@ ## `log -## ``print` - -```text -Result[I32] : Is[File; Void] `print Any -``` - If no `File` is specified the output is send to `stdout` ## ``format` ```text -Result[String] : Const[String]`format Any +Result[String] : Value[String]`format Any ``` ### Formatting diff --git a/docs/type_system/fn.md b/docs/type_system/fn.md index 66a350e..c5c1ba7 100644 --- a/docs/type_system/fn.md +++ b/docs/type_system/fn.md @@ -10,7 +10,12 @@ Fn_class `alias Enum[ .regex ] -Fn[Fn_class; RETURN_TYPE; Tuple[ARGS]; STATE; List] +Fn[Fn_class; RETURN_TYPE; List[ARGS]; STATE; List] + +Fn[Fn_class; RETURN_TYPE; ARGS...] +Fn[RETURN_TYPE; ARGS...] +Fn[Fn_class; ARGS...] +Fn[ARGS...] ``` # Function Classes @@ -37,7 +42,7 @@ A list of tasks with state ## Generator -A function for creating an iterator or closure +A function for creating an iterator ## Iterator diff --git a/docs/type_system/name.md b/docs/type_system/name.md index 343232b..d506201 100644 --- a/docs/type_system/name.md +++ b/docs/type_system/name.md @@ -5,5 +5,5 @@ ```text Name_class `alias Enum[.unknown; .data; .alias; .unique] -Name[Name_class; TYPE] +Name[Name_class; Is[Void; Value; Var]] ``` diff --git a/mkdocs.yml b/mkdocs.yml index 0036696..0741131 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -43,6 +43,7 @@ nav: - Type: 'application/type.md' - Pool: 'application/pool.md' - Thread: 'application/thread.md' + - Io: 'application/io.md' - Tuple: 'application/tuple.md' - Buffer: 'application/buffer.md' - Map: 'application/map.md' -- cgit v1.2.3