emit: Allow the use of labels in arguments of type 'any'
This commit is contained in:
parent
bc76324d03
commit
a19b740a28
@ -478,6 +478,7 @@ typedef enum s_optmark {
|
||||
|
||||
#define eotNUMBER 0
|
||||
#define eotFUNCTION 1
|
||||
#define eotLABEL 2
|
||||
typedef struct s_emit_outval {
|
||||
int type;
|
||||
union {
|
||||
|
@ -5981,10 +5981,12 @@ fetchtok:
|
||||
break;
|
||||
} /* if */
|
||||
if (sym->ident==iLABEL) {
|
||||
tok=tLABEL;
|
||||
goto invalid_token;
|
||||
} /* if */
|
||||
if (sym->ident==iFUNCTN || sym->ident==iREFFUNC) {
|
||||
if (neg!=FALSE)
|
||||
goto invalid_token_neg;
|
||||
sym->usage|=uREAD;
|
||||
p->type=eotLABEL;
|
||||
p->value.ucell=(ucell)sym->addr;
|
||||
} else if (sym->ident==iFUNCTN || sym->ident==iREFFUNC) {
|
||||
if (neg!=FALSE)
|
||||
goto invalid_token_neg;
|
||||
if ((sym->usage & uNATIVE)!=0 && (sym->usage & uREAD)==0 && sym->addr>=0)
|
||||
@ -6024,7 +6026,6 @@ fetchtok:
|
||||
break;
|
||||
} /* if */
|
||||
default:
|
||||
invalid_token:
|
||||
emit_invalid_token(teNUMERIC,tok);
|
||||
} /* switch */
|
||||
}
|
||||
|
@ -1390,6 +1390,9 @@ SC_FUNC void outinstr(const char *name, emit_outval params[],int numparams)
|
||||
stgwrite(" ");
|
||||
switch (params[i].type)
|
||||
{
|
||||
case eotLABEL:
|
||||
stgwrite("l.");
|
||||
/* fallthrough */
|
||||
case eotNUMBER:
|
||||
stgwrite(itoh(params[i].value.ucell));
|
||||
break;
|
||||
|
@ -102,7 +102,7 @@ static ucell getparam(const char *s,char **n)
|
||||
char name[sNAMEMAX+1];
|
||||
symbol *sym;
|
||||
|
||||
if (*s=='.') {
|
||||
if (s[0]=='.') {
|
||||
/* this is a function, find it in the global symbol table */
|
||||
for (i=0; !isspace(*(++s)); i++) {
|
||||
assert(*s!='\0');
|
||||
@ -115,6 +115,12 @@ static ucell getparam(const char *s,char **n)
|
||||
assert(sym->ident==iFUNCTN || sym->ident==iREFFUNC);
|
||||
assert(sym->vclass==sGLOBAL);
|
||||
result=sym->addr;
|
||||
} else if (s[0]=='l' && s[1]=='.') {
|
||||
/* this is a label */
|
||||
i=(int)hex2long(s+2,NULL);
|
||||
assert(i>=0 && i<sc_labnum);
|
||||
assert(lbltab!=NULL);
|
||||
result=lbltab[i];
|
||||
} else {
|
||||
for ( ;; ) {
|
||||
result+=hex2long(s,(char**)&s);
|
||||
|
Loading…
x
Reference in New Issue
Block a user