mirror of
https://github.com/alliedmodders/sourcemod.git
synced 2025-12-07 02:18:35 +00:00
Initial prototype.
This commit is contained in:
parent
00c09584c7
commit
e3ddef8916
@ -237,7 +237,7 @@ typedef struct s_symbol {
|
||||
|
||||
#define sSTATEVAR 3 /* criterion to find variables (sSTATEVAR implies a global variable) */
|
||||
|
||||
typedef struct s_value {
|
||||
typedef struct value_s {
|
||||
symbol *sym; /* symbol in symbol table, NULL for (constant) expression */
|
||||
cell constval; /* value of the constant expression (if ident==iCONSTEXPR)
|
||||
* also used for the size of a literal array */
|
||||
@ -249,6 +249,12 @@ typedef struct s_value {
|
||||
cell *arrayidx; /* last used array indices, for checking self assignment */
|
||||
} value;
|
||||
|
||||
/* Wrapper around value + l/rvalue bit. */
|
||||
typedef struct svalue_s {
|
||||
value val;
|
||||
int lvalue;
|
||||
} svalue;
|
||||
|
||||
/* "while" statement queue (also used for "for" and "do - while" loops) */
|
||||
enum {
|
||||
wqBRK, /* used to restore stack for "break" */
|
||||
@ -293,7 +299,7 @@ typedef struct s_stringpair {
|
||||
*/
|
||||
#define tFIRST 256 /* value of first multi-character operator */
|
||||
#define tMIDDLE 280 /* value of last multi-character operator */
|
||||
#define tLAST 332 /* value of last multi-character match-able token */
|
||||
#define tLAST 333 /* value of last multi-character match-able token */
|
||||
/* multi-character operators */
|
||||
#define taMULT 256 /* *= */
|
||||
#define taDIV 257 /* /= */
|
||||
@ -342,50 +348,51 @@ typedef struct s_stringpair {
|
||||
#define tFUNCTAG 299
|
||||
#define tGOTO 300
|
||||
#define tIF 301
|
||||
#define tNATIVE 302
|
||||
#define tNEW 303
|
||||
#define tDECL 304
|
||||
#define tOPERATOR 305
|
||||
#define tPUBLIC 306
|
||||
#define tRETURN 307
|
||||
#define tSIZEOF 308
|
||||
#define tSLEEP 309
|
||||
#define tSTATIC 310
|
||||
#define tSTOCK 311
|
||||
#define tSTRUCT 312
|
||||
#define tSWITCH 313
|
||||
#define tTAGOF 314
|
||||
#define tTHEN 315
|
||||
#define tWHILE 316
|
||||
#define tMETHODMAP 302
|
||||
#define tNATIVE 303
|
||||
#define tNEW 304
|
||||
#define tDECL 305
|
||||
#define tOPERATOR 306
|
||||
#define tPUBLIC 307
|
||||
#define tRETURN 308
|
||||
#define tSIZEOF 309
|
||||
#define tSLEEP 310
|
||||
#define tSTATIC 311
|
||||
#define tSTOCK 312
|
||||
#define tSTRUCT 313
|
||||
#define tSWITCH 314
|
||||
#define tTAGOF 315
|
||||
#define tTHEN 316
|
||||
#define tWHILE 317
|
||||
/* compiler directives */
|
||||
#define tpASSERT 317 /* #assert */
|
||||
#define tpDEFINE 318
|
||||
#define tpELSE 319 /* #else */
|
||||
#define tpELSEIF 320 /* #elseif */
|
||||
#define tpEMIT 321
|
||||
#define tpENDIF 322
|
||||
#define tpENDINPUT 323
|
||||
#define tpENDSCRPT 324
|
||||
#define tpERROR 325
|
||||
#define tpFILE 326
|
||||
#define tpIF 327 /* #if */
|
||||
#define tINCLUDE 328
|
||||
#define tpLINE 329
|
||||
#define tpPRAGMA 330
|
||||
#define tpTRYINCLUDE 331
|
||||
#define tpUNDEF 332
|
||||
#define tpASSERT 318 /* #assert */
|
||||
#define tpDEFINE 319
|
||||
#define tpELSE 320 /* #else */
|
||||
#define tpELSEIF 321 /* #elseif */
|
||||
#define tpEMIT 322
|
||||
#define tpENDIF 323
|
||||
#define tpENDINPUT 324
|
||||
#define tpENDSCRPT 325
|
||||
#define tpERROR 326
|
||||
#define tpFILE 327
|
||||
#define tpIF 328 /* #if */
|
||||
#define tINCLUDE 329
|
||||
#define tpLINE 330
|
||||
#define tpPRAGMA 331
|
||||
#define tpTRYINCLUDE 332
|
||||
#define tpUNDEF 333
|
||||
/* semicolon is a special case, because it can be optional */
|
||||
#define tTERM 333 /* semicolon or newline */
|
||||
#define tENDEXPR 334 /* forced end of expression */
|
||||
#define tTERM 334 /* semicolon or newline */
|
||||
#define tENDEXPR 335 /* forced end of expression */
|
||||
/* other recognized tokens */
|
||||
#define tNUMBER 335 /* integer number */
|
||||
#define tRATIONAL 336 /* rational number */
|
||||
#define tSYMBOL 337
|
||||
#define tLABEL 338
|
||||
#define tSTRING 339
|
||||
#define tEXPR 341 /* for assigment to "lastst" only (see SC1.C) */
|
||||
#define tENDLESS 342 /* endless loop, for assigment to "lastst" only */
|
||||
#define tEMPTYBLOCK 343 /* empty blocks for AM bug 4825 */
|
||||
#define tNUMBER 336 /* integer number */
|
||||
#define tRATIONAL 337 /* rational number */
|
||||
#define tSYMBOL 338
|
||||
#define tLABEL 339
|
||||
#define tSTRING 340
|
||||
#define tEXPR 342 /* for assigment to "lastst" only (see SC1.C) */
|
||||
#define tENDLESS 343 /* endless loop, for assigment to "lastst" only */
|
||||
#define tEMPTYBLOCK 344 /* empty blocks for AM bug 4825 */
|
||||
|
||||
/* (reversed) evaluation of staging buffer */
|
||||
#define sSTARTREORDER 0x01
|
||||
@ -467,8 +474,10 @@ typedef enum s_optmark {
|
||||
int pc_compile(int argc, char **argv);
|
||||
int pc_addconstant(char *name,cell value,int tag);
|
||||
int pc_addtag(char *name);
|
||||
int pc_findtag(const char *name);
|
||||
int pc_addfunctag(char *name);
|
||||
int pc_enablewarning(int number,int enable);
|
||||
const char *pc_tagname(int tag);
|
||||
|
||||
/*
|
||||
* Functions called from the compiler (to be implemented by you)
|
||||
@ -570,8 +579,7 @@ SC_FUNC symbol *findglb(const char *name,int filter);
|
||||
SC_FUNC symbol *findloc(const char *name);
|
||||
SC_FUNC symbol *findconst(const char *name,int *matchtag);
|
||||
SC_FUNC symbol *finddepend(const symbol *parent);
|
||||
SC_FUNC symbol *addsym(const char *name,cell addr,int ident,int vclass,int tag,
|
||||
int usage);
|
||||
SC_FUNC symbol *addsym(const char *name,cell addr,int ident,int vclass,int tag, int usage);
|
||||
SC_FUNC symbol *addvariable(const char *name,cell addr,int ident,int vclass,int tag,
|
||||
int dim[],int numdim,int idxtag[]);
|
||||
SC_FUNC symbol *addvariable2(const char *name,cell addr,int ident,int vclass,int tag,
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* vim: set sts=2 ts=8 sw=2 tw=99 et: */
|
||||
/* Pawn compiler
|
||||
*
|
||||
* Function and variable definition and declaration, statement parser.
|
||||
@ -107,7 +108,7 @@ static cell initvector(int ident,int tag,cell size,int fillzero,
|
||||
static cell init(int ident,int *tag,int *errorfound);
|
||||
static int getstates(const char *funcname);
|
||||
static void attachstatelist(symbol *sym, int state_id);
|
||||
static void funcstub(int fnative);
|
||||
static symbol *funcstub(int fnative);
|
||||
static int newfunc(char *firstname,int firsttag,int fpublic,int fstatic,int stock);
|
||||
static int declargs(symbol *sym,int chkshadow);
|
||||
static void doarg(char *name,int ident,int offset,int tags[],int numtags,
|
||||
@ -137,6 +138,7 @@ static void dogoto(void);
|
||||
static void dolabel(void);
|
||||
static void doreturn(void);
|
||||
static void dofuncenum(int listmode);
|
||||
static void domethodmap();
|
||||
static void dobreak(void);
|
||||
static void docont(void);
|
||||
static void dosleep(void);
|
||||
@ -345,7 +347,8 @@ int pc_compile(int argc, char *argv[])
|
||||
#endif
|
||||
resetglobals();
|
||||
pstructs_free();
|
||||
funcenums_free();
|
||||
funcenums_free();
|
||||
methodmaps_free();
|
||||
sc_ctrlchar=sc_ctrlchar_org;
|
||||
sc_packstr=lcl_packstr;
|
||||
sc_needsemicolon=lcl_needsemicolon;
|
||||
@ -407,6 +410,7 @@ int pc_compile(int argc, char *argv[])
|
||||
reduce_referrers(&glbtab);
|
||||
delete_symbols(&glbtab,0,TRUE,FALSE);
|
||||
funcenums_free();
|
||||
methodmaps_free();
|
||||
pstructs_free();
|
||||
#if !defined NO_DEFINE
|
||||
delete_substtable();
|
||||
@ -529,6 +533,7 @@ cleanup:
|
||||
delete_sourcefiletable();
|
||||
delete_dbgstringtable();
|
||||
funcenums_free();
|
||||
methodmaps_free();
|
||||
pstructs_free();
|
||||
#if !defined NO_DEFINE
|
||||
delete_substtable();
|
||||
@ -628,6 +633,26 @@ static void inst_datetime_defines(void)
|
||||
insert_subst("__TIME__", ltime, 8);
|
||||
}
|
||||
|
||||
const char *pc_tagname(int tag)
|
||||
{
|
||||
constvalue *ptr=tagname_tab.next;
|
||||
for (; ptr; ptr=ptr->next) {
|
||||
if ((int)(ptr->value & TAGMASK) == (tag & TAGMASK))
|
||||
return ptr->name;
|
||||
}
|
||||
return "<unknown>";
|
||||
}
|
||||
|
||||
int pc_findtag(const char *name)
|
||||
{
|
||||
constvalue *ptr=tagname_tab.next;
|
||||
for (; ptr; ptr=ptr->next) {
|
||||
if (strcmp(name,ptr->name)==0)
|
||||
return (int)(ptr->value & TAGMASK);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if defined __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
@ -1488,6 +1513,9 @@ static void parse(void)
|
||||
case tFUNCENUM:
|
||||
dofuncenum(TRUE);
|
||||
break;
|
||||
case tMETHODMAP:
|
||||
domethodmap();
|
||||
break;
|
||||
case tFUNCTAG:
|
||||
dofuncenum(FALSE);
|
||||
break;
|
||||
@ -3209,6 +3237,122 @@ static void declstruct(void)
|
||||
matchtoken(';'); /* eat up optional semicolon */
|
||||
}
|
||||
|
||||
/**
|
||||
* domethodmap - declare a method map for OO-ish syntax.
|
||||
*
|
||||
* methodmap ::= "methodmap" symbol ("<" symbol)? "{" methodmap-body? "}"
|
||||
* methodmap-body ::= symbol "=" methodmap-method term (, methodmap-body)*
|
||||
* methodmap-method ::= native-decl|symbol
|
||||
*/
|
||||
static void domethodmap()
|
||||
{
|
||||
int val;
|
||||
char *str;
|
||||
char mapname[sNAMEMAX + 1];
|
||||
methodmap_t *map;
|
||||
methodmap_t *parent = NULL;
|
||||
|
||||
// Get the tag.
|
||||
if (lex(&val, &str) != tSYMBOL)
|
||||
error(93);
|
||||
strcpy(mapname, str);
|
||||
|
||||
int maptag = pc_addtag(mapname);
|
||||
if (methodmap_find_by_tag(maptag))
|
||||
error(103, mapname);
|
||||
|
||||
int extends = matchtoken('<');
|
||||
if (extends) {
|
||||
if (lex(&val, &str) != tSYMBOL) {
|
||||
error(93);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((parent = methodmap_find_by_name(str)) == NULL) {
|
||||
error(102, str);
|
||||
}
|
||||
}
|
||||
|
||||
map = (methodmap_t *)calloc(1, sizeof(methodmap_t));
|
||||
map->parent = parent;
|
||||
map->tag = maptag;
|
||||
strcpy(map->name, mapname);
|
||||
|
||||
methodmap_add(map);
|
||||
|
||||
needtoken('{');
|
||||
while (!matchtoken('}')) {
|
||||
int tok;
|
||||
symbol *target;
|
||||
const arginfo *first_arg;
|
||||
char ident[sNAMEMAX + 1];
|
||||
methodmap_method_t *method;
|
||||
methodmap_method_t **methods;
|
||||
|
||||
tok = lex(&val, &str);
|
||||
if (tok != tSYMBOL) {
|
||||
// Error, and if EOF, return.
|
||||
error(93);
|
||||
if (tok == 0)
|
||||
return;
|
||||
}
|
||||
strcpy(ident, str);
|
||||
|
||||
needtoken('=');
|
||||
|
||||
tok = lex(&val, &str);
|
||||
if (tok == tNATIVE) {
|
||||
if ((target = funcstub(TRUE)) == NULL)
|
||||
return;
|
||||
} else if (tok == tSYMBOL) {
|
||||
target = findglb(str, sGLOBAL);
|
||||
if (!target)
|
||||
error(17, str);
|
||||
else if (target->ident != iFUNCTN)
|
||||
error(10);
|
||||
} else {
|
||||
error(10);
|
||||
}
|
||||
|
||||
if (!target || target->ident != iFUNCTN) {
|
||||
matchtoken(';');
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check the implicit this parameter. Currently we only allow scalars. As
|
||||
// to not encourage enum-structs, we will not allow those either.
|
||||
first_arg = &target->dim.arglist[0];
|
||||
if (first_arg->ident == 0 ||
|
||||
first_arg->ident != iVARIABLE ||
|
||||
(first_arg->usage & uCONST) ||
|
||||
first_arg->hasdefault ||
|
||||
first_arg->numtags != 1 ||
|
||||
first_arg->tags[0] != map->tag)
|
||||
{
|
||||
error(108, mapname);
|
||||
}
|
||||
|
||||
methods = (methodmap_method_t **)realloc(map->methods, sizeof(methodmap_method_t *) * map->nummethods);
|
||||
if (!methods) {
|
||||
error(123);
|
||||
return;
|
||||
}
|
||||
map->methods = methods;
|
||||
|
||||
method = (methodmap_method_t *)calloc(1, sizeof(methodmap_method_t));
|
||||
if (!method) {
|
||||
error(123);
|
||||
return;
|
||||
}
|
||||
map->methods[map->nummethods++] = method;
|
||||
|
||||
strcpy(method->name, ident);
|
||||
method->target = target;
|
||||
|
||||
matchtoken(';');
|
||||
}
|
||||
matchtoken(';');
|
||||
}
|
||||
|
||||
/**
|
||||
* dofuncenum - declare function enumerations
|
||||
@ -3997,7 +4141,7 @@ SC_FUNC char *funcdisplayname(char *dest,char *funcname)
|
||||
return dest;
|
||||
}
|
||||
|
||||
static void funcstub(int fnative)
|
||||
static symbol *funcstub(int fnative)
|
||||
{
|
||||
int tok,tag,fpublic;
|
||||
char *str;
|
||||
@ -4022,7 +4166,7 @@ static void funcstub(int fnative)
|
||||
*/
|
||||
if (numdim == sDIMEN_MAX) {
|
||||
error(53); /* exceeding maximum number of dimensions */
|
||||
return;
|
||||
return NULL;
|
||||
} /* if */
|
||||
size=needsub(&idxtag[numdim],NULL); /* get size; size==0 for "var[]" */
|
||||
if (size==0)
|
||||
@ -4050,12 +4194,12 @@ static void funcstub(int fnative)
|
||||
if (tok==tOPERATOR) {
|
||||
opertok=operatorname(symbolname);
|
||||
if (opertok==0)
|
||||
return; /* error message already given */
|
||||
return NULL; /* error message already given */
|
||||
check_operatortag(opertok,tag,symbolname);
|
||||
} else {
|
||||
if (tok!=tSYMBOL && freading) {
|
||||
error(10); /* illegal function or declaration */
|
||||
return;
|
||||
return NULL;
|
||||
} /* if */
|
||||
strcpy(symbolname,str);
|
||||
} /* if */
|
||||
@ -4063,7 +4207,7 @@ static void funcstub(int fnative)
|
||||
|
||||
sym=fetchfunc(symbolname,tag);/* get a pointer to the function entry */
|
||||
if (sym==NULL)
|
||||
return;
|
||||
return NULL;
|
||||
if (fnative) {
|
||||
sym->usage=(char)(uNATIVE | uRETVALUE | uDEFINE | (sym->usage & uPROTOTYPED));
|
||||
sym->x.lib=curlibrary;
|
||||
@ -4122,6 +4266,8 @@ static void funcstub(int fnative)
|
||||
|
||||
litidx=0; /* clear the literal pool */
|
||||
delete_symbols(&loctab,0,TRUE,TRUE);/* clear local variables queue */
|
||||
|
||||
return sym;
|
||||
}
|
||||
|
||||
/* newfunc - begin a function
|
||||
|
||||
@ -1928,7 +1928,7 @@ char *sc_tokens[] = {
|
||||
"...", "..", "::",
|
||||
"assert", "*begin", "break", "case", "cellsof", "chars", "const", "continue", "default",
|
||||
"defined", "do", "else", "*end", "enum", "exit", "for", "forward", "funcenum", "functag", "goto",
|
||||
"if", "native", "new", "decl", "operator", "public", "return", "sizeof",
|
||||
"if", "methodmap", "native", "new", "decl", "operator", "public", "return", "sizeof",
|
||||
"sleep", "static", "stock", "struct", "switch", "tagof", "*then", "while",
|
||||
"#assert", "#define", "#else", "#elseif", "#emit", "#endif", "#endinput",
|
||||
"#endscript", "#error", "#file", "#if", "#include", "#line", "#pragma",
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* vim: set ts=8 sts=2 sw=2 tw=99 et: */
|
||||
/* Pawn compiler - Recursive descend expresion parser
|
||||
*
|
||||
* Copyright (c) ITB CompuPhase, 1997-2005
|
||||
@ -56,7 +57,7 @@ static int hier2(value *lval);
|
||||
static int hier1(value *lval1);
|
||||
static int primary(value *lval);
|
||||
static void clear_value(value *lval);
|
||||
static void callfunction(symbol *sym,value *lval_result,int matchparanthesis);
|
||||
static void callfunction(symbol *sym, const svalue *implicitthis, value *lval_result, int matchparanthesis);
|
||||
static int dbltest(void (*oper)(),value *lval1,value *lval2);
|
||||
static int commutative(void (*oper)());
|
||||
static int constant(value *lval);
|
||||
@ -291,7 +292,7 @@ SC_FUNC int checktags_string(int tags[], int numtags, value *sym1)
|
||||
}
|
||||
for (i=0; i<numtags; i++) {
|
||||
if ((sym1->tag == pc_tag_string && tags[i] == 0) ||
|
||||
(sym1->tag == 0 && tags[i] == pc_tag_string))
|
||||
(sym1->tag == 0 && tags[i] == pc_tag_string))
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
@ -299,13 +300,13 @@ SC_FUNC int checktags_string(int tags[], int numtags, value *sym1)
|
||||
|
||||
SC_FUNC int checktag_string(value *sym1, value *sym2)
|
||||
{
|
||||
if (sym1->ident == iARRAY || sym2->ident == iARRAY
|
||||
|| sym1->ident == iREFARRAY || sym2->ident == iREFARRAY)
|
||||
if (sym1->ident == iARRAY || sym2->ident == iARRAY ||
|
||||
sym1->ident == iREFARRAY || sym2->ident == iREFARRAY)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if ((sym1->tag == pc_tag_string && sym2->tag == 0)
|
||||
|| (sym1->tag == 0 && sym2->tag == pc_tag_string))
|
||||
if ((sym1->tag == pc_tag_string && sym2->tag == 0) ||
|
||||
(sym1->tag == 0 && sym2->tag == pc_tag_string))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@ -1583,7 +1584,7 @@ static int hier2(value *lval)
|
||||
if (subsym!=NULL)
|
||||
subsym=finddepend(subsym);
|
||||
} /* for */
|
||||
if (level>sym->dim.array.level+1) {
|
||||
if (level>sym->dim.array.level+1) {
|
||||
error(28,sym->name); /* invalid subscript */
|
||||
} else if (level==sym->dim.array.level+1) {
|
||||
lval->constval=(idxsym!=NULL && idxsym->dim.array.length>0) ? idxsym->dim.array.length : 1;
|
||||
@ -1637,7 +1638,7 @@ static int hier2(value *lval)
|
||||
if (subsym!=NULL)
|
||||
subsym=finddepend(subsym);
|
||||
} /* for */
|
||||
if (level>sym->dim.array.level+1) {
|
||||
if (level>sym->dim.array.level+1) {
|
||||
error(28,sym->name); /* invalid subscript */
|
||||
} else if (level==sym->dim.array.level+1) {
|
||||
lval->constval= (idxsym!=NULL && idxsym->dim.array.length>0) ? idxsym->dim.array.length : 1;
|
||||
@ -1812,7 +1813,7 @@ static int hier1(value *lval1)
|
||||
cursym=lval1->sym;
|
||||
restart:
|
||||
sym=cursym;
|
||||
if (matchtoken('[') || matchtoken('{') || matchtoken('(')) {
|
||||
if (matchtoken('[') || matchtoken('{') || matchtoken('(') || matchtoken('.')) {
|
||||
tok=tokeninfo(&val,&st); /* get token read by matchtoken() */
|
||||
magic_string = (sym && (sym->tag == pc_tag_string && sym->dim.array.level == 0));
|
||||
if (sym==NULL && symtok!=tSYMBOL) {
|
||||
@ -1974,14 +1975,62 @@ restart:
|
||||
lval1->tag=sym->tag;
|
||||
lval1->constval=0;
|
||||
} /* if */
|
||||
|
||||
// If there's a call coming up, keep parsing.
|
||||
if (matchtoken('.')) {
|
||||
lexpush();
|
||||
goto restart;
|
||||
}
|
||||
|
||||
/* a cell in an array is an lvalue, a character in an array is not
|
||||
* always a *valid* lvalue */
|
||||
return TRUE;
|
||||
} else { /* tok=='(' -> function(...) */
|
||||
svalue thisval = {*lval1, lvalue};
|
||||
svalue *implicitthis = NULL;
|
||||
if (tok == '.') {
|
||||
methodmap_t *map;
|
||||
|
||||
/* Catch invalid calls early so we don't compile with a tag mismatch. */
|
||||
switch (thisval.val.ident) {
|
||||
case iARRAY:
|
||||
case iREFARRAY:
|
||||
error(106);
|
||||
break;
|
||||
|
||||
case iFUNCTN:
|
||||
case iREFFUNC:
|
||||
error(107);
|
||||
break;
|
||||
}
|
||||
|
||||
if ((map = methodmap_find_by_tag(thisval.val.tag)) == NULL)
|
||||
error(104, pc_tagname(thisval.val.tag));
|
||||
|
||||
if (needtoken(tSYMBOL) && map) {
|
||||
cell lexval;
|
||||
char *lexstr;
|
||||
methodmap_method_t *method;
|
||||
|
||||
tokeninfo(&lexval, &lexstr);
|
||||
if ((method = methodmap_find_method(map, lexstr)) == NULL)
|
||||
error(105, map->name, lexstr);
|
||||
if (method) {
|
||||
implicitthis = &thisval;
|
||||
sym = method->target;
|
||||
}
|
||||
}
|
||||
|
||||
// If we don't find a '(' next, just fail to compile for now -- and
|
||||
// don't even try to do a function call, just restart the parse loop.
|
||||
if (!needtoken('('))
|
||||
goto restart;
|
||||
|
||||
tok = '(';
|
||||
}
|
||||
|
||||
assert(tok=='(');
|
||||
if (sym==NULL
|
||||
|| (sym->ident!=iFUNCTN && sym->ident!=iREFFUNC))
|
||||
{
|
||||
if (sym==NULL || (sym->ident!=iFUNCTN && sym->ident!=iREFFUNC)) {
|
||||
if (sym==NULL && sc_status==statFIRST) {
|
||||
/* could be a "use before declaration"; in that case, create a stub
|
||||
* function so that the usage can be marked.
|
||||
@ -1998,14 +2047,14 @@ restart:
|
||||
funcdisplayname(symname,sym->name);
|
||||
error(4,symname); /* function not defined */
|
||||
} /* if */
|
||||
callfunction(sym,lval1,TRUE);
|
||||
callfunction(sym,implicitthis,lval1,TRUE);
|
||||
return FALSE; /* result of function call is no lvalue */
|
||||
} /* if */
|
||||
} /* if */
|
||||
if (sym!=NULL && lval1->ident==iFUNCTN) {
|
||||
assert(sym->ident==iFUNCTN);
|
||||
if (sc_allowproccall) {
|
||||
callfunction(sym,lval1,FALSE);
|
||||
callfunction(sym,NULL,lval1,FALSE);
|
||||
} else if ((sym->usage & uNATIVE) != uNATIVE) {
|
||||
symbol *oldsym=sym;
|
||||
int n=-1,iter=0;
|
||||
@ -2036,14 +2085,14 @@ restart:
|
||||
}
|
||||
lval1->tag=pc_addfunctag(faketag);
|
||||
oldsym->usage |= uREAD;
|
||||
sym->usage |= uREAD;
|
||||
sym->usage |= uREAD;
|
||||
} else {
|
||||
error(76); /* invalid function call, or syntax error */
|
||||
} /* if */
|
||||
return FALSE;
|
||||
} else {
|
||||
error(76); /* invalid function call, or syntax error */
|
||||
}
|
||||
} else {
|
||||
error(76); /* invalid function call, or syntax error */
|
||||
}
|
||||
} /* if */
|
||||
return lvalue;
|
||||
}
|
||||
@ -2243,7 +2292,7 @@ enum {
|
||||
* Generates code to call a function. This routine handles default arguments
|
||||
* and positional as well as named parameters.
|
||||
*/
|
||||
static void callfunction(symbol *sym,value *lval_result,int matchparanthesis)
|
||||
static void callfunction(symbol *sym, const svalue *implicitthis, value *lval_result, int matchparanthesis)
|
||||
{
|
||||
static long nest_stkusage=0L;
|
||||
static int nesting=0;
|
||||
@ -2261,6 +2310,7 @@ static int nesting=0;
|
||||
symbol *symret;
|
||||
cell lexval;
|
||||
char *lexstr;
|
||||
int pending_this = (implicitthis ? TRUE : FALSE);
|
||||
|
||||
assert(sym!=NULL);
|
||||
lval_result->ident=iEXPRESSION; /* preset, may be changed later */
|
||||
@ -2321,9 +2371,9 @@ static int nesting=0;
|
||||
lexpush(); /* reset the '.' */
|
||||
} /* if */
|
||||
} /* if */
|
||||
if (!close) {
|
||||
if (pending_this || !close) {
|
||||
do {
|
||||
if (matchtoken('.')) {
|
||||
if (!pending_this && matchtoken('.')) {
|
||||
namedparams=TRUE;
|
||||
if (needtoken(tSYMBOL))
|
||||
tokeninfo(&lexval,&lexstr);
|
||||
@ -2350,7 +2400,7 @@ static int nesting=0;
|
||||
stgmark((char)(sEXPRSTART+argpos));/* mark beginning of new expression in stage */
|
||||
if (arglist[argpos]!=ARG_UNHANDLED)
|
||||
error(58); /* argument already set */
|
||||
if (matchtoken('_')) {
|
||||
if (!pending_this && matchtoken('_')) {
|
||||
arglist[argpos]=ARG_IGNORED; /* flag argument as "present, but ignored" */
|
||||
if (arg[argidx].ident==0 || arg[argidx].ident==iVARARGS) {
|
||||
error(92); /* argument count mismatch */
|
||||
@ -2368,7 +2418,12 @@ static int nesting=0;
|
||||
arglist[argpos]=ARG_DONE; /* flag argument as "present" */
|
||||
if (arg[argidx].ident!=0 && arg[argidx].numtags==1) /* set the expected tag, if any */
|
||||
lval.cmptag=arg[argidx].tags[0];
|
||||
lvalue=hier14(&lval);
|
||||
if (pending_this) {
|
||||
lval = implicitthis->val;
|
||||
lvalue = implicitthis->lvalue;
|
||||
} else {
|
||||
lvalue = hier14(&lval);
|
||||
}
|
||||
assert(sc_status==statFIRST || arg[argidx].ident == 0 || arg[argidx].tags!=NULL);
|
||||
switch (arg[argidx].ident) {
|
||||
case 0:
|
||||
@ -2547,18 +2602,32 @@ static int nesting=0;
|
||||
} /* if */
|
||||
assert(arglist[argpos]!=ARG_UNHANDLED);
|
||||
nargs++;
|
||||
|
||||
/**
|
||||
* We can already have decided it was time to close because of pending_this.
|
||||
* If that's the case, then bail out now.
|
||||
*/
|
||||
if (pending_this && close) {
|
||||
pending_this = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (matchparanthesis) {
|
||||
close=matchtoken(')');
|
||||
if (!close) /* if not paranthese... */
|
||||
if (!needtoken(',')) /* ...should be comma... */
|
||||
/* Not expecting comma if the first argument was implicit. */
|
||||
if (!pending_this && !needtoken(','))
|
||||
break; /* ...but abort loop if neither */
|
||||
} else {
|
||||
close=!matchtoken(',');
|
||||
/* Not expecting comma if the first argument was implicit. */
|
||||
close = (!pending_this && !matchtoken(','));
|
||||
if (close) { /* if not comma... */
|
||||
if (needtoken(tTERM)==1)/* ...must be end of statement */
|
||||
lexpush(); /* push again, because end of statement is analised later */
|
||||
} /* if */
|
||||
} /* if */
|
||||
|
||||
pending_this = FALSE;
|
||||
} while (!close && freading && !matchtoken(tENDEXPR)); /* do */
|
||||
} /* if */
|
||||
/* check remaining function arguments (they may have default values) */
|
||||
@ -2797,7 +2866,7 @@ static int constant(value *lval)
|
||||
* value distinguishes between literal arrays
|
||||
* and literal strings (this was done for
|
||||
* array assignment). */
|
||||
lval->tag=pc_tag_string;
|
||||
lval->tag=pc_tag_string;
|
||||
} else if (tok=='{') {
|
||||
int tag,lasttag=-1;
|
||||
val=litidx;
|
||||
|
||||
@ -1,361 +1,385 @@
|
||||
/* Pawn compiler - Error message strings (plain and compressed formats)
|
||||
*
|
||||
* Copyright (c) ITB CompuPhase, 2000-2006
|
||||
*
|
||||
* This software is provided "as-is", without any express or implied warranty.
|
||||
* In no event will the authors be held liable for any damages arising from
|
||||
* the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software in
|
||||
* a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
SC_FUNC int strexpand(char *dest, unsigned char *source, int maxlen, unsigned char pairtable[128][2]);
|
||||
|
||||
#define SCPACK_TABLE errstr_table
|
||||
/*-*SCPACK start of pair table, do not change or remove this line */
|
||||
unsigned char errstr_table[][2] = {
|
||||
{101,32}, {111,110}, {116,32}, {105,110}, {97,114}, {115,32}, {116,105}, {100,32}, {101,114}, {37,115}, {101,110}, {134,129}, {34,137}, {140,34}, {97,108}, {117,110},
|
||||
{114,101}, {110,111}, {97,116}, {115,105}, {121,32}, {97,110}, {111,114}, {109,98}, {115,116}, {32,141}, {100,101}, {41,10}, {109,138}, {145,130}, {101,135}, {139,32},
|
||||
{98,108}, {111,108}, {114,97}, {143,99}, {118,142}, {102,163}, {115,121}, {166,151}, {167,161}, {97,32}, {117,115}, {103,32}, {115,147}, {132,162}, {97,160}, {136,32},
|
||||
{150,32}, {99,104}, {103,117}, {105,135}, {178,156}, {164,179}, {132,180}, {111,102}, {116,104}, {101,120}, {165,159}, {131,181}, {101,100}, {101,133}, {105,133}, {168,153},
|
||||
{154,102}, {118,132}, {183,32}, {105,174}, {193,195}, {116,111}, {173,148}, {109,97}, {99,129}, {101,10}, {115,10}, {112,144}, {116,97}, {182,130}, {98,128}, {152,146},
|
||||
{44,32}, {132,97}, {192,131}, {170,130}, {153,10}, {109,146}, {191,155}, {109,211}, {40,214}, {104,97}, {196,128}, {34,32}, {129,32}, {142,32}, {105,99}, {117,108},
|
||||
{99,111}, {147,122}, {110,32}, {100,105}, {101,108}, {108,111}, {111,112}, {116,136}, {200,152}, {131,32}, {149,32}, {131,171}, {213,177}, {58,212}, {109,101}, {102,105},
|
||||
{100,111}, {97,115}, {108,128}, {118,128}, {230,136}, {232,149}, {204,171}, {203,172}, {215,206}, {119,105}, {109,112}, {110,117}, {185,247}, {165,139}, {251,151}
|
||||
};
|
||||
/*-*SCPACK end of pair table, do not change or remove this line */
|
||||
|
||||
static char *errmsg[] = {
|
||||
#if 1
|
||||
/*001*/ "expected token: \"%s\", but found \"%s\"\n",
|
||||
/*002*/ "only a single statement (or expression) can follow each \"case\"\n",
|
||||
/*003*/ "declaration of a local variable must appear in a compound block\n",
|
||||
/*004*/ "function \"%s\" is not implemented\n",
|
||||
/*005*/ "function may not have arguments\n",
|
||||
/*006*/ "must be assigned to an array\n",
|
||||
/*007*/ "operator cannot be redefined\n",
|
||||
/*008*/ "must be a constant expression; assumed zero\n",
|
||||
/*009*/ "invalid array size (negative, zero or out of bounds)\n",
|
||||
/*010*/ "invalid function or declaration\n",
|
||||
/*011*/ "invalid outside functions\n",
|
||||
/*012*/ "invalid function call, not a valid address\n",
|
||||
/*013*/ "no entry point (no public functions)\n",
|
||||
/*014*/ "invalid statement; not in switch\n",
|
||||
/*015*/ "\"default\" case must be the last case in switch statement\n",
|
||||
/*016*/ "multiple defaults in \"switch\"\n",
|
||||
/*017*/ "undefined symbol \"%s\"\n",
|
||||
/*018*/ "initialization data exceeds declared size\n",
|
||||
/*019*/ "not a label: \"%s\"\n",
|
||||
/*020*/ "invalid symbol name \"%s\"\n",
|
||||
/*021*/ "symbol already defined: \"%s\"\n",
|
||||
/*022*/ "must be lvalue (non-constant)\n",
|
||||
/*023*/ "array assignment must be simple assignment\n",
|
||||
/*024*/ "\"break\" or \"continue\" is out of context\n",
|
||||
/*025*/ "function heading differs from prototype\n",
|
||||
/*026*/ "no matching \"#if...\"\n",
|
||||
/*027*/ "invalid character constant\n",
|
||||
/*028*/ "invalid subscript (not an array or too many subscripts): \"%s\"\n",
|
||||
/*029*/ "invalid expression, assumed zero\n",
|
||||
/*030*/ "compound statement not closed at the end of file (started at line %d)\n",
|
||||
/*031*/ "unknown directive\n",
|
||||
/*032*/ "array index out of bounds (variable \"%s\")\n",
|
||||
/*033*/ "array must be indexed (variable \"%s\")\n",
|
||||
/*034*/ "argument does not have a default value (argument %d)\n",
|
||||
/*035*/ "argument type mismatch (argument %d)\n",
|
||||
/*036*/ "empty statement\n",
|
||||
/*037*/ "invalid string (possibly non-terminated string)\n",
|
||||
/*038*/ "extra characters on line\n",
|
||||
/*039*/ "constant symbol has no size\n",
|
||||
/*040*/ "duplicate \"case\" label (value %d)\n",
|
||||
/*041*/ "invalid ellipsis, array size is not known\n",
|
||||
/*042*/ "invalid combination of class specifiers\n",
|
||||
/*043*/ "character constant exceeds range for packed string\n",
|
||||
/*044*/ "positional parameters must precede all named parameters\n",
|
||||
/*045*/ "too many function arguments\n",
|
||||
/*046*/ "unknown array size (variable \"%s\")\n",
|
||||
/*047*/ "array sizes do not match, or destination array is too small\n",
|
||||
/*048*/ "array (s do not match\n",
|
||||
/*049*/ "invalid line continuation\n",
|
||||
/*050*/ "invalid range\n",
|
||||
/*051*/ "invalid subscript, use \"[ ]\" operators on major dimensions\n",
|
||||
/*052*/ "multi-dimensional arrays must be fully initialized\n",
|
||||
/*053*/ "exceeding maximum number of dimensions\n",
|
||||
/*054*/ "unmatched closing brace (\"}\")\n",
|
||||
/*055*/ "start of function body without function header\n",
|
||||
/*056*/ "arrays, local variables and function arguments cannot be public (variable \"%s\")\n",
|
||||
/*057*/ "unfinished expression before compiler directive\n",
|
||||
/*058*/ "duplicate argument; same argument is passed twice\n",
|
||||
/*059*/ "function argument may not have a default value (variable \"%s\")\n",
|
||||
/*060*/ "multiple \"#else\" directives between \"#if ... #endif\"\n",
|
||||
/*061*/ "\"#elseif\" directive follows an \"#else\" directive\n",
|
||||
/*062*/ "number of operands does not fit the operator\n",
|
||||
/*063*/ "function result tag of operator \"%s\" must be \"%s\"\n",
|
||||
/*064*/ "cannot change predefined operators\n",
|
||||
/*065*/ "function argument may only have a single tag (argument %d)\n",
|
||||
/*066*/ "function argument may not be a reference argument or an array (argument \"%s\")\n",
|
||||
/*067*/ "variable cannot be both a reference and an array (variable \"%s\")\n",
|
||||
/*068*/ "invalid rational number precision in #pragma\n",
|
||||
/*069*/ "rational number format already defined\n",
|
||||
/*070*/ "rational number support was not enabled\n",
|
||||
/*071*/ "user-defined operator must be declared before use (function \"%s\")\n",
|
||||
/*072*/ "\"sizeof\" operator is invalid on \"function\" symbols\n",
|
||||
/*073*/ "function argument must be an array (argument \"%s\")\n",
|
||||
/*074*/ "#define pattern must start with an alphabetic character\n",
|
||||
/*075*/ "input line too long (after substitutions)\n",
|
||||
/*076*/ "syntax error in the expression, or invalid function call\n",
|
||||
/*077*/ "malformed UTF-8 encoding, or corrupted file: %s\n",
|
||||
/*078*/ "function uses both \"return\" and \"return <value>\"\n",
|
||||
/*079*/ "inconsistent return types (array & non-array)\n",
|
||||
/*080*/ "unknown symbol, or not a constant symbol (symbol \"%s\")\n",
|
||||
/*081*/ "cannot take a tag as a default value for an indexed array parameter (symbol \"%s\")\n",
|
||||
/*082*/ "user-defined operators and native functions may not have states\n",
|
||||
/*083*/ "a function or variable may only belong to a single automaton (symbol \"%s\")\n",
|
||||
/*084*/ "state conflict: one of the states is already assigned to another implementation (symbol \"%s\")\n",
|
||||
/*085*/ "no states are defined for symbol \"%s\"\n",
|
||||
/*086*/ "unknown automaton \"%s\"\n",
|
||||
/*087*/ "unknown state \"%s\" for automaton \"%s\"\n",
|
||||
/*088*/ "public variables and local variables may not have states (symbol \"%s\")\n",
|
||||
/*089*/ "state variables may not be initialized (symbol \"%s\")\n",
|
||||
/*090*/ "public functions may not return arrays (symbol \"%s\")\n",
|
||||
/*091*/ "ambiguous constant; tag override is required (symbol \"%s\")\n",
|
||||
/*092*/ "number of arguments does not match definition\n",
|
||||
/*093*/ "expected tag name identifier\n",
|
||||
/*094*/ "function enumeration requires unique tag\n",
|
||||
/*095*/ "cannot have required parameters after optional parameters\n",
|
||||
/*096*/ "could not find member \"%s\" in struct \"%s\"\n",
|
||||
/*097*/ "symbol \"%s\" does not have a matching type\n",
|
||||
/*098*/ "struct requires unique struct name\n",
|
||||
/*099*/ "member \"%s\" appears more than once in struct \"%s\"\n",
|
||||
/*100*/ "function prototypes do not match\n",
|
||||
/*101*/ "specify either all dimensions or only the last dimension\n"
|
||||
#else
|
||||
"\271pect\236\305k\212:\231\320bu\202fo\217\207\215\012",
|
||||
"\201l\224\251s\203g\362\317e\234\202(\260\374\201) c\352f\241\345w ea\261 \042c\361e\042\012",
|
||||
"\232cl\321\237\302\251\345c\335\332\327appe\204 \351\251\340\372o\217\207\240ock\012",
|
||||
"\375\231 \276\235i\372le\234t\274\012",
|
||||
"\272\307\224\235\331\363\266t\312",
|
||||
"\370a\254gn\236\305 \352\255y\012",
|
||||
"\364\222\260c\225\235\316\220\322\274\012",
|
||||
"\370\251\365\202\374\201; \361sum\236z\210o\012",
|
||||
"\273\306\341\200(nega\206ve\320z\210o \260ou\202\302bo\217ds\233",
|
||||
"\273\272\260\232cl\321\213\012",
|
||||
"\273out\223d\200\375\312",
|
||||
"\273\272c\216l\320\235\251\265add\220s\312",
|
||||
"\221 \212tr\224po\203\202(\221 pu\240\336 \375s\233",
|
||||
"\273\317e\234t; \235\351s\371t\261\012",
|
||||
"\042\300a\337t\333c\361\200\370\270\200l\361\202c\361\200\351s\371t\261 \317e\234t\012",
|
||||
"m\337\206p\362\300a\337t\205\351\042s\371t\261\042\012",
|
||||
"\217\322\236\277\012",
|
||||
"\203i\206\216iza\237d\222\251\271ce\274\205\232cl\204\236\341\311",
|
||||
"\235\251lab\344\355",
|
||||
"\273\250 nam\200\215\012",
|
||||
"\250 \216\220ad\224\322\274\355",
|
||||
"\370l\244u\200(n\201-\365t\233",
|
||||
"\306a\254gn\234\202\370\223\372\362a\254gn\234t\012",
|
||||
"\042b\220ak\333\260\042\310t\203ue\333\276ou\202\302\310t\271t\012",
|
||||
"\272head\353\343ff\210\205from pro\305typ\311",
|
||||
"\221 \354\353\042#if...\042\012",
|
||||
"\273\261\321ct\257\365t\012",
|
||||
"\273subscrip\202(\235\352\306\260\305o m\225\224subscripts)\355",
|
||||
"\273\374\201\320\361sum\236z\210o\012",
|
||||
"\340\372o\217\207\317e\234\202\235c\345s\236a\202\270\200\212\207\302\357\362(\230\204t\236a\202l\203\200%d\233",
|
||||
"\217k\221w\342\343\220c\206v\311",
|
||||
"\306\203\232x ou\202\302bo\217d\205(\332\215\233",
|
||||
"\306\370\203\232x\236(\332\215\233",
|
||||
"\315\360\275\235\331\363\251\300a\337\202\244u\200(\315%d\233",
|
||||
"\315typ\200mis\354 (\315%d\233",
|
||||
"e\372t\224\317e\234t\012",
|
||||
"\273\230r\353(po\254\240\224n\201-\347m\203\222\236\230r\203g\233",
|
||||
"\271t\242 \261\321c\347\205\334l\203\311",
|
||||
"\365\202\250 \331\205\221 \341\311",
|
||||
"dupl\336\222\200\042c\361e\333lab\344 (\244u\200%d\233",
|
||||
"\273\344lip\223s\320\306\341\200\276\235k\221wn\012",
|
||||
"\273\340\227\203a\237\302cl\361\205speci\357\210\312",
|
||||
"\261\321ct\257\365\202\271ce\274\205r\225g\200f\260pack\236\230r\203g\012",
|
||||
"po\223\213\335p\321\356\347\205\327\313c\274\200\216l nam\236p\321\356\347\312",
|
||||
"\305o m\225\224\272\266t\312",
|
||||
"\217k\221w\342\306\341\200(\332\215\233",
|
||||
"\306\341\275\360 \235\354\320\260\232\230\203a\237\306\276\305o sm\216l\012",
|
||||
"\306(\205\360 \235\354\012",
|
||||
"\273l\203\200\310t\203ua\213\012",
|
||||
"\273r\225g\311",
|
||||
"\273subscript\320\252\200\042[ ]\333\364\222\226\205\334\307j\260\343\234\223\201\312",
|
||||
"m\337\206-\343\234\223\201\335\255y\205\370f\337l\224\203i\206\216iz\274\012",
|
||||
"\271ce\274\353\307ximum \376\257\302\343\234\223\201\312",
|
||||
"\217\354\236c\345s\353b\242c\200(\042}\042\233",
|
||||
"\230\204\202\302\272bod\224\371\270ou\202\272head\210\012",
|
||||
"\255ys\320\345c\335\304\275\225\207\272\266t\205c\225\235\316pu\240\336 (\332\215\233",
|
||||
"\217f\203ish\236\374\334bef\226\200\340\372il\257\343\220c\206v\311",
|
||||
"dupl\336\222\200\266t; sam\200\315\276p\361s\236tw\336\311",
|
||||
"\272\315\307\224\235\331\363\251\300a\337\202\244u\200(\332\215\233",
|
||||
"m\337\206p\362\042#\344se\333\343\220c\206v\275betwe\212 \042#if ... #\212\343f\042\012",
|
||||
"\042#\344seif\333\343\220c\206\363f\241\345w\205\352\042#\344se\333\343\220c\206v\311",
|
||||
"\376\257\302\364\225d\205\360\275\235\357\202\270\200\364\222\226\012",
|
||||
"\272\220s\337\202\366\302\364\222\226\231 \370\215\012",
|
||||
"c\225\235\261\225g\200\313\322\236\364\222\226\312",
|
||||
"\272\315\307\224\201l\224\331\363\251s\203g\362\366(\315%d\233",
|
||||
"\272\315\307\224\235\316\251\220f\210\212c\200\315\260\352\306(\315\215\233",
|
||||
"\332c\225\235\316bo\270 \251\220f\210\212c\200\225\207\352\306(\332\215\233",
|
||||
"\273\242\213\335\376\257\313ci\223\334\351#p\242g\307\012",
|
||||
"\242\213\335\376\257f\226\307\202\216\220ad\224\322\274\012",
|
||||
"\242\213\335\376\257supp\226\202wa\205\235\212\256\274\012",
|
||||
"\252\210-\322\236\364\222\260\370\232cl\204\236bef\226\200\252\200(\375\231\233",
|
||||
"\042\341e\267\333\364\222\260\276\273\334\042\375\333\250\312",
|
||||
"\272\315\370\352\306(\315\215\233",
|
||||
"#\322\200p\222\347\342\327\230\204\202\371\270 \352\216p\331be\206c \261\321c\347\012",
|
||||
"\203pu\202l\203\200\305o l\201\253(aft\257subs\206tu\213s\233",
|
||||
"\246n\314x \210r\260\351\270\200\374\201\320\260\273\272c\216l\012",
|
||||
"m\216f\226m\236UTF-8 \212\340d\203g\320\260c\226rupt\236\357le: \211\012",
|
||||
"\272\252\275bo\270 \042\220turn\333\225\207\042\220tur\342<\244ue>\042\012",
|
||||
"\203\310\223\230\212\202\220tur\342typ\275(\306& n\201-\255y\233",
|
||||
"\217k\221w\342\250\320\260\235\251\365\202\250 \330",
|
||||
"c\225\235\314k\200\251\366a\205\251\300a\337\202\244u\200f\260\352\203\232x\236\306p\321\356t\257\330",
|
||||
"\252\210-\322\236\364\222\226\205\225\207na\206\363\375\205\307\224\235\331\363\317e\312",
|
||||
"\251\272\260\332\307\224\201l\224b\344\201\253\305 \251s\203g\362au\305\325\334\330",
|
||||
"\317\200\310fl\336t: \201\200\302\270\200\317\275\276\216\220ad\224a\254gn\236\305 a\221\270\257i\372le\234\314\237\330",
|
||||
"\221 \317\275\204\200\322\236f\260\277\012",
|
||||
"\217k\221w\342au\305\325\201\324",
|
||||
"\217k\221w\342\317\200\215 f\260au\305\325\201\324",
|
||||
"pu\240\336 \304\275\225\207\345c\335\304\275\307\224\235\331\363\317\275\330",
|
||||
"\317\200\304\275\307\224\235\316\203i\206\216iz\236\330",
|
||||
"pu\240\336 \375\205\307\224\235\220tur\342\255y\205\330",
|
||||
"a\227i\262ou\205\365t; \366ov\210rid\200\276\220qui\220\207\330",
|
||||
"\376\257\302\266t\205\360\275\235\354 \322i\213\012",
|
||||
"\271pect\236\366nam\200id\212\206\357\210\012",
|
||||
"\272\212um\210a\237\220qui\220\205\217iqu\200\314g\012",
|
||||
"c\225\235\331\363\220qui\220\207p\321\356\347\205aft\257\346\213\335p\321\356\347\312",
|
||||
"\340\337\207\235f\203\207\356\227\210\231 \351\230ruc\202\215\012",
|
||||
"\277 \360\275\235\331\363\251\354\353typ\311",
|
||||
"\230ruc\202\220qui\220\205\217iqu\200\230ruc\202nam\311",
|
||||
"\356\227\210\231 appe\204\205m\226\200\270\352\201c\200\351\230ruc\202\215\012",
|
||||
"\272pro\305typ\275\360 \235\354\012"
|
||||
#endif
|
||||
};
|
||||
|
||||
static char *fatalmsg[] = {
|
||||
#if 1
|
||||
/*120*/ "cannot read from file: \"%s\"\n",
|
||||
/*121*/ "cannot write to file: \"%s\"\n",
|
||||
/*122*/ "table overflow: \"%s\"\n",
|
||||
/* table can be: loop table
|
||||
* literal table
|
||||
* staging buffer
|
||||
* option table (response file)
|
||||
* peephole optimizer table
|
||||
*/
|
||||
/*123*/ "insufficient memory\n",
|
||||
/*124*/ "invalid assembler instruction \"%s\"\n",
|
||||
/*125*/ "numeric overflow, exceeding capacity\n",
|
||||
/*126*/ "compiled script exceeds the maximum memory size (%ld bytes)\n",
|
||||
/*127*/ "too many error messages on one line\n",
|
||||
/*128*/ "codepage mapping file not found\n",
|
||||
/*129*/ "invalid path: \"%s\"\n",
|
||||
/*130*/ "assertion failed: %s\n",
|
||||
/*131*/ "user error: %s\n",
|
||||
#else
|
||||
"c\225\235\220a\207from \357le\355",
|
||||
"c\225\235writ\200\305 \357le\355",
|
||||
"t\256\200ov\210f\345w\355",
|
||||
"\203suff\336i\212\202\356m\226y\012",
|
||||
"\273\361se\227l\257\203\230ruc\213\324",
|
||||
"\373m\210\336 ov\210f\345w\320\271ce\274\353capacity\012",
|
||||
"\340\372il\236scrip\202\271ce\274\205\270\200\307ximum \356m\226\224\341\200(%l\207bytes\233",
|
||||
"\305o m\225\224\210r\260\356ssag\275\334\201\200l\203\311",
|
||||
"\340\232pag\200\307pp\353\357\362\235fo\217d\012",
|
||||
"\273p\222h\355",
|
||||
"\361s\210\237fail\274: \211\012",
|
||||
"\252\257\210r\226: \211\012"
|
||||
#endif
|
||||
};
|
||||
|
||||
static char *warnmsg[] = {
|
||||
#if 1
|
||||
/*200*/ "symbol \"%s\" is truncated to %d characters\n",
|
||||
/*201*/ "redefinition of constant/macro (symbol \"%s\")\n",
|
||||
/*202*/ "number of arguments does not match definition\n",
|
||||
/*203*/ "symbol is never used: \"%s\"\n",
|
||||
/*204*/ "symbol is assigned a value that is never used: \"%s\"\n",
|
||||
/*205*/ "redundant code: constant expression is zero\n",
|
||||
/*206*/ "redundant test: constant expression is non-zero\n",
|
||||
/*207*/ "unknown #pragma\n",
|
||||
/*208*/ "function with tag result used before definition, forcing reparse\n",
|
||||
/*209*/ "function \"%s\" should return a value\n",
|
||||
/*210*/ "possible use of symbol before initialization: \"%s\"\n",
|
||||
/*211*/ "possibly unintended assignment\n",
|
||||
/*212*/ "possibly unintended bitwise operation\n",
|
||||
/*213*/ "tag mismatch\n",
|
||||
/*214*/ "possibly a \"const\" array argument was intended: \"%s\"\n",
|
||||
/*215*/ "expression has no effect\n",
|
||||
/*216*/ "nested comment\n",
|
||||
/*217*/ "loose indentation\n",
|
||||
/*218*/ "old style prototypes used with optional semicolumns\n",
|
||||
/*219*/ "local variable \"%s\" shadows a variable at a preceding level\n",
|
||||
/*220*/ "expression with tag override must appear between parentheses\n",
|
||||
/*221*/ "label name \"%s\" shadows tag name\n",
|
||||
/*222*/ "number of digits exceeds rational number precision\n",
|
||||
/*223*/ "redundant \"sizeof\": argument size is always 1 (symbol \"%s\")\n",
|
||||
/*224*/ "indeterminate array size in \"sizeof\" expression (symbol \"%s\")\n",
|
||||
/*225*/ "unreachable code\n",
|
||||
/*226*/ "a variable is assigned to itself (symbol \"%s\")\n",
|
||||
/*227*/ "more initializers than enum fields\n",
|
||||
/*228*/ "length of initializer exceeds size of the enum field\n",
|
||||
/*229*/ "index tag mismatch (symbol \"%s\")\n",
|
||||
/*230*/ "no implementation for state \"%s\" in function \"%s\", no fall-back\n",
|
||||
/*231*/ "state specification on forward declaration is ignored\n",
|
||||
/*232*/ "output file is written, but with compact encoding disabled\n",
|
||||
/*233*/ "state variable \"%s\" shadows a global variable\n",
|
||||
/*234*/ "symbol \"%s\" is marked as deprecated: %s\n",
|
||||
/*235*/ "public function lacks forward declaration (symbol \"%s\")\n",
|
||||
/*236*/ "unknown parameter in substitution (incorrect #define pattern)\n"
|
||||
#else
|
||||
"\277 \276tr\243\222\236\305 %\207\261\321c\347\312",
|
||||
"\220\322i\237\302\365t/\307cro \330",
|
||||
"\376\257\302\266t\205\360\275\235\354 \322i\213\012",
|
||||
"\250 \276nev\257\252\274\355",
|
||||
"\250 \276a\254gn\236\251\244u\200\270a\202\276nev\257\252\274\355",
|
||||
"\220d\217d\225\202\340\232: \365\202\374\334\276z\210o\012",
|
||||
"\220d\217d\225\202te\230: \365\202\374\334\276n\201-z\210o\012",
|
||||
"\217k\221w\342#p\242g\307\012",
|
||||
"\272\371\270 \366\220s\337\202\252\236bef\226\200\322i\213\320f\226c\353\220p\204s\311",
|
||||
"\375\231 sho\337\207\220tur\342\251\244u\311",
|
||||
"po\254\240\200\252\200\302\250 bef\226\200\203i\206\216iza\213\355",
|
||||
"po\254\240\224\217\203t\212\232\207a\254gn\234t\012",
|
||||
"po\254\240\224\217\203t\212\232\207bit\371s\200\364a\213\012",
|
||||
"\366mis\354\012",
|
||||
"po\254\240\224\251\042\350\333\306\315wa\205\203t\212\232d\355",
|
||||
"\374\334\331\205\221 effect\012",
|
||||
"ne\230\236\340m\234t\012",
|
||||
"\345os\200\203d\212\314\213\012",
|
||||
"\241\207\230y\362pro\305typ\275\252\236\371\270 \346\213\335sem\336\241umn\312",
|
||||
"\345c\335\332\215 s\331\360w\205\251\332a\202\251\313c\274\353lev\344\012",
|
||||
"\374\334\371\270 \366ov\210rid\200\327appe\204 betwe\212 p\204\212\270ese\312",
|
||||
"lab\344 nam\200\215 s\331\360w\205\366nam\311",
|
||||
"\376\257\302\343git\205\271ce\274\205\242\213\335\376\257\313ci\223\201\012",
|
||||
"\220d\217d\225\202\042\341e\267\042: \315\341\200\276\216way\2051 \330",
|
||||
"\203\232\347m\203\222\200\306\341\200\351\042\341e\267\333\374\334\330",
|
||||
"\217\220a\261\256\200\340\232\012",
|
||||
"\251\332\276a\254gn\236\305 its\344f \330",
|
||||
"m\226\200\203i\206\216iz\210\205\270\352\212um \357\344d\312",
|
||||
"l\212g\270 \302\203i\206\216iz\257\271ce\274\205\341\200\302\270\200\212um \357\344d\012",
|
||||
"\203\232x \366mis\354 \330",
|
||||
"\221 i\372le\234\314\237f\260\317\200\215 \351\375\231\320\221 f\216l-back\012",
|
||||
"\317\200specif\336a\237\334f\226w\204\207\232cl\321\237\276ig\221\220d\012",
|
||||
"outpu\202\357\362\276writt\212\320bu\202\371\270 \340\372ac\202\212\340d\353\343s\256\274\012",
|
||||
"\317\200\332\215 s\331\360w\205\251g\345b\335\304\311",
|
||||
"\277 \276m\204k\236a\205\232\313c\222\274: \211\012",
|
||||
"pu\240\336 \272lack\205f\226w\204\207\232cl\321\237\330",
|
||||
"\217k\221w\342p\321\356t\257\351subs\206tu\237(\203c\226\220c\202#\322\200p\222\347n\233"
|
||||
#endif
|
||||
};
|
||||
/* Pawn compiler - Error message strings (plain and compressed formats)
|
||||
*
|
||||
* Copyright (c) ITB CompuPhase, 2000-2006
|
||||
*
|
||||
* This software is provided "as-is", without any express or implied warranty.
|
||||
* In no event will the authors be held liable for any damages arising from
|
||||
* the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software in
|
||||
* a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
SC_FUNC int strexpand(char *dest, unsigned char *source, int maxlen, unsigned char pairtable[128][2]);
|
||||
|
||||
#ifndef SCPACK
|
||||
# define SCPACK
|
||||
# define SCPACK_PUSH
|
||||
#endif
|
||||
|
||||
#define SCPACK_TABLE errstr_table
|
||||
/*-*SCPACK start of pair table, do not change or remove this line */
|
||||
unsigned char errstr_table[][2] = {
|
||||
{101,32}, {116,32}, {111,110}, {105,110}, {97,114}, {115,32}, {100,32}, {116,105}, {101,114}, {37,115}, {109,101}, {97,108}, {135,130}, {34,137}, {141,34}, {110,111},
|
||||
{117,110}, {114,101}, {97,110}, {121,32}, {97,116}, {115,105}, {111,114}, {109,98}, {115,116}, {32,142}, {100,101}, {143,129}, {138,110}, {41,10}, {140,32}, {98,108},
|
||||
{116,104}, {111,108}, {114,97}, {144,99}, {101,134}, {102,163}, {118,139}, {115,121}, {167,151}, {168,161}, {97,32}, {117,115}, {103,32}, {150,32}, {132,162}, {136,32},
|
||||
{99,104}, {103,117}, {115,149}, {97,159}, {177,156}, {132,180}, {101,110}, {101,120}, {105,134}, {166,184}, {101,100}, {111,102}, {102,131}, {165,158}, {131,185}, {109,97},
|
||||
{101,133}, {105,133}, {169,153}, {118,132}, {187,32}, {105,179}, {195,197}, {116,111}, {174,147}, {99,130}, {181,129}, {115,10}, {112,145}, {116,97}, {98,128}, {171,129},
|
||||
{109,148}, {152,148}, {44,32}, {130,32}, {154,188}, {109,207}, {104,97}, {132,97}, {153,10}, {101,10}, {99,146}, {194,157}, {40,219}, {100,105}, {102,105}, {198,128},
|
||||
{218,155}, {34,32}, {139,32}, {117,108}, {99,111}, {149,122}, {110,32}, {131,172}, {208,176}, {101,108}, {108,111}, {111,112}, {97,115}, {118,128}, {116,136}, {201,152},
|
||||
{131,32}, {146,32}, {58,216}, {105,99}, {100,111}, {108,128}, {235,136}, {165,140}, {239,146}, {205,172}, {204,178}, {213,206}, {119,105}, {109,112}, {110,117}
|
||||
};
|
||||
/*-*SCPACK end of pair table, do not change or remove this line */
|
||||
|
||||
static char *errmsg[] = {
|
||||
#ifdef SCPACK
|
||||
/*001*/ "expected token: \"%s\", but found \"%s\"\n",
|
||||
/*002*/ "only a single statement (or expression) can follow each \"case\"\n",
|
||||
/*003*/ "declaration of a local variable must appear in a compound block\n",
|
||||
/*004*/ "function \"%s\" is not implemented\n",
|
||||
/*005*/ "function may not have arguments\n",
|
||||
/*006*/ "must be assigned to an array\n",
|
||||
/*007*/ "operator cannot be redefined\n",
|
||||
/*008*/ "must be a constant expression; assumed zero\n",
|
||||
/*009*/ "invalid array size (negative, zero or out of bounds)\n",
|
||||
/*010*/ "invalid function or declaration\n",
|
||||
/*011*/ "invalid outside functions\n",
|
||||
/*012*/ "invalid function call, not a valid address\n",
|
||||
/*013*/ "no entry point (no public functions)\n",
|
||||
/*014*/ "invalid statement; not in switch\n",
|
||||
/*015*/ "\"default\" case must be the last case in switch statement\n",
|
||||
/*016*/ "multiple defaults in \"switch\"\n",
|
||||
/*017*/ "undefined symbol \"%s\"\n",
|
||||
/*018*/ "initialization data exceeds declared size\n",
|
||||
/*019*/ "not a label: \"%s\"\n",
|
||||
/*020*/ "invalid symbol name \"%s\"\n",
|
||||
/*021*/ "symbol already defined: \"%s\"\n",
|
||||
/*022*/ "must be lvalue (non-constant)\n",
|
||||
/*023*/ "array assignment must be simple assignment\n",
|
||||
/*024*/ "\"break\" or \"continue\" is out of context\n",
|
||||
/*025*/ "function heading differs from prototype\n",
|
||||
/*026*/ "no matching \"#if...\"\n",
|
||||
/*027*/ "invalid character constant\n",
|
||||
/*028*/ "invalid subscript (not an array or too many subscripts): \"%s\"\n",
|
||||
/*029*/ "invalid expression, assumed zero\n",
|
||||
/*030*/ "compound statement not closed at the end of file (started at line %d)\n",
|
||||
/*031*/ "unknown directive\n",
|
||||
/*032*/ "array index out of bounds (variable \"%s\")\n",
|
||||
/*033*/ "array must be indexed (variable \"%s\")\n",
|
||||
/*034*/ "argument does not have a default value (argument %d)\n",
|
||||
/*035*/ "argument type mismatch (argument %d)\n",
|
||||
/*036*/ "empty statement\n",
|
||||
/*037*/ "invalid string (possibly non-terminated string)\n",
|
||||
/*038*/ "extra characters on line\n",
|
||||
/*039*/ "constant symbol has no size\n",
|
||||
/*040*/ "duplicate \"case\" label (value %d)\n",
|
||||
/*041*/ "invalid ellipsis, array size is not known\n",
|
||||
/*042*/ "invalid combination of class specifiers\n",
|
||||
/*043*/ "character constant exceeds range for packed string\n",
|
||||
/*044*/ "positional parameters must precede all named parameters\n",
|
||||
/*045*/ "too many function arguments\n",
|
||||
/*046*/ "unknown array size (variable \"%s\")\n",
|
||||
/*047*/ "array sizes do not match, or destination array is too small\n",
|
||||
/*048*/ "array (s do not match\n",
|
||||
/*049*/ "invalid line continuation\n",
|
||||
/*050*/ "invalid range\n",
|
||||
/*051*/ "invalid subscript, use \"[ ]\" operators on major dimensions\n",
|
||||
/*052*/ "multi-dimensional arrays must be fully initialized\n",
|
||||
/*053*/ "exceeding maximum number of dimensions\n",
|
||||
/*054*/ "unmatched closing brace (\"}\")\n",
|
||||
/*055*/ "start of function body without function header\n",
|
||||
/*056*/ "arrays, local variables and function arguments cannot be public (variable \"%s\")\n",
|
||||
/*057*/ "unfinished expression before compiler directive\n",
|
||||
/*058*/ "duplicate argument; same argument is passed twice\n",
|
||||
/*059*/ "function argument may not have a default value (variable \"%s\")\n",
|
||||
/*060*/ "multiple \"#else\" directives between \"#if ... #endif\"\n",
|
||||
/*061*/ "\"#elseif\" directive follows an \"#else\" directive\n",
|
||||
/*062*/ "number of operands does not fit the operator\n",
|
||||
/*063*/ "function result tag of operator \"%s\" must be \"%s\"\n",
|
||||
/*064*/ "cannot change predefined operators\n",
|
||||
/*065*/ "function argument may only have a single tag (argument %d)\n",
|
||||
/*066*/ "function argument may not be a reference argument or an array (argument \"%s\")\n",
|
||||
/*067*/ "variable cannot be both a reference and an array (variable \"%s\")\n",
|
||||
/*068*/ "invalid rational number precision in #pragma\n",
|
||||
/*069*/ "rational number format already defined\n",
|
||||
/*070*/ "rational number support was not enabled\n",
|
||||
/*071*/ "user-defined operator must be declared before use (function \"%s\")\n",
|
||||
/*072*/ "\"sizeof\" operator is invalid on \"function\" symbols\n",
|
||||
/*073*/ "function argument must be an array (argument \"%s\")\n",
|
||||
/*074*/ "#define pattern must start with an alphabetic character\n",
|
||||
/*075*/ "input line too long (after substitutions)\n",
|
||||
/*076*/ "syntax error in the expression, or invalid function call\n",
|
||||
/*077*/ "malformed UTF-8 encoding, or corrupted file: %s\n",
|
||||
/*078*/ "function uses both \"return\" and \"return <value>\"\n",
|
||||
/*079*/ "inconsistent return types (array & non-array)\n",
|
||||
/*080*/ "unknown symbol, or not a constant symbol (symbol \"%s\")\n",
|
||||
/*081*/ "cannot take a tag as a default value for an indexed array parameter (symbol \"%s\")\n",
|
||||
/*082*/ "user-defined operators and native functions may not have states\n",
|
||||
/*083*/ "a function or variable may only belong to a single automaton (symbol \"%s\")\n",
|
||||
/*084*/ "state conflict: one of the states is already assigned to another implementation (symbol \"%s\")\n",
|
||||
/*085*/ "no states are defined for symbol \"%s\"\n",
|
||||
/*086*/ "unknown automaton \"%s\"\n",
|
||||
/*087*/ "unknown state \"%s\" for automaton \"%s\"\n",
|
||||
/*088*/ "public variables and local variables may not have states (symbol \"%s\")\n",
|
||||
/*089*/ "state variables may not be initialized (symbol \"%s\")\n",
|
||||
/*090*/ "public functions may not return arrays (symbol \"%s\")\n",
|
||||
/*091*/ "ambiguous constant; tag override is required (symbol \"%s\")\n",
|
||||
/*092*/ "number of arguments does not match definition\n",
|
||||
/*093*/ "expected tag name identifier\n",
|
||||
/*094*/ "function enumeration requires unique tag\n",
|
||||
/*095*/ "cannot have required parameters after optional parameters\n",
|
||||
/*096*/ "could not find member \"%s\" in struct \"%s\"\n",
|
||||
/*097*/ "symbol \"%s\" does not have a matching type\n",
|
||||
/*098*/ "struct requires unique struct name\n",
|
||||
/*099*/ "member \"%s\" appears more than once in struct \"%s\"\n",
|
||||
/*100*/ "function prototypes do not match\n",
|
||||
/*101*/ "specify either all dimensions or only the last dimension\n",
|
||||
/*102*/ "cannot find methodmap %s\n",
|
||||
/*103*/ "methodmap %s was already defined\n",
|
||||
/*104*/ "cannot find any methods for %s\n",
|
||||
/*105*/ "cannot find method %s.%s\n",
|
||||
/*106*/ "cannot call methods on an array\n",
|
||||
/*107*/ "cannot call methods on a function\n",
|
||||
/*108*/ "method must have a first argument exactly matching the methodmap type (%s)\n",
|
||||
#else
|
||||
"\267pect\244\307k\266:\231\322bu\201fo\220\206\216\012",
|
||||
"\202l\223\252s\203g\365\321e\234\201(\255\267\372\202) \332 f\241\352w ea\260 \042c\354e\042\012",
|
||||
"\232cl\327\236\304\252\352c\342\337\325appe\204 \360\252\344\375o\220\206\237ock\012",
|
||||
"\367\231 \301\233i\375le\234t\272\012",
|
||||
"\275\277\223\233\326\355\265t\313",
|
||||
"\373a\262gn\244\307 \361\256y\012",
|
||||
"\366\224\255\340\316\221\324\272\012",
|
||||
"\373\252\370\201\267\372\202; \354su\212\206z\210o\012",
|
||||
"\276\310\345\200(nega\207ve\322z\210o \255ou\201\304bo\220ds\235",
|
||||
"\276\275\255\232cl\327\214\012",
|
||||
"\276out\225d\200\367\313",
|
||||
"\276\275c\213l\322\233\252\271add\221s\313",
|
||||
"\217 \266tr\223po\203\201(\217 pu\237\363 \367s\235",
|
||||
"\276\321e\234t; \233\360s\374t\260\012",
|
||||
"\042\232fa\343t\341c\354\200\373\240\200l\354\201c\354\200\360s\374t\260 \321e\234t\012",
|
||||
"m\343\207p\365\232fa\343t\205\360\042s\374t\260\042\012",
|
||||
"\220\324\244\302\012",
|
||||
"\203i\207\213iza\236d\224\252\267ce\272\205\232cl\204\244\345\331",
|
||||
"\233\252lab\351\362",
|
||||
"\276\251 nam\200\216\012",
|
||||
"\251 \213\221ad\223\324\272\362",
|
||||
"\373l\246u\200(n\202-\370t\235",
|
||||
"\310a\262gn\234\201\373\225\375\365a\262gn\234t\012",
|
||||
"\042b\221ak\341\255\042\311t\203ue\341\301ou\201\304\311t\267t\012",
|
||||
"\275head\347\335ff\210\205from pro\307typ\331",
|
||||
"\217 \350\347\042#if...\042\012",
|
||||
"\276\260\327ct\257\370t\012",
|
||||
"\276subscrip\201(\233\361\310\255\307o m\222\223subscripts)\362",
|
||||
"\276\267\372\202\322\354su\212\206z\210o\012",
|
||||
"\344\375o\220\206\321e\234\201\233c\352s\244a\201\240\200\266\206\304\336\365(\230\204t\244a\201l\203\200%d\235",
|
||||
"\220k\217w\346\335\221c\207v\331",
|
||||
"\310\203\232x ou\201\304bo\220d\205(\337\216\235",
|
||||
"\310\373\203\232x\244(\337\216\235",
|
||||
"\312\364\300\233\326\355\252\232fa\343\201\246u\200(\312%d\235",
|
||||
"\312typ\200mis\350 (\312%d\235",
|
||||
"e\375t\223\321e\234t\012",
|
||||
"\276\230r\347(po\262\237\223n\202-\356m\203\224\244\230r\203g\235",
|
||||
"\267t\242 \260\327c\356\205\323l\203\331",
|
||||
"\370\201\251 \326\205\217 \345\331",
|
||||
"dupl\363\224\200\042c\354e\341lab\351 (\246u\200%d\235",
|
||||
"\276\351lip\225s\322\310\345\200\301\233k\217wn\012",
|
||||
"\276\344\227\203a\236\304cl\354\205speci\336\210\313",
|
||||
"\260\327ct\257\370\201\267ce\272\205r\222g\200f\255pack\244\230r\203g\012",
|
||||
"po\225\214\342p\327\212\356\205\325\314c\272\200\213l na\212\206p\327\212\356\313",
|
||||
"\307o m\222\223\275\265t\313",
|
||||
"\220k\217w\346\310\345\200(\337\216\235",
|
||||
"\310\345\300\364 \233\350\322\255\232\230\203a\236\310\301\307o sm\213l\012",
|
||||
"\310(\205\364 \233\350\012",
|
||||
"\276l\203\200\311t\203ua\214\012",
|
||||
"\276r\222g\331",
|
||||
"\276subscript\322\253\200\042[ ]\341\366\224\226\205\323\277j\255\335\234\225\202\313",
|
||||
"m\343\207-\335\234\225\202\342\256y\205\373f\343l\223\203i\207\213iz\272\012",
|
||||
"\267ce\272\347\277ximum \376\227\257\304\335\234\225\202\313",
|
||||
"\220\350\244c\352s\347b\242c\200(\042}\042\235",
|
||||
"\230\204\201\304\275bod\223\374\240ou\201\275head\210\012",
|
||||
"\256ys\322\352c\342\306\300\222\206\275\265t\205\340\316pu\237\363 (\337\216\235",
|
||||
"\220\274ish\244\267\372\323bef\226\200\344\375il\257\335\221c\207v\331",
|
||||
"dupl\363\224\200\265t; sam\200\312\301p\354s\244tw\363\331",
|
||||
"\275\312\277\223\233\326\355\252\232fa\343\201\246u\200(\337\216\235",
|
||||
"m\343\207p\365\042#\351se\341\335\221c\207v\300betwe\266 \042#if ... #\266\335f\042\012",
|
||||
"\042#\351seif\341\335\221c\207\355f\241\352w\205\361\042#\351se\341\335\221c\207v\331",
|
||||
"\376\227\257\304\366\222d\205\364\300\233\336\201\240\200\366\224\226\012",
|
||||
"\275\221s\343\201\371\304\366\224\226\231 \373\216\012",
|
||||
"\340\260\222g\200\314\324\244\366\224\226\313",
|
||||
"\275\312\277\223\202l\223\326\355\252s\203g\365\371(\312%d\235",
|
||||
"\275\312\277\223\233\316\252\221f\210\266c\200\312\255\361\310(\312\216\235",
|
||||
"\337\340\316bo\240 \252\221f\210\266c\200\222\206\361\310(\337\216\235",
|
||||
"\276\242\214\342\376\227\257\314ci\225\323\360#p\242g\277\012",
|
||||
"\242\214\342\376\227\257f\226\277\201\213\221ad\223\324\272\012",
|
||||
"\242\214\342\376\227\257supp\226\201wa\205\233\266\263\272\012",
|
||||
"\253\210-\324\244\366\224\255\373\232cl\204\244bef\226\200\253\200(\367\231\235",
|
||||
"\042\345e\273\341\366\224\255\301\276\323\042\367\341\251\313",
|
||||
"\275\312\373\361\310(\312\216\235",
|
||||
"#\324\200p\224\356\346\325\230\204\201\374\240 \361\213p\326be\207c \260\327c\356\012",
|
||||
"\203pu\201l\203\200\307o l\202\254(aft\257subs\207tu\214s\235",
|
||||
"\247n\315x \210r\255\360\240\200\267\372\202\322\255\276\275c\213l\012",
|
||||
"m\213f\226\212\206UTF-8 \266\344d\203g\322\255c\226rupt\244\336le: \211\012",
|
||||
"\275\253\300bo\240 \042\221turn\341\222\206\042\221tur\346<\246ue>\042\012",
|
||||
"\203\311\225\230\266\201\221tur\346typ\300(\310& n\202-\256y\235",
|
||||
"\220k\217w\346\251\322\255\233\252\370\201\251 \334",
|
||||
"\340\315k\200\252\371a\205\252\232fa\343\201\246u\200f\255\361\203\232x\244\310p\327\212t\257\334",
|
||||
"\253\210-\324\244\366\224\226\205\222\206na\207\355\367\205\277\223\233\326\355\321e\313",
|
||||
"\252\275\255\337\277\223\202l\223b\351\202\254\307 \252s\203g\365au\307\320\323\334",
|
||||
"\321\200\311fl\363t: \202\200\304\240\200\321\300\301\213\221ad\223a\262gn\244\307 a\217\240\257i\375le\234\315\236\334",
|
||||
"\217 \321\300\204\200\324\244f\255\302\012",
|
||||
"\220k\217w\346au\307\320\202\330",
|
||||
"\220k\217w\346\321\200\216 f\255au\307\320\202\330",
|
||||
"pu\237\363 \306\300\222\206\352c\342\306\300\277\223\233\326\355\321\300\334",
|
||||
"\321\200\306\300\277\223\233\316\203i\207\213iz\244\334",
|
||||
"pu\237\363 \367\205\277\223\233\221tur\346\256y\205\334",
|
||||
"a\227i\261ou\205\370t; \371ov\210rid\200\301\221qui\221\206\334",
|
||||
"\376\227\257\304\265t\205\364\300\233\350 \324i\214\012",
|
||||
"\267pect\244\371nam\200i\232n\207\336\210\012",
|
||||
"\275\266um\210a\236\221qui\221\205\220iqu\200\315g\012",
|
||||
"\340\326\355\221qui\221\206p\327\212\356\205aft\257\353\214\342p\327\212\356\313",
|
||||
"\344\343\206\233\274\206\212\227\210\231 \360\230ruc\201\216\012",
|
||||
"\302 \364\300\233\326\355\252\350\347typ\331",
|
||||
"\230ruc\201\221qui\221\205\220iqu\200\230ruc\201na\212\012",
|
||||
"\212\227\210\231 appe\204\205m\226\200\240\361\202c\200\360\230ruc\201\216\012",
|
||||
"\275pro\307typ\300\364 \233\350\012",
|
||||
"specif\223ei\240\257\213l \335\234\225\202\205\255\202l\223\240\200l\354\201\335\234\225\202\012",
|
||||
"\340\274\206\212\240od\277p \211\012",
|
||||
"\212\240od\277p %\205wa\205\213\221ad\223\324\272\012",
|
||||
"\340\274\206\222\223\212\240od\205f\255\211\012",
|
||||
"\340\274\206\212\240o\206\211.\211\012",
|
||||
"\340c\213l \212\240od\205\323\361\256y\012",
|
||||
"\340c\213l \212\240od\205\323\252\367\012",
|
||||
"\212\240o\206\325\326\355\252\336rs\201\312\267actl\223\350\347\240\200\212\240od\277p typ\200(\211\235"
|
||||
#endif
|
||||
};
|
||||
|
||||
static char *fatalmsg[] = {
|
||||
#ifdef SCPACK
|
||||
/*120*/ "cannot read from file: \"%s\"\n",
|
||||
/*121*/ "cannot write to file: \"%s\"\n",
|
||||
/*122*/ "table overflow: \"%s\"\n",
|
||||
/* table can be: loop table
|
||||
* literal table
|
||||
* staging buffer
|
||||
* option table (response file)
|
||||
* peephole optimizer table
|
||||
*/
|
||||
/*123*/ "insufficient memory\n",
|
||||
/*124*/ "invalid assembler instruction \"%s\"\n",
|
||||
/*125*/ "numeric overflow, exceeding capacity\n",
|
||||
/*126*/ "compiled script exceeds the maximum memory size (%ld bytes)\n",
|
||||
/*127*/ "too many error messages on one line\n",
|
||||
/*128*/ "codepage mapping file not found\n",
|
||||
/*129*/ "invalid path: \"%s\"\n",
|
||||
/*130*/ "assertion failed: %s\n",
|
||||
/*131*/ "user error: %s\n",
|
||||
#else
|
||||
"\340\221a\206from \336le\362",
|
||||
"\340writ\200\307 \336le\362",
|
||||
"t\263\200ov\210f\352w\362",
|
||||
"\203suf\336ci\266\201\212m\226y\012",
|
||||
"\276\354se\227l\257\203\230ruc\214\330",
|
||||
"\376m\210\363 ov\210f\352w\322\267ce\272\347capacity\012",
|
||||
"\344\375il\244scrip\201\267ce\272\205\240\200\277ximum \212m\226\223\345\200(%l\206bytes\235",
|
||||
"\307o m\222\223\210r\255\212ssag\300\323\202\200l\203\331",
|
||||
"\344\232pag\200\277pp\347\336\365\233fo\220d\012",
|
||||
"\276p\224h\362",
|
||||
"\354s\210\236fail\272: \211\012",
|
||||
"\253\257\210r\226: \211\012"
|
||||
#endif
|
||||
};
|
||||
|
||||
static char *warnmsg[] = {
|
||||
#ifdef SCPACK
|
||||
/*200*/ "symbol \"%s\" is truncated to %d characters\n",
|
||||
/*201*/ "redefinition of constant/macro (symbol \"%s\")\n",
|
||||
/*202*/ "number of arguments does not match definition\n",
|
||||
/*203*/ "symbol is never used: \"%s\"\n",
|
||||
/*204*/ "symbol is assigned a value that is never used: \"%s\"\n",
|
||||
/*205*/ "redundant code: constant expression is zero\n",
|
||||
/*206*/ "redundant test: constant expression is non-zero\n",
|
||||
/*207*/ "unknown #pragma\n",
|
||||
/*208*/ "function with tag result used before definition, forcing reparse\n",
|
||||
/*209*/ "function \"%s\" should return a value\n",
|
||||
/*210*/ "possible use of symbol before initialization: \"%s\"\n",
|
||||
/*211*/ "possibly unintended assignment\n",
|
||||
/*212*/ "possibly unintended bitwise operation\n",
|
||||
/*213*/ "tag mismatch\n",
|
||||
/*214*/ "possibly a \"const\" array argument was intended: \"%s\"\n",
|
||||
/*215*/ "expression has no effect\n",
|
||||
/*216*/ "nested comment\n",
|
||||
/*217*/ "loose indentation\n",
|
||||
/*218*/ "old style prototypes used with optional semicolumns\n",
|
||||
/*219*/ "local variable \"%s\" shadows a variable at a preceding level\n",
|
||||
/*220*/ "expression with tag override must appear between parentheses\n",
|
||||
/*221*/ "label name \"%s\" shadows tag name\n",
|
||||
/*222*/ "number of digits exceeds rational number precision\n",
|
||||
/*223*/ "redundant \"sizeof\": argument size is always 1 (symbol \"%s\")\n",
|
||||
/*224*/ "indeterminate array size in \"sizeof\" expression (symbol \"%s\")\n",
|
||||
/*225*/ "unreachable code\n",
|
||||
/*226*/ "a variable is assigned to itself (symbol \"%s\")\n",
|
||||
/*227*/ "more initializers than enum fields\n",
|
||||
/*228*/ "length of initializer exceeds size of the enum field\n",
|
||||
/*229*/ "index tag mismatch (symbol \"%s\")\n",
|
||||
/*230*/ "no implementation for state \"%s\" in function \"%s\", no fall-back\n",
|
||||
/*231*/ "state specification on forward declaration is ignored\n",
|
||||
/*232*/ "output file is written, but with compact encoding disabled\n",
|
||||
/*233*/ "state variable \"%s\" shadows a global variable\n",
|
||||
/*234*/ "symbol \"%s\" is marked as deprecated: %s\n",
|
||||
/*235*/ "public function lacks forward declaration (symbol \"%s\")\n",
|
||||
/*236*/ "unknown parameter in substitution (incorrect #define pattern)\n"
|
||||
#else
|
||||
"\302 \301tr\243\224\244\307 %\206\260\327c\356\313",
|
||||
"\221\324i\236\304\370t/\277cro \334",
|
||||
"\376\227\257\304\265t\205\364\300\233\350 \324i\214\012",
|
||||
"\251 \301nev\257\253\272\362",
|
||||
"\251 \301a\262gn\244\252\246u\200\240a\201\301nev\257\253\272\362",
|
||||
"\221d\220d\222\201\344\232: \370\201\267\372\323\301z\210o\012",
|
||||
"\221d\220d\222\201te\230: \370\201\267\372\323\301n\202-z\210o\012",
|
||||
"\220k\217w\346#p\242g\277\012",
|
||||
"\275\374\240 \371\221s\343\201\253\244bef\226\200\324i\214\322f\226c\347\221p\204s\331",
|
||||
"\367\231 sho\343\206\221tur\346\252\246u\331",
|
||||
"po\262\237\200\253\200\304\251 bef\226\200\203i\207\213iza\214\362",
|
||||
"po\262\237\223\220\203t\266\232\206a\262gn\234t\012",
|
||||
"po\262\237\223\220\203t\266\232\206bit\374s\200\366a\214\012",
|
||||
"\371mis\350\012",
|
||||
"po\262\237\223\252\042\357\341\310\312wa\205\203t\266\232d\362",
|
||||
"\267\372\323\326\205\217 effect\012",
|
||||
"ne\230\244\344m\234t\012",
|
||||
"\352os\200\203\232n\315\214\012",
|
||||
"\241\206\230y\365pro\307typ\300\253\244\374\240 \353\214\342sem\363\241umn\313",
|
||||
"\352c\342\337\216 s\326\364w\205\252\337a\201\252\314c\272\347lev\351\012",
|
||||
"\267\372\323\374\240 \371ov\210rid\200\325appe\204 betwe\266 p\204\266\240ese\313",
|
||||
"lab\351 nam\200\216 s\326\364w\205\371na\212\012",
|
||||
"\376\227\257\304\335git\205\267ce\272\205\242\214\342\376\227\257\314ci\225\202\012",
|
||||
"\221d\220d\222\201\042\345e\273\042: \312\345\200\301\213way\2051 \334",
|
||||
"\203\232\356m\203\224\200\310\345\200\360\042\345e\273\341\267\372\323\334",
|
||||
"\220\221a\260\263\200\344\232\012",
|
||||
"\252\337\301a\262gn\244\307 its\351f \334",
|
||||
"m\226\200\203i\207\213iz\210\205\240\361\266um \336\351d\313",
|
||||
"l\266g\240 \304\203i\207\213iz\257\267ce\272\205\345\200\304\240\200\266um \336\351d\012",
|
||||
"\203\232x \371mis\350 \334",
|
||||
"\217 i\375le\234\315\236f\255\321\200\216 \360\367\231\322\217 f\213l-back\012",
|
||||
"\321\200speci\336ca\236\323f\226w\204\206\232cl\327\236\301ig\217\221d\012",
|
||||
"outpu\201\336\365\301writt\266\322bu\201\374\240 \344\375ac\201\266\344d\347\335s\263\272\012",
|
||||
"\321\200\337\216 s\326\364w\205\252g\352b\342\306\331",
|
||||
"\302 \301m\204k\244a\205\232\314c\224\272: \211\012",
|
||||
"pu\237\363 \275lack\205f\226w\204\206\232cl\327\236\334",
|
||||
"\220k\217w\346p\327\212t\257\360subs\207tu\236(\203c\226\221c\201#\324\200p\224\356n\235"
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef SCPACK_PUSH
|
||||
# undef SCPACK
|
||||
#endif
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* vim: set ts=8 sts=2 sw=2 tw=99 et: */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
@ -10,6 +11,8 @@ funcenum_t *firstenum = NULL;
|
||||
funcenum_t *lastenum = NULL;
|
||||
pstruct_t *firststruct = NULL;
|
||||
pstruct_t *laststruct = NULL;
|
||||
methodmap_t *methodmap_first = NULL;
|
||||
methodmap_t *methodmap_last = NULL;
|
||||
|
||||
structarg_t *pstructs_getarg(pstruct_t *pstruct, const char *member)
|
||||
{
|
||||
@ -345,20 +348,20 @@ void _stack_genusage(memuse_list_t *stack, int dofree)
|
||||
while (cur)
|
||||
{
|
||||
if (cur->type == MEMUSE_DYNAMIC)
|
||||
{
|
||||
{
|
||||
/* no idea yet */
|
||||
assert(0);
|
||||
} else {
|
||||
} else {
|
||||
modstk(cur->size * sizeof(cell));
|
||||
}
|
||||
if (dofree)
|
||||
{
|
||||
}
|
||||
if (dofree)
|
||||
{
|
||||
tmp = cur->prev;
|
||||
free(cur);
|
||||
cur = tmp;
|
||||
} else {
|
||||
} else {
|
||||
cur = cur->prev;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dofree)
|
||||
{
|
||||
@ -427,3 +430,55 @@ void resetheaplist()
|
||||
{
|
||||
_reset_memlist(&heapusage);
|
||||
}
|
||||
|
||||
void methodmap_add(methodmap_t *map)
|
||||
{
|
||||
if (!methodmap_first) {
|
||||
methodmap_first = map;
|
||||
methodmap_last = map;
|
||||
} else {
|
||||
methodmap_last->next = map;
|
||||
methodmap_last = map;
|
||||
}
|
||||
}
|
||||
|
||||
methodmap_t *methodmap_find_by_tag(int tag)
|
||||
{
|
||||
methodmap_t *ptr = methodmap_first;
|
||||
for (; ptr; ptr = ptr->next) {
|
||||
if (ptr->tag == tag)
|
||||
return ptr;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
methodmap_t *methodmap_find_by_name(const char *name)
|
||||
{
|
||||
int tag = pc_findtag(name);
|
||||
if (tag == -1)
|
||||
return NULL;
|
||||
return methodmap_find_by_tag(tag);
|
||||
}
|
||||
|
||||
methodmap_method_t *methodmap_find_method(methodmap_t *map, const char *name)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < map->nummethods; i++) {
|
||||
if (strcmp(map->methods[i]->name, name) == 0)
|
||||
return map->methods[i];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void methodmaps_free()
|
||||
{
|
||||
methodmap_t *ptr = methodmap_first;
|
||||
while (ptr) {
|
||||
methodmap_t *next = ptr->next;
|
||||
free(ptr->methods);
|
||||
free(ptr);
|
||||
ptr = next;
|
||||
}
|
||||
methodmap_first = NULL;
|
||||
methodmap_last = NULL;
|
||||
}
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* vim: set sts=2 ts=8 sw=2 tw=99 et: */
|
||||
#ifndef _INCLUDE_SOURCEPAWN_COMPILER_TRACKER_H_
|
||||
#define _INCLUDE_SOURCEPAWN_COMPILER_TRACKER_H_
|
||||
|
||||
@ -66,6 +67,22 @@ typedef struct pstruct_s
|
||||
struct pstruct_s *next;
|
||||
} pstruct_t;
|
||||
|
||||
typedef struct methodmap_method_s
|
||||
{
|
||||
char name[sNAMEMAX+1];
|
||||
symbol *target;
|
||||
} methodmap_method_t;
|
||||
|
||||
typedef struct methodmap_s
|
||||
{
|
||||
struct methodmap_s *next;
|
||||
struct methodmap_s *parent;
|
||||
int tag;
|
||||
char name[sNAMEMAX+1];
|
||||
methodmap_method_t **methods;
|
||||
size_t nummethods;
|
||||
} methodmap_t;
|
||||
|
||||
/**
|
||||
* Pawn Structs
|
||||
*/
|
||||
@ -111,6 +128,15 @@ void genheapfree(int stop_id);
|
||||
void resetstacklist();
|
||||
void resetheaplist();
|
||||
|
||||
/**
|
||||
* Method maps.
|
||||
*/
|
||||
void methodmap_add(methodmap_t *map);
|
||||
methodmap_t *methodmap_find_by_tag(int tag);
|
||||
methodmap_t *methodmap_find_by_name(const char *name);
|
||||
methodmap_method_t *methodmap_find_method(methodmap_t *map, const char *name);
|
||||
void methodmaps_free();
|
||||
|
||||
extern memuse_list_t *heapusage;
|
||||
extern memuse_list_t *stackusage;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user