emit/__emit: Check if the argument of instruction 'call' is a Pawn function
This commit is contained in:
parent
abe9c965dc
commit
912376b658
@ -406,9 +406,11 @@ typedef struct s_valuepair {
|
|||||||
#define teNUMBER 339 /* integer/rational number */
|
#define teNUMBER 339 /* integer/rational number */
|
||||||
#define teDATA 340 /* data (variable name or address) */
|
#define teDATA 340 /* data (variable name or address) */
|
||||||
#define teLOCAL 341 /* local variable (name or offset) */
|
#define teLOCAL 341 /* local variable (name or offset) */
|
||||||
|
#define teFUNCTN 342 /* Pawn function */
|
||||||
|
#define teNATIVE 343 /* native function */
|
||||||
/* for assigment to "lastst" only (see SC1.C) */
|
/* for assigment to "lastst" only (see SC1.C) */
|
||||||
#define tEXPR 342
|
#define tEXPR 344
|
||||||
#define tENDLESS 343 /* endless loop */
|
#define tENDLESS 345 /* endless loop */
|
||||||
|
|
||||||
/* (reversed) evaluation of staging buffer */
|
/* (reversed) evaluation of staging buffer */
|
||||||
#define sSTARTREORDER 0x01
|
#define sSTARTREORDER 0x01
|
||||||
|
@ -6182,12 +6182,23 @@ static void OPHANDLER_CALL emit_do_call(char *name)
|
|||||||
int tok;
|
int tok;
|
||||||
|
|
||||||
tok=lex(&val,&str);
|
tok=lex(&val,&str);
|
||||||
if (tok!=tSYMBOL)
|
if (tok!=tSYMBOL) {
|
||||||
emit_invalid_token(tSYMBOL,tok);
|
emit_invalid_token(tSYMBOL,tok);
|
||||||
|
return;
|
||||||
|
}
|
||||||
sym=findglb(str,sGLOBAL);
|
sym=findglb(str,sGLOBAL);
|
||||||
if (sym==NULL) {
|
if (sym==NULL) {
|
||||||
error(12); /* invalid function call */
|
error(17,str); /* undefined symbol */
|
||||||
} else {
|
return;
|
||||||
|
}
|
||||||
|
if (sym->ident!=iFUNCTN && sym->ident!=iREFFUNC && sym->ident!=iVARARGS) {
|
||||||
|
emit_invalid_token(teFUNCTN,(sym->ident==iCONSTEXPR) ? teNUMBER : teDATA);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ((sym->usage & uNATIVE)!=0) {
|
||||||
|
emit_invalid_token(teFUNCTN,teNATIVE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
stgwrite("\t");
|
stgwrite("\t");
|
||||||
stgwrite(name);
|
stgwrite(name);
|
||||||
stgwrite(" .");
|
stgwrite(" .");
|
||||||
@ -6196,7 +6207,6 @@ static void OPHANDLER_CALL emit_do_call(char *name)
|
|||||||
code_idx+=opcodes(1)+opargs(1);
|
code_idx+=opcodes(1)+opargs(1);
|
||||||
markusage(sym,uREAD);
|
markusage(sym,uREAD);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static EMIT_OPCODE emit_opcodelist[] = {
|
static EMIT_OPCODE emit_opcodelist[] = {
|
||||||
{ 0, NULL, emit_noop },
|
{ 0, NULL, emit_noop },
|
||||||
|
@ -2097,7 +2097,8 @@ char *sc_tokens[] = {
|
|||||||
"#tryinclude", "#undef", "#warning",
|
"#tryinclude", "#undef", "#warning",
|
||||||
";", ";", "-integer value-", "-rational value-", "-identifier-",
|
";", ";", "-integer value-", "-rational value-", "-identifier-",
|
||||||
"-label-", "-string-",
|
"-label-", "-string-",
|
||||||
"-numeric value-", "-data offset-", "-local variable-"
|
"-numeric value-", "-data offset-", "-local variable-", "-function-",
|
||||||
|
"-native function-"
|
||||||
};
|
};
|
||||||
|
|
||||||
SC_FUNC int lex(cell *lexvalue,char **lexsym)
|
SC_FUNC int lex(cell *lexvalue,char **lexsym)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user