struct ulas_sym *ulas_symbolresolve(const char *name, int *rc);
// define a new symbol
-// scope 0 indicates global scope
+// scope 0 indicates global scope. a scope of -1 instructs
+// 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(const char *name, int scope, struct ulas_tok token);
+int ulas_symbolset(int scope, struct ulas_sym symbol);
// tokenisze according to pre-defined rules
// returns the amount of bytes of line that were
return NULL;
}
-int ulas_symbolset(const char *name, int scope, struct ulas_tok token) {
+int ulas_symbolset(int scope, struct ulas_sym symbol) {
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) {
ulas_asmlst(start, outbuf, towrite);
return 0;
}
- // ulas_symbolset(ulas.tok.buf, ulas.scope,
+ // ulas_symbolset(ulas.tok.buf, -1,
line = prev;
} else {
// start over for the next step...