diff options
Diffstat (limited to 'include/kpl/value.h')
| -rw-r--r-- | include/kpl/value.h | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/include/kpl/value.h b/include/kpl/value.h deleted file mode 100644 index d6120ee..0000000 --- a/include/kpl/value.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * KPL value definitions - */ - -#pragma once - -/* - * Enum values need to fit within in 3 bits - */ -typedef enum : uint8_t { - KPL_VALUE_BIT_WIDTH8 = 1, - KPL_VALUE_BIT_WIDTH16 = 2, - KPL_VALUE_BIT_WIDTH32 = 3, - KPL_VALUE_BIT_WIDTH64 = 4 -} kpl_value_bit_width; - -#define _KPL_VALUE8 \ - uint8_t u8; \ - int8_t i8 - -typedef union { - _KPL_VALUE8; -} kpl_value8; - -#define _KPL_VALUE16 \ - uint16_t u16; \ - int16_t i16 - -typedef union { - _KPL_VALUE8; - _KPL_VALUE16; -} kpl_value16; - -typedef uint8_t kpl_utf8[4]; - -#define _KPL_VALUE32 \ - kpl_utf8 utf8; \ - uint32_t u32; \ - int32_t i32; \ - float f32 - -typedef union { - _KPL_VALUE8; - _KPL_VALUE16; - _KPL_VALUE32; -} kpl_value32; - -typedef union { - _KPL_VALUE8; - _KPL_VALUE16; - _KPL_VALUE32; - uint64_t u64; - int64_t i64; - double f64; - void *ptr; -} kpl_value64; - -#define KPL_VALUE64_EMPTY ((kpl_value64) { .ptr = NULL }) - -typedef struct { - kpl_value64 value; - int64_t tag; -} kpl_result; - -#define KPL_RESULT_EMPTY ((kpl_result) { .value = KPL_VALUE64_EMPTY, .tag = 0 }) - -typedef struct { - void *async, *sync; -} kpl_function; - -/* - * Must match the type of c main return - * if code != KPL_EXIT_CODE_SUCCESS then return code - */ -typedef enum : int32_t { - KPL_EXIT_CODE_SUCCESS, - KPL_EXIT_CODE_ERROR, - KPL_EXIT_CODE_HELP, - KPL_EXIT_CODE_MEMORY_ERROR, - KPL_EXIT_CODE_IO_ERROR, - KPL_EXIT_CODE_THREAD_ERROR, - KPL_EXIT_CODE_GC_ERROR -} kpl_exit_code; |
