From 52da08a6cddf67844658a9e3d7f2f8a6ce0e5398 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Sat, 2 Dec 2023 12:17:51 +0100 Subject: [PATCH] WIP: symbol def --- include/ulas.h | 3 ++- src/ulas.c | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/ulas.h b/include/ulas.h index 6ca65e5..dcd60bf 100644 --- a/include/ulas.h +++ b/include/ulas.h @@ -418,7 +418,8 @@ struct ulas_sym *ulas_symbolresolve(const char *name, int *rc); // the function to auto-detect the scope // if a label starts with @ the current scope is used, otherwise 0 is used // if the symbol already exists -1 is returned -int ulas_symbolset(int scope, struct ulas_sym symbol); +int ulas_symbolset(const char *name, int scope, struct ulas_tok tok, + int constant); // tokenisze according to pre-defined rules // returns the amount of bytes of line that were diff --git a/src/ulas.c b/src/ulas.c index ad101e6..466409f 100644 --- a/src/ulas.c +++ b/src/ulas.c @@ -223,10 +223,10 @@ struct ulas_sym *ulas_symbolresolve(const char *name, int *rc) { return NULL; } -int ulas_symbolset(int scope, struct ulas_sym symbol) { +int ulas_symbolset(const char *name, int scope, struct ulas_tok tok, + int constant) { int rc = 0; int resolve_rc = 0; - const char *name = symbol.name; struct ulas_sym *exisitng = ulas_symbolresolve(name, &resolve_rc); // define new if (!exisitng) { @@ -1164,6 +1164,7 @@ struct ulas_sym *ulas_symbufget(struct ulas_symbuf *sb, int i) { void ulas_symbufclear(struct ulas_symbuf *sb) { for (long i = 0; i < sb->len; i++) { struct ulas_sym *s = &sb->buf[i]; + free(s->name); ulas_tokfree(&s->tok); } sb->len = 0; -- 2.30.2