From 19815d42c35522c2f87baf75fd157478dc828db6 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 4 Jul 2014 00:37:39 -0700 Subject: [PATCH 1/7] Add new-style declaration support for global declarations. --- sourcepawn/compiler/sc.h | 25 +- sourcepawn/compiler/sc1.c | 719 +++++++++++------------------------- sourcepawn/compiler/sc2.c | 16 + sourcepawn/compiler/sc5.scp | 393 ++++++++++---------- 4 files changed, 449 insertions(+), 704 deletions(-) diff --git a/sourcepawn/compiler/sc.h b/sourcepawn/compiler/sc.h index 2fb0a391..6edd5c48 100644 --- a/sourcepawn/compiler/sc.h +++ b/sourcepawn/compiler/sc.h @@ -258,20 +258,20 @@ typedef struct svalue_s { int lvalue; } svalue; -#define TYPEFLAG_ONLY_NEW 0x01 // Only new-style types are allowed. -#define TYPEFLAG_ARGUMENT 0x02 // The declaration is for an argument. -#define TYPEFLAG_VARIABLE 0x04 // The declaration is for a variable. -#define TYPEFLAG_ENUMROOT 0x08 // Multi-dimensional arrays should have an enumroot. -#define TYPEFLAG_NO_POSTDIMS 0x10 // Do not parse post-fix dimensions. -#define TYPEFLAG_RETURN 0x20 // Return type. -#define TYPEMASK_NAMED_DECL (TYPEFLAG_ARGUMENT | TYPEFLAG_VARIABLE) +#define DECLFLAG_ONLY_NEW 0x01 // Only new-style types are allowed. +#define DECLFLAG_ARGUMENT 0x02 // The declaration is for an argument. +#define DECLFLAG_VARIABLE 0x04 // The declaration is for a variable. +#define DECLFLAG_ENUMROOT 0x08 // Multi-dimensional arrays should have an enumroot. +#define DECLFLAG_NO_POSTDIMS 0x10 // Do not parse post-fix dimensions. +#define DECLFLAG_MAYBE_FUNCTION 0x20 // Might be a named function. +#define DECLMASK_NAMED_DECL (DECLFLAG_ARGUMENT | DECLFLAG_VARIABLE | DECLFLAG_MAYBE_FUNCTION) typedef struct { // Array information. int numdim; int dim[sDIMEN_MAX]; int idxtag[sDIMEN_MAX]; - cell array_size; + cell size; constvalue *enumroot; // Type information. @@ -286,6 +286,9 @@ typedef struct { typedef struct { char name[sNAMEMAX + 1]; typeinfo_t type; + int is_new; // New-style declaration. + int has_postdims; // Dimensions, if present, were in postfix position. + int opertok; // Operator token, if applicable. } declinfo_t; /* "while" statement queue (also used for "for" and "do - while" loops) */ @@ -516,9 +519,10 @@ typedef enum s_optmark { #define OBJECTTAG 0x10000000Lu #define ENUMTAG 0x08000000Lu #define METHODMAPTAG 0x04000000Lu +#define STRUCTTAG 0x02000000Lu #define TAGMASK (~PUBLICTAG) #define TAGTYPEMASK (FUNCTAG | OBJECTTAG | ENUMTAG | METHODMAPTAG) -#define TAGFLAGMASK (FIXEDTAG | TAGTYPEMASK) +#define TAGFLAGMASK (FIXEDTAG | TAGTYPEMASK | STRUCTTAG) #define CELL_MAX (((ucell)1 << (sizeof(cell)*8-1)) - 1) @@ -651,7 +655,8 @@ SC_FUNC symbol *addsym(const char *name,cell addr,int ident,int vclass,int tag, 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, - int dim[],int numdim,int idxtag[],int slength); + int dim[],int numdim,int idxtag[],int slength); +SC_FUNC symbol *addvariable3(declinfo_t *decl,cell addr,int vclass,int slength); SC_FUNC int getlabel(void); SC_FUNC char *itoh(ucell val); diff --git a/sourcepawn/compiler/sc1.c b/sourcepawn/compiler/sc1.c index 8dabb4e5..00b19a18 100644 --- a/sourcepawn/compiler/sc1.c +++ b/sourcepawn/compiler/sc1.c @@ -80,13 +80,6 @@ int pc_tag_void = 0; int pc_tag_object = 0; int pc_tag_bool = 0; -typedef struct funcstub_setup_s { - const char *name; - int return_tag; - int this_tag; - int is_new; -} funcstub_setup_t; - static void resetglobals(void); static void initglobals(void); static char *get_extension(char *filename); @@ -99,9 +92,7 @@ static void setconstants(void); static void parse(void); static void dumplits(void); static void dumpzero(int count); -static void declfuncvar(int fpublic,int fstatic,int fstock,int fconst); -static void declglb(char *firstname,int firsttag,int fpublic,int fstatic, - int stock,int fconst); +static void declglb(declinfo_t *decl,int fpublic,int fstatic,int stock); static void declstructvar(char *firstname,int fpublic, pstruct_t *pstruct); static int declloc(int fstatic); static void dodelete(); @@ -116,11 +107,13 @@ static cell initarray(int ident,int tag,int dim[],int numdim,int cur, constvalue *enumroot,int *errorfound); static cell initvector(int ident,int tag,cell size,int fillzero, constvalue *enumroot,int *errorfound); +static void initials3(declinfo_t *decl); +static cell fix_char_size(declinfo_t *decl); static cell init(int ident,int *tag,int *errorfound); static int getstates(const char *funcname); static void attachstatelist(symbol *sym, int state_id); -static symbol *funcstub(int fnative, const funcstub_setup_t *setup); -static int newfunc(const funcstub_setup_t *setup,int fpublic,int fstatic,int stock,symbol **symp); +static symbol *funcstub(int tokid, declinfo_t *decl, const int *thistag); +static int newfunc(declinfo_t *decl, const int *thistag, int fpublic, int fstatic, int stock, symbol **symp); static int declargs(symbol *sym, int chkshadow, const int *thistag); static void doarg(declinfo_t *decl, int offset, int fpublic, int chkshadow, arginfo *arg); static void make_report(symbol *root,FILE *log,char *sourcefile); @@ -158,6 +151,7 @@ static void delwhile(void); static int *readwhile(void); static void inst_datetime_defines(void); static void inst_binary_name(char *binfname); +static int operatorname(char *name); enum { TEST_PLAIN, /* no parentheses */ @@ -1468,38 +1462,76 @@ static int getclassspec(int initialtok,int *fpublic,int *fstatic,int *fstock,int return err==0; } +static void dodecl(const token_t *tok) +{ + declinfo_t decl; + + if (tok->id == tNATIVE || tok->id == tFORWARD) { + parse_decl(&decl, DECLFLAG_MAYBE_FUNCTION); + funcstub(tok->id, &decl, NULL); + return; + } + + int fpublic = (tok->id == tPUBLIC); + int fstock = (tok->id == tSTOCK); + int fstatic = (tok->id == tSTATIC); + + parse_decl(&decl, DECLFLAG_MAYBE_FUNCTION|DECLFLAG_VARIABLE|DECLFLAG_ENUMROOT); + + if (!decl.opertok && (tok->id == tNEW || decl.has_postdims || !lexpeek('('))) { + if (decl.type.tag & STRUCTTAG) { + pstruct_t *pstruct = pstructs_find(pc_tagname(decl.type.tag)); + declstructvar(decl.name, fpublic, pstruct); + } else { + declglb(&decl, fpublic, fstatic, fstock); + } + } else { + if (!newfunc(&decl, NULL, fpublic, fstatic, fstock, NULL)) { + // Illegal function or declaration. Drop the line, reset literal queue. + error(10); + lexclr(TRUE); + litidx = 0; + } + } +} + /* parse - process all input text * * At this level, only static declarations and function definitions are legal. */ static void parse(void) { - int tok,fconst,fstock,fstatic,fpublic; - cell val; - char *str; + token_t tok; while (freading){ - /* first try whether a declaration possibly is native or public */ - tok=lex(&val,&str); /* read in (new) token */ - switch (tok) { + switch (lextok(&tok)) { case 0: /* ignore zero's */ break; + case tINT: + case tOBJECT: + case tCHAR: + case tVOID: + case tLABEL: + case tSYMBOL: + lexpush(); + // Fallthrough. case tNEW: - if (getclassspec(tok,&fpublic,&fstatic,&fstock,&fconst)) - declglb(NULL,0,fpublic,fstatic,fstock,fconst); - break; case tSTATIC: - /* This can be a static function or a static global variable; we know - * which of the two as soon as we have parsed up to the point where an - * opening paranthesis of a function would be expected. To back out after - * deciding it was a declaration of a static variable after all, we have - * to store the symbol name and tag. - */ - if (getclassspec(tok,&fpublic,&fstatic,&fstock,&fconst)) { - assert(!fpublic); - declfuncvar(fpublic,fstatic,fstock,fconst); - } /* if */ + case tPUBLIC: + case tSTOCK: + case tOPERATOR: + case tNATIVE: + case tFORWARD: + { + dodecl(&tok); + break; + } + case tFUNCTAG: + dofuncenum(FALSE); + break; + case tSTRUCT: + declstruct(); break; case tCONST: decl_const(sGLOBAL); @@ -1516,53 +1548,6 @@ static void parse(void) case tCLASS: domethodmap(Layout_Class); break; - case tFUNCTAG: - dofuncenum(FALSE); - break; - case tSTRUCT: - declstruct(); - break; - case tPUBLIC: - /* This can be a public function or a public variable; see the comment - * above (for static functions/variables) for details. - */ - if (getclassspec(tok,&fpublic,&fstatic,&fstock,&fconst)) { - assert(!fstatic); - declfuncvar(fpublic,fstatic,fstock,fconst); - } /* if */ - break; - case tSTOCK: - /* This can be a stock function or a stock *global*) variable; see the - * comment above (for static functions/variables) for details. - */ - if (getclassspec(tok,&fpublic,&fstatic,&fstock,&fconst)) { - assert(fstock); - declfuncvar(fpublic,fstatic,fstock,fconst); - } /* if */ - break; - case tLABEL: - case tSYMBOL: - case tOPERATOR: - { - funcstub_setup_t setup; - memset(&setup, 0, sizeof(setup)); - setup.return_tag = -1; - setup.this_tag = -1; - - lexpush(); - if (!newfunc(&setup,FALSE,FALSE,FALSE,NULL)) { - error(10); /* illegal function or declaration */ - lexclr(TRUE); /* drop the rest of the line */ - litidx=0; /* drop the literal queue too */ - } /* if */ - break; - } - case tNATIVE: - funcstub(TRUE, NULL); /* create a dummy function */ - break; - case tFORWARD: - funcstub(FALSE, NULL); - break; case '}': error(54); /* unmatched closing brace */ break; @@ -1739,73 +1724,6 @@ static void insert_docstring_separator(void) #define insert_docstring_separator() #endif -static void declfuncvar(int fpublic,int fstatic,int fstock,int fconst) -{ - char name[sNAMEMAX+11]; - int tok,tag=0; - char *str; - cell val; - int invalidfunc; - pstruct_t *pstruct = NULL; - - tok=lex(&val,&str); - if (tok == tLABEL) { - pstruct=pstructs_find(str); - tag=pc_addtag(str); - } else { - lexpush(); - } - tok=lex(&val,&str); - /* if we arrived here, this may not be a declaration of a native function - * or variable - */ - if (tok==tNATIVE) { - error(42); /* invalid combination of class specifiers */ - return; - } /* if */ - - if (tok!=tSYMBOL && tok!=tOPERATOR) { - lexpush(); - needtoken(tSYMBOL); - lexclr(TRUE); /* drop the rest of the line */ - litidx=0; /* drop the literal queue too */ - return; - } /* if */ - if (tok==tOPERATOR) { - funcstub_setup_t setup; - memset(&setup, 0, sizeof(setup)); - setup.return_tag = tag; - setup.this_tag = -1; - lexpush(); /* push "operator" keyword back (for later analysis) */ - if (!newfunc(&setup,fpublic,fstatic,fstock,NULL)) { - error(10); /* illegal function or declaration */ - lexclr(TRUE); /* drop the rest of the line */ - litidx=0; /* drop the literal queue too */ - } /* if */ - } else { - funcstub_setup_t setup; - memset(&setup, 0, sizeof(setup)); - setup.return_tag = tag; - setup.this_tag = -1; - setup.name = name; - - /* so tok is tSYMBOL */ - assert(strlen(str)<=sNAMEMAX); - strcpy(name,str); - - /* only variables can be "const" or both "public" and "stock" */ - invalidfunc = fconst || (fpublic && fstock); - if (invalidfunc || !newfunc(&setup,fpublic,fstatic,fstock,NULL)) { - /* if not a function, try a global variable */ - if (pstruct) { - declstructvar(name,fpublic,pstruct); - } else { - declglb(name,tag,fpublic,fstatic,fstock,fconst); - } - } /* if */ - } /* if */ -} - /* declstruct - declare global struct symbols * * global references: glb_declared (altered) @@ -2033,17 +1951,13 @@ static void declstructvar(char *firstname,int fpublic, pstruct_t *pstruct) * * global references: glb_declared (altered) */ -static void declglb(char *firstname,int firsttag,int fpublic,int fstatic,int fstock,int fconst) +static void declglb(declinfo_t *decl,int fpublic,int fstatic,int fstock) { - int ident,tag,ispublic; - int idxtag[sDIMEN_MAX]; - char name[sNAMEMAX+1]; - cell val,size,cidx; + int ispublic; + cell val,cidx; ucell address; int glb_incr; char *str; - int dim[sDIMEN_MAX]; - int numdim; int slength=0; short filenum; symbol *sym; @@ -2056,66 +1970,33 @@ static void declglb(char *firstname,int firsttag,int fpublic,int fstatic,int fst insert_docstring_separator(); /* see comment in newfunc() */ filenum=fcurrent; /* save file number at the start of the declaration */ do { - size=1; /* single size (no array) */ - numdim=0; /* no dimensions */ - ident=iVARIABLE; - if (firstname!=NULL) { - assert(strlen(firstname)<=sNAMEMAX); - strcpy(name,firstname); /* save symbol name */ - tag=firsttag; - firstname=NULL; - } else { - tag=pc_addtag(NULL); - if (lex(&val,&str)!=tSYMBOL) /* read in (new) token */ - error(20,str); /* invalid symbol name */ - assert(strlen(str)<=sNAMEMAX); - strcpy(name,str); /* save symbol name */ - } /* if */ + typeinfo_t *type = &decl->type; + ispublic=fpublic; - if (name[0]==PUBLIC_CHAR) { + if (decl->name[0]==PUBLIC_CHAR) { ispublic=TRUE; /* implicitly public variable */ assert(!fstatic); - } /* if */ - while (matchtoken('[')) { - ident=iARRAY; - if (numdim == sDIMEN_MAX) { - error(53); /* exceeding maximum number of dimensions */ - return; - } /* if */ - size=needsub(&idxtag[numdim],&enumroot); /* get size; size==0 for "var[]" */ - #if INT_MAX < LONG_MAX - if (size > INT_MAX) - error(165); /* overflow, exceeding capacity */ - #endif -#if 0 /* We don't actually care */ - if (ispublic) - error(56,name); /* arrays cannot be public */ -#endif - dim[numdim++]=(int)size; - } /* while */ - if (ident == iARRAY && tag == pc_tag_string && dim[numdim-1]) { - slength=dim[numdim-1]; - dim[numdim-1] = (size + sizeof(cell)-1) / sizeof(cell); } + slength = fix_char_size(decl); assert(sc_curstates==0); - sc_curstates=getstates(name); + sc_curstates=getstates(decl->name); if (sc_curstates<0) { - error(85,name); /* empty state list on declaration */ + error(85,decl->name); /* empty state list on declaration */ sc_curstates=0; } else if (sc_curstates>0 && ispublic) { - error(88,name); /* public variables may not have states */ + error(88,decl->name); /* public variables may not have states */ sc_curstates=0; } /* if */ - sym=findconst(name,NULL); + sym=findconst(decl->name,NULL); if (sym==NULL) { - sym=findglb(name,sSTATEVAR); + sym=findglb(decl->name,sSTATEVAR); /* if a global variable without states is found and this declaration has * states, the declaration is okay */ if (sym!=NULL && sym->states==NULL && sc_curstates>0) sym=NULL; /* set to NULL, we found the global variable */ - if (sc_curstates>0 && findglb(name,sGLOBAL)!=NULL) - error(233,name); /* state variable shadows a global variable */ + if (sc_curstates>0 && findglb(decl->name,sGLOBAL)!=NULL) + error(233,decl->name); /* state variable shadows a global variable */ } /* if */ /* we have either: * a) not found a matching variable (or rejected it, because it was a shadow) @@ -2133,7 +2014,7 @@ static void declglb(char *firstname,int firsttag,int fpublic,int fstatic,int fst * a different automaton */ if (sym!=NULL && (sym->usage & uDEFINE)!=0) - error(21,name); /* symbol already defined */ + error(21,decl->name); /* symbol already defined */ /* if this variable is never used (which can be detected only in the * second stage), shut off code generation */ @@ -2155,116 +2036,22 @@ static void declglb(char *firstname,int firsttag,int fpublic,int fstatic,int fst litidx=0; /* global initial data is dumped, so restart at zero */ } /* if */ assert(litidx==0); /* literal queue should be empty (again) */ - initials(ident,tag,&size,dim,numdim,enumroot);/* stores values in the literal queue */ - if (tag == pc_tag_string && (numdim == 1) && !dim[numdim-1]) { + initials3(decl); + if (type->tag == pc_tag_string && type->numdim == 1 && !type->dim[type->numdim - 1]) { slength = glbstringread; } - assert(size>=litidx); - if (numdim==1) - dim[0]=(int)size; - /* before dumping the initial values (or zeros) check whether this variable - * overlaps another - */ - if (sc_curstates>0) { - unsigned char *map; - - if (litidx!=0) - error(89,name); /* state variables may not be initialized */ - /* find an appropriate address for the state variable */ - /* assume that it cannot be found */ - address=sizeof(cell)*glb_declared; - glb_incr=(int)size; - /* use a memory map in which every cell occupies one bit */ - if (glb_declared>0 && (map=(unsigned char*)malloc((glb_declared+7)/8))!=NULL) { - int fsa=state_getfsa(sc_curstates); - symbol *sweep; - cell sweepsize,addr; - memset(map,0,(glb_declared+7)/8); - assert(fsa>=0); - /* fill in all variables belonging to this automaton */ - for (sweep=glbtab.next; sweep!=NULL; sweep=sweep->next) { - if (sweep->parent!=NULL || sweep->states==NULL || sweep==sym) - continue; /* hierarchical type, or no states, or same as this variable */ - if (sweep->ident!=iVARIABLE && sweep->ident!=iARRAY) - continue; /* a function or a constant */ - if ((sweep->usage & uDEFINE)==0) - continue; /* undefined variable, ignore */ - if (fsa!=state_getfsa(sweep->states->next->index)) - continue; /* wrong automaton */ - /* when arrived here, this is a global variable, with states and - * belonging to the same automaton as the variable we are declaring - */ - sweepsize=(sweep->ident==iVARIABLE) ? 1 : array_totalsize(sweep); - assert(sweep->addr % sizeof(cell) == 0); - addr=sweep->addr/sizeof(cell); - /* mark this address range */ - while (sweepsize-->0) { - map[addr/8] |= (unsigned char)(1 << (addr % 8)); - addr++; - } /* while */ - } /* for */ - /* go over it again, clearing any ranges that have conflicts */ - for (sweep=glbtab.next; sweep!=NULL; sweep=sweep->next) { - if (sweep->parent!=NULL || sweep->states==NULL || sweep==sym) - continue; /* hierarchical type, or no states, or same as this variable */ - if (sweep->ident!=iVARIABLE && sweep->ident!=iARRAY) - continue; /* a function or a constant */ - if ((sweep->usage & uDEFINE)==0) - continue; /* undefined variable, ignore */ - if (fsa!=state_getfsa(sweep->states->next->index)) - continue; /* wrong automaton */ - /* when arrived here, this is a global variable, with states and - * belonging to the same automaton as the variable we are declaring - */ - /* if the lists of states of the existing variable and the new - * variable have a non-empty intersection, this is not a suitable - * overlap point -> wipe the address range - */ - if (state_conflict_id(sc_curstates,sweep->states->next->index)) { - sweepsize=(sweep->ident==iVARIABLE) ? 1 : array_totalsize(sweep); - assert(sweep->addr % sizeof(cell) == 0); - addr=sweep->addr/sizeof(cell); - /* mark this address range */ - while (sweepsize-->0) { - map[addr/8] &= (unsigned char)(~(1 << (addr % 8))); - addr++; - } /* while */ - } /* if */ - } /* for */ - /* now walk through the map and find a starting point that is big enough */ - sweepsize=0; - for (addr=0; addr=size) - break; /* fitting range found, no need to search further */ - } /* for */ - if (sweepsize-addr>=size) - break; /* fitting range found, no need to search further */ - addr=sweepsize; - } /* for */ - free(map); - if (sweepsize-addr>=size) { - address=sizeof(cell)*addr; /* fitting range found, set it */ - glb_incr=0; - } /* if */ - } /* if */ - } else { - address=sizeof(cell)*glb_declared; - glb_incr=(int)size; - } /* if */ - if (size != CELL_MAX && address==sizeof(cell)*glb_declared) { + assert(type->size>=litidx); + if (type->numdim == 1) + type->dim[0] = (int)type->size; + address=sizeof(cell)*glb_declared; + glb_incr=(int)type->size; + if (type->size != CELL_MAX && address==sizeof(cell)*glb_declared) { dumplits(); /* dump the literal queue */ - dumpzero((int)size-litidx); + dumpzero((int)(type->size)-litidx); } /* if */ litidx=0; if (sym==NULL) { /* define only if not yet defined */ - sym=addvariable2(name,address,ident,sGLOBAL,tag,dim,numdim,idxtag,slength); - if (sc_curstates>0) - attachstatelist(sym,sc_curstates); + sym=addvariable3(decl,address,sGLOBAL,slength); } else { /* if declared but not yet defined, adjust the variable's address */ assert((sym->states==NULL && sc_curstates==0) || (sym->states->next!=NULL && sym->states->next->index==sc_curstates && sym->states->next->next==NULL)); @@ -2276,7 +2063,7 @@ static void declglb(char *firstname,int firsttag,int fpublic,int fstatic,int fst sc_curstates=0; if (ispublic) sym->usage|=uPUBLIC|uREAD; - if (fconst) + if (decl->type.usage & uCONST) sym->usage|=uCONST; if (fstock) sym->usage|=uSTOCK; @@ -2885,6 +2672,12 @@ static void initials(int ident,int tag,cell *size,int dim[],int numdim, initials2(ident, tag, size, dim, numdim, enumroot, -1, -1); } +static void initials3(declinfo_t *decl) +{ + typeinfo_t *type = &decl->type; + initials(type->ident, type->tag, &type->size, type->dim, type->numdim, type->enumroot); +} + static cell initarray(int ident,int tag,int dim[],int numdim,int cur, int startlit,int counteddim[],constvalue *lastdim, constvalue *enumroot,int *errorfound) @@ -3171,6 +2964,11 @@ static void declstruct(void) pstruct = pstructs_add(str); + int flags = STRUCTTAG; + if (isupper(*pstruct->name)) + flags |= FIXEDTAG; + pc_addtag_flags(pstruct->name, flags); + needtoken('{'); do { @@ -3332,11 +3130,6 @@ static int parse_new_typeexpr(typeinfo_t *type, const token_t *first, int flags) // Note: we could have already filled in the prefix array bits, so we check // that ident != iARRAY before looking for an open bracket. if (type->ident != iARRAY && matchtoken('[')) { - // Not yet supported for return vals. This is allowed with old decls, but - // it's a huge hack. For now we forbid it in new code until it works right. - if (flags & TYPEFLAG_RETURN) - error(136); - do { if (type->numdim == sDIMEN_MAX) { error(53); @@ -3351,8 +3144,7 @@ static int parse_new_typeexpr(typeinfo_t *type, const token_t *first, int flags) type->ident = iARRAY; } - - if (flags & TYPEFLAG_ARGUMENT) { + if (flags & DECLFLAG_ARGUMENT) { if (matchtoken('&')) { if (type->ident == iARRAY) { error(137); @@ -3381,7 +3173,7 @@ static void parse_old_array_dims(declinfo_t *decl, int flags) if (type->ident == iREFERENCE) error(67, decl->name); - if (flags & TYPEFLAG_ENUMROOT) + if (flags & DECLFLAG_ENUMROOT) enumrootp = &type->enumroot; else enumrootp = NULL; @@ -3394,14 +3186,15 @@ static void parse_old_array_dims(declinfo_t *decl, int flags) return; } - type->array_size = needsub(&type->idxtag[type->numdim], enumrootp); - if (type->array_size > INT_MAX) + type->size = needsub(&type->idxtag[type->numdim], enumrootp); + if (type->size > INT_MAX) error(165); - type->dim[type->numdim++] = type->array_size; + type->dim[type->numdim++] = type->size; } while (matchtoken('[')); type->ident = iARRAY; + decl->has_postdims = TRUE; } static int parse_old_decl(declinfo_t *decl, int flags) @@ -3415,7 +3208,7 @@ static int parse_old_decl(declinfo_t *decl, int flags) type->usage |= uCONST; } - if (flags & TYPEFLAG_ARGUMENT) { + if (flags & DECLFLAG_ARGUMENT) { if (matchtoken('&')) type->ident = iREFERENCE; @@ -3456,14 +3249,20 @@ static int parse_old_decl(declinfo_t *decl, int flags) return TRUE; } - if (flags & TYPEMASK_NAMED_DECL) { - if (expecttoken(tSYMBOL, &tok)) - strcpy(decl->name, tok.str); - else - strcpy(decl->name, ""); + if (flags & DECLMASK_NAMED_DECL) { + if ((flags & DECLFLAG_MAYBE_FUNCTION) && matchtoken(tOPERATOR)) { + decl->opertok = operatorname(decl->name); + if (decl->opertok == 0) + strcpy(decl->name, ""); + } else { + if (expecttoken(tSYMBOL, &tok)) + strcpy(decl->name, tok.str); + else + strcpy(decl->name, ""); + } } - if ((flags & TYPEMASK_NAMED_DECL) && !(flags & TYPEFLAG_NO_POSTDIMS)) { + if ((flags & DECLMASK_NAMED_DECL) && !(flags & DECLFLAG_NO_POSTDIMS) && !decl->opertok) { if (matchtoken('[')) parse_old_array_dims(decl, flags); } @@ -3477,11 +3276,22 @@ static int parse_new_decl(declinfo_t *decl, const token_t *first, int flags) if (!parse_new_typeexpr(&decl->type, first, flags)) return FALSE; - if (!expecttoken(tSYMBOL, &tok)) - return FALSE; - strcpy(decl->name, tok.str); - if ((flags & TYPEMASK_NAMED_DECL) && !(flags & TYPEFLAG_NO_POSTDIMS)) { + if (flags & DECLMASK_NAMED_DECL) { + if ((flags & DECLFLAG_MAYBE_FUNCTION) && matchtoken(tOPERATOR)) { + decl->opertok = operatorname(decl->name); + if (decl->opertok == 0) + strcpy(decl->name, ""); + } else { + if (!expecttoken(tSYMBOL, &tok)) { + strcpy(decl->name, ""); + return FALSE; + } + strcpy(decl->name, tok.str); + } + } + + if ((flags & DECLMASK_NAMED_DECL) && !(flags & DECLFLAG_NO_POSTDIMS)) { if (matchtoken('[')) { if (decl->type.numdim == 0) parse_old_array_dims(decl, flags); @@ -3490,6 +3300,7 @@ static int parse_new_decl(declinfo_t *decl, const token_t *first, int flags) } } + decl->is_new = TRUE; return TRUE; } @@ -3507,6 +3318,7 @@ int parse_decl(declinfo_t *decl, int flags) memset(decl, 0, sizeof(*decl)); decl->type.ident = iVARIABLE; + decl->type.size = 1; // Must attempt to match const first, since it's a common prefix. if (matchtoken(tCONST)) @@ -3514,25 +3326,24 @@ int parse_decl(declinfo_t *decl, int flags) // If parsing an argument, there are two simple checks for whether this is a // new or old-style declaration. - if ((flags & TYPEFLAG_ARGUMENT) && (lexpeek('&') || lexpeek('{'))) + if ((flags & DECLFLAG_ARGUMENT) && (lexpeek('&') || lexpeek('{'))) return parse_old_decl(decl, flags); - // Another dead giveaway is there being a label. - if (lexpeek(tLABEL)) + // Another dead giveaway is there being a label or typeless operator. + if (lexpeek(tLABEL) || lexpeek(tOPERATOR)) return parse_old_decl(decl, flags); // Otherwise, we have to eat a symbol to tell. if (matchsymbol(&ident)) { - if (lexpeek(tSYMBOL)) { + if (lexpeek(tSYMBOL) || lexpeek(tOPERATOR)) { // A new-style declaration only allows array dims or a symbol name, so - // this is a new-style declaration. Make sure to push back the first - // symbol. + // this is a new-style declaration. return parse_new_decl(decl, &ident.tok, flags); } - if ((flags & TYPEMASK_NAMED_DECL) && matchtoken('[')) { + if ((flags & DECLMASK_NAMED_DECL) && matchtoken('[')) { // If we're not allowing postdims here, then it must be a newdecl. - if (flags & TYPEFLAG_NO_POSTDIMS) { + if (flags & DECLFLAG_NO_POSTDIMS) { // Give the '[' and symbol back, since we're going to parse from the start. lexpush(); lexpush(); @@ -3641,20 +3452,31 @@ void check_name_length(char *original) } } +static void make_primitive(typeinfo_t *type, int tag) +{ + memset(type, 0, sizeof(*type)); + type->tag = tag; + type->tags[type->numtags++] = type->tag; + type->ident = iVARIABLE; +} + symbol *parse_inline_function(methodmap_t *map, const typeinfo_t *type, const char *name, int is_native, int is_ctor, int is_dtor) { - funcstub_setup_t setup; - if (is_dtor) - setup.return_tag = -1; - else if (is_ctor) - setup.return_tag = map->tag; - else - setup.return_tag = type->tag; + declinfo_t decl; + memset(&decl, 0, sizeof(decl)); - if (is_ctor) - setup.this_tag = -1; - else - setup.this_tag = map->tag; + if (is_dtor) { + make_primitive(&decl.type, pc_tag_void); + } else if (is_ctor) { + make_primitive(&decl.type, map->tag); + } else { + decl.type = *type; + } + decl.is_new = TRUE; + + const int *thistag = NULL; + if (!is_ctor) + thistag = &map->tag; // Build a new symbol. Construct a temporary name including the class. char fullname[METHOD_NAMEMAX + 1]; @@ -3662,15 +3484,13 @@ symbol *parse_inline_function(methodmap_t *map, const typeinfo_t *type, const ch strcat(fullname, "."); strcat(fullname, name); check_name_length(fullname); - - setup.name = fullname; - setup.is_new = TRUE; + strcpy(decl.name, fullname); symbol *target = NULL; if (is_native) { - target = funcstub(TRUE, &setup); + target = funcstub(tMETHODMAP, &decl, thistag); } else { - if (!newfunc(&setup, FALSE, FALSE, TRUE, &target)) + if (!newfunc(&decl, thistag, FALSE, FALSE, TRUE, &target)) return NULL; if (!target || (target->usage & uFORWARD)) { error(10); @@ -3789,7 +3609,7 @@ methodmap_method_t *parse_property(methodmap_t *map) methodmap_method_t *method; memset(&type, 0, sizeof(type)); - if (!parse_new_typeexpr(&type, NULL, TYPEFLAG_RETURN)) + if (!parse_new_typeexpr(&type, NULL, 0)) return NULL; if (!needsymbol(&ident)) return NULL; @@ -3891,7 +3711,7 @@ methodmap_method_t *parse_method(methodmap_t *map) // Parse for type expression, priming it with the token we predicted // would be an identifier. - if (!parse_new_typeexpr(&type, first, TYPEFLAG_RETURN)) + if (!parse_new_typeexpr(&type, first, 0)) return NULL; // Now, we should get an identifier. @@ -4968,85 +4788,42 @@ SC_FUNC char *funcdisplayname(char *dest,char *funcname) return dest; } -static symbol *funcstub(int fnative, const funcstub_setup_t *setup) +static cell char_array_cells(cell size) { - int tok,tag,fpublic; + return (size + sizeof(cell) - 1) / sizeof(cell); +} + +static cell fix_char_size(declinfo_t *decl) +{ + typeinfo_t *type = &decl->type; + if (type->tag == pc_tag_string && type->numdim && type->dim[type->numdim - 1]) { + cell slength = type->dim[type->numdim - 1]; + type->dim[type->numdim - 1] = char_array_cells(type->size); + return slength; + } + return 0; +} + +static symbol *funcstub(int tokid, declinfo_t *decl, const int *thistag) +{ + int tok,fpublic; char *str; cell val,size; - char symbolname[sNAMEMAX+1]; - int idxtag[sDIMEN_MAX]; - int dim[sDIMEN_MAX]; - int numdim; symbol *sym,*sub; - int opertok; + int fnative = (tokid == tNATIVE || tokid == tMETHODMAP); - opertok=0; lastst=0; litidx=0; /* clear the literal pool */ assert(loctab.next==NULL); /* local symbol table should be empty */ - // Either use an explicit return tag, or find a new one. - if (!setup || setup->return_tag == 0) - tag = pc_addtag(NULL); - else if (setup->return_tag == -1) - tag = 0; - else - tag = setup->return_tag; + fix_char_size(decl); - numdim=0; - if (!setup) { - // Method functions can't return arrays, since it's broken anyway. - while (matchtoken('[')) { - /* the function returns an array, get this tag for the index and the array - * dimensions - */ - if (numdim == sDIMEN_MAX) { - error(53); /* exceeding maximum number of dimensions */ - return NULL; - } /* if */ - size=needsub(&idxtag[numdim],NULL); /* get size; size==0 for "var[]" */ - if (size==0) - error(9); /* invalid array size */ - #if INT_MAX < LONG_MAX - if (size > INT_MAX) - error(165); /* overflow, exceeding capacity */ - #endif - dim[numdim++]=(int)size; - } /* while */ - } + if (decl->opertok) + check_operatortag(decl->opertok, decl->type.tag, decl->name); - if (tag == pc_tag_string && numdim && dim[numdim-1]) - dim[numdim-1] = (size + sizeof(cell)-1) / sizeof(cell); - - if (!setup || !setup->name) { - tok=lex(&val,&str); - fpublic=(tok==tPUBLIC) || (tok==tSYMBOL && str[0]==PUBLIC_CHAR); - if (fnative) { - if (fpublic || tok==tSTOCK || tok==tSTATIC || (tok==tSYMBOL && *str==PUBLIC_CHAR)) - error(42); /* invalid combination of class specifiers */ - } else { - if (tok==tPUBLIC || tok==tSTOCK || tok==tSTATIC) - tok=lex(&val,&str); - } /* if */ - - if (tok==tOPERATOR) { - opertok=operatorname(symbolname); - if (opertok==0) - return NULL; /* error message already given */ - check_operatortag(opertok,tag,symbolname); - } else { - if (tok!=tSYMBOL && freading) { - error(10); /* illegal function or declaration */ - return NULL; - } /* if */ - strcpy(symbolname,str); - } /* if */ - } else { - strcpy(symbolname, setup->name); - } needtoken('('); /* only functions may be native/forward */ - sym=fetchfunc(symbolname,tag);/* get a pointer to the function entry */ + sym=fetchfunc(decl->name, decl->type.tag); /* get a pointer to the function entry */ if (sym==NULL) return NULL; if (fnative) { @@ -5057,18 +4834,14 @@ static symbol *funcstub(int fnative, const funcstub_setup_t *setup) } /* if */ sym->usage|=uFORWARD; - const int *thistag = NULL; - if (setup && setup->this_tag) - thistag = &setup->this_tag; - declargs(sym, FALSE, thistag); /* "declargs()" found the ")" */ sc_attachdocumentation(sym); /* attach any documenation to the function */ - if (!operatoradjust(opertok,sym,symbolname,tag)) + if (!operatoradjust(decl->opertok,sym,decl->name,decl->type.tag)) sym->usage &= ~uDEFINE; - if (getstates(symbolname)!=0) { - if (fnative || opertok!=0) + if (getstates(decl->name)!=0) { + if (fnative || decl->opertok!=0) error(82); /* native functions and operators may not have states */ else error(231); /* ignoring state specifications on forward declarations */ @@ -5078,7 +4851,7 @@ static symbol *funcstub(int fnative, const funcstub_setup_t *setup) * for a native function, this is optional */ if (fnative) { - if (opertok!=0) { + if (decl->opertok!=0) { needtoken('='); lexpush(); /* push back, for matchtoken() to retrieve again */ } /* if */ @@ -5101,16 +4874,13 @@ static symbol *funcstub(int fnative, const funcstub_setup_t *setup) } /* if */ } /* if */ - // Don't assume inline if we're being setup. - if (!setup) + // Don't look for line endings if we're inline. + if (tokid != tMETHODMAP) needtoken(tTERM); /* attach the array to the function symbol */ - if (numdim>0) { - assert(sym!=NULL); - sub=addvariable(symbolname,0,iARRAY,sGLOBAL,tag,dim,numdim,idxtag); - sub->parent=sym; - } /* if */ + if (decl->type.numdim>0) + error(141); litidx=0; /* clear the literal pool */ delete_symbols(&loctab,0,TRUE,TRUE);/* clear local variables queue */ @@ -5130,12 +4900,11 @@ static symbol *funcstub(int fnative, const funcstub_setup_t *setup) * glb_declared (altered) * sc_alignnext (altered) */ -static int newfunc(const funcstub_setup_t *setup,int fpublic,int fstatic,int stock,symbol **symp) +static int newfunc(declinfo_t *decl, const int *thistag, int fpublic, int fstatic, int stock, symbol **symp) { symbol *sym; - int argcnt,tok,tag,funcline; - int opertok,opererror; - char symbolname[sNAMEMAX+1]; + int argcnt,tok,funcline; + int opererror; char *str; cell val,cidx,glbdecl; short filenum; @@ -5143,7 +4912,6 @@ static int newfunc(const funcstub_setup_t *setup,int fpublic,int fstatic,int sto assert(litidx==0); /* literal queue should be empty */ litidx=0; /* clear the literal pool (should already be empty) */ - opertok=0; lastst=0; /* no statement yet */ cidx=0; /* just to avoid compiler warnings */ glbdecl=0; @@ -5153,44 +4921,20 @@ static int newfunc(const funcstub_setup_t *setup,int fpublic,int fstatic,int sto if (symp) *symp = NULL; - if (setup->name) { - assert(strlen(setup->name) <= METHOD_NAMEMAX); - strcpy(symbolname, setup->name); /* save symbol name */ - tag = setup->return_tag; - } else { - if (setup->return_tag != -1) - tag = setup->return_tag; - else - tag = pc_addtag(NULL); - tok=lex(&val,&str); - assert(!fpublic); - if (tok==tNATIVE || (tok==tPUBLIC && stock)) - error(42); /* invalid combination of class specifiers */ - if (tok==tOPERATOR) { - opertok=operatorname(symbolname); - if (opertok==0) - return TRUE; /* error message already given */ - check_operatortag(opertok,tag,symbolname); - } else { - if (tok!=tSYMBOL && freading) { - error(20,str); /* invalid symbol name */ - return FALSE; - } /* if */ - assert(strlen(str)<=sNAMEMAX); - strcpy(symbolname,str); - } /* if */ + if (decl->opertok) { + check_operatortag(decl->opertok, decl->type.tag, decl->name); } /* if */ /* check whether this is a function or a variable declaration */ if (!matchtoken('(')) return FALSE; /* so it is a function, proceed */ funcline=fline; /* save line at which the function is defined */ - if (symbolname[0]==PUBLIC_CHAR) { + if (decl->name[0]==PUBLIC_CHAR) { fpublic=TRUE; /* implicitly public function */ if (stock) error(42); /* invalid combination of class specifiers */ } /* if */ - sym=fetchfunc(symbolname,tag);/* get a pointer to the function entry */ + sym=fetchfunc(decl->name, decl->type.tag);/* get a pointer to the function entry */ if (sym==NULL || (sym->usage & uNATIVE)!=0) return TRUE; /* it was recognized as a function declaration, but not as a valid one */ if (fpublic) @@ -5212,25 +4956,16 @@ static int newfunc(const funcstub_setup_t *setup,int fpublic,int fstatic,int sto sc_status=curstatus; sc_reparse=TRUE; /* must add another pass to "initial scan" phase */ } /* if */ -#if 0 /* Not used for SourceMod */ - /* we want public functions to be explicitly prototyped, as they are called - * from the outside - */ - if (fpublic && (sym->usage & uFORWARD)==0) - error(235,symbolname); -#endif + /* declare all arguments */ - argcnt=declargs(sym, TRUE, &setup->this_tag); - opererror=!operatoradjust(opertok,sym,symbolname,tag); - if (strcmp(symbolname,uMAINFUNC)==0 || strcmp(symbolname,uENTRYFUNC)==0) { + argcnt = declargs(sym, TRUE, thistag); + opererror = !operatoradjust(decl->opertok, sym, decl->name, decl->type.tag); + if (strcmp(decl->name, uMAINFUNC)==0 || strcmp(decl->name, uENTRYFUNC)==0) { if (argcnt>0) error(5); /* "main()" and "entry()" functions may not have any arguments */ sym->usage|=uREAD; /* "main()" is the program's entry point: always used */ } /* if */ - state_id=getstates(symbolname); - if (state_id>0 && (opertok!=0 || strcmp(symbolname,uMAINFUNC)==0)) - error(82); /* operators may not have states, main() may neither */ - attachstatelist(sym,state_id); + /* "declargs()" found the ")"; if a ";" appears after this, it was a * prototype */ if (matchtoken(';')) { @@ -5252,26 +4987,14 @@ static int newfunc(const funcstub_setup_t *setup,int fpublic,int fstatic,int sto } /* if */ if ((sym->flags & flgDEPRECATED) != 0 && (sym->usage & uSTOCK) == 0) { char *ptr= (sym->documentation!=NULL) ? sym->documentation : ""; - error(234,symbolname,ptr); /* deprecated (probably a public function) */ + error(234, decl->name, ptr); /* deprecated (probably a public function) */ } /* if */ begcseg(); sym->usage|=uDEFINE; /* set the definition flag */ if (stock) sym->usage|=uSTOCK; - if (opertok!=0 && opererror) + if (decl->opertok != 0 && opererror) sym->usage &= ~uDEFINE; - /* if the function has states, dump the label to the start of the function */ - if (state_id!=0) { - constvalue *ptr=sym->states->next; - while (ptr!=NULL) { - assert(sc_status!=statWRITE || strlen(ptr->name)>0); - if (ptr->index==state_id) { - setlabel((int)strtol(ptr->name,NULL,16)); - break; - } /* if */ - ptr=ptr->next; - } /* while */ - } /* if */ startfunc(sym->name); /* creates stack frame */ insert_dbgline(funcline); setline(FALSE); @@ -5290,7 +5013,7 @@ static int newfunc(const funcstub_setup_t *setup,int fpublic,int fstatic,int sto lexpush(); } else { // We require '{' for new methods. - if (setup->is_new) + if (decl->is_new) needtoken('{'); /* Insert a separator so that comments following the statement will not @@ -5303,9 +5026,7 @@ static int newfunc(const funcstub_setup_t *setup,int fpublic,int fstatic,int sto insert_docstring_separator(); } /* if */ #endif - sc_curstates=state_id;/* set state id, for accessing global state variables */ statement(NULL,FALSE); - sc_curstates=0; if ((rettype & uRETVALUE)!=0) sym->usage|=uRETVALUE; if (declared!=0) { @@ -5452,7 +5173,7 @@ static int declargs(symbol *sym, int chkshadow, const int *thistag) if (!matchtoken(')')){ do { /* there are arguments; process them */ declinfo_t decl; - parse_decl(&decl, TYPEFLAG_ARGUMENT|TYPEFLAG_ENUMROOT); + parse_decl(&decl, DECLFLAG_ARGUMENT|DECLFLAG_ENUMROOT); assert(decl.type.numtags > 0); if (decl.type.ident == iVARARGS) { @@ -5599,7 +5320,7 @@ static void doarg(declinfo_t *decl, int offset, int fpublic, int chkshadow, argi assert(type->numtags > 0); if (type->tags[0] == pc_tag_string) { slength = arg->dim[arg->numdim - 1]; - arg->dim[arg->numdim - 1] = (type->array_size + sizeof(cell) - 1) / sizeof(cell); + arg->dim[arg->numdim - 1] = (type->size + sizeof(cell) - 1) / sizeof(cell); } if (matchtoken('=')) { assert(litidx==0); /* at the start of a function, this is reset */ @@ -5622,8 +5343,8 @@ static void doarg(declinfo_t *decl, int offset, int fpublic, int chkshadow, argi } } } else { - initials2(type->ident, type->tags[0], &type->array_size, arg->dim, arg->numdim, type->enumroot, 1, 0); - assert(type->array_size >= litidx); + initials2(type->ident, type->tags[0], &type->size, arg->dim, arg->numdim, type->enumroot, 1, 0); + assert(type->size >= litidx); /* allocate memory to hold the initial values */ arg->defvalue.array.data=(cell *)malloc(litidx*sizeof(cell)); if (arg->defvalue.array.data!=NULL) { diff --git a/sourcepawn/compiler/sc2.c b/sourcepawn/compiler/sc2.c index 25d17e7d..5662edec 100644 --- a/sourcepawn/compiler/sc2.c +++ b/sourcepawn/compiler/sc2.c @@ -3021,6 +3021,22 @@ SC_FUNC symbol *addvariable(const char *name,cell addr,int ident,int vclass,int return addvariable2(name,addr,ident,vclass,tag,dim,numdim,idxtag,0); } +SC_FUNC symbol *addvariable3(declinfo_t *decl,cell addr,int vclass,int slength) +{ + typeinfo_t *type = &decl->type; + return addvariable2( + decl->name, + addr, + type->ident, + vclass, + type->tag, + type->dim, + type->numdim, + type->idxtag, + slength + ); +} + SC_FUNC symbol *addvariable2(const char *name,cell addr,int ident,int vclass,int tag, int dim[],int numdim,int idxtag[],int slength) { diff --git a/sourcepawn/compiler/sc5.scp b/sourcepawn/compiler/sc5.scp index ab2cf3ae..b9a231af 100644 --- a/sourcepawn/compiler/sc5.scp +++ b/sourcepawn/compiler/sc5.scp @@ -31,14 +31,14 @@ SC_FUNC int strexpand(char *dest, unsigned char *source, int maxlen, unsigned ch #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}, {115,32}, {100,32}, {105,110}, {97,114}, {116,105}, {37,115}, {101,114}, {110,111}, {97,110}, {101,110}, {97,108}, {135,130}, {34,136}, - {143,34}, {114,101}, {111,114}, {117,110}, {121,32}, {138,129}, {97,116}, {115,105}, {115,116}, {101,132}, {100,101}, {109,140}, {32,144}, {41,10}, {109,98}, {116,104}, - {114,97}, {117,115}, {146,32}, {147,99}, {142,32}, {98,108}, {102,163}, {111,108}, {101,120}, {118,141}, {97,32}, {115,121}, {171,158}, {172,167}, {99,139}, {103,32}, - {134,160}, {116,121}, {115,10}, {174,149}, {112,101}, {103,117}, {181,155}, {137,32}, {134,182}, {116,111}, {102,133}, {115,151}, {99,104}, {105,132}, {97,165}, {105,131}, - {161,129}, {166,164}, {169,189}, {109,192}, {104,97}, {109,101}, {111,102}, {99,116}, {133,194}, {109,97}, {101,100}, {99,130}, {37,131}, {176,148}, {173,156}, {44,32}, - {117,108}, {99,111}, {98,128}, {118,134}, {112,145}, {198,32}, {105,190}, {211,214}, {116,97}, {101,131}, {130,32}, {154,186}, {134,97}, {102,105}, {118,128}, {184,129}, - {110,32}, {111,112}, {97,115}, {136,10}, {156,10}, {128,144}, {152,150}, {109,150}, {100,105}, {119,105}, {225,137}, {101,10}, {206,157}, {34,32}, {40,236}, {99,108}, - {97,131}, {203,152}, {139,32}, {141,32}, {196,222}, {101,108}, {177,112}, {151,122}, {108,128}, {166,142}, {133,32}, {159,32}, {216,175}, {133,175}, {231,188} + {101,32}, {116,32}, {111,110}, {115,32}, {100,32}, {105,110}, {97,114}, {116,105}, {37,115}, {101,114}, {110,111}, {97,110}, {101,110}, {97,108}, {135,130}, {114,101}, + {34,136}, {144,34}, {111,114}, {117,110}, {121,32}, {138,129}, {115,105}, {97,116}, {115,116}, {101,132}, {100,101}, {109,140}, {32,145}, {41,10}, {109,98}, {116,104}, + {114,97}, {117,115}, {146,32}, {147,99}, {142,32}, {98,108}, {102,163}, {111,108}, {101,120}, {118,141}, {97,32}, {115,121}, {99,139}, {171,158}, {134,160}, {173,167}, + {112,101}, {116,121}, {172,149}, {115,10}, {103,32}, {103,117}, {181,155}, {137,32}, {134,182}, {116,111}, {102,133}, {115,150}, {99,104}, {105,132}, {97,165}, {111,102}, + {105,131}, {161,129}, {166,164}, {169,189}, {109,193}, {104,97}, {109,101}, {99,116}, {174,148}, {133,195}, {109,97}, {101,100}, {101,131}, {99,130}, {37,131}, {175,156}, + {44,32}, {191,32}, {117,108}, {99,111}, {98,128}, {118,134}, {112,143}, {130,32}, {105,190}, {213,216}, {116,97}, {110,32}, {154,186}, {134,97}, {102,105}, {118,128}, + {184,129}, {100,105}, {111,112}, {97,115}, {136,10}, {156,10}, {128,145}, {152,151}, {109,151}, {119,105}, {97,131}, {226,137}, {101,10}, {207,157}, {34,32}, {99,108}, + {40,237}, {150,122}, {108,128}, {205,152}, {139,32}, {141,32}, {177,176}, {197,223}, {110,97}, {101,108}, {177,112}, {166,142}, {133,32}, {159,32}, {133,180} }; /*-*SCPACK end of pair table, do not change or remove this line */ @@ -184,146 +184,149 @@ static char *errmsg[] = { /*138*/ "const was specified twice\n", /*139*/ "could not find type \"%s\"\n", /*140*/ "new-style array types cannot specify dimension sizes as part of their type\n", +/*141*/ "natives cannot return arrays\n", #else - "\250\264\307\231\271k\214:\234\317bu\201fo\223\204\220\012", - "\202l\224\252s\205g\370\346e\233\201(\242\250\324\273\202) \256 f\247low ea\274 \042c\342e\042\012", - "\232\357\334\244\325\252loc\363\327\200\303ap\264\206 \372\252\321mpo\223\204\245ock\012", - "\371\234 \277\225imple\233t\312\012", - "\301\311\224\225\364\270t\262", - "\303\322a\273gn\231\271 \362\260y\012", - "\352\226\242\263\322\221\333\312\012", - "\303\322\252\361\213\201\250\324\273\202; \342sum\231z\211o\012", - "\310\315\367\200(nega\207ve\317z\211o \242ou\201\325bo\223ds\235", - "\310\301\242\232\357\334\216\012", - "\310out\227d\200\371\262", - "\310\301c\215l\317\225\252\302add\221s\262", - "\212 \214tr\224po\205\201(\212 pu\245ic \371s\235", - "\310\346e\233t; \225\372s\351t\274\012", - "\042\232fa\320t\355c\342\200\303\322\237\200l\342\201c\342\200\372s\351t\274 \346e\233t\012", - "m\320\207p\370\232fa\320t\203\372\042s\351t\274\042\012", - "\223\333\231\316\012", - "\205i\207\215iza\244d\226\252\250ce\312\203\232\357\206\231\367\353", - "\225\252lab\365:\344", - "\310\255 nam\345\012", - "\255 \215\221ad\224\333\312:\344", - "\303\322l\251u\200(n\202-\361\213t\235", - "\315a\273gn\233\201\303\322\227mp\370a\273gn\233t\012", - "\042b\221ak\355\242\042\313t\205ue\355\277ou\201\325\313t\250t\012", - "\301head\375\350ff\211\203from pro\271\261\264\012", - "\212 \376\375\042#if...\042\012", - "\310\274\334\307\267\361\213t\012", - "\310subscrip\201(\225\362\315\242\271o m\213\224subscripts):\344", - "\310\250\324\273\202\317\342sum\231z\211o\012", - "\321mpo\223\204\346e\233\201\225\357os\231a\201\237\200\214\204\325\335\370(\230\206t\231a\201l\205\200%d\235", - "\223k\212w\340\350\221c\207v\353", - "\315\205\232x ou\201\325bo\223d\203(\327\345\235", - "\315\303\322\205\232x\231(\327\345\235", - "\337do\331\225\364\252\232fa\320\201\251u\200(\337%d\235", - "\337\366\200mis\376 (\337%d\235", - "empt\224\346e\233t\012", - "\310\230r\375(po\273\245\224n\202-t\211m\205\226\231\230r\205g\235", - "\250t\240 \274\334\307\211\203\332l\205\353", - "\361\213\201\255 \304\203\212 \367\353", - "duplic\226\200\042c\342e\355lab\365 (\251u\200%d\235", - "\310\365lip\227s\317\315\367\200\277\225k\212wn\012", - "\310\321\236\205a\244\325\357\342\203s\264ci\335\211\262", - "\274\334\307\267\361\213\201\250ce\312\203r\213g\200f\242pack\231\230r\205g\012", - "po\227\216\363p\334\305t\211\203\303\324c\312\200\215l nam\231p\334\305t\211\262", - "\271o m\213\224\301\270t\262", - "\223k\212w\340\315\367\200(\327\345\235", - "\315\367\331do \225\376\317\242\232\230\205a\244\315\277\271o sm\215l\012", - "\315(\203do \225\376\012", - "\310l\205\200\313t\205ua\216\012", - "\310r\213g\353", - "\310subscript\317\241\200\042[ ]\355\352\226\222\203\332\311j\242\350\233\227\202\262", - "m\320\207-\350\233\227\202\363\260y\203\303\322f\320l\224\205i\207\215iz\312\012", - "\250ce\312\375\311ximum nu\236\267\325\350\233\227\202\262", - "\223\376\231\357os\375b\240c\200(\042}\042\235", - "\230\206\201\325\301bod\224\351\237ou\201\301head\211\012", - "\260ys\317loc\363\327\331\213\204\301\270t\203\263\322pu\245ic (\327\345\235", - "\223\272ish\231\250\324\273\332bef\222\200\321mpil\267\350\221c\207v\353", - "duplic\226\200\270t; sam\200\337\277p\342s\231t\351c\353", - "\301\337\311\224\225\364\252\232fa\320\201\251u\200(\327\345\235", - "m\320\207p\370\042#\365se\355\350\221c\207v\331betwe\214 \042#if ... #\214\350f\042\012", - "\042#\365seif\355\350\221c\207\336f\247low\203\362\042#\365se\355\350\221c\207v\353", - "nu\236\267\325\352\213d\203do\331\225\335\201\237\200\352\226\222\012", - "\301\221s\320\201\374\325\352\226\222\234 \303\322\220\012", - "\263\274\213g\200\324\333\231\352\226\222\262", - "\301\337\311\224\202l\224\364\252s\205g\370\374(\337%d\235", - "\301\337\311\224\225\322\252\221f\211\214c\200\337\242\362\315(\337\220\235", - "\327\200\263\322bo\373\252\221f\211\214c\200\213\204\362\315(\327\345\235", - "\310\240\216\363nu\236\267\324ci\227\332\372#p\240g\311\012", - "\240\216\363nu\236\267f\222\311\201\215\221ad\224\333\312\012", - "\240\216\363nu\236\267supp\222\201w\360\225\214\276\312\012", - "\241\211-\333\231\352\226\242\303\322\232\357\206\231bef\222\200\241\200(\371\234\235", - "\042\367e\306\355\352\226\242\277\310\332\042\371\355\255\262", - "\301\337\303\322\362\315(\337\220\235", - "#\333\200p\226t\211\340\303\230\206\201\351\373\362\215p\304be\207c \274\334\307\211\012", - "\205pu\201l\205\200\271o l\202\257(aft\267subs\207tu\216s\235", - "\253n\330x \211r\242\372\237\200\250\324\273\202\317\242\310\301c\215l\012", - "m\215f\222m\231UTF-8 \214\321d\205g\317\242c\222rupt\231\335le: \343", - "\301\241\331bo\373\042\221turn\355\213\204\042\221tur\340<\251ue>\042\012", - "\205\313\227\230\214\201\221tur\340\261\264\203(\315& n\202-\260y\235", - "\223k\212w\340\255\317\242\225\252\361\213\201\255 \356", - "\263\330k\200\252\374\360\252\232fa\320\201\251u\200f\242\362\205\232x\231\315p\334\305t\267\356", - "\241\211-\333\231\352\226\222\203\213\204na\207\336\371\203\311\224\225\364\346e\262", - "\252\301\242\327\200\311\224\202l\224b\365\202\257\271 \252s\205g\370au\271\347\332\356", - "\346\200\313fli\307: \202\200\325\237\200\346\331\277\215\221ad\224a\273gn\231\271 a\212\237\267imple\233\330\244\356", - "\212 \346\331\206\200\333\231f\242\316\012", - "\223k\212w\340au\271\347\202\344", - "\223k\212w\340\346\345 f\242au\271\347\202\344", - "pu\245ic \327\331\213\204loc\363\327\331\311\224\225\364\346\331\356", - "\346\200\327\331\311\224\225\322\205i\207\215iz\231\356", - "pu\245ic \371\203\311\224\225\221tur\340\260y\203\356", - "a\236i\265ou\203\361\213t; \374ov\211rid\200\277\221qui\221\204\356", - "nu\236\267\325\270t\203do\331\225\376 \333i\216\012", - "\250\264\307\231\374nam\200id\214\207\335\211\012", - "\301\214um\211a\244\221qui\221\203\223iqu\200\330g\012", - "\263\364\221qui\221\204p\334\305t\211\203aft\267\341\216\363p\334\305t\211\262", - "\321\320\204\225\272\204\305\236\211\234 \372\230ruc\201\220\012", - "\316 do\331\225\364\252\376\375\261\264\012", - "\366\345 sho\320\204\322\220 \372new-\230y\370\232\357\334\216\262", - "\314sho\320\204\225\364\362\250plici\201\221tur\340\261\264\012", - "\301pro\271\261\264\203do \225\376\012", - "s\264cif\224ei\237\267\215l \350\233\227\202\203\242\202l\224\237\200l\342\201\350\233\227\202\012", - "\263\272\204\314\343", - "\314w\360\215\221ad\224\333\231\332\237\277\343", - "\263\272\204\213\224\305\237od\203f\242\343", - "\263\272\204\305\237o\204\242pr\352t\224\210.\343", - "\263c\215l \305\237od\203\332\362\260y\012", - "\263c\215l \305\237od\203\332\252\371\012", - "\305\237o\204\303\364\252\335rs\201\337\321mpa\207\245\200\351\373\237\200\314\366\200(\210\235", - "\314nam\200\303\230\206\201\351\373\362upp\211c\342\200lett\211\012", - "\314\304\203\215\221ad\224be\214 \333\231(\324vio\241l\224se\214 \360\210\235", - "\250\264\307\231id\214\207\335\267- d\275you f\222ge\201\252\261\264?\012", - "\361ru\307\242\301\303\221tur\340\374\343", - "\263\333\200\361ru\307\242f\222\234; \215\221ad\224\250i\230\203\360\252\343", - "miss\375\261\264\317\242\314\303\364\237\200sam\200nam\200\360\314\220\012", - "\263\241\200\232lete\317\314\314\304\203\212 \232\230ru\307\222\012", - "\212 \305\237od\311p \242\357\342\203w\360fo\223\204f\242\343", - "\212 \232\230ru\307\242w\360fo\223\204f\242\314\343", - "\232\230ru\307\222\203\303\322na\207\336\371\262", - "\232\230ru\307\222\203\263\364\250t\240 \270t\262", - "\305\237od\311p \213\204\357\342\203\227gn\226u\221\203\303\241\200new-\230y\370\366\200\232\357\334\216\262", - "\263s\264cif\224\315\350\233\227\202\203\332bo\373\366\200\213\204na\305\012", - "\250\264\307\231\366\200\250\324\273\202\012", - "f\320ly-qu\215i\335\231nam\345 \277\271o l\202g\317wo\320\204\322tr\243\226\231\271\344", - "\223\250\264\307\231\271k\214\317\250\264\307\231\305\237o\204\242pr\352\261\012", - "\250\264\307\231\042na\207ve\355\242\042get\042\012", - "\314f\242\314\215\221ad\224\250i\230\262", - "pr\352t\224gett\211\203\263accep\201\250t\240 \270t\262", - "\314\303\364\237\200sam\200\221tur\340\366\200\360pr\352t\224\314(\210\235", - "\263mix \305\237od\311p\203\213\204\357\342s\331\351\373\205h\211it\213c\353", - "\263\321\211c\200\371\203\271 \251ue\262", - "\263\321\211c\200objec\201\366\200\314\271 n\202-objec\201\366\200\343", - "\263\321\211c\200n\202-objec\201\366\200\314\271 objec\201\366\200\343", - "\263\321\211c\200\223\221l\226\231objec\201\261\264\203\314\213\204\343", - "\366\200mis\376 (\314\213\204\210\235", - "\263\241\200\362objec\201\372\252m\320\207-\374s\365e\307\222\012", - "\260y\203\206\200\225supp\222t\231\360\221tur\340\261\264\262", - "\263mix \221f\211\214c\200\213\204\315\261\264\262", - "\313s\201w\360s\264ci\335\231t\351c\353", - "\321\320\204\225\272\204\366\345\012" + "\250\260\307\231\271k\214:\234\320bu\201fo\223\204\221\012", + "\202l\224\252s\205g\362\347e\233\201(\242\250\326\273\202) \254 f\247low ea\274 \042c\343e\042\012", + "\232\357\335\244\321\252loc\365\331\200\304ap\260\206 \374\252\323mpo\223\204\245ock\012", + "\373\234 \300\225imple\233t\313\012", + "\302\312\224\225\367\270t\263", + "\304\324a\273gn\231\271 \364\256y\012", + "\353\227\242\262\324\217\334\313\012", + "\304\324\252\363\213\201\250\326\273\202; \343sum\231z\211o\012", + "\311\310\361\200(nega\207ve\320z\211o \242ou\201\321bo\223ds\235", + "\311\302\242\232\357\335\216\012", + "\311out\226d\200\373\263", + "\311\302c\215l\320\225\252\303add\217s\263", + "\212 \214tr\224po\205\201(\212 pu\245ic \373s\235", + "\311\347e\233t; \225\374s\351t\274\012", + "\042\232fa\322t\356c\343\200\304\324\237\200l\343\201c\343\200\374s\351t\274 \347e\233t\012", + "m\322\207p\362\232fa\322t\203\374\042s\351t\274\042\012", + "\223\334\231\317\012", + "\205i\207\215iza\244d\227\252\250ce\313\203\232\357\206\231\361\354", + "\225\252lab\371:\345", + "\311\257 \370m\346\012", + "\257 \215\217ad\224\334\313:\345", + "\304\324l\251u\200(n\202-\363\213t\235", + "\310a\273gn\233\201\304\324\226mp\362a\273gn\233t\012", + "\042b\217ak\356\242\042\315t\205ue\356\300ou\201\321\315t\250t\012", + "\302head\376\341ff\211\203from pro\271\366\012", + "\212 \350\274\376\042#if...\042\012", + "\311\274\335\307\267\363\213t\012", + "\311subscrip\201(\225\364\310\242\271o m\213\224subscripts):\345", + "\311\250\326\273\202\320\343sum\231z\211o\012", + "\323mpo\223\204\347e\233\201\225\357os\231a\201\237\200\214\204\321\336\362(\230\206t\231a\201l\205\200%d\235", + "\223k\212w\333\341\217c\207v\354", + "\310\205\232x ou\201\321bo\223d\203(\331\346\235", + "\310\304\324\205\232x\231(\331\346\235", + "\340do\314\225\367\252\232fa\322\201\251u\200(\340%d\235", + "\340\372\200mis\350\274 (\340%d\235", + "empt\224\347e\233t\012", + "\311\230r\376(po\273\245\224n\202-t\211m\205\227\231\230r\205g\235", + "\250t\240 \274\335\307\211\203\327l\205\354", + "\363\213\201\257 \305\203\212 \361\354", + "duplic\227\200\042c\343e\356lab\371 (\251u\200%d\235", + "\311\371lip\226s\320\310\361\200\300\225k\212wn\012", + "\311\323\236\205a\244\321\357\343\203s\260ci\336\211\263", + "\274\335\307\267\363\213\201\250ce\313\203r\213g\200f\242pack\231\230r\205g\012", + "po\226\216\365p\335\306t\211\203\304\326c\313\200\215l \370m\231p\335\306t\211\263", + "\271o m\213\224\302\270t\263", + "\223k\212w\333\310\361\200(\331\346\235", + "\310\361\314do \225\350\274\320\242\232\230\205a\244\310\300\271o sm\215l\012", + "\310(\203do \225\350\274\012", + "\311l\205\200\315t\205ua\216\012", + "\311r\213g\354", + "\311subscript\320\241\200\042[ ]\356\353\227\222\203\327\312j\242\341\233\226\202\263", + "m\322\207-\341\233\226\202\365\256y\203\304\324f\322l\224\205i\207\215iz\313\012", + "\250ce\313\376\312ximum nu\236\267\321\341\233\226\202\263", + "\223\350\274\231\357os\376b\240c\200(\042}\042\235", + "\230\206\201\321\302bod\224\351\237ou\201\302head\211\012", + "\256ys\320loc\365\331\314\213\204\302\270t\203\262\324pu\245ic (\331\346\235", + "\223\272ish\231\250\326\273\327bef\222\200\323mpil\267\341\217c\207v\354", + "duplic\227\200\270t; sam\200\340\300p\343s\231t\351c\354", + "\302\340\312\224\225\367\252\232fa\322\201\251u\200(\331\346\235", + "m\322\207p\362\042#\371se\356\341\217c\207v\314betwe\214 \042#if ... #\214\341f\042\012", + "\042#\371seif\356\341\217c\207\337f\247low\203\364\042#\371se\356\341\217c\207v\354", + "nu\236\267\321\353\213d\203do\314\225\336\201\237\200\353\227\222\012", + "\302\217s\322\201\332\264\321\353\227\222\234 \304\324\221\012", + "\262\274\213g\200\326\334\231\353\227\222\263", + "\302\340\312\224\202l\224\367\252s\205g\362\332\264(\340%d\235", + "\302\340\312\224\225\324\252\217f\211\214c\200\340\242\364\310(\340\221\235", + "\331\200\262\324bo\375\252\217f\211\214c\200\213\204\364\310(\331\346\235", + "\311\240\216\365nu\236\267\326ci\226\327\374#p\240g\312\012", + "\240\216\365nu\236\267f\222\312\201\215\217ad\224\334\313\012", + "\240\216\365nu\236\267supp\222\201w\352\225\214\276\313\012", + "\241\211-\334\231\353\227\242\304\324\232\357\206\231bef\222\200\241\200(\373\234\235", + "\042\361e\277\356\353\227\242\300\311\327\042\373\356\257\263", + "\302\340\304\324\364\310(\340\221\235", + "#\334\200p\227t\211\333\304\230\206\201\351\375\364\215p\305be\207c \274\335\307\211\012", + "\205pu\201l\205\200\271o l\202\264(aft\267subs\207tu\216s\235", + "\253n\332x \211r\242\374\237\200\250\326\273\202\320\242\311\302c\215l\012", + "m\215f\222m\231UTF-8 \214\323d\205g\320\242c\222rupt\231\336le: \344", + "\302\241\314bo\375\042\217turn\356\213\204\042\217tur\333<\251ue>\042\012", + "\205\315\226\230\214\201\217tur\333\366\203(\310& n\202-\256y\235", + "\223k\212w\333\257\320\242\225\252\363\213\201\257 \360", + "\262\332k\200\252\332\264\352\252\232fa\322\201\251u\200f\242\364\205\232x\231\310p\335\306t\267\360", + "\241\211-\334\231\353\227\222\203\213\204\370\207\337\373\203\312\224\225\367\347e\263", + "\252\302\242\331\200\312\224\202l\224b\371\202\264\271 \252s\205g\362au\271\350\327\360", + "\347\200\315fli\307: \202\200\321\237\200\347\314\300\215\217ad\224a\273gn\231\271 a\212\237\267imple\233\332\244\360", + "\212 \347\314\206\200\334\231f\242\317\012", + "\223k\212w\333au\271\350\202\345", + "\223k\212w\333\347\346 f\242au\271\350\202\345", + "pu\245ic \331\314\213\204loc\365\331\314\312\224\225\367\347\314\360", + "\347\200\331\314\312\224\225\324\205i\207\215iz\231\360", + "pu\245ic \373\203\312\224\225\217tur\333\256y\203\360", + "a\236i\265ou\203\363\213t; \332\264ov\211rid\200\300\217qui\217\204\360", + "nu\236\267\321\270t\203do\314\225\350\274 \334i\216\012", + "\250\260\307\231\332\264\370m\200id\214\207\336\211\012", + "\302\214um\211a\244\217qui\217\203\223iqu\200\332g\012", + "\262\367\217qui\217\204p\335\306t\211\203aft\267\342\216\365p\335\306t\211\263", + "\323\322\204\225\272\204\306\236\211\234 \374\230ruc\201\221\012", + "\317 do\314\225\367\252\350\274\376\366\012", + "\372\346 sho\322\204\324\221 \374new-\230y\362\232\357\335\216\263", + "\316sho\322\204\225\367\364\250plici\201\217tur\333\366\012", + "\302pro\271\366\203do \225\350\274\012", + "s\260cif\224ei\237\267\215l \341\233\226\202\203\242\202l\224\237\200l\343\201\341\233\226\202\012", + "\262\272\204\316\344", + "\316w\352\215\217ad\224\334\231\327\237\300\344", + "\262\272\204\213\224\306\237od\203f\242\344", + "\262\272\204\306\237o\204\242pr\353t\224\210.\344", + "\262c\215l \306\237od\203\327\364\256y\012", + "\262c\215l \306\237od\203\327\252\373\012", + "\306\237o\204\304\367\252\336rs\201\340\323mpa\207\245\200\351\375\237\200\316\372\200(\210\235", + "\316\370m\200\304\230\206\201\351\375\364upp\211c\343\200lett\211\012", + "\316\305\203\215\217ad\224be\214 \334\231(\326vio\241l\224se\214 \352\210\235", + "\250\260\307\231id\214\207\336\267- d\275you f\222ge\201\252\366?\012", + "\363ru\307\242\302\304\217tur\333\332\264\344", + "\262\334\200\363ru\307\242f\222\234; \215\217ad\224\250i\230\203\352\252\344", + "miss\376\366\320\242\316\304\367\237\200sam\200\370m\200\352\316\221\012", + "\262\241\200\232lete\320\316\316\305\203\212 \232\230ru\307\222\012", + "\212 \306\237od\312p \242\357\343\203w\352fo\223\204f\242\344", + "\212 \232\230ru\307\242w\352fo\223\204f\242\316\344", + "\232\230ru\307\222\203\304\324\370\207\337\373\263", + "\232\230ru\307\222\203\262\367\250t\240 \270t\263", + "\306\237od\312p \213\204\357\343\203\226gn\227u\217\203\304\241\200new-\230y\362\372\200\232\357\335\216\263", + "\262s\260cif\224\310\341\233\226\202\203\327bo\375\372\200\213\204\370\306\012", + "\250\260\307\231\372\200\250\326\273\202\012", + "f\322ly-qu\215i\336\231\370m\346 \300\271o l\202g\320wo\322\204\324tr\243\227\231\271\345", + "\223\250\260\307\231\271k\214\320\250\260\307\231\306\237o\204\242pr\353\261\012", + "\250\260\307\231\042\370\207ve\356\242\042get\042\012", + "\316f\242\316\215\217ad\224\250i\230\263", + "pr\353t\224gett\211\203\262accep\201\250t\240 \270t\263", + "\316\304\367\237\200sam\200\217tur\333\372\200\352pr\353t\224\316(\210\235", + "\262mix \306\237od\312p\203\213\204\357\343s\314\351\375\205h\211it\213c\354", + "\262\323\211c\200\373\203\271 \251ue\263", + "\262\323\211c\200objec\201\372\200\316\271 n\202-objec\201\372\200\344", + "\262\323\211c\200n\202-objec\201\372\200\316\271 objec\201\372\200\344", + "\262\323\211c\200\223\217l\227\231objec\201\366\203\316\213\204\344", + "\372\200mis\350\274 (\316\213\204\210\235", + "\262\241\200\364objec\201\374\252m\322\207-\332\264s\371e\307\222\012", + "\256y\203\206\200\225supp\222t\231\352\217tur\333\366\263", + "\262mix \217f\211\214c\200\213\204\310\366\263", + "\315s\201w\352s\260ci\336\231t\351c\354", + "\323\322\204\225\272\204\372\346\012", + "new-\230y\362\310\366\203\262s\260cif\224\341\233\226\327\361\314\352p\206\201\321\237eir \366\012", + "\370\207v\314\262\217tur\333\256y\263" #endif }; @@ -348,18 +351,18 @@ static char *fatalmsg[] = { /*170*/ "assertion failed: %s\n", /*171*/ "user error: %s\n", #else - "\263\221a\204from \335le:\344", - "\263writ\200\271 \335le:\344", - "t\276\200ov\211flow:\344", - "\205suf\335ci\214\201\305m\222y\012", - "\310\342se\236l\267\205\230ruc\216\344", - "num\211ic ov\211flow\317\250ce\312\375capaci\261\012", - "\321mpil\231scrip\201\250ce\312\203\237\200\311ximum \305m\222\224\367\200(%l\204bytes\235", - "\271o m\213\224\211r\242\305ssag\331\332\202\200l\205\353", - "\321\232pag\200\311pp\375\335\370\225fo\223d\012", - "\310p\226h:\344", - "\342s\211\244fail\312: \343", - "\241\267\211r\222: \343" + "\262\217a\204from \336le:\345", + "\262writ\200\271 \336le:\345", + "t\276\200ov\211flow:\345", + "\205suf\336ci\214\201\306m\222y\012", + "\311\343se\236l\267\205\230ruc\216\345", + "num\211ic ov\211flow\320\250ce\313\376capaci\261\012", + "\323mpil\231scrip\201\250ce\313\203\237\200\312ximum \306m\222\224\361\200(%l\204bytes\235", + "\271o m\213\224\211r\242\306ssag\314\327\202\200l\205\354", + "\323\232pag\200\312pp\376\336\362\225fo\223d\012", + "\311p\227h:\345", + "\343s\211\244fail\313: \344", + "\241\267\211r\222: \344" #endif }; @@ -403,43 +406,43 @@ static char *warnmsg[] = { /*235*/ "public function lacks forward declaration (symbol \"%s\")\n", /*236*/ "unknown parameter in substitution (incorrect #define pattern)\n" #else - "\316 \277tr\243\226\231\271 %\204\274\334\307\211\262", - "\221\333i\244\325\361\213t/\311cro \356", - "nu\236\267\325\270t\203do\331\225\376 \333i\216\012", - "\255 \277nev\267\241\312:\344", - "\255 \277a\273gn\231\252\251u\200\237a\201\277nev\267\241\312:\344", - "\221d\223d\213\201\321\232: \361\213\201\250\324\273\332\277z\211o\012", - "\221d\223d\213\201te\230: \361\213\201\250\324\273\332\277n\202-z\211o\012", - "\223k\212w\340#p\240g\311\012", - "\301\351\373\374\221s\320\201\241\231bef\222\200\333i\216\317f\222c\375\221p\206s\353", - "\371\234 sho\320\204\221tur\340\252\251u\353", - "po\273\245\200\241\200\325\255 bef\222\200\205i\207\215iza\216:\344", + "\317 \300tr\243\227\231\271 %\204\274\335\307\211\263", + "\217\334i\244\321\363\213t/\312cro \360", + "nu\236\267\321\270t\203do\314\225\350\274 \334i\216\012", + "\257 \300nev\267\241\313:\345", + "\257 \300a\273gn\231\252\251u\200\237a\201\300nev\267\241\313:\345", + "\217d\223d\213\201\323\232: \363\213\201\250\326\273\327\300z\211o\012", + "\217d\223d\213\201te\230: \363\213\201\250\326\273\327\300n\202-z\211o\012", + "\223k\212w\333#p\240g\312\012", + "\302\351\375\332\264\217s\322\201\241\231bef\222\200\334i\216\320f\222c\376\217p\206s\354", + "\373\234 sho\322\204\217tur\333\252\251u\354", + "po\273\245\200\241\200\321\257 bef\222\200\205i\207\215iza\216:\345", "po\273\245\224\223\205t\214d\231a\273gn\233t\012", - "po\273\245\224\223\205t\214d\231bit\351s\200\352a\216\012", - "\374mis\376\012", - "po\273\245\224\252\042\361\355\315\337w\360\205t\214\232d:\344", - "\250\324\273\332\304\203\212 effe\307\012", - "ne\230\231\321m\233t\012", - "loos\200\205d\214\330\216\012", - "\247\204\230y\370pro\271\261\264\203\241\231\351\373\341\216\363semic\247umn\262", - "loc\363\327\345 s\304dow\203\252\327\200a\201\252\324c\312\375lev\365\012", - "\250\324\273\332\351\373\374ov\211rid\200\303ap\264\206 betwe\214 p\206\214\237ese\262", - "lab\365 nam\345 s\304dow\203\374na\305\012", - "nu\236\267\325\350git\203\250ce\312\203\240\216\363nu\236\267\324ci\227\202\012", - "\221d\223d\213\201\042\367e\306\042: \337\367\200\277\215way\2031 \356", - "\205\232t\211m\205\226\200\315\367\200\372\042\367e\306\355\250\324\273\332\356", - "\223\221a\274\276\200\321\232\012", - "\252\327\200\277a\273gn\231\271 its\365f \356", - "m\222\200\205i\207\215iz\211\203\237\362\214um \335\365d\262", - "l\214g\373\325\205i\207\215iz\267\250ce\312\203\367\200\325\237\200\214um \335\365d\012", - "\205\232x \374mis\376 \356", - "\212 imple\233\330\244f\242\346\345 \372\371\234\317\212 f\215l-back\012", - "\346\200s\264ci\335ca\244\332f\222w\206\204\232\357\334\244\277ig\212\221d\012", - "outpu\201\335\370\277writt\214\317bu\201\351\373\321mpac\201\214\321d\375\350s\276\312\012", - "\346\200\327\345 s\304dow\203\252glob\363\327\353", - "\316 \277m\206k\231\360\232\324c\226\312: \343", - "pu\245ic \301lack\203f\222w\206\204\232\357\334\244\356", - "\223k\212w\340p\334\305t\267\372subs\207tu\244(\205c\222\221c\201#\333\200p\226t\211n\235" + "po\273\245\224\223\205t\214d\231bit\351s\200\353a\216\012", + "\332\264mis\350\274\012", + "po\273\245\224\252\042\363\356\310\340w\352\205t\214\232d:\345", + "\250\326\273\327\305\203\212 effe\307\012", + "ne\230\231\323m\233t\012", + "loos\200\205d\214\332\216\012", + "\247\204\230y\362pro\271\366\203\241\231\351\375\342\216\365semic\247umn\263", + "loc\365\331\346 s\305dow\203\252\331\200a\201\252\326c\313\376lev\371\012", + "\250\326\273\327\351\375\332\264ov\211rid\200\304ap\260\206 betwe\214 p\206\214\237ese\263", + "lab\371 \370m\346 s\305dow\203\332\264\370\306\012", + "nu\236\267\321\341git\203\250ce\313\203\240\216\365nu\236\267\326ci\226\202\012", + "\217d\223d\213\201\042\361e\277\042: \340\361\200\300\215way\2031 \360", + "\205\232t\211m\205\227\200\310\361\200\374\042\361e\277\356\250\326\273\327\360", + "\223\217a\274\276\200\323\232\012", + "\252\331\200\300a\273gn\231\271 its\371f \360", + "m\222\200\205i\207\215iz\211\203\237\364\214um \336\371d\263", + "l\214g\375\321\205i\207\215iz\267\250ce\313\203\361\200\321\237\200\214um \336\371d\012", + "\205\232x \332\264mis\350\274 \360", + "\212 imple\233\332\244f\242\347\346 \374\373\234\320\212 f\215l-back\012", + "\347\200s\260ci\336ca\244\327f\222w\206\204\232\357\335\244\300ig\212\217d\012", + "outpu\201\336\362\300writt\214\320bu\201\351\375\323mpac\201\214\323d\376\341s\276\313\012", + "\347\200\331\346 s\305dow\203\252glob\365\331\354", + "\317 \300m\206k\231\352\232\326c\227\313: \344", + "pu\245ic \302lack\203f\222w\206\204\232\357\335\244\360", + "\223k\212w\333p\335\306t\267\374subs\207tu\244(\205c\222\217c\201#\334\200p\227t\211n\235" #endif }; From 3cf9e56a19dfad9dded8a21c8fb5b408e56f603d Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 4 Jul 2014 14:31:56 -0700 Subject: [PATCH 2/7] Fix various bugs in global newdecl support. --- plugins/include/sourcemod.inc | 6 +- plugins/mapchooser.sp | 2 +- plugins/nextmap.sp | 26 +-- sourcepawn/compiler/sc.h | 6 +- sourcepawn/compiler/sc1.c | 78 +++++-- sourcepawn/compiler/sc2.c | 2 +- sourcepawn/compiler/sc3.c | 4 +- sourcepawn/compiler/sc5.scp | 396 +++++++++++++++++----------------- 8 files changed, 283 insertions(+), 237 deletions(-) diff --git a/plugins/include/sourcemod.inc b/plugins/include/sourcemod.inc index 8d894cbd..6b1f8d48 100644 --- a/plugins/include/sourcemod.inc +++ b/plugins/include/sourcemod.inc @@ -108,7 +108,7 @@ public Plugin:myinfo; * * @noreturn */ -forward OnPluginStart(); +forward void OnPluginStart(); /** * @deprecated Use AskPluginLoad2() instead. @@ -167,7 +167,7 @@ forward OnGameFrame(); * @note This used to be OnServerLoad(), which is now deprecated. * Plugins still using the old forward will work. */ -forward OnMapStart(); +forward void OnMapStart(); /** * Called right before a map ends. @@ -184,7 +184,7 @@ forward OnMapEnd(); * * @noreturn */ -forward OnConfigsExecuted(); +forward void OnConfigsExecuted(); /** * This is called once, right after OnMapStart() but any time before diff --git a/plugins/mapchooser.sp b/plugins/mapchooser.sp index 1842d18e..8c36a086 100644 --- a/plugins/mapchooser.sp +++ b/plugins/mapchooser.sp @@ -1200,4 +1200,4 @@ public Native_GetNominatedMapList(Handle:plugin, numParams) } return; -} \ No newline at end of file +} diff --git a/plugins/nextmap.sp b/plugins/nextmap.sp index 4f11925d..9a4278ed 100644 --- a/plugins/nextmap.sp +++ b/plugins/nextmap.sp @@ -36,7 +36,7 @@ #include #include "include/nextmap.inc" -public Plugin:myinfo = +public Plugin myinfo = { name = "Nextmap", author = "AlliedModders LLC", @@ -46,13 +46,13 @@ public Plugin:myinfo = }; -new g_MapPos = -1; -new Handle:g_MapList = INVALID_HANDLE; -new g_MapListSerial = -1; +int g_MapPos = -1; +Handle g_MapList = INVALID_HANDLE; +int g_MapListSerial = -1; -new g_CurrentMapStartTime; +int g_CurrentMapStartTime; -public APLRes:AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) +public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) { decl String:game[128]; GetGameFolderName(game, sizeof(game)); @@ -73,7 +73,7 @@ public APLRes:AskPluginLoad2(Handle myself, bool late, char[] error, int err_max } -public OnPluginStart() +public void OnPluginStart() { LoadTranslations("common.phrases"); LoadTranslations("nextmap.phrases"); @@ -89,12 +89,12 @@ public OnPluginStart() SetNextMap(currentMap); } -public OnMapStart() +public void OnMapStart() { g_CurrentMapStartTime = GetTime(); } -public OnConfigsExecuted() +public void OnConfigsExecuted() { decl String:lastMap[64], String:currentMap[64]; GetNextMap(lastMap, sizeof(lastMap)); @@ -109,7 +109,7 @@ public OnConfigsExecuted() } } -public Action:Command_List(int client, int args) +public Action Command_List(int client, int args) { PrintToConsole(client, "Map Cycle:"); @@ -124,7 +124,7 @@ public Action:Command_List(int client, int args) return Plugin_Handled; } -FindAndSetNextMap() +void FindAndSetNextMap() { if (ReadMapList(g_MapList, g_MapListSerial, @@ -169,7 +169,7 @@ FindAndSetNextMap() SetNextMap(mapName); } -public Action:Command_MapHistory(int client, int args) +public Action Command_MapHistory(int client, int args) { new mapCount = GetMapHistorySize(); @@ -202,7 +202,7 @@ public Action:Command_MapHistory(int client, int args) return Plugin_Handled; } -FormatTimeDuration(char[] buffer, int maxlen, int time) +int FormatTimeDuration(char[] buffer, int maxlen, int time) { new days = time / 86400; new hours = (time / 3600) % 24; diff --git a/sourcepawn/compiler/sc.h b/sourcepawn/compiler/sc.h index 6edd5c48..dff12a86 100644 --- a/sourcepawn/compiler/sc.h +++ b/sourcepawn/compiler/sc.h @@ -521,8 +521,8 @@ typedef enum s_optmark { #define METHODMAPTAG 0x04000000Lu #define STRUCTTAG 0x02000000Lu #define TAGMASK (~PUBLICTAG) -#define TAGTYPEMASK (FUNCTAG | OBJECTTAG | ENUMTAG | METHODMAPTAG) -#define TAGFLAGMASK (FIXEDTAG | TAGTYPEMASK | STRUCTTAG) +#define TAGTYPEMASK (FUNCTAG | OBJECTTAG | ENUMTAG | METHODMAPTAG | STRUCTTAG) +#define TAGFLAGMASK (FIXEDTAG | TAGTYPEMASK) #define CELL_MAX (((ucell)1 << (sizeof(cell)*8-1)) - 1) @@ -602,7 +602,7 @@ void sp_fdbg_ntv_hook(int index, symbol *sym); /* function prototypes in SC1.C */ SC_FUNC void set_extension(char *filename,char *extension,int force); -SC_FUNC symbol *fetchfunc(char *name,int tag); +SC_FUNC symbol *fetchfunc(char *name); SC_FUNC char *operator_symname(char *symname,char *opername,int tag1,int tag2,int numtags,int resulttag); SC_FUNC char *funcdisplayname(char *dest,char *funcname); SC_FUNC int constexpr(cell *val,int *tag,symbol **symptr); diff --git a/sourcepawn/compiler/sc1.c b/sourcepawn/compiler/sc1.c index 00b19a18..47c60507 100644 --- a/sourcepawn/compiler/sc1.c +++ b/sourcepawn/compiler/sc1.c @@ -3101,8 +3101,6 @@ static int parse_new_typeexpr(typeinfo_t *type, const token_t *first, int flags) type->tag = sc_rationaltag; } else if (strcmp(tok.str, "bool") == 0) { type->tag = pc_tag_bool; - } else if (strcmp(tok.str, "char") == 0) { - type->tag = pc_tag_string; } else { type->tag = pc_findtag(tok.str); if (type->tag == sc_rationaltag) { @@ -3142,6 +3140,7 @@ static int parse_new_typeexpr(typeinfo_t *type, const token_t *first, int flags) } } while (matchtoken('[')); type->ident = iARRAY; + type->size = 0; } if (flags & DECLFLAG_ARGUMENT) { @@ -3360,6 +3359,7 @@ int parse_decl(declinfo_t *decl, int flags) // This must be a newdecl, "x[] y" or "x[] &y", the latter of which // is illegal, but we flow it through the right path anyway. lexpush(); + decl->has_postdims = FALSE; return parse_new_decl(decl, &ident.tok, flags); } @@ -4471,7 +4471,7 @@ static int compare_tag(int tag1, int tag2) * Finds a function in the global symbol table or creates a new entry. * It does some basic processing and error checking. */ -SC_FUNC symbol *fetchfunc(char *name,int tag) +SC_FUNC symbol *fetchfunc(char *name) { symbol *sym; @@ -4483,17 +4483,9 @@ SC_FUNC symbol *fetchfunc(char *name,int tag) error(21,name); /* yes, and it is a native */ } /* if */ assert(sym->vclass==sGLOBAL); - if ((sym->usage & uPROTOTYPED)!=0 && !compare_tag(sym->tag, tag)) - error(25); /* mismatch from earlier prototype */ - if ((sym->usage & uDEFINE)==0) { - /* as long as the function stays undefined, update the address and the tag */ - if (sym->states==NULL) - sym->addr=code_idx; - sym->tag=tag; - } /* if */ } else { /* don't set the "uDEFINE" flag; it may be a prototype */ - sym=addsym(name,code_idx,iFUNCTN,sGLOBAL,tag,0); + sym=addsym(name,code_idx,iFUNCTN,sGLOBAL,0,0); assert(sym!=NULL); /* fatal error 103 must be given on error */ /* assume no arguments */ sym->dim.arglist=(arginfo*)calloc(1, sizeof(arginfo)); @@ -4823,9 +4815,17 @@ static symbol *funcstub(int tokid, declinfo_t *decl, const int *thistag) needtoken('('); /* only functions may be native/forward */ - sym=fetchfunc(decl->name, decl->type.tag); /* get a pointer to the function entry */ + sym=fetchfunc(decl->name); if (sym==NULL) return NULL; + if ((sym->usage & uPROTOTYPED)!=0 && !compare_tag(sym->tag, decl->type.tag)) + error(25); + if ((sym->usage & uDEFINE) == 0) { + // As long as the function stays undefined, update its address and tag. + sym->addr = code_idx; + sym->tag = decl->type.tag; + } + if (fnative) { sym->usage=(char)(uNATIVE | uRETVALUE | uDEFINE | (sym->usage & uPROTOTYPED)); sym->x.lib=curlibrary; @@ -4934,13 +4934,32 @@ static int newfunc(declinfo_t *decl, const int *thistag, int fpublic, int fstati if (stock) error(42); /* invalid combination of class specifiers */ } /* if */ - sym=fetchfunc(decl->name, decl->type.tag);/* get a pointer to the function entry */ - if (sym==NULL || (sym->usage & uNATIVE)!=0) - return TRUE; /* it was recognized as a function declaration, but not as a valid one */ + + if ((sym=fetchfunc(decl->name)) == NULL) + return TRUE; + + // Not a valid function declaration if native. + if (sym->usage & uNATIVE) + return TRUE; + + // If the function has not been prototyed, set its tag. + if (!(sym->usage & uPROTOTYPED)) + sym->tag = decl->type.tag; + + // As long as the function stays undefined, update its address. + if (!(sym->usage & uDEFINE)) + sym->addr = code_idx; + if (fpublic) sym->usage|=uPUBLIC; if (fstatic) sym->fnumber=filenum; + + if (sym->usage & (uPUBLIC | uFORWARD)) { + if (decl->type.numdim > 0) + error(141); + } + /* if the function was used before being declared, and it has a tag for the * result, add a third pass (as second "skimming" parse) because the function * result may have been used with user-defined operators, which have now @@ -5027,8 +5046,33 @@ static int newfunc(declinfo_t *decl, const int *thistag, int fpublic, int fstati } /* if */ #endif statement(NULL,FALSE); - if ((rettype & uRETVALUE)!=0) + + if ((rettype & uRETVALUE)!=0) { sym->usage|=uRETVALUE; + } else { + if (sym->tag == pc_tag_void && + (sym->usage & uFORWARD) && + !decl->type.tag && + !decl->is_new) + { + // We got something like: + // forward void X(); + // public X() + // + // Switch our decl type to void. + decl->type.tag = pc_tag_void; + decl->type.tags[0] = pc_tag_void; + } + } + + // Check that return tags match. + if ((sym->usage & uPROTOTYPED) && !compare_tag(sym->tag, decl->type.tag)) { + int old_fline = fline; + fline = sym->lnumber; + error(25); + fline = old_fline; + } + if (declared!=0) { /* This happens only in a very special (and useless) case, where a function * has only a single statement in its body (no compound block) and that diff --git a/sourcepawn/compiler/sc2.c b/sourcepawn/compiler/sc2.c index 5662edec..32d3fa19 100644 --- a/sourcepawn/compiler/sc2.c +++ b/sourcepawn/compiler/sc2.c @@ -1949,7 +1949,7 @@ char *sc_tokens[] = { "...", "..", "::", "assert", "*begin", "break", - "case", "cellsof", "chars", "class", "const", "continue", + "case", "cellsof", "char", "class", "const", "continue", "decl", "default", "defined", "delete", "do", "else", "*end", "enum", "exit", "for", "forward", "funcenum", "functag", diff --git a/sourcepawn/compiler/sc3.c b/sourcepawn/compiler/sc3.c index 152ef3ef..8472122c 100644 --- a/sourcepawn/compiler/sc3.c +++ b/sourcepawn/compiler/sc3.c @@ -2129,7 +2129,7 @@ restart: /* could be a "use before declaration"; in that case, create a stub * function so that the usage can be marked. */ - sym=fetchfunc(lastsymbol,0); + sym=fetchfunc(lastsymbol); if (sym==NULL) error(163); /* insufficient memory */ markusage(sym,uREAD); @@ -2281,7 +2281,7 @@ static int primary(value *lval) * call" syntax. So assume that the symbol refers to a function. */ assert(sc_status==statFIRST); - sym=fetchfunc(st,0); + sym=fetchfunc(st); if (sym==NULL) error(163); /* insufficient memory */ } /* if */ diff --git a/sourcepawn/compiler/sc5.scp b/sourcepawn/compiler/sc5.scp index b9a231af..509ae828 100644 --- a/sourcepawn/compiler/sc5.scp +++ b/sourcepawn/compiler/sc5.scp @@ -32,13 +32,13 @@ SC_FUNC int strexpand(char *dest, unsigned char *source, int maxlen, unsigned ch /*-*SCPACK start of pair table, do not change or remove this line */ unsigned char errstr_table [][2] = { {101,32}, {116,32}, {111,110}, {115,32}, {100,32}, {105,110}, {97,114}, {116,105}, {37,115}, {101,114}, {110,111}, {97,110}, {101,110}, {97,108}, {135,130}, {114,101}, - {34,136}, {144,34}, {111,114}, {117,110}, {121,32}, {138,129}, {115,105}, {97,116}, {115,116}, {101,132}, {100,101}, {109,140}, {32,145}, {41,10}, {109,98}, {116,104}, - {114,97}, {117,115}, {146,32}, {147,99}, {142,32}, {98,108}, {102,163}, {111,108}, {101,120}, {118,141}, {97,32}, {115,121}, {99,139}, {171,158}, {134,160}, {173,167}, - {112,101}, {116,121}, {172,149}, {115,10}, {103,32}, {103,117}, {181,155}, {137,32}, {134,182}, {116,111}, {102,133}, {115,150}, {99,104}, {105,132}, {97,165}, {111,102}, - {105,131}, {161,129}, {166,164}, {169,189}, {109,193}, {104,97}, {109,101}, {99,116}, {174,148}, {133,195}, {109,97}, {101,100}, {101,131}, {99,130}, {37,131}, {175,156}, - {44,32}, {191,32}, {117,108}, {99,111}, {98,128}, {118,134}, {112,143}, {130,32}, {105,190}, {213,216}, {116,97}, {110,32}, {154,186}, {134,97}, {102,105}, {118,128}, - {184,129}, {100,105}, {111,112}, {97,115}, {136,10}, {156,10}, {128,145}, {152,151}, {109,151}, {119,105}, {97,131}, {226,137}, {101,10}, {207,157}, {34,32}, {99,108}, - {40,237}, {150,122}, {108,128}, {205,152}, {139,32}, {141,32}, {177,176}, {197,223}, {110,97}, {101,108}, {177,112}, {166,142}, {133,32}, {159,32}, {133,180} + {34,136}, {144,34}, {111,114}, {117,110}, {121,32}, {138,129}, {115,105}, {97,116}, {115,116}, {100,101}, {101,132}, {109,140}, {32,145}, {41,10}, {109,98}, {116,104}, + {114,97}, {147,99}, {117,115}, {146,32}, {98,108}, {161,142}, {102,165}, {111,108}, {101,120}, {118,141}, {97,32}, {115,121}, {116,121}, {99,139}, {171,158}, {134,160}, + {174,167}, {112,101}, {173,149}, {115,10}, {103,32}, {103,117}, {181,155}, {137,32}, {134,182}, {116,111}, {102,133}, {105,132}, {115,150}, {99,104}, {97,164}, {169,187}, + {111,102}, {105,131}, {162,129}, {44,32}, {166,32}, {133,191}, {109,194}, {104,97}, {109,101}, {99,116}, {175,148}, {109,97}, {101,100}, {99,130}, {37,131}, {176,156}, + {192,32}, {117,108}, {99,111}, {98,128}, {101,131}, {118,134}, {112,143}, {97,142}, {130,32}, {105,190}, {213,217}, {110,32}, {153,186}, {102,105}, {118,128}, {184,129}, + {100,105}, {111,112}, {97,115}, {136,10}, {156,10}, {128,145}, {152,151}, {109,151}, {116,97}, {119,105}, {99,108}, {97,131}, {225,137}, {101,10}, {207,157}, {34,32}, + {40,238}, {172,112}, {150,122}, {108,128}, {205,152}, {139,32}, {141,32}, {172,177}, {199,222}, {110,97}, {101,108}, {241,128}, {139,132}, {102,146}, {133,32} }; /*-*SCPACK end of pair table, do not change or remove this line */ @@ -184,149 +184,151 @@ static char *errmsg[] = { /*138*/ "const was specified twice\n", /*139*/ "could not find type \"%s\"\n", /*140*/ "new-style array types cannot specify dimension sizes as part of their type\n", -/*141*/ "natives cannot return arrays\n", +/*141*/ "natives, forwards, and public functions cannot return arrays\n", +/*142*/ "invalid type declaration\n", #else - "\250\260\307\231\271k\214:\234\320bu\201fo\223\204\221\012", - "\202l\224\252s\205g\362\347e\233\201(\242\250\326\273\202) \254 f\247low ea\274 \042c\343e\042\012", - "\232\357\335\244\321\252loc\365\331\200\304ap\260\206 \374\252\323mpo\223\204\245ock\012", - "\373\234 \300\225imple\233t\313\012", - "\302\312\224\225\367\270t\263", - "\304\324a\273gn\231\271 \364\256y\012", - "\353\227\242\262\324\217\334\313\012", - "\304\324\252\363\213\201\250\326\273\202; \343sum\231z\211o\012", - "\311\310\361\200(nega\207ve\320z\211o \242ou\201\321bo\223ds\235", - "\311\302\242\232\357\335\216\012", - "\311out\226d\200\373\263", - "\311\302c\215l\320\225\252\303add\217s\263", - "\212 \214tr\224po\205\201(\212 pu\245ic \373s\235", - "\311\347e\233t; \225\374s\351t\274\012", - "\042\232fa\322t\356c\343\200\304\324\237\200l\343\201c\343\200\374s\351t\274 \347e\233t\012", - "m\322\207p\362\232fa\322t\203\374\042s\351t\274\042\012", - "\223\334\231\317\012", - "\205i\207\215iza\244d\227\252\250ce\313\203\232\357\206\231\361\354", - "\225\252lab\371:\345", - "\311\257 \370m\346\012", - "\257 \215\217ad\224\334\313:\345", - "\304\324l\251u\200(n\202-\363\213t\235", - "\310a\273gn\233\201\304\324\226mp\362a\273gn\233t\012", - "\042b\217ak\356\242\042\315t\205ue\356\300ou\201\321\315t\250t\012", - "\302head\376\341ff\211\203from pro\271\366\012", - "\212 \350\274\376\042#if...\042\012", - "\311\274\335\307\267\363\213t\012", - "\311subscrip\201(\225\364\310\242\271o m\213\224subscripts):\345", - "\311\250\326\273\202\320\343sum\231z\211o\012", - "\323mpo\223\204\347e\233\201\225\357os\231a\201\237\200\214\204\321\336\362(\230\206t\231a\201l\205\200%d\235", - "\223k\212w\333\341\217c\207v\354", - "\310\205\232x ou\201\321bo\223d\203(\331\346\235", - "\310\304\324\205\232x\231(\331\346\235", - "\340do\314\225\367\252\232fa\322\201\251u\200(\340%d\235", - "\340\372\200mis\350\274 (\340%d\235", - "empt\224\347e\233t\012", - "\311\230r\376(po\273\245\224n\202-t\211m\205\227\231\230r\205g\235", - "\250t\240 \274\335\307\211\203\327l\205\354", - "\363\213\201\257 \305\203\212 \361\354", - "duplic\227\200\042c\343e\356lab\371 (\251u\200%d\235", - "\311\371lip\226s\320\310\361\200\300\225k\212wn\012", - "\311\323\236\205a\244\321\357\343\203s\260ci\336\211\263", - "\274\335\307\267\363\213\201\250ce\313\203r\213g\200f\242pack\231\230r\205g\012", - "po\226\216\365p\335\306t\211\203\304\326c\313\200\215l \370m\231p\335\306t\211\263", - "\271o m\213\224\302\270t\263", - "\223k\212w\333\310\361\200(\331\346\235", - "\310\361\314do \225\350\274\320\242\232\230\205a\244\310\300\271o sm\215l\012", - "\310(\203do \225\350\274\012", - "\311l\205\200\315t\205ua\216\012", - "\311r\213g\354", - "\311subscript\320\241\200\042[ ]\356\353\227\222\203\327\312j\242\341\233\226\202\263", - "m\322\207-\341\233\226\202\365\256y\203\304\324f\322l\224\205i\207\215iz\313\012", - "\250ce\313\376\312ximum nu\236\267\321\341\233\226\202\263", - "\223\350\274\231\357os\376b\240c\200(\042}\042\235", - "\230\206\201\321\302bod\224\351\237ou\201\302head\211\012", - "\256ys\320loc\365\331\314\213\204\302\270t\203\262\324pu\245ic (\331\346\235", - "\223\272ish\231\250\326\273\327bef\222\200\323mpil\267\341\217c\207v\354", - "duplic\227\200\270t; sam\200\340\300p\343s\231t\351c\354", - "\302\340\312\224\225\367\252\232fa\322\201\251u\200(\331\346\235", - "m\322\207p\362\042#\371se\356\341\217c\207v\314betwe\214 \042#if ... #\214\341f\042\012", - "\042#\371seif\356\341\217c\207\337f\247low\203\364\042#\371se\356\341\217c\207v\354", - "nu\236\267\321\353\213d\203do\314\225\336\201\237\200\353\227\222\012", - "\302\217s\322\201\332\264\321\353\227\222\234 \304\324\221\012", - "\262\274\213g\200\326\334\231\353\227\222\263", - "\302\340\312\224\202l\224\367\252s\205g\362\332\264(\340%d\235", - "\302\340\312\224\225\324\252\217f\211\214c\200\340\242\364\310(\340\221\235", - "\331\200\262\324bo\375\252\217f\211\214c\200\213\204\364\310(\331\346\235", - "\311\240\216\365nu\236\267\326ci\226\327\374#p\240g\312\012", - "\240\216\365nu\236\267f\222\312\201\215\217ad\224\334\313\012", - "\240\216\365nu\236\267supp\222\201w\352\225\214\276\313\012", - "\241\211-\334\231\353\227\242\304\324\232\357\206\231bef\222\200\241\200(\373\234\235", - "\042\361e\277\356\353\227\242\300\311\327\042\373\356\257\263", - "\302\340\304\324\364\310(\340\221\235", - "#\334\200p\227t\211\333\304\230\206\201\351\375\364\215p\305be\207c \274\335\307\211\012", + "\250\261\311\232\271k\214:\234\303bu\201fo\223\204\221\012", + "\202l\224\252s\205g\363\346e\233\201(\243\250\326\274\202) \255 f\247low ea\275 \042c\342e\042\012", + "\231\352\206\327 \320\252loc\366\332\200\306ap\261\206 \376\252\322mpo\223\204\244ock\012", + "\246\234 \301\225imple\233t\314\012", + "\304\313\224\225\370\270t\263", + "\306\323a\274gn\232\271 \365\257y\012", + "\354\227\243\262\323\217\334\314\012", + "\306\323\252\364\213\201\250\326\274\202; \342sum\232z\211o\012", + "\305\312\362\200(nega\207ve\303z\211o \243ou\201\320bo\223ds\235", + "\305\304\243\231\352\206\327\012", + "\305out\226d\200\246\263", + "\305\304c\215l\303\225\252\277add\217s\263", + "\212 \214tr\224po\205\201(\212 pu\244ic \246s\235", + "\305\346e\233t; \225\376s\351t\275\012", + "\042\231fa\321t\357c\342\200\306\323\237\200l\342\201c\342\200\376s\351t\275 \346e\233t\012", + "m\321\207p\363\231fa\321t\203\376\042s\351t\275\042\012", + "\223\334\232\317\012", + "\205i\207\215iz\327 d\227\252\250ce\314\203\231\352\206\232\362\355", + "\225\252lab\372:\344", + "\305\260 \371m\345\012", + "\260 \215\217ad\224\334\314:\344", + "\306\323l\251u\200(n\202-\364\213t\235", + "\312a\274gn\233\201\306\323\226mp\363a\274gn\233t\012", + "\042b\217ak\357\243\042\315t\205ue\357\301ou\201\320\315t\250t\012", + "\304head\205\264\340ff\211\203from pro\271\367\012", + "\212 \347\275\205\264\042#if...\042\012", + "\305\275\206a\311\267\364\213t\012", + "\305subscrip\201(\225\365\312\243\271o m\213\224subscripts):\344", + "\305\250\326\274\202\303\342sum\232z\211o\012", + "\322mpo\223\204\346e\233\201\225\352os\232a\201\237\200\214\204\320\335\363(\230\206t\232a\201l\205\200%d\235", + "\223k\212w\333\340\217c\207v\355", + "\312\205\231x ou\201\320bo\223d\203(\332\345\235", + "\312\306\323\205\231x\232(\332\345\235", + "\337do\324\225\370\252\231fa\321\201\251u\200(\337%d\235", + "\337\373mis\347\275 (\337%d\235", + "empt\224\346e\233t\012", + "\305\230r\205\264(po\274\244\224n\202-t\211m\205\227\232\230r\205g\235", + "\250t\240 \275\206a\311\211\203\330l\205\355", + "\364\213\201\260 \307\203\212 \362\355", + "duplic\227\200\042c\342e\357lab\372 (\251u\200%d\235", + "\305\372lip\226s\303\312\362\200\301\225k\212wn\012", + "\305\322\236\205\327 \320\352\342\203s\261ci\335\211\263", + "\275\206a\311\267\364\213\201\250ce\314\203r\213g\200f\243pack\232\230r\205g\012", + "po\226\216\366p\206a\310t\211\203\306\326c\314\200\215l \371m\232p\206a\310t\211\263", + "\271o m\213\224\304\270t\263", + "\223k\212w\333\312\362\200(\332\345\235", + "\312\362\324do \225\347\275\303\243\231\230\205\327 \312\301\271o sm\215l\012", + "\312(\203do \225\347\275\012", + "\305l\205\200\315t\205u\327\012", + "\305r\213g\355", + "\305subscript\303\242\200\042[ ]\357\354\227\222\203\330\313j\243\340\233\226\202\263", + "m\321\207-\340\233\226\202\366\257y\203\306\323f\321l\224\205i\207\215iz\314\012", + "\250ce\314\205\264\313ximum nu\236\267\320\340\233\226\202\263", + "\223\347\275\232\352os\205\264b\240c\200(\042}\042\235", + "\230\206\201\320\304bod\224\351\237ou\201\304head\211\012", + "\257ys\303loc\366\332\324\374\304\270t\203\262\323pu\244ic (\332\345\235", + "\223\272ish\232\250\326\274\330be\375\200\322mpil\267\340\217c\207v\355", + "duplic\227\200\270t; sam\200\337\301p\342s\232t\351c\355", + "\304\337\313\224\225\370\252\231fa\321\201\251u\200(\332\345\235", + "m\321\207p\363\042#\372se\357\340\217c\207v\324betwe\214 \042#if ... #\214\340f\042\012", + "\042#\372seif\357\340\217c\207\336f\247low\203\365\042#\372se\357\340\217c\207v\355", + "nu\236\267\320\354\213d\203do\324\225\335\201\237\200\354\227\222\012", + "\304\217s\321\201\350\264\320\354\227\222\234 \306\323\221\012", + "\262\275\213g\200\326\334\232\354\227\222\263", + "\304\337\313\224\202l\224\370\252s\205g\363\350\264(\337%d\235", + "\304\337\313\224\225\323\252\217f\211\214c\200\337\243\365\312(\337\221\235", + "\332\200\262\323bo\237 \252\217f\211\214c\200\374\365\312(\332\345\235", + "\305\240\216\366nu\236\267\326ci\226\330\376#p\240g\313\012", + "\240\216\366nu\236\267\375\313\201\215\217ad\224\334\314\012", + "\240\216\366nu\236\267supp\222\201w\353\225\214\276\314\012", + "\242\211-\334\232\354\227\243\306\323\231\352\206\232be\375\200\242\200(\246\234\235", + "\042\362e\300\357\354\227\243\301\305\330\042\246\357\260\263", + "\304\337\306\323\365\312(\337\221\235", + "#\334\200p\227t\211\333\306\230\206\201\351\237 \365\215p\307be\207c \275\206a\311\211\012", "\205pu\201l\205\200\271o l\202\264(aft\267subs\207tu\216s\235", - "\253n\332x \211r\242\374\237\200\250\326\273\202\320\242\311\302c\215l\012", - "m\215f\222m\231UTF-8 \214\323d\205g\320\242c\222rupt\231\336le: \344", - "\302\241\314bo\375\042\217turn\356\213\204\042\217tur\333<\251ue>\042\012", - "\205\315\226\230\214\201\217tur\333\366\203(\310& n\202-\256y\235", - "\223k\212w\333\257\320\242\225\252\363\213\201\257 \360", - "\262\332k\200\252\332\264\352\252\232fa\322\201\251u\200f\242\364\205\232x\231\310p\335\306t\267\360", - "\241\211-\334\231\353\227\222\203\213\204\370\207\337\373\203\312\224\225\367\347e\263", - "\252\302\242\331\200\312\224\202l\224b\371\202\264\271 \252s\205g\362au\271\350\327\360", - "\347\200\315fli\307: \202\200\321\237\200\347\314\300\215\217ad\224a\273gn\231\271 a\212\237\267imple\233\332\244\360", - "\212 \347\314\206\200\334\231f\242\317\012", - "\223k\212w\333au\271\350\202\345", - "\223k\212w\333\347\346 f\242au\271\350\202\345", - "pu\245ic \331\314\213\204loc\365\331\314\312\224\225\367\347\314\360", - "\347\200\331\314\312\224\225\324\205i\207\215iz\231\360", - "pu\245ic \373\203\312\224\225\217tur\333\256y\203\360", - "a\236i\265ou\203\363\213t; \332\264ov\211rid\200\300\217qui\217\204\360", - "nu\236\267\321\270t\203do\314\225\350\274 \334i\216\012", - "\250\260\307\231\332\264\370m\200id\214\207\336\211\012", - "\302\214um\211a\244\217qui\217\203\223iqu\200\332g\012", - "\262\367\217qui\217\204p\335\306t\211\203aft\267\342\216\365p\335\306t\211\263", - "\323\322\204\225\272\204\306\236\211\234 \374\230ruc\201\221\012", - "\317 do\314\225\367\252\350\274\376\366\012", - "\372\346 sho\322\204\324\221 \374new-\230y\362\232\357\335\216\263", - "\316sho\322\204\225\367\364\250plici\201\217tur\333\366\012", - "\302pro\271\366\203do \225\350\274\012", - "s\260cif\224ei\237\267\215l \341\233\226\202\203\242\202l\224\237\200l\343\201\341\233\226\202\012", - "\262\272\204\316\344", - "\316w\352\215\217ad\224\334\231\327\237\300\344", - "\262\272\204\213\224\306\237od\203f\242\344", - "\262\272\204\306\237o\204\242pr\353t\224\210.\344", - "\262c\215l \306\237od\203\327\364\256y\012", - "\262c\215l \306\237od\203\327\252\373\012", - "\306\237o\204\304\367\252\336rs\201\340\323mpa\207\245\200\351\375\237\200\316\372\200(\210\235", - "\316\370m\200\304\230\206\201\351\375\364upp\211c\343\200lett\211\012", - "\316\305\203\215\217ad\224be\214 \334\231(\326vio\241l\224se\214 \352\210\235", - "\250\260\307\231id\214\207\336\267- d\275you f\222ge\201\252\366?\012", - "\363ru\307\242\302\304\217tur\333\332\264\344", - "\262\334\200\363ru\307\242f\222\234; \215\217ad\224\250i\230\203\352\252\344", - "miss\376\366\320\242\316\304\367\237\200sam\200\370m\200\352\316\221\012", - "\262\241\200\232lete\320\316\316\305\203\212 \232\230ru\307\222\012", - "\212 \306\237od\312p \242\357\343\203w\352fo\223\204f\242\344", - "\212 \232\230ru\307\242w\352fo\223\204f\242\316\344", - "\232\230ru\307\222\203\304\324\370\207\337\373\263", - "\232\230ru\307\222\203\262\367\250t\240 \270t\263", - "\306\237od\312p \213\204\357\343\203\226gn\227u\217\203\304\241\200new-\230y\362\372\200\232\357\335\216\263", - "\262s\260cif\224\310\341\233\226\202\203\327bo\375\372\200\213\204\370\306\012", - "\250\260\307\231\372\200\250\326\273\202\012", - "f\322ly-qu\215i\336\231\370m\346 \300\271o l\202g\320wo\322\204\324tr\243\227\231\271\345", - "\223\250\260\307\231\271k\214\320\250\260\307\231\306\237o\204\242pr\353\261\012", - "\250\260\307\231\042\370\207ve\356\242\042get\042\012", - "\316f\242\316\215\217ad\224\250i\230\263", - "pr\353t\224gett\211\203\262accep\201\250t\240 \270t\263", - "\316\304\367\237\200sam\200\217tur\333\372\200\352pr\353t\224\316(\210\235", - "\262mix \306\237od\312p\203\213\204\357\343s\314\351\375\205h\211it\213c\354", - "\262\323\211c\200\373\203\271 \251ue\263", - "\262\323\211c\200objec\201\372\200\316\271 n\202-objec\201\372\200\344", - "\262\323\211c\200n\202-objec\201\372\200\316\271 objec\201\372\200\344", - "\262\323\211c\200\223\217l\227\231objec\201\366\203\316\213\204\344", - "\372\200mis\350\274 (\316\213\204\210\235", - "\262\241\200\364objec\201\374\252m\322\207-\332\264s\371e\307\222\012", - "\256y\203\206\200\225supp\222t\231\352\217tur\333\366\263", - "\262mix \217f\211\214c\200\213\204\310\366\263", - "\315s\201w\352s\260ci\336\231t\351c\354", - "\323\322\204\225\272\204\372\346\012", - "new-\230y\362\310\366\203\262s\260cif\224\341\233\226\327\361\314\352p\206\201\321\237eir \366\012", - "\370\207v\314\262\217tur\333\256y\263" + "\253n\350x \211r\243\376\237\200\250\326\274\202\303\243\305\304c\215l\012", + "m\215\375m\232UTF-8 \214\322d\205g\303\243c\222rupt\232\335le: \343", + "\304\242\324bo\237 \042\217turn\357\374\042\217tur\333<\251ue>\042\012", + "\205\315\226\230\214\201\217tur\333\367\203(\312& n\202-\257y\235", + "\223k\212w\333\260\303\243\225\252\364\213\201\260 \360", + "\262\350k\200\252\350\264\353\252\231fa\321\201\251u\200f\243\365\205\231x\232\312p\206a\310t\267\360", + "\242\211-\334\232\354\227\222\203\374\371\207\336\246\203\313\224\225\370\346e\263", + "\252\304\243\332\200\313\224\202l\224b\372\202\264\271 \252s\205g\363au\271\347\330\360", + "\346\200\315fli\311: \202\200\320\237\200\346\324\301\215\217ad\224a\274gn\232\271 a\212\237\267imple\233t\327 \360", + "\212 \346\324\206\200\334\232f\243\317\012", + "\223k\212w\333au\271\347\202\344", + "\223k\212w\333\346\345 f\243au\271\347\202\344", + "pu\244ic \332\324\374loc\366\332\324\313\224\225\370\346\324\360", + "\346\200\332\324\313\224\225\323\205i\207\215iz\232\360", + "pu\244ic \246\203\313\224\225\217tur\333\257y\203\360", + "a\236i\265ou\203\364\213t; \350\264ov\211rid\200\301\217qui\217\204\360", + "nu\236\267\320\270t\203do\324\225\347\275 \334i\216\012", + "\250\261\311\232\350\264\371m\200id\214\207\335\211\012", + "\304\214um\211\327 \217qui\217\203\223iqu\200\350g\012", + "\262\370\217qui\217\204p\206a\310t\211\203aft\267\341\216\366p\206a\310t\211\263", + "\322\321\204\225\272\204\310\236\211\234 \376\230ruc\201\221\012", + "\317 do\324\225\370\252\347\275\205\264\367\012", + "\361\345 sho\321\204\323\221 \376new-\230y\363\231\352\206\327\263", + "\316sho\321\204\225\370\365\250plici\201\217tur\333\367\012", + "\304pro\271\367\203do \225\347\275\012", + "s\261cif\224ei\237\267\215l \340\233\226\202\203\243\202l\224\237\200l\342\201\340\233\226\202\012", + "\262\272\204\316\343", + "\316w\353\215\217ad\224\334\232\330\237\301\343", + "\262\272\204\213\224\310\237od\203f\243\343", + "\262\272\204\310\237o\204\243pr\354t\224\210.\343", + "\262c\215l \310\237od\203\330\365\257y\012", + "\262c\215l \310\237od\203\330\252\246\012", + "\310\237o\204\306\370\252\335rs\201\337\322mpa\207\244\200\351\237 \237\200\316\373(\210\235", + "\316\371m\200\306\230\206\201\351\237 \365upp\211c\342\200lett\211\012", + "\316\307\203\215\217ad\224be\214 \334\232(\326vio\242l\224se\214 \353\210\235", + "\250\261\311\232id\214\207\335\267- d\273you \375ge\201\252\367?\012", + "\364ru\311\243\304\306\217tur\333\350\264\343", + "\262\334\200\364ru\311\243\375\234; \215\217ad\224\250i\230\203\353\252\343", + "miss\205\264\367\303\243\316\306\370\237\200sam\200\371m\200\353\316\221\012", + "\262\242\200\231lete\303\316\316\307\203\212 \231\230ru\311\222\012", + "\212 \310\237od\313p \243\352\342\203w\353fo\223\204f\243\343", + "\212 \231\230ru\311\243w\353fo\223\204f\243\316\343", + "\231\230ru\311\222\203\306\323\371\207\336\246\263", + "\231\230ru\311\222\203\262\370\250t\240 \270t\263", + "\310\237od\313p \374\352\342\203\226gn\227u\217\203\306\242\200new-\230y\363\373\231\352\206\327\263", + "\262s\261cif\224\312\340\233\226\202\203\330bo\237 \373\374\371\310\012", + "\250\261\311\232\373\250\326\274\202\012", + "f\321ly-qu\215i\335\232\371m\345 \301\271o l\202g\303wo\321\204\323tr\241\227\232\271\344", + "\223\250\261\311\232\271k\214\303\250\261\311\232\310\237o\204\243pr\354\254\012", + "\250\261\311\232\042\371\207ve\357\243\042get\042\012", + "\316f\243\316\215\217ad\224\250i\230\263", + "pr\354t\224gett\211\203\262accep\201\250t\240 \270t\263", + "\316\306\370\237\200sam\200\217tur\333\373\353pr\354t\224\316(\210\235", + "\262mix \310\237od\313p\203\374\352\342s\324\351\237 \205h\211it\213c\355", + "\262\322\211c\200\246\203\271 \251ue\263", + "\262\322\211c\200objec\201\373\316\271 n\202-objec\201\373\343", + "\262\322\211c\200n\202-objec\201\373\316\271 objec\201\373\343", + "\262\322\211c\200\223\217l\227\232objec\201\367\203\316\374\343", + "\373mis\347\275 (\316\374\210\235", + "\262\242\200\365objec\201\376\252m\321\207-\350\264s\372e\311\222\012", + "\257y\203\206\200\225supp\222t\232\353\217tur\333\367\263", + "\262mix \217f\211\214c\200\374\312\367\263", + "\315s\201w\353s\261ci\335\232t\351c\355", + "\322\321\204\225\272\204\361\345\012", + "new-\230y\363\312\367\203\262s\261cif\224\340\233\226\330\362\324\353p\206\201\320\237eir \367\012", + "\371\207ves\303\375w\206ds\303\374pu\244ic \246\203\262\217tur\333\257y\263", + "\305\373\231\352\206\327\012" #endif }; @@ -351,18 +353,18 @@ static char *fatalmsg[] = { /*170*/ "assertion failed: %s\n", /*171*/ "user error: %s\n", #else - "\262\217a\204from \336le:\345", - "\262writ\200\271 \336le:\345", - "t\276\200ov\211flow:\345", - "\205suf\336ci\214\201\306m\222y\012", - "\311\343se\236l\267\205\230ruc\216\345", - "num\211ic ov\211flow\320\250ce\313\376capaci\261\012", - "\323mpil\231scrip\201\250ce\313\203\237\200\312ximum \306m\222\224\361\200(%l\204bytes\235", - "\271o m\213\224\211r\242\306ssag\314\327\202\200l\205\354", - "\323\232pag\200\312pp\376\336\362\225fo\223d\012", - "\311p\227h:\345", - "\343s\211\244fail\313: \344", - "\241\267\211r\222: \344" + "\262\217a\204from \335le:\344", + "\262writ\200\271 \335le:\344", + "t\276\200ov\211flow:\344", + "\205suf\335ci\214\201\310m\222y\012", + "\305\342se\236l\267\205\230ruc\216\344", + "num\211ic ov\211flow\303\250ce\314\205\264capaci\254\012", + "\322mpil\232scrip\201\250ce\314\203\237\200\313ximum \310m\222\224\362\200(%l\204bytes\235", + "\271o m\213\224\211r\243\310ssag\324\330\202\200l\205\355", + "\322\231pag\200\313pp\205\264\335\363\225fo\223d\012", + "\305p\227h:\344", + "\342s\211\216 fail\314: \343", + "\242\267\211r\222: \343" #endif }; @@ -406,43 +408,43 @@ static char *warnmsg[] = { /*235*/ "public function lacks forward declaration (symbol \"%s\")\n", /*236*/ "unknown parameter in substitution (incorrect #define pattern)\n" #else - "\317 \300tr\243\227\231\271 %\204\274\335\307\211\263", - "\217\334i\244\321\363\213t/\312cro \360", - "nu\236\267\321\270t\203do\314\225\350\274 \334i\216\012", - "\257 \300nev\267\241\313:\345", - "\257 \300a\273gn\231\252\251u\200\237a\201\300nev\267\241\313:\345", - "\217d\223d\213\201\323\232: \363\213\201\250\326\273\327\300z\211o\012", - "\217d\223d\213\201te\230: \363\213\201\250\326\273\327\300n\202-z\211o\012", - "\223k\212w\333#p\240g\312\012", - "\302\351\375\332\264\217s\322\201\241\231bef\222\200\334i\216\320f\222c\376\217p\206s\354", - "\373\234 sho\322\204\217tur\333\252\251u\354", - "po\273\245\200\241\200\321\257 bef\222\200\205i\207\215iza\216:\345", - "po\273\245\224\223\205t\214d\231a\273gn\233t\012", - "po\273\245\224\223\205t\214d\231bit\351s\200\353a\216\012", - "\332\264mis\350\274\012", - "po\273\245\224\252\042\363\356\310\340w\352\205t\214\232d:\345", - "\250\326\273\327\305\203\212 effe\307\012", - "ne\230\231\323m\233t\012", - "loos\200\205d\214\332\216\012", - "\247\204\230y\362pro\271\366\203\241\231\351\375\342\216\365semic\247umn\263", - "loc\365\331\346 s\305dow\203\252\331\200a\201\252\326c\313\376lev\371\012", - "\250\326\273\327\351\375\332\264ov\211rid\200\304ap\260\206 betwe\214 p\206\214\237ese\263", - "lab\371 \370m\346 s\305dow\203\332\264\370\306\012", - "nu\236\267\321\341git\203\250ce\313\203\240\216\365nu\236\267\326ci\226\202\012", - "\217d\223d\213\201\042\361e\277\042: \340\361\200\300\215way\2031 \360", - "\205\232t\211m\205\227\200\310\361\200\374\042\361e\277\356\250\326\273\327\360", - "\223\217a\274\276\200\323\232\012", - "\252\331\200\300a\273gn\231\271 its\371f \360", - "m\222\200\205i\207\215iz\211\203\237\364\214um \336\371d\263", - "l\214g\375\321\205i\207\215iz\267\250ce\313\203\361\200\321\237\200\214um \336\371d\012", - "\205\232x \332\264mis\350\274 \360", - "\212 imple\233\332\244f\242\347\346 \374\373\234\320\212 f\215l-back\012", - "\347\200s\260ci\336ca\244\327f\222w\206\204\232\357\335\244\300ig\212\217d\012", - "outpu\201\336\362\300writt\214\320bu\201\351\375\323mpac\201\214\323d\376\341s\276\313\012", - "\347\200\331\346 s\305dow\203\252glob\365\331\354", - "\317 \300m\206k\231\352\232\326c\227\313: \344", - "pu\245ic \302lack\203f\222w\206\204\232\357\335\244\360", - "\223k\212w\333p\335\306t\267\374subs\207tu\244(\205c\222\217c\201#\334\200p\227t\211n\235" + "\317 \301tr\241\227\232\271 %\204\275\206a\311\211\263", + "\217\334i\216 \320\364\213t/\313cro \360", + "nu\236\267\320\270t\203do\324\225\347\275 \334i\216\012", + "\260 \301nev\267\242\314:\344", + "\260 \301a\274gn\232\252\251u\200\237a\201\301nev\267\242\314:\344", + "\217d\223d\213\201\322\231: \364\213\201\250\326\274\330\301z\211o\012", + "\217d\223d\213\201te\230: \364\213\201\250\326\274\330\301n\202-z\211o\012", + "\223k\212w\333#p\240g\313\012", + "\304\351\237 \350\264\217s\321\201\242\232be\375\200\334i\216\303\375c\205\264\217p\206s\355", + "\246\234 sho\321\204\217tur\333\252\251u\355", + "po\274\244\200\242\200\320\260 be\375\200\205i\207\215iz\327:\344", + "po\274\244\224\223\205t\214\231\204a\274gn\233t\012", + "po\274\244\224\223\205t\214\231\204bit\351s\200\354\327\012", + "\350\264mis\347\275\012", + "po\274\244\224\252\042\364\357\312\337w\353\205t\214\231d:\344", + "\250\326\274\330\307\203\212 effe\311\012", + "ne\230\232\322m\233t\012", + "loos\200\205d\214t\327\012", + "\247\204\230y\363pro\271\367\203\242\232\351\237 \341\216\366semic\247umn\263", + "loc\366\332\345 s\307dow\203\252\332\200a\201\252\326c\314\205\264lev\372\012", + "\250\326\274\330\351\237 \350\264ov\211rid\200\306ap\261\206 betwe\214 p\206\214\237ese\263", + "lab\372 \371m\345 s\307dow\203\350\264\371\310\012", + "nu\236\267\320\340git\203\250ce\314\203\240\216\366nu\236\267\326ci\226\202\012", + "\217d\223d\213\201\042\362e\300\042: \337\362\200\301\215way\2031 \360", + "\205\231t\211m\205\227\200\312\362\200\376\042\362e\300\357\250\326\274\330\360", + "\223\217a\275\276\200\322\231\012", + "\252\332\200\301a\274gn\232\271 its\372f \360", + "m\222\200\205i\207\215iz\211\203\237\365\214um \335\372d\263", + "l\214g\237 \320\205i\207\215iz\267\250ce\314\203\362\200\320\237\200\214um \335\372d\012", + "\205\231x \350\264mis\347\275 \360", + "\212 imple\233t\327 f\243\346\345 \376\246\234\303\212 f\215l-back\012", + "\346\200s\261ci\335c\327 \330\375w\206\204\231\352\206\327 \301ig\212\217d\012", + "outpu\201\335\363\301writt\214\303bu\201\351\237 \322mpac\201\214\322d\205\264\340s\276\314\012", + "\346\200\332\345 s\307dow\203\252glob\366\332\355", + "\317 \301m\206k\232\353\231\326c\227\314: \343", + "pu\244ic \304lack\203\375w\206\204\231\352\206\327 \360", + "\223k\212w\333p\206a\310t\267\376subs\207tu\216 (\205c\222\217c\201#\334\200p\227t\211n\235" #endif }; From 7e770908fb014db884e3cc7bad4098716546fff7 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 4 Jul 2014 16:37:52 -0700 Subject: [PATCH 3/7] Add support for decl lists. --- sourcepawn/compiler/sc1.c | 70 ++++++- sourcepawn/compiler/sc5.scp | 378 ++++++++++++++++++------------------ 2 files changed, 255 insertions(+), 193 deletions(-) diff --git a/sourcepawn/compiler/sc1.c b/sourcepawn/compiler/sc1.c index 47c60507..f1ad74fe 100644 --- a/sourcepawn/compiler/sc1.c +++ b/sourcepawn/compiler/sc1.c @@ -152,6 +152,8 @@ static int *readwhile(void); static void inst_datetime_defines(void); static void inst_binary_name(char *binfname); static int operatorname(char *name); +static int reparse_old_decl(declinfo_t *decl, int flags); +static int reparse_new_decl(declinfo_t *decl, int flags); enum { TEST_PLAIN, /* no parentheses */ @@ -1479,6 +1481,8 @@ static void dodecl(const token_t *tok) parse_decl(&decl, DECLFLAG_MAYBE_FUNCTION|DECLFLAG_VARIABLE|DECLFLAG_ENUMROOT); if (!decl.opertok && (tok->id == tNEW || decl.has_postdims || !lexpeek('('))) { + if (tok->id == tNEW && decl.is_new) + error(143); if (decl.type.tag & STRUCTTAG) { pstruct_t *pstruct = pstructs_find(pc_tagname(decl.type.tag)); declstructvar(decl.name, fpublic, pstruct); @@ -1962,14 +1966,16 @@ static void declglb(declinfo_t *decl,int fpublic,int fstatic,int fstock) short filenum; symbol *sym; constvalue *enumroot; - #if !defined NDEBUG - cell glbdecl=0; - #endif +#if !defined NDEBUG + cell glbdecl=0; +#endif + declinfo_t orig_decl = *decl; assert(!fpublic || !fstatic); /* may not both be set */ insert_docstring_separator(); /* see comment in newfunc() */ filenum=fcurrent; /* save file number at the start of the declaration */ - do { + + for (;;) { typeinfo_t *type = &decl->type; ispublic=fpublic; @@ -2077,7 +2083,15 @@ static void declglb(declinfo_t *decl,int fpublic,int fstatic,int fstock) } else { glb_declared+=glb_incr; /* add total number of cells (if added to the end) */ } /* if */ - } while (matchtoken(',')); /* enddo */ /* more? */ + + if (!matchtoken(',')) + break; + + if (decl->is_new) + reparse_new_decl(decl, DECLFLAG_VARIABLE|DECLFLAG_ENUMROOT); + else + reparse_old_decl(decl, DECLFLAG_VARIABLE|DECLFLAG_ENUMROOT); + }; needtoken(tTERM); /* if not comma, must be semicolumn */ } @@ -3269,6 +3283,18 @@ static int parse_old_decl(declinfo_t *decl, int flags) return TRUE; } +static int reparse_old_decl(declinfo_t *decl, int flags) +{ + int usage = decl->type.usage & uCONST; + + memset(decl, 0, sizeof(*decl)); + decl->type.ident = iVARIABLE; + decl->type.size = 1; + decl->type.usage |= usage; + + return parse_old_decl(decl, flags); +} + static int parse_new_decl(declinfo_t *decl, const token_t *first, int flags) { token_t tok; @@ -3303,6 +3329,40 @@ static int parse_new_decl(declinfo_t *decl, const token_t *first, int flags) return TRUE; } +static int reparse_new_decl(declinfo_t *decl, int flags) +{ + token_t tok; + if (expecttoken(tSYMBOL, &tok)) + strcpy(decl->name, tok.str); + + if (decl->has_postdims) { + // We have something like: + // int x[], y... + // + // Reset the fact that we saw an array. + decl->type.numdim = 0; + decl->type.size = 0; + decl->type.enumroot = NULL; + decl->has_postdims = FALSE; + if (matchtoken('[')) + parse_old_array_dims(decl, flags); + } else { + // No post-dimensions means anything here is part of the type. + if (matchtoken('[')) { + if (decl->type.numdim > 0) { + if (lexpeek('[')) + error(121); + } + parse_old_array_dims(decl, flags); + } else if (decl->type.numdim) { + // Reset dimension sizes. + memset(decl->type.dim, 0, sizeof(decl->type.dim[0]) * decl->type.numdim); + } + } + + return TRUE; +} + // Parse a declaration. // // Grammar for named declarations is: diff --git a/sourcepawn/compiler/sc5.scp b/sourcepawn/compiler/sc5.scp index 509ae828..26997dae 100644 --- a/sourcepawn/compiler/sc5.scp +++ b/sourcepawn/compiler/sc5.scp @@ -32,13 +32,13 @@ SC_FUNC int strexpand(char *dest, unsigned char *source, int maxlen, unsigned ch /*-*SCPACK start of pair table, do not change or remove this line */ unsigned char errstr_table [][2] = { {101,32}, {116,32}, {111,110}, {115,32}, {100,32}, {105,110}, {97,114}, {116,105}, {37,115}, {101,114}, {110,111}, {97,110}, {101,110}, {97,108}, {135,130}, {114,101}, - {34,136}, {144,34}, {111,114}, {117,110}, {121,32}, {138,129}, {115,105}, {97,116}, {115,116}, {100,101}, {101,132}, {109,140}, {32,145}, {41,10}, {109,98}, {116,104}, + {34,136}, {144,34}, {111,114}, {117,110}, {121,32}, {138,129}, {115,105}, {115,116}, {97,116}, {100,101}, {101,132}, {109,140}, {32,145}, {41,10}, {109,98}, {116,104}, {114,97}, {147,99}, {117,115}, {146,32}, {98,108}, {161,142}, {102,165}, {111,108}, {101,120}, {118,141}, {97,32}, {115,121}, {116,121}, {99,139}, {171,158}, {134,160}, - {174,167}, {112,101}, {173,149}, {115,10}, {103,32}, {103,117}, {181,155}, {137,32}, {134,182}, {116,111}, {102,133}, {105,132}, {115,150}, {99,104}, {97,164}, {169,187}, - {111,102}, {105,131}, {162,129}, {44,32}, {166,32}, {133,191}, {109,194}, {104,97}, {109,101}, {99,116}, {175,148}, {109,97}, {101,100}, {99,130}, {37,131}, {176,156}, - {192,32}, {117,108}, {99,111}, {98,128}, {101,131}, {118,134}, {112,143}, {97,142}, {130,32}, {105,190}, {213,217}, {110,32}, {153,186}, {102,105}, {118,128}, {184,129}, - {100,105}, {111,112}, {97,115}, {136,10}, {156,10}, {128,145}, {152,151}, {109,151}, {116,97}, {119,105}, {99,108}, {97,131}, {225,137}, {101,10}, {207,157}, {34,32}, - {40,238}, {172,112}, {150,122}, {108,128}, {205,152}, {139,32}, {141,32}, {172,177}, {199,222}, {110,97}, {101,108}, {241,128}, {139,132}, {102,146}, {133,32} + {174,167}, {112,101}, {173,149}, {115,10}, {103,32}, {103,117}, {181,155}, {137,32}, {134,182}, {116,111}, {102,133}, {105,132}, {115,150}, {104,97}, {169,187}, {111,102}, + {99,104}, {105,131}, {162,129}, {44,32}, {166,32}, {97,164}, {133,190}, {109,194}, {109,101}, {99,116}, {175,148}, {109,97}, {101,100}, {117,108}, {99,130}, {37,131}, + {97,142}, {176,156}, {191,32}, {99,111}, {98,128}, {101,131}, {118,134}, {112,143}, {130,32}, {105,197}, {214,217}, {118,128}, {110,32}, {153,186}, {102,105}, {184,129}, + {100,105}, {99,108}, {111,112}, {97,115}, {136,10}, {156,10}, {128,145}, {109,152}, {151,152}, {116,97}, {119,105}, {108,128}, {97,131}, {226,137}, {101,10}, {209,157}, + {34,32}, {189,219}, {40,239}, {172,112}, {150,122}, {206,151}, {139,32}, {141,32}, {172,177}, {110,97}, {101,108}, {243,128}, {139,132}, {102,146}, {133,32} }; /*-*SCPACK end of pair table, do not change or remove this line */ @@ -186,149 +186,151 @@ static char *errmsg[] = { /*140*/ "new-style array types cannot specify dimension sizes as part of their type\n", /*141*/ "natives, forwards, and public functions cannot return arrays\n", /*142*/ "invalid type declaration\n", +/*143*/ "new-style declarations should not have \"new\"\n", #else "\250\261\311\232\271k\214:\234\303bu\201fo\223\204\221\012", - "\202l\224\252s\205g\363\346e\233\201(\243\250\326\274\202) \255 f\247low ea\275 \042c\342e\042\012", - "\231\352\206\327 \320\252loc\366\332\200\306ap\261\206 \376\252\322mpo\223\204\244ock\012", + "\202l\224\252s\205g\353\350e\233\201(\243\250\327\274\202) \255 f\247low ea\300 \042c\343e\042\012", + "\231\341\206\320 \322\252loc\367\332\200\307ap\261\206 \376\252\323mpo\223\204\244ock\012", "\246\234 \301\225imple\233t\314\012", - "\304\313\224\225\370\270t\263", - "\306\323a\274gn\232\271 \365\257y\012", - "\354\227\243\262\323\217\334\314\012", - "\306\323\252\364\213\201\250\326\274\202; \342sum\232z\211o\012", - "\305\312\362\200(nega\207ve\303z\211o \243ou\201\320bo\223ds\235", - "\305\304\243\231\352\206\327\012", - "\305out\226d\200\246\263", - "\305\304c\215l\303\225\252\277add\217s\263", + "\304\313\224\225\361\270t\263", + "\307\324a\274gn\232\271 \366\257y\012", + "\355\230\243\262\324\217\335\314\012", + "\307\324\252\365\213\201\250\327\274\202; \343sum\232z\211o\012", + "\306\312\364\200(nega\207ve\303z\211o \243ou\201\322bo\223ds\235", + "\306\304\243\231\341\206\320\012", + "\306out\226d\200\246\263", + "\306\304c\215l\303\225\252\276add\217s\263", "\212 \214tr\224po\205\201(\212 pu\244ic \246s\235", - "\305\346e\233t; \225\376s\351t\275\012", - "\042\231fa\321t\357c\342\200\306\323\237\200l\342\201c\342\200\376s\351t\275 \346e\233t\012", - "m\321\207p\363\231fa\321t\203\376\042s\351t\275\042\012", - "\223\334\232\317\012", - "\205i\207\215iz\327 d\227\252\250ce\314\203\231\352\206\232\362\355", - "\225\252lab\372:\344", - "\305\260 \371m\345\012", - "\260 \215\217ad\224\334\314:\344", - "\306\323l\251u\200(n\202-\364\213t\235", - "\312a\274gn\233\201\306\323\226mp\363a\274gn\233t\012", - "\042b\217ak\357\243\042\315t\205ue\357\301ou\201\320\315t\250t\012", - "\304head\205\264\340ff\211\203from pro\271\367\012", - "\212 \347\275\205\264\042#if...\042\012", - "\305\275\206a\311\267\364\213t\012", - "\305subscrip\201(\225\365\312\243\271o m\213\224subscripts):\344", - "\305\250\326\274\202\303\342sum\232z\211o\012", - "\322mpo\223\204\346e\233\201\225\352os\232a\201\237\200\214\204\320\335\363(\230\206t\232a\201l\205\200%d\235", - "\223k\212w\333\340\217c\207v\355", - "\312\205\231x ou\201\320bo\223d\203(\332\345\235", - "\312\306\323\205\231x\232(\332\345\235", - "\337do\324\225\370\252\231fa\321\201\251u\200(\337%d\235", - "\337\373mis\347\275 (\337%d\235", - "empt\224\346e\233t\012", - "\305\230r\205\264(po\274\244\224n\202-t\211m\205\227\232\230r\205g\235", - "\250t\240 \275\206a\311\211\203\330l\205\355", - "\364\213\201\260 \307\203\212 \362\355", - "duplic\227\200\042c\342e\357lab\372 (\251u\200%d\235", - "\305\372lip\226s\303\312\362\200\301\225k\212wn\012", - "\305\322\236\205\327 \320\352\342\203s\261ci\335\211\263", - "\275\206a\311\267\364\213\201\250ce\314\203r\213g\200f\243pack\232\230r\205g\012", - "po\226\216\366p\206a\310t\211\203\306\326c\314\200\215l \371m\232p\206a\310t\211\263", + "\306\350e\233t; \225\376s\352t\300\012", + "\042\231fa\315t\360c\343\200\307\324\237\200l\343\201c\343\200\376s\352t\300 \350e\233t\012", + "m\315\207p\353\231fa\315t\203\376\042s\352t\300\042\012", + "\223\335\232\321\012", + "\205i\207\215iz\320 d\230\252\250ce\314\203\231\341\206\232\364\356", + "\225\252lab\372:\345", + "\306\260 \371m\346\012", + "\260 \215\217ad\224\335\314:\345", + "\307\324l\251u\200(n\202-\365\213t\235", + "\312a\274gn\233\201\307\324\226mp\353a\274gn\233t\012", + "\042b\217ak\360\243\042\316t\205ue\360\301ou\201\322\316t\250t\012", + "\304head\205\264\340ff\211\203from pro\271\370\012", + "\212 \347\300\205\264\042#if...\042\012", + "\306\300\206a\311\267\365\213t\012", + "\306subscrip\201(\225\366\312\243\271o m\213\224subscripts):\345", + "\306\250\327\274\202\303\343sum\232z\211o\012", + "\323mpo\223\204\350e\233\201\225\341os\232a\201\237\200\214\204\322\336\353(\227\206t\232a\201l\205\200%d\235", + "\223k\212w\334\340\217c\207v\356", + "\312\205\231x ou\201\322bo\223d\203(\332\346\235", + "\312\307\324\205\231x\232(\332\346\235", + "\337do\325\225\361\252\231fa\315\201\251u\200(\337%d\235", + "\337\373mis\347\300 (\337%d\235", + "empt\224\350e\233t\012", + "\306\227r\205\264(po\274\244\224n\202-t\211m\205\230\232\227r\205g\235", + "\250t\240 \300\206a\311\211\203\330l\205\356", + "\365\213\201\260 \275\203\212 \364\356", + "duplic\230\200\042c\343e\360lab\372 (\251u\200%d\235", + "\306\372lip\226s\303\312\364\200\301\225k\212wn\012", + "\306\323\236\205\320 \322\341\343\203s\261ci\336\211\263", + "\300\206a\311\267\365\213\201\250ce\314\203r\213g\200f\243pack\232\227r\205g\012", + "po\226\216\367p\206a\310t\211\203\307\327c\314\200\215l \371m\232p\206a\310t\211\263", "\271o m\213\224\304\270t\263", - "\223k\212w\333\312\362\200(\332\345\235", - "\312\362\324do \225\347\275\303\243\231\230\205\327 \312\301\271o sm\215l\012", - "\312(\203do \225\347\275\012", - "\305l\205\200\315t\205u\327\012", - "\305r\213g\355", - "\305subscript\303\242\200\042[ ]\357\354\227\222\203\330\313j\243\340\233\226\202\263", - "m\321\207-\340\233\226\202\366\257y\203\306\323f\321l\224\205i\207\215iz\314\012", - "\250ce\314\205\264\313ximum nu\236\267\320\340\233\226\202\263", - "\223\347\275\232\352os\205\264b\240c\200(\042}\042\235", - "\230\206\201\320\304bod\224\351\237ou\201\304head\211\012", - "\257ys\303loc\366\332\324\374\304\270t\203\262\323pu\244ic (\332\345\235", - "\223\272ish\232\250\326\274\330be\375\200\322mpil\267\340\217c\207v\355", - "duplic\227\200\270t; sam\200\337\301p\342s\232t\351c\355", - "\304\337\313\224\225\370\252\231fa\321\201\251u\200(\332\345\235", - "m\321\207p\363\042#\372se\357\340\217c\207v\324betwe\214 \042#if ... #\214\340f\042\012", - "\042#\372seif\357\340\217c\207\336f\247low\203\365\042#\372se\357\340\217c\207v\355", - "nu\236\267\320\354\213d\203do\324\225\335\201\237\200\354\227\222\012", - "\304\217s\321\201\350\264\320\354\227\222\234 \306\323\221\012", - "\262\275\213g\200\326\334\232\354\227\222\263", - "\304\337\313\224\202l\224\370\252s\205g\363\350\264(\337%d\235", - "\304\337\313\224\225\323\252\217f\211\214c\200\337\243\365\312(\337\221\235", - "\332\200\262\323bo\237 \252\217f\211\214c\200\374\365\312(\332\345\235", - "\305\240\216\366nu\236\267\326ci\226\330\376#p\240g\313\012", - "\240\216\366nu\236\267\375\313\201\215\217ad\224\334\314\012", - "\240\216\366nu\236\267supp\222\201w\353\225\214\276\314\012", - "\242\211-\334\232\354\227\243\306\323\231\352\206\232be\375\200\242\200(\246\234\235", - "\042\362e\300\357\354\227\243\301\305\330\042\246\357\260\263", - "\304\337\306\323\365\312(\337\221\235", - "#\334\200p\227t\211\333\306\230\206\201\351\237 \365\215p\307be\207c \275\206a\311\211\012", + "\223k\212w\334\312\364\200(\332\346\235", + "\312\364\325do \225\347\300\303\243\231\227\205\320 \312\301\271o sm\215l\012", + "\312(\203do \225\347\300\012", + "\306l\205\200\316t\205u\320\012", + "\306r\213g\356", + "\306subscript\303\242\200\042[ ]\360\355\230\222\203\330\313j\243\340\233\226\202\263", + "m\315\207-\340\233\226\202\367\257y\203\307\324f\315l\224\205i\207\215iz\314\012", + "\250ce\314\205\264\313ximum nu\236\267\322\340\233\226\202\263", + "\223\347\300\232\341os\205\264b\240c\200(\042}\042\235", + "\227\206\201\322\304bod\224\352\237ou\201\304head\211\012", + "\257ys\303loc\367\332\325\374\304\270t\203\262\324pu\244ic (\332\346\235", + "\223\272ish\232\250\327\274\330be\375\200\323mpil\267\340\217c\207v\356", + "duplic\230\200\270t; sam\200\337\301p\343s\232t\352c\356", + "\304\337\313\224\225\361\252\231fa\315\201\251u\200(\332\346\235", + "m\315\207p\353\042#\372se\360\340\217c\207v\325betwe\214 \042#if ... #\214\340f\042\012", + "\042#\372seif\360\340\217c\207\333f\247low\203\366\042#\372se\360\340\217c\207v\356", + "nu\236\267\322\355\213d\203do\325\225\336\201\237\200\355\230\222\012", + "\304\217s\315\201\351\264\322\355\230\222\234 \307\324\221\012", + "\262\300\213g\200\327\335\232\355\230\222\263", + "\304\337\313\224\202l\224\361\252s\205g\353\351\264(\337%d\235", + "\304\337\313\224\225\324\252\217f\211\214c\200\337\243\366\312(\337\221\235", + "\332\200\262\324bo\237 \252\217f\211\214c\200\374\366\312(\332\346\235", + "\306\240\216\367nu\236\267\327ci\226\330\376#p\240g\313\012", + "\240\216\367nu\236\267\375\313\201\215\217ad\224\335\314\012", + "\240\216\367nu\236\267supp\222\201w\354\225\214\305\314\012", + "\242\211-\335\232\355\230\243\307\324\231\341\206\232be\375\200\242\200(\246\234\235", + "\042\364e\277\360\355\230\243\301\306\330\042\246\360\260\263", + "\304\337\307\324\366\312(\337\221\235", + "#\335\200p\230t\211\334\307\227\206\201\352\237 \366\215p\275be\207c \300\206a\311\211\012", "\205pu\201l\205\200\271o l\202\264(aft\267subs\207tu\216s\235", - "\253n\350x \211r\243\376\237\200\250\326\274\202\303\243\305\304c\215l\012", - "m\215\375m\232UTF-8 \214\322d\205g\303\243c\222rupt\232\335le: \343", - "\304\242\324bo\237 \042\217turn\357\374\042\217tur\333<\251ue>\042\012", - "\205\315\226\230\214\201\217tur\333\367\203(\312& n\202-\257y\235", - "\223k\212w\333\260\303\243\225\252\364\213\201\260 \360", - "\262\350k\200\252\350\264\353\252\231fa\321\201\251u\200f\243\365\205\231x\232\312p\206a\310t\267\360", - "\242\211-\334\232\354\227\222\203\374\371\207\336\246\203\313\224\225\370\346e\263", - "\252\304\243\332\200\313\224\202l\224b\372\202\264\271 \252s\205g\363au\271\347\330\360", - "\346\200\315fli\311: \202\200\320\237\200\346\324\301\215\217ad\224a\274gn\232\271 a\212\237\267imple\233t\327 \360", - "\212 \346\324\206\200\334\232f\243\317\012", - "\223k\212w\333au\271\347\202\344", - "\223k\212w\333\346\345 f\243au\271\347\202\344", - "pu\244ic \332\324\374loc\366\332\324\313\224\225\370\346\324\360", - "\346\200\332\324\313\224\225\323\205i\207\215iz\232\360", - "pu\244ic \246\203\313\224\225\217tur\333\257y\203\360", - "a\236i\265ou\203\364\213t; \350\264ov\211rid\200\301\217qui\217\204\360", - "nu\236\267\320\270t\203do\324\225\347\275 \334i\216\012", - "\250\261\311\232\350\264\371m\200id\214\207\335\211\012", - "\304\214um\211\327 \217qui\217\203\223iqu\200\350g\012", - "\262\370\217qui\217\204p\206a\310t\211\203aft\267\341\216\366p\206a\310t\211\263", - "\322\321\204\225\272\204\310\236\211\234 \376\230ruc\201\221\012", - "\317 do\324\225\370\252\347\275\205\264\367\012", - "\361\345 sho\321\204\323\221 \376new-\230y\363\231\352\206\327\263", - "\316sho\321\204\225\370\365\250plici\201\217tur\333\367\012", - "\304pro\271\367\203do \225\347\275\012", - "s\261cif\224ei\237\267\215l \340\233\226\202\203\243\202l\224\237\200l\342\201\340\233\226\202\012", - "\262\272\204\316\343", - "\316w\353\215\217ad\224\334\232\330\237\301\343", - "\262\272\204\213\224\310\237od\203f\243\343", - "\262\272\204\310\237o\204\243pr\354t\224\210.\343", - "\262c\215l \310\237od\203\330\365\257y\012", + "\253n\351x \211r\243\376\237\200\250\327\274\202\303\243\306\304c\215l\012", + "m\215\375m\232UTF-8 \214\323d\205g\303\243c\222rupt\232\336le: \344", + "\304\242\325bo\237 \042\217turn\360\374\042\217tur\334<\251ue>\042\012", + "\205\316\226\227\214\201\217tur\334\370\203(\312& n\202-\257y\235", + "\223k\212w\334\260\303\243\225\252\365\213\201\260 \362", + "\262\351k\200\252\351\264\354\252\231fa\315\201\251u\200f\243\366\205\231x\232\312p\206a\310t\267\362", + "\242\211-\335\232\355\230\222\203\374\371\207\333\246\203\313\224\225\361\350e\263", + "\252\304\243\332\200\313\224\202l\224b\372\202\264\271 \252s\205g\353au\271\347\330\362", + "\350\200\316fli\311: \202\200\322\237\200\350\325\301\215\217ad\224a\274gn\232\271 a\212\237\267imple\233t\320 \362", + "\212 \350\325\206\200\335\232f\243\321\012", + "\223k\212w\334au\271\347\202\345", + "\223k\212w\334\350\346 f\243au\271\347\202\345", + "pu\244ic \332\325\374loc\367\332\325\313\224\225\361\350\325\362", + "\350\200\332\325\313\224\225\324\205i\207\215iz\232\362", + "pu\244ic \246\203\313\224\225\217tur\334\257y\203\362", + "a\236i\265ou\203\365\213t; \351\264ov\211rid\200\301\217qui\217\204\362", + "nu\236\267\322\270t\203do\325\225\347\300 \335i\216\012", + "\250\261\311\232\351\264\371m\200id\214\207\336\211\012", + "\304\214um\211\320 \217qui\217\203\223iqu\200\351g\012", + "\262\361\217qui\217\204p\206a\310t\211\203aft\267\342\216\367p\206a\310t\211\263", + "\323\315\204\225\272\204\310\236\211\234 \376\227ruc\201\221\012", + "\321 do\325\225\361\252\347\300\205\264\370\012", + "\363\346 sho\315\204\324\221 \376new-\227y\353\231\341\206\320\263", + "\317sho\315\204\225\361\366\250plici\201\217tur\334\370\012", + "\304pro\271\370\203do \225\347\300\012", + "s\261cif\224ei\237\267\215l \340\233\226\202\203\243\202l\224\237\200l\343\201\340\233\226\202\012", + "\262\272\204\317\344", + "\317w\354\215\217ad\224\335\232\330\237\301\344", + "\262\272\204\213\224\310\237od\203f\243\344", + "\262\272\204\310\237o\204\243pr\355t\224\210.\344", + "\262c\215l \310\237od\203\330\366\257y\012", "\262c\215l \310\237od\203\330\252\246\012", - "\310\237o\204\306\370\252\335rs\201\337\322mpa\207\244\200\351\237 \237\200\316\373(\210\235", - "\316\371m\200\306\230\206\201\351\237 \365upp\211c\342\200lett\211\012", - "\316\307\203\215\217ad\224be\214 \334\232(\326vio\242l\224se\214 \353\210\235", - "\250\261\311\232id\214\207\335\267- d\273you \375ge\201\252\367?\012", - "\364ru\311\243\304\306\217tur\333\350\264\343", - "\262\334\200\364ru\311\243\375\234; \215\217ad\224\250i\230\203\353\252\343", - "miss\205\264\367\303\243\316\306\370\237\200sam\200\371m\200\353\316\221\012", - "\262\242\200\231lete\303\316\316\307\203\212 \231\230ru\311\222\012", - "\212 \310\237od\313p \243\352\342\203w\353fo\223\204f\243\343", - "\212 \231\230ru\311\243w\353fo\223\204f\243\316\343", - "\231\230ru\311\222\203\306\323\371\207\336\246\263", - "\231\230ru\311\222\203\262\370\250t\240 \270t\263", - "\310\237od\313p \374\352\342\203\226gn\227u\217\203\306\242\200new-\230y\363\373\231\352\206\327\263", + "\310\237o\204\307\361\252\336rs\201\337\323mpa\207\244\200\352\237 \237\200\317\373(\210\235", + "\317\371m\200\307\227\206\201\352\237 \366upp\211c\343\200lett\211\012", + "\317\275\203\215\217ad\224be\214 \335\232(\327vio\242l\224se\214 \354\210\235", + "\250\261\311\232id\214\207\336\267- d\273you \375ge\201\252\370?\012", + "\365ru\311\243\304\307\217tur\334\351\264\344", + "\262\335\200\365ru\311\243\375\234; \215\217ad\224\250i\227\203\354\252\344", + "miss\205\264\370\303\243\317\307\361\237\200sam\200\371m\200\354\317\221\012", + "\262\242\200\231lete\303\317\317\275\203\212 \231\227ru\311\222\012", + "\212 \310\237od\313p \243\341\343\203w\354fo\223\204f\243\344", + "\212 \231\227ru\311\243w\354fo\223\204f\243\317\344", + "\231\227ru\311\222\203\307\324\371\207\333\246\263", + "\231\227ru\311\222\203\262\361\250t\240 \270t\263", + "\310\237od\313p \374\341\343\203\226gn\230u\217\203\307\242\200new-\227y\353\373\231\341\206\320\263", "\262s\261cif\224\312\340\233\226\202\203\330bo\237 \373\374\371\310\012", - "\250\261\311\232\373\250\326\274\202\012", - "f\321ly-qu\215i\335\232\371m\345 \301\271o l\202g\303wo\321\204\323tr\241\227\232\271\344", - "\223\250\261\311\232\271k\214\303\250\261\311\232\310\237o\204\243pr\354\254\012", - "\250\261\311\232\042\371\207ve\357\243\042get\042\012", - "\316f\243\316\215\217ad\224\250i\230\263", - "pr\354t\224gett\211\203\262accep\201\250t\240 \270t\263", - "\316\306\370\237\200sam\200\217tur\333\373\353pr\354t\224\316(\210\235", - "\262mix \310\237od\313p\203\374\352\342s\324\351\237 \205h\211it\213c\355", - "\262\322\211c\200\246\203\271 \251ue\263", - "\262\322\211c\200objec\201\373\316\271 n\202-objec\201\373\343", - "\262\322\211c\200n\202-objec\201\373\316\271 objec\201\373\343", - "\262\322\211c\200\223\217l\227\232objec\201\367\203\316\374\343", - "\373mis\347\275 (\316\374\210\235", - "\262\242\200\365objec\201\376\252m\321\207-\350\264s\372e\311\222\012", - "\257y\203\206\200\225supp\222t\232\353\217tur\333\367\263", - "\262mix \217f\211\214c\200\374\312\367\263", - "\315s\201w\353s\261ci\335\232t\351c\355", - "\322\321\204\225\272\204\361\345\012", - "new-\230y\363\312\367\203\262s\261cif\224\340\233\226\330\362\324\353p\206\201\320\237eir \367\012", - "\371\207ves\303\375w\206ds\303\374pu\244ic \246\203\262\217tur\333\257y\263", - "\305\373\231\352\206\327\012" + "\250\261\311\232\373\250\327\274\202\012", + "f\315ly-qu\215i\336\232\371m\346 \301\271o l\202g\303wo\315\204\324tr\241\230\232\271\345", + "\223\250\261\311\232\271k\214\303\250\261\311\232\310\237o\204\243pr\355\254\012", + "\250\261\311\232\042\371\207ve\360\243\042get\042\012", + "\317f\243\317\215\217ad\224\250i\227\263", + "pr\355t\224gett\211\203\262accep\201\250t\240 \270t\263", + "\317\307\361\237\200sam\200\217tur\334\373\354pr\355t\224\317(\210\235", + "\262mix \310\237od\313p\203\374\341\343s\325\352\237 \205h\211it\213c\356", + "\262\323\211c\200\246\203\271 \251ue\263", + "\262\323\211c\200objec\201\373\317\271 n\202-objec\201\373\344", + "\262\323\211c\200n\202-objec\201\373\317\271 objec\201\373\344", + "\262\323\211c\200\223\217l\230\232objec\201\370\203\317\374\344", + "\373mis\347\300 (\317\374\210\235", + "\262\242\200\366objec\201\376\252m\315\207-\351\264s\372e\311\222\012", + "\257y\203\206\200\225supp\222t\232\354\217tur\334\370\263", + "\262mix \217f\211\214c\200\374\312\370\263", + "\316s\201w\354s\261ci\336\232t\352c\356", + "\323\315\204\225\272\204\363\346\012", + "new-\227y\353\312\370\203\262s\261cif\224\340\233\226\330\364\325\354p\206\201\322\237eir \370\012", + "\371\207ves\303\375w\206ds\303\374pu\244ic \246\203\262\217tur\334\257y\263", + "\306\373\231\341\206\320\012", + "new-\227y\353\231\341\206\320\203sho\315\204\225\361\042new\042\012" #endif }; @@ -353,18 +355,18 @@ static char *fatalmsg[] = { /*170*/ "assertion failed: %s\n", /*171*/ "user error: %s\n", #else - "\262\217a\204from \335le:\344", - "\262writ\200\271 \335le:\344", - "t\276\200ov\211flow:\344", - "\205suf\335ci\214\201\310m\222y\012", - "\305\342se\236l\267\205\230ruc\216\344", + "\262\217a\204from \336le:\345", + "\262writ\200\271 \336le:\345", + "t\305\200ov\211flow:\345", + "\205suf\336ci\214\201\310m\222y\012", + "\306\343se\236l\267\205\227ruc\216\345", "num\211ic ov\211flow\303\250ce\314\205\264capaci\254\012", - "\322mpil\232scrip\201\250ce\314\203\237\200\313ximum \310m\222\224\362\200(%l\204bytes\235", - "\271o m\213\224\211r\243\310ssag\324\330\202\200l\205\355", - "\322\231pag\200\313pp\205\264\335\363\225fo\223d\012", - "\305p\227h:\344", - "\342s\211\216 fail\314: \343", - "\242\267\211r\222: \343" + "\323mpil\232scrip\201\250ce\314\203\237\200\313ximum \310m\222\224\364\200(%l\204bytes\235", + "\271o m\213\224\211r\243\310ssag\325\330\202\200l\205\356", + "\323\231pag\200\313pp\205\264\336\353\225fo\223d\012", + "\306p\230h:\345", + "\343s\211\216 fail\314: \344", + "\242\267\211r\222: \344" #endif }; @@ -408,43 +410,43 @@ static char *warnmsg[] = { /*235*/ "public function lacks forward declaration (symbol \"%s\")\n", /*236*/ "unknown parameter in substitution (incorrect #define pattern)\n" #else - "\317 \301tr\241\227\232\271 %\204\275\206a\311\211\263", - "\217\334i\216 \320\364\213t/\313cro \360", - "nu\236\267\320\270t\203do\324\225\347\275 \334i\216\012", - "\260 \301nev\267\242\314:\344", - "\260 \301a\274gn\232\252\251u\200\237a\201\301nev\267\242\314:\344", - "\217d\223d\213\201\322\231: \364\213\201\250\326\274\330\301z\211o\012", - "\217d\223d\213\201te\230: \364\213\201\250\326\274\330\301n\202-z\211o\012", - "\223k\212w\333#p\240g\313\012", - "\304\351\237 \350\264\217s\321\201\242\232be\375\200\334i\216\303\375c\205\264\217p\206s\355", - "\246\234 sho\321\204\217tur\333\252\251u\355", - "po\274\244\200\242\200\320\260 be\375\200\205i\207\215iz\327:\344", + "\321 \301tr\241\230\232\271 %\204\300\206a\311\211\263", + "\217\335i\216 \322\365\213t/\313cro \362", + "nu\236\267\322\270t\203do\325\225\347\300 \335i\216\012", + "\260 \301nev\267\242\314:\345", + "\260 \301a\274gn\232\252\251u\200\237a\201\301nev\267\242\314:\345", + "\217d\223d\213\201\323\231: \365\213\201\250\327\274\330\301z\211o\012", + "\217d\223d\213\201te\227: \365\213\201\250\327\274\330\301n\202-z\211o\012", + "\223k\212w\334#p\240g\313\012", + "\304\352\237 \351\264\217s\315\201\242\232be\375\200\335i\216\303\375c\205\264\217p\206s\356", + "\246\234 sho\315\204\217tur\334\252\251u\356", + "po\274\244\200\242\200\322\260 be\375\200\205i\207\215iz\320:\345", "po\274\244\224\223\205t\214\231\204a\274gn\233t\012", - "po\274\244\224\223\205t\214\231\204bit\351s\200\354\327\012", - "\350\264mis\347\275\012", - "po\274\244\224\252\042\364\357\312\337w\353\205t\214\231d:\344", - "\250\326\274\330\307\203\212 effe\311\012", - "ne\230\232\322m\233t\012", - "loos\200\205d\214t\327\012", - "\247\204\230y\363pro\271\367\203\242\232\351\237 \341\216\366semic\247umn\263", - "loc\366\332\345 s\307dow\203\252\332\200a\201\252\326c\314\205\264lev\372\012", - "\250\326\274\330\351\237 \350\264ov\211rid\200\306ap\261\206 betwe\214 p\206\214\237ese\263", - "lab\372 \371m\345 s\307dow\203\350\264\371\310\012", - "nu\236\267\320\340git\203\250ce\314\203\240\216\366nu\236\267\326ci\226\202\012", - "\217d\223d\213\201\042\362e\300\042: \337\362\200\301\215way\2031 \360", - "\205\231t\211m\205\227\200\312\362\200\376\042\362e\300\357\250\326\274\330\360", - "\223\217a\275\276\200\322\231\012", - "\252\332\200\301a\274gn\232\271 its\372f \360", - "m\222\200\205i\207\215iz\211\203\237\365\214um \335\372d\263", - "l\214g\237 \320\205i\207\215iz\267\250ce\314\203\362\200\320\237\200\214um \335\372d\012", - "\205\231x \350\264mis\347\275 \360", - "\212 imple\233t\327 f\243\346\345 \376\246\234\303\212 f\215l-back\012", - "\346\200s\261ci\335c\327 \330\375w\206\204\231\352\206\327 \301ig\212\217d\012", - "outpu\201\335\363\301writt\214\303bu\201\351\237 \322mpac\201\214\322d\205\264\340s\276\314\012", - "\346\200\332\345 s\307dow\203\252glob\366\332\355", - "\317 \301m\206k\232\353\231\326c\227\314: \343", - "pu\244ic \304lack\203\375w\206\204\231\352\206\327 \360", - "\223k\212w\333p\206a\310t\267\376subs\207tu\216 (\205c\222\217c\201#\334\200p\227t\211n\235" + "po\274\244\224\223\205t\214\231\204bit\352s\200\355\320\012", + "\351\264mis\347\300\012", + "po\274\244\224\252\042\365\360\312\337w\354\205t\214\231d:\345", + "\250\327\274\330\275\203\212 effe\311\012", + "ne\227\232\323m\233t\012", + "loos\200\205d\214t\320\012", + "\247\204\227y\353pro\271\370\203\242\232\352\237 \342\216\367semic\247umn\263", + "loc\367\332\346 s\275dow\203\252\332\200a\201\252\327c\314\205\264lev\372\012", + "\250\327\274\330\352\237 \351\264ov\211rid\200\307ap\261\206 betwe\214 p\206\214\237ese\263", + "lab\372 \371m\346 s\275dow\203\351\264\371\310\012", + "nu\236\267\322\340git\203\250ce\314\203\240\216\367nu\236\267\327ci\226\202\012", + "\217d\223d\213\201\042\364e\277\042: \337\364\200\301\215way\2031 \362", + "\205\231t\211m\205\230\200\312\364\200\376\042\364e\277\360\250\327\274\330\362", + "\223\217ac\275\244\200\323\231\012", + "\252\332\200\301a\274gn\232\271 its\372f \362", + "m\222\200\205i\207\215iz\211\203\237\366\214um \336\372d\263", + "l\214g\237 \322\205i\207\215iz\267\250ce\314\203\364\200\322\237\200\214um \336\372d\012", + "\205\231x \351\264mis\347\300 \362", + "\212 imple\233t\320 f\243\350\346 \376\246\234\303\212 f\215l-back\012", + "\350\200s\261ci\336c\320 \330\375w\206\204\231\341\206\320 \301ig\212\217d\012", + "outpu\201\336\353\301writt\214\303bu\201\352\237 \323mpac\201\214\323d\205\264\340s\305\314\012", + "\350\200\332\346 s\275dow\203\252glob\367\332\356", + "\321 \301m\206k\232\354\231\327c\230\314: \344", + "pu\244ic \304lack\203\375w\206\204\231\341\206\320 \362", + "\223k\212w\334p\206a\310t\267\376subs\207tu\216 (\205c\222\217c\201#\335\200p\230t\211n\235" #endif }; From 58b9fd57b264bfd3540deadaa1e9e205a569424a Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 4 Jul 2014 16:41:38 -0700 Subject: [PATCH 4/7] Remove unused "no-postdims" flag. --- sourcepawn/compiler/sc.h | 3 +-- sourcepawn/compiler/sc1.c | 12 ++---------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/sourcepawn/compiler/sc.h b/sourcepawn/compiler/sc.h index dff12a86..716d9674 100644 --- a/sourcepawn/compiler/sc.h +++ b/sourcepawn/compiler/sc.h @@ -262,8 +262,7 @@ typedef struct svalue_s { #define DECLFLAG_ARGUMENT 0x02 // The declaration is for an argument. #define DECLFLAG_VARIABLE 0x04 // The declaration is for a variable. #define DECLFLAG_ENUMROOT 0x08 // Multi-dimensional arrays should have an enumroot. -#define DECLFLAG_NO_POSTDIMS 0x10 // Do not parse post-fix dimensions. -#define DECLFLAG_MAYBE_FUNCTION 0x20 // Might be a named function. +#define DECLFLAG_MAYBE_FUNCTION 0x10 // Might be a named function. #define DECLMASK_NAMED_DECL (DECLFLAG_ARGUMENT | DECLFLAG_VARIABLE | DECLFLAG_MAYBE_FUNCTION) typedef struct { diff --git a/sourcepawn/compiler/sc1.c b/sourcepawn/compiler/sc1.c index f1ad74fe..ad315fd2 100644 --- a/sourcepawn/compiler/sc1.c +++ b/sourcepawn/compiler/sc1.c @@ -3275,7 +3275,7 @@ static int parse_old_decl(declinfo_t *decl, int flags) } } - if ((flags & DECLMASK_NAMED_DECL) && !(flags & DECLFLAG_NO_POSTDIMS) && !decl->opertok) { + if ((flags & DECLMASK_NAMED_DECL) && !decl->opertok) { if (matchtoken('[')) parse_old_array_dims(decl, flags); } @@ -3316,7 +3316,7 @@ static int parse_new_decl(declinfo_t *decl, const token_t *first, int flags) } } - if ((flags & DECLMASK_NAMED_DECL) && !(flags & DECLFLAG_NO_POSTDIMS)) { + if (flags & DECLMASK_NAMED_DECL) { if (matchtoken('[')) { if (decl->type.numdim == 0) parse_old_array_dims(decl, flags); @@ -3401,14 +3401,6 @@ int parse_decl(declinfo_t *decl, int flags) } if ((flags & DECLMASK_NAMED_DECL) && matchtoken('[')) { - // If we're not allowing postdims here, then it must be a newdecl. - if (flags & DECLFLAG_NO_POSTDIMS) { - // Give the '[' and symbol back, since we're going to parse from the start. - lexpush(); - lexpush(); - return parse_new_decl(decl, NULL, flags); - } - // Oh no - we have to parse array dims before we can tell what kind of // declarator this is. It could be either: // "x[] y" (new-style), or From 49eee8c04ef112cb97dde27d24e4fb6626db6ddb Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 4 Jul 2014 16:55:33 -0700 Subject: [PATCH 5/7] Fix regression in methodmap tagging. --- sourcepawn/compiler/sc1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sourcepawn/compiler/sc1.c b/sourcepawn/compiler/sc1.c index ad315fd2..2d45de8e 100644 --- a/sourcepawn/compiler/sc1.c +++ b/sourcepawn/compiler/sc1.c @@ -703,7 +703,7 @@ int pc_addtag_flags(char *name, int flags) tag=(int)(ptr->value & TAGMASK); if (strcmp(name,ptr->name)==0) { ptr->value |= flags; - return tag; /* tagname is known, return its sequence number */ + return ptr->value & TAGMASK; } tag &= ~TAGFLAGMASK; if (tag>last) From dfa9a8f134b07d6e975d923a7d853848af2a2314 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 4 Jul 2014 17:01:12 -0700 Subject: [PATCH 6/7] Add tests. --- sourcepawn/compiler/sc1.c | 5 +- sourcepawn/compiler/tests/fail-newdecls.sp | 13 +++++ sourcepawn/compiler/tests/fail-newdecls.txt | 5 ++ sourcepawn/compiler/tests/ok-newdecls.sp | 55 +++++++++++++++++++++ 4 files changed, 74 insertions(+), 4 deletions(-) create mode 100644 sourcepawn/compiler/tests/fail-newdecls.sp create mode 100644 sourcepawn/compiler/tests/fail-newdecls.txt create mode 100644 sourcepawn/compiler/tests/ok-newdecls.sp diff --git a/sourcepawn/compiler/sc1.c b/sourcepawn/compiler/sc1.c index 2d45de8e..1806e344 100644 --- a/sourcepawn/compiler/sc1.c +++ b/sourcepawn/compiler/sc1.c @@ -3347,12 +3347,9 @@ static int reparse_new_decl(declinfo_t *decl, int flags) if (matchtoken('[')) parse_old_array_dims(decl, flags); } else { - // No post-dimensions means anything here is part of the type. if (matchtoken('[')) { - if (decl->type.numdim > 0) { - if (lexpeek('[')) + if (decl->type.numdim > 0) error(121); - } parse_old_array_dims(decl, flags); } else if (decl->type.numdim) { // Reset dimension sizes. diff --git a/sourcepawn/compiler/tests/fail-newdecls.sp b/sourcepawn/compiler/tests/fail-newdecls.sp new file mode 100644 index 00000000..197c4b10 --- /dev/null +++ b/sourcepawn/compiler/tests/fail-newdecls.sp @@ -0,0 +1,13 @@ +native int[] egg6(); +forward float[] egg7(); +new void crab4; +int[] yam1 = {1,2,3}, yam2[] = {3,4,5}; + +forward void OnPluginStart(); + +public int OnPluginStart() +{ + +} + + diff --git a/sourcepawn/compiler/tests/fail-newdecls.txt b/sourcepawn/compiler/tests/fail-newdecls.txt new file mode 100644 index 00000000..4258d3f8 --- /dev/null +++ b/sourcepawn/compiler/tests/fail-newdecls.txt @@ -0,0 +1,5 @@ +(1) : error 141: natives, forwards, and public functions cannot return arrays +(2) : error 141: natives, forwards, and public functions cannot return arrays +(3) : error 143: new-style declarations should not have "new" +(4) : error 121: cannot specify array dimensions on both type and name +(6) : error 025: function heading differs from prototype diff --git a/sourcepawn/compiler/tests/ok-newdecls.sp b/sourcepawn/compiler/tests/ok-newdecls.sp new file mode 100644 index 00000000..33000f14 --- /dev/null +++ b/sourcepawn/compiler/tests/ok-newdecls.sp @@ -0,0 +1,55 @@ +native egg(); +native void egg2(); +native int egg3(); +native bool egg4(); +native bool:egg5(); + +new crab; +new crab2 = 5; +bool crab3 = true; +int crab4 = 6; +new crab5[] = {1, 2, 3}; +bool[] crab6 = {true, false, false, true} +bool crab7[] = {false, true, true} +char crab8[] = "hello" +char[] crab9 = "bye" + +native float operator*(float oper1, float oper2) = FloatMul; + +forward void OnPluginStart(); + +public int Crab() +{ +} + +public float Crab2() +{ +} + +public Crab3() +{ +} + +stock char[] Crab4() +{ + new String:t[5] = "egg"; + return t; +} + +new yam, yam2, yam3 +new Float:ham, bool:ham2; +int cram, cram2, cram3; +new cram4[] = {1, 2}, cram5[] = {3, 4, 7} +int cram6[] = {1, 2}, cram7[] = {3, 4, 7} +int[] cram8 = {3, 4}, cram9 = {4, 8, 10} + +public OnPluginStart() +{ + new String:t[5]; + t = Crab4(); + cram4[0] = 2 + cram5[2] = 2 + cram7[2] = 2 + cram8[1] = 5 + cram9[2] = 5 +} From 1c41f905f92af0c7f6d620e9a0829370432aa093 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 4 Jul 2014 17:14:40 -0700 Subject: [PATCH 7/7] Add some tests and errors for bad void usage. --- sourcepawn/compiler/sc1.c | 27 ++++++++++++++++++++- sourcepawn/compiler/sc5.scp | 2 ++ sourcepawn/compiler/tests/fail-bad-void.sp | 13 ++++++++++ sourcepawn/compiler/tests/fail-bad-void.txt | 3 +++ 4 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 sourcepawn/compiler/tests/fail-bad-void.sp create mode 100644 sourcepawn/compiler/tests/fail-bad-void.txt diff --git a/sourcepawn/compiler/sc1.c b/sourcepawn/compiler/sc1.c index 1806e344..0679a5fb 100644 --- a/sourcepawn/compiler/sc1.c +++ b/sourcepawn/compiler/sc1.c @@ -154,6 +154,7 @@ static void inst_binary_name(char *binfname); static int operatorname(char *name); static int reparse_old_decl(declinfo_t *decl, int flags); static int reparse_new_decl(declinfo_t *decl, int flags); +static void check_void_decl(const declinfo_t *decl, int variable); enum { TEST_PLAIN, /* no parentheses */ @@ -1978,6 +1979,8 @@ static void declglb(declinfo_t *decl,int fpublic,int fstatic,int fstock) for (;;) { typeinfo_t *type = &decl->type; + check_void_decl(decl, TRUE); + ispublic=fpublic; if (decl->name[0]==PUBLIC_CHAR) { ispublic=TRUE; /* implicitly public variable */ @@ -3429,7 +3432,23 @@ int parse_decl(declinfo_t *decl, int flags) return parse_new_decl(decl, NULL, flags); } -void define_constructor(methodmap_t *map, methodmap_method_t *method) +static void check_void_decl(const declinfo_t *decl, int variable) +{ + if (decl->type.tag != pc_tag_void) + return; + + if (variable) { + error(144); + return; + } + + if (decl->type.numdim > 0) { + error(145); + return; + } +} + +static void define_constructor(methodmap_t *map, methodmap_method_t *method) { symbol *sym = findglb(map->name, sGLOBAL); @@ -4970,9 +4989,12 @@ static int newfunc(declinfo_t *decl, const int *thistag, int fpublic, int fstati if (symp) *symp = NULL; + check_void_decl(decl, FALSE); + if (decl->opertok) { check_operatortag(decl->opertok, decl->type.tag, decl->name); } /* if */ + /* check whether this is a function or a variable declaration */ if (!matchtoken('(')) return FALSE; @@ -5266,9 +5288,12 @@ static int declargs(symbol *sym, int chkshadow, const int *thistag) if (!matchtoken(')')){ do { /* there are arguments; process them */ declinfo_t decl; + parse_decl(&decl, DECLFLAG_ARGUMENT|DECLFLAG_ENUMROOT); assert(decl.type.numtags > 0); + check_void_decl(&decl, TRUE); + if (decl.type.ident == iVARARGS) { assert(decl.type.numtags > 0); if ((sym->usage & uPROTOTYPED)==0) { diff --git a/sourcepawn/compiler/sc5.scp b/sourcepawn/compiler/sc5.scp index 26997dae..70ea80d7 100644 --- a/sourcepawn/compiler/sc5.scp +++ b/sourcepawn/compiler/sc5.scp @@ -187,6 +187,8 @@ static char *errmsg[] = { /*141*/ "natives, forwards, and public functions cannot return arrays\n", /*142*/ "invalid type declaration\n", /*143*/ "new-style declarations should not have \"new\"\n", +/*144*/ "void cannot be used as a variable type\n", +/*145*/ "invalid type expression\n", #else "\250\261\311\232\271k\214:\234\303bu\201fo\223\204\221\012", "\202l\224\252s\205g\353\350e\233\201(\243\250\327\274\202) \255 f\247low ea\300 \042c\343e\042\012", diff --git a/sourcepawn/compiler/tests/fail-bad-void.sp b/sourcepawn/compiler/tests/fail-bad-void.sp new file mode 100644 index 00000000..4e83660f --- /dev/null +++ b/sourcepawn/compiler/tests/fail-bad-void.sp @@ -0,0 +1,13 @@ +void[] Bad1() +{ +} + +void Bad2; + +stock Bad3(void x) +{ +} + +public main() +{ +} diff --git a/sourcepawn/compiler/tests/fail-bad-void.txt b/sourcepawn/compiler/tests/fail-bad-void.txt new file mode 100644 index 00000000..7d5d07c8 --- /dev/null +++ b/sourcepawn/compiler/tests/fail-bad-void.txt @@ -0,0 +1,3 @@ +(1) : error 145: invalid type expression +(5) : error 144: void cannot be used as a variable type +(7) : error 144: void cannot be used as a variable type