From dd9713497bfc9e27f9b1ff3181d34ee241f05ec8 Mon Sep 17 00:00:00 2001 From: nodist Date: Tue, 30 Jun 2026 16:13:39 -0400 Subject: match internal kpl status --- docs/application/interface.md | 18 +++++++++++++++++- docs/application/shared.md | 2 +- docs/application/testing.md | 4 ++-- docs/application/thread.md | 3 ++- docs/type_system/empty.md | 10 +++++----- docs/type_system/union.md | 14 +++++++------- 6 files changed, 34 insertions(+), 17 deletions(-) diff --git a/docs/application/interface.md b/docs/application/interface.md index 5acfba7..e1c947a 100644 --- a/docs/application/interface.md +++ b/docs/application/interface.md @@ -41,10 +41,26 @@ typedef struct { kpl_interface *interflace; } kpl_class; +typedef enum : uint8_t { + KPL_STATUS_ERROR, + KPL_STATUS_VALUE, + KPL_STATUS_NULL, + KPL_STATUS_DONE +} kpl_status; + typedef struct { - any value, info; + any value; + kpl_status status; } kpl_result; +kpl_result kpl_result_error(error *er); + +kpl_result kpl_result_value(any value); + +kpl_result kpl_result_null(void); + +kpl_result kpl_result_done(void); + typdef struct { uint16_t slab_index, array_index; } kpl_ptr; diff --git a/docs/application/shared.md b/docs/application/shared.md index f597d8d..3a3f4f7 100644 --- a/docs/application/shared.md +++ b/docs/application/shared.md @@ -28,7 +28,7 @@ static kpl_mutex shared_head_mutex; ## Mark Task(s) -1. Run gc interface on each task in the queue +1. Run gc interface on each task in the threads queue 2. Increase `shared_threads_makred` 3. If `shared_threads_makred` is equal to `avaiable_threads` schedule sweep task diff --git a/docs/application/testing.md b/docs/application/testing.md index 6e85c6f..2964fae 100644 --- a/docs/application/testing.md +++ b/docs/application/testing.md @@ -19,7 +19,7 @@ FAIL(FAIL_STRING) ```c typedef struct { const char *name; - kpl_error error; + kpl_error *error; } kpl_test; // TODO STORE ERRORS FOR PRINT AT END @@ -29,7 +29,7 @@ typedef struct { #define TEST(NAME) \ _TEST_FN(NAME); \ static void __attribute__((constructor)) _kpl_test_constructor_##NAME(void) { \ - kpl_test _test = { .name = #NAME; .error = nullptr }; \ + kpl_test _test = { .name = #NAME; .error = NULL }; \ kpl_test_fn_##NAME(&test); \ if (_test.error) { \ /* TODO STORE ERROR */ \ diff --git a/docs/application/thread.md b/docs/application/thread.md index d564d20..7ed5cae 100644 --- a/docs/application/thread.md +++ b/docs/application/thread.md @@ -16,7 +16,8 @@ typedef struct _task { kpl_class state[KPL_TASK_STATE_SIZE]; kpl_result result; task_fn *fn; - int32_t thread_id; + uint32_t io_flags; + int32_t io_res, thread_id; int16_t state_length; _Atomic bool join_ready; } task; diff --git a/docs/type_system/empty.md b/docs/type_system/empty.md index 7997901..2fae1e7 100644 --- a/docs/type_system/empty.md +++ b/docs/type_system/empty.md @@ -13,14 +13,14 @@ Container type can be null ```text make_array : ([yes] ? yes { - `some Array $ (1; 2; 3) - `nome + `value Array $ (1; 2; 3) + `null } ) -v : make_array(...) // %empty Array[I64] $ .none OR %empty Array[I64] $ (.some : (1; 2; 3)) +v : make_array(...) // %empty Array[I64] $ .null OR %empty Array[I64] $ (.value : (1; 2; 3)) # v { - .some {[x] `log x } // Array[I64] $ (1; 2; 3) - .none { ... } + .value {[x] `log x } // Array[I64] $ (1; 2; 3) + .null { ... } } // same as above ? v {[x] `log x } // Array[I64] $ (1; 2; 3) diff --git a/docs/type_system/union.md b/docs/type_system/union.md index adaed4e..2572591 100644 --- a/docs/type_system/union.md +++ b/docs/type_system/union.md @@ -3,7 +3,7 @@ --- ```text -Union[CONTAINER | TRANSIENT] Collection[VAR_TREE_LIST; TYPE.SYMBOL]] +Union[CONTAINER | TRANSIENT | TRANSIENT_GENERIC] Collection[VAR_TREE_LIST; TYPE.SYMBOL]] ``` ## Type Body Object Definitions @@ -42,15 +42,17 @@ Can only be retuned from functions and operations. The inner value must be moved ## Alias ```text +Transient_generic[Generic.T] `alias Union[[TRANSIENT_GENERIC] Generic.T.value] + Result[Generic.T] `alias Union[[TRANSIENT] Generic.T.value; Error.error] -Option[Generic.T] `alias Union[[TRANSIENT] Generic.T.some; Void.none] +Option[Generic.T] `alias Union[[TRANSIENT] Generic.T.value; Void.null] -Next[Generic.T] `alias Union[[TRANSIENT] Generic.T.iter; Void.done] +Next[Generic.T] `alias Union[[TRANSIENT] Generic.T.value; Void.done] Next_result[Generic.T] `alias Union[[TRANSIENT] Generic.T.value; Error.error; Void.done] -Next_option[Generic.T] `alias Union[[TRANSIENT] Generic.T.some; Void.none; Void.done] +Next_option[Generic.T] `alias Union[[TRANSIENT] Generic.T.value; Void.null; Void.done] ``` ## Default Operation @@ -69,6 +71,4 @@ z // is value if y is not zero ### \`error -### \`some - -### \`none +### \`null -- cgit v1.2.3