diff --git a/engine/slc.h b/engine/slc.h index a5ddbd8..7a6e8c8 100644 --- a/engine/slc.h +++ b/engine/slc.h @@ -107,6 +107,12 @@ enum SLC_IO_OP { }; typedef enum SLC_IO_OP SLC_IO_OP; +union symptr { + uint32_t *varp; + wordstart *worp; +}; +typedef union symptr symptr; + /** * Function-abstraction for a "symbol-table". * @@ -123,8 +129,7 @@ typedef enum SLC_IO_OP SLC_IO_OP; * @param ptr When adding a found word/variable to the symbol table, the key will point to this wordstart* or uint32_t* * @returns The word/var definition stored for the key, or NULL when it is not stored yet or op is SET and there was an error. */ -typedef void* (*sym)(SLC_SYM_OP op, char *key, void *ptr); -// TODO: union for this? +typedef symptr (*sym)(SLC_SYM_OP op, char *key, symptr ptr); /** * Function-abstraction for an integer "stack". @@ -161,6 +166,14 @@ typedef uint32_t (*stack)(SLC_STACK_OP op, uint32_t param); */ typedef uint32_t (*session)(SLC_SESSION_OP op, uint32_t i, uint32_t j); +union iores { + /** Either the cmd result or the handle pointer*/ + const char *ptr; + /** The read character */ + char c; +}; +typedef union iores iores; + /** * Function-abstraction for io connectors. * @@ -180,8 +193,7 @@ typedef uint32_t (*session)(SLC_SESSION_OP op, uint32_t i, uint32_t j); * @param param The name or temporary name or command or the handle pointer parameter depending on op. * @returns A handle pointer or pointer to character to read / written or closed/unlocked handle (NULL on errors). Also cmd stdout. */ -typedef const char* (*ioconn)(SLC_IO_OP op, const char *param); -// TODO: union for this? +typedef iores (*ioconn)(SLC_IO_OP op, const char *param); /** * Function-abstraction for reading the source code byte-by-byte.