From d53ce4e17d89742fde82700fcbd86d28116e0e81 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Sat, 2 Dec 2023 07:17:09 +0100 Subject: [PATCH] WIP: added const flag to symbols --- include/ulas.h | 3 ++- src/ulas.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/ulas.h b/include/ulas.h index 4dd9166..83d9028 100644 --- a/include/ulas.h +++ b/include/ulas.h @@ -173,6 +173,7 @@ struct ulas_sym { // last pass this was defined in... // a symbol may only be defined once per pass/scope enum ulas_pass lastdefin; + int constant; }; // holds all currently defned symbols @@ -415,7 +416,7 @@ struct ulas_sym *ulas_symbolresolve(const char *name, int *rc); // define a new symbol // scope 0 indicates global scope // if the symbol already exists -1 is returned -int ulas_symboldef(const char *name, int scope, struct ulas_tok token); +int ulas_symbolset(const char *name, int scope, struct ulas_tok token); // 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 4f4b394..c2d79cf 100644 --- a/src/ulas.c +++ b/src/ulas.c @@ -223,7 +223,7 @@ struct ulas_sym *ulas_symbolresolve(const char *name, int *rc) { return NULL; } -int ulas_symboldef(const char *name, int scope, struct ulas_tok token) { +int ulas_symbolset(const char *name, int scope, struct ulas_tok token) { int rc = 0; int resolve_rc = 0; struct ulas_sym *exisitng = ulas_symbolresolve(name, &resolve_rc); @@ -2059,6 +2059,7 @@ int ulas_asmline(FILE *dst, FILE *src, const char *line, unsigned long n) { ulas_asmlst(start, outbuf, towrite); return 0; } + // ulas_symbolset(ulas.tok.buf, ulas.scope, line = prev; } else { // start over for the next step... -- 2.30.2