sym changes

This commit is contained in:
Richard Thier 2024-09-29 16:09:05 +02:00
parent 83f85858ca
commit 4b31e09cd7
2 changed files with 3 additions and 11 deletions

View File

@ -162,12 +162,6 @@ enum SLC_IO_OP {
};
typedef enum SLC_IO_OP SLC_IO_OP;
union symptr {
uint32_t *varp;
word *worp;
};
typedef union symptr symptr;
struct do_not_save_charptr {
char *ptr;
};
@ -189,7 +183,7 @@ typedef struct do_not_save_charptr do_not_save_charptr;
* @param ptr When adding a found word/variable to the symbol table, the key will point to this word* 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 symptr (*sym)(SLC_SYM_OP op, do_not_save_charptr key, symptr ptr);
typedef void* (*sym)(SLC_SYM_OP op, do_not_save_charptr key, void *ptr);
/**
* Function-abstraction for an integer "stack".

6
main.c
View File

@ -6,7 +6,7 @@
#define SLC_DEBUG
#include "engine/slc.h"
symptr nopsym(SLC_SYM_OP op, do_not_save_charptr key, symptr ptr) {
void *nopsym(SLC_SYM_OP op, do_not_save_charptr key, void *ptr) {
if(op == SLC_SYM_ERASE) {
printf("SYM_ERASE\n");
} else {
@ -15,9 +15,7 @@ symptr nopsym(SLC_SYM_OP op, do_not_save_charptr key, symptr ptr) {
printf(" %s", key.ptr);
}
symptr ret;
ret.worp = NULL;
return ret;
return NULL;
// TODO: Create a "peasantly" symbol table where we have:
// - 32 previndex
// - 32 nextindex