Merge pull request #64 from alliedmodders/newdecl

New declaration syntax: arguments.
This commit is contained in:
David Anderson 2014-07-03 09:18:25 -07:00
commit bdb5ef506b
11 changed files with 769 additions and 447 deletions

View File

@ -52,7 +52,7 @@ new g_MapListSerial = -1;
new g_CurrentMapStartTime;
public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
public APLRes:AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
{
decl String:game[128];
GetGameFolderName(game, sizeof(game));
@ -75,7 +75,6 @@ public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
public OnPluginStart()
{
LoadTranslations("common.phrases");
LoadTranslations("nextmap.phrases");
@ -110,7 +109,7 @@ public OnConfigsExecuted()
}
}
public Action:Command_List(client, args)
public Action:Command_List(int client, int args)
{
PrintToConsole(client, "Map Cycle:");
@ -170,7 +169,7 @@ FindAndSetNextMap()
SetNextMap(mapName);
}
public Action:Command_MapHistory(client, args)
public Action:Command_MapHistory(int client, int args)
{
new mapCount = GetMapHistorySize();
@ -203,7 +202,7 @@ public Action:Command_MapHistory(client, args)
return Plugin_Handled;
}
FormatTimeDuration(String:buffer[], maxlen, time)
FormatTimeDuration(char[] buffer, int maxlen, int time)
{
new days = time / 86400;
new hours = (time / 3600) % 24;

View File

@ -1,3 +1,4 @@
// vim: set sts=2 ts=8 sw=2 tw=99 et:
/* Pawn compiler
*
* Drafted after the Small-C compiler Version 2.01, originally created
@ -50,6 +51,7 @@
#define CTRL_CHAR '\\' /* default control character */
#define sCHARBITS 8 /* size of a packed character */
#define MAXTAGS 16
#define sDIMEN_MAX 4 /* maximum number of array dimensions */
#define sLINEMAX 4095 /* input line length (in characters) */
#define sCOMP_STACK 32 /* maximum nesting of #if .. #endif sections */
@ -256,14 +258,34 @@ typedef struct svalue_s {
int lvalue;
} svalue;
#define DECLFLAG_ONLY_NEW_TYPES 0x1
#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)
typedef struct {
// Array information.
int numdim;
int dim[sDIMEN_MAX];
int idxtag[sDIMEN_MAX];
cell array_size;
constvalue *enumroot;
// Type information.
int tag; // Same as tags[0].
int tags[MAXTAGS]; // List of tags if multi-tagged.
int numtags; // Number of tags found.
int ident; // Either iREFERENCE, iARRAY, or iVARIABLE.
char usage; // Usage flags.
} typeinfo_t;
/* For parsing declarations. */
typedef struct {
char type[sNAMEMAX + 1];
constvalue *enumroot;
int tag;
char usage;
char name[sNAMEMAX + 1];
typeinfo_t type;
} declinfo_t;
/* "while" statement queue (also used for "for" and "do - while" loops) */
@ -492,8 +514,11 @@ typedef enum s_optmark {
#define FIXEDTAG 0x40000000Lu
#define FUNCTAG 0x20000000Lu
#define OBJECTTAG 0x10000000Lu
#define ENUMTAG 0x08000000Lu
#define METHODMAPTAG 0x04000000Lu
#define TAGMASK (~PUBLICTAG)
#define TAGFLAGMASK (FIXEDTAG | FUNCTAG | OBJECTTAG)
#define TAGTYPEMASK (FUNCTAG | OBJECTTAG | ENUMTAG | METHODMAPTAG)
#define TAGFLAGMASK (FIXEDTAG | TAGTYPEMASK)
#define CELL_MAX (((ucell)1 << (sizeof(cell)*8-1)) - 1)
@ -513,7 +538,8 @@ int pc_findtag(const char *name);
constvalue *pc_tagptr(const char *name);
int pc_enablewarning(int number,int enable);
const char *pc_tagname(int tag);
int parse_decl(declinfo_t *decl, const token_t *first, int flags);
int parse_decl(declinfo_t *decl, int flags);
const char *type_to_name(int tag);
/*
* Functions called from the compiler (to be implemented by you)
@ -599,11 +625,13 @@ SC_FUNC void preprocess(void);
SC_FUNC void lexinit(void);
SC_FUNC int lex(cell *lexvalue,char **lexsym);
SC_FUNC int lextok(token_t *tok);
SC_FUNC int lexpeek(int id);
SC_FUNC void lexpush(void);
SC_FUNC void lexclr(int clreol);
SC_FUNC int matchtoken(int token);
SC_FUNC int tokeninfo(cell *val,char **str);
SC_FUNC int needtoken(int token);
SC_FUNC int matchtoken2(int id, token_t *tok);
SC_FUNC int expecttoken(int id, token_t *tok);
SC_FUNC int matchsymbol(token_ident_t *ident);
SC_FUNC int needsymbol(token_ident_t *ident);
@ -888,8 +916,10 @@ SC_VDECL int pc_functag; /* global function tag */
SC_VDECL int pc_tag_string; /* global String tag */
SC_VDECL int pc_tag_void; /* global void tag */
SC_VDECL int pc_tag_object; /* root object tag */
SC_VDECL int pc_tag_bool; /* global bool tag */
SC_VDECL int pc_anytag; /* global any tag */
SC_VDECL int glbstringread; /* last global string read */
SC_VDECL int sc_require_newdecls; /* only newdecls are allowed */
SC_VDECL constvalue sc_automaton_tab; /* automaton table */
SC_VDECL constvalue sc_state_tab; /* state table */

View File

@ -78,6 +78,7 @@ int pc_functag = 0;
int pc_tag_string = 0;
int pc_tag_void = 0;
int pc_tag_object = 0;
int pc_tag_bool = 0;
typedef struct funcstub_setup_s {
const char *name;
@ -121,8 +122,7 @@ 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 int declargs(symbol *sym, int chkshadow, const int *thistag);
static void doarg(char *name,int ident,int offset,int tags[],int numtags,
int fpublic,int fconst,int chkshadow,arginfo *arg);
static void doarg(declinfo_t *decl, int offset, int fpublic, int chkshadow, arginfo *arg);
static void make_report(symbol *root,FILE *log,char *sourcefile);
static void reduce_referrers(symbol *root);
static long max_stacksize(symbol *root,int *recursion);
@ -705,8 +705,10 @@ int pc_addtag_flags(char *name, int flags)
ptr=tagname_tab.next;
while (ptr!=NULL) {
tag=(int)(ptr->value & TAGMASK);
if (strcmp(name,ptr->name)==0)
if (strcmp(name,ptr->name)==0) {
ptr->value |= flags;
return tag; /* tagname is known, return its sequence number */
}
tag &= ~TAGFLAGMASK;
if (tag>last)
last=tag;
@ -1261,7 +1263,7 @@ static void setconfig(char *root)
static void setcaption(void)
{
pc_printf("SourcePawn Compiler %s\n", SOURCEMOD_VERSION);
pc_printf("Copyright (c) 1997-2006, ITB CompuPhase, (C)2004-2008 AlliedModders, LLC\n\n");
pc_printf("Copyright (c) 1997-2006, ITB CompuPhase, (C)2004-2014 AlliedModders, LLC\n\n");
}
static void about(void)
@ -1345,6 +1347,7 @@ static void setconstants(void)
sc_rationaltag = pc_addtag("Float");
pc_tag_void = pc_addtag_flags("void", FIXEDTAG);
pc_tag_object = pc_addtag_flags("object", FIXEDTAG|OBJECTTAG);
pc_tag_bool = pc_addtag("bool");
add_constant("true",1,sGLOBAL,1); /* boolean flags */
add_constant("false",0,sGLOBAL,1);
@ -3242,70 +3245,6 @@ static void declstruct(void)
matchtoken(';'); /* eat up optional semicolon */
}
int parse_typeexpr(declinfo_t *decl, const token_t *first, int flags)
{
token_t tok;
if (first) {
tok = *first;
} else {
lextok(&tok);
}
if (tok.id == tCONST) {
decl->usage |= uCONST;
lextok(&tok);
}
if (tok.id == tLABEL && (flags & DECLFLAG_ONLY_NEW_TYPES)) {
error(120);
return FALSE;
}
if (tok.id == '[') {
error(121);
return FALSE;
}
switch (tok.id) {
case tINT:
strcpy(decl->type, "int");
decl->tag = 0;
break;
case tCHAR:
strcpy(decl->type, "char");
decl->tag = pc_tag_string;
break;
case tVOID:
strcpy(decl->type, "void");
decl->tag = pc_tag_void;
break;
case tOBJECT:
strcpy(decl->type, "object");
decl->tag = pc_tag_object;
break;
case tSYMBOL:
strcpy(decl->type, tok.str);
if (strcmp(decl->type, "float") == 0) {
decl->tag = sc_rationaltag;
} else {
decl->tag = pc_findtag(decl->type);
if (decl->tag == sc_rationaltag)
error(98, "Float", "float");
else if (decl->tag == pc_tag_string)
error(98, "String", "char");
else if (decl->tag == 0)
error(98, "_", "int");
}
break;
default:
error(122);
return FALSE;
}
return TRUE;
}
// Consumes a line, returns FALSE if EOF hit.
static int consume_line()
{
@ -3326,18 +3265,310 @@ static int consume_line()
return TRUE;
}
// Parse a new-style declaration. If the name was already fetched (because we
// didn't have enough lookahead), it can be given ahead of time.
int parse_decl(declinfo_t *decl, const token_t *first, int flags)
static int parse_new_typeexpr(typeinfo_t *type, const token_t *first, int flags)
{
memset(decl, 0, sizeof(*decl));
token_t tok;
if (!parse_typeexpr(decl, first, flags))
if (first)
tok = *first;
else
lextok(&tok);
if (tok.id == tCONST) {
if (type->usage & uCONST)
error(138);
type->usage |= uCONST;
lextok(&tok);
}
switch (tok.id) {
case tINT:
type->tag = 0;
break;
case tCHAR:
type->tag = pc_tag_string;
break;
case tVOID:
type->tag = pc_tag_void;
break;
case tOBJECT:
type->tag = pc_tag_object;
break;
case tLABEL:
type->tag = pc_addtag(tok.str);
error(120);
break;
case tSYMBOL:
if (strcmp(tok.str, "float") == 0) {
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) {
error(98, "Float", "float");
} else if (type->tag == pc_tag_string) {
error(98, "String", "char");
} else if (type->tag == 0) {
error(98, "_", "int");
} else if (type->tag == -1) {
error(139, tok.str);
type->tag = 0;
} else {
// Perform some basic filters so we can start narrowing down what can
// be used as a type.
if (!(type->tag & TAGTYPEMASK))
error(139, tok.str);
}
}
break;
default:
error(122);
goto err_out;
}
// 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);
break;
}
type->dim[type->numdim++] = 0;
if (!matchtoken(']')) {
error(140);
goto err_out;
}
} while (matchtoken('['));
type->ident = iARRAY;
}
if (flags & TYPEFLAG_ARGUMENT) {
if (matchtoken('&')) {
if (type->ident == iARRAY) {
error(137);
goto err_out;
}
type->ident = iREFERENCE;
}
}
type->tags[0] = type->tag;
type->numtags = 1;
return TRUE;
err_out:
type->tags[0] = type->tag;
type->numtags = 1;
return FALSE;
}
static void parse_old_array_dims(declinfo_t *decl, int flags)
{
typeinfo_t *type = &decl->type;
constvalue **enumrootp;
// Illegal declaration (we'll have a name since ref requires decl).
if (type->ident == iREFERENCE)
error(67, decl->name);
if (flags & TYPEFLAG_ENUMROOT)
enumrootp = &type->enumroot;
else
enumrootp = NULL;
do {
cell size;
if (type->numdim == sDIMEN_MAX) {
error(53);
return;
}
type->array_size = needsub(&type->idxtag[type->numdim], enumrootp);
if (type->array_size > INT_MAX)
error(165);
type->dim[type->numdim++] = type->array_size;
} while (matchtoken('['));
type->ident = iARRAY;
}
static int parse_old_decl(declinfo_t *decl, int flags)
{
token_t tok;
typeinfo_t *type = &decl->type;
if (matchtoken(tCONST)) {
if (type->usage & uCONST)
error(138);
type->usage |= uCONST;
}
if (flags & TYPEFLAG_ARGUMENT) {
if (matchtoken('&'))
type->ident = iREFERENCE;
// grammar for multitags is:
// multi-tag ::= '{' (symbol (',' symbol)*)? '}' ':'
if (matchtoken('{')) {
while (type->numtags < MAXTAGS) {
int tag = 0;
if (!matchtoken('_')) {
// If we don't get the magic tag '_', then we should have a symbol.
if (expecttoken(tSYMBOL, &tok))
tag = pc_addtag(tok.str);
}
type->tags[type->numtags++] = tag;
if (matchtoken('}'))
break;
needtoken(',');
}
needtoken(':');
}
}
if (type->numtags == 0) {
if (matchtoken2(tLABEL, &tok))
type->tags[type->numtags++] = pc_addtag(tok.str);
else
type->tags[type->numtags++] = 0;
}
// All finished with tag stuff.
type->tag = type->tags[0];
// Look for varargs and end early.
if (matchtoken(tELLIPS)) {
type->ident = iVARARGS;
return TRUE;
}
if (flags & TYPEMASK_NAMED_DECL) {
if (expecttoken(tSYMBOL, &tok))
strcpy(decl->name, tok.str);
else
strcpy(decl->name, "<unknown>");
}
if ((flags & TYPEMASK_NAMED_DECL) && !(flags & TYPEFLAG_NO_POSTDIMS)) {
if (matchtoken('['))
parse_old_array_dims(decl, flags);
}
return TRUE;
}
static int parse_new_decl(declinfo_t *decl, const token_t *first, int flags)
{
token_t tok;
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 (matchtoken('[')) {
if (decl->type.numdim == 0)
parse_old_array_dims(decl, flags);
else
error(121);
}
}
return TRUE;
}
// Parse a declaration.
//
// Grammar for named declarations is:
// "const"? symbol ('[' ']')* '&'? symbol
// | "const"? label? '&'? symbol '[' ']'
//
int parse_decl(declinfo_t *decl, int flags)
{
token_t tok;
token_ident_t ident;
memset(decl, 0, sizeof(*decl));
decl->type.ident = iVARIABLE;
// Must attempt to match const first, since it's a common prefix.
if (matchtoken(tCONST))
decl->type.usage |= uCONST;
// 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('{')))
return parse_old_decl(decl, flags);
// Another dead giveaway is there being a label.
if (lexpeek(tLABEL))
return parse_old_decl(decl, flags);
// Otherwise, we have to eat a symbol to tell.
if (matchsymbol(&ident)) {
if (lexpeek(tSYMBOL)) {
// 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.
return parse_new_decl(decl, &ident.tok, flags);
}
if ((flags & TYPEMASK_NAMED_DECL) && matchtoken('[')) {
// If we're not allowing postdims here, then it must be a newdecl.
if (flags & TYPEFLAG_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
// "y[]," (old-style)
parse_old_array_dims(decl, flags);
if (matchtoken(tSYMBOL) || matchtoken('&')) {
// 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();
return parse_new_decl(decl, &ident.tok, flags);
}
// The most basic - "x[]" and that's it. Well, we know it has no tag and
// we know its name. We might as well just complete the entire decl.
strcpy(decl->name, ident.name);
decl->type.tags[decl->type.numtags++] = 0;
decl->type.tag = decl->type.tags[0];
return TRUE;
}
// Give the symbol back to the lexer. This is an old decl.
lexpush();
return parse_old_decl(decl, flags);
}
// All else has failed. Probably got a type keyword. New-style.
return parse_new_decl(decl, NULL, flags);
}
void define_constructor(methodmap_t *map, methodmap_method_t *method)
{
symbol *sym = findglb(map->name, sGLOBAL);
@ -3410,7 +3641,7 @@ void check_name_length(char *original)
}
}
symbol *parse_inline_function(methodmap_t *map, const declinfo_t *decl, const char *name, int is_native, int is_ctor, int is_dtor)
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)
@ -3418,7 +3649,7 @@ symbol *parse_inline_function(methodmap_t *map, const declinfo_t *decl, const ch
else if (is_ctor)
setup.return_tag = map->tag;
else
setup.return_tag = decl->tag;
setup.return_tag = type->tag;
if (is_ctor)
setup.this_tag = -1;
@ -3474,7 +3705,7 @@ int check_this_tag(methodmap_t *map, symbol *target)
return ok;
}
int parse_property_accessor(const declinfo_t *decl, methodmap_t *map, methodmap_method_t *method)
int parse_property_accessor(const typeinfo_t *type, methodmap_t *map, methodmap_method_t *method)
{
token_ident_t ident;
int is_native = FALSE;
@ -3517,7 +3748,7 @@ int parse_property_accessor(const declinfo_t *decl, methodmap_t *map, methodmap_
char tmpname[METHOD_NAMEMAX + 1];
strcpy(tmpname, method->name);
strcat(tmpname, ".get");
target = parse_inline_function(map, decl, tmpname, is_native, FALSE, FALSE);
target = parse_inline_function(map, type, tmpname, is_native, FALSE, FALSE);
}
if (!target)
@ -3537,9 +3768,9 @@ int parse_property_accessor(const declinfo_t *decl, methodmap_t *map, methodmap_
}
// Must return the same tag as the property.
if (decl->tag != target->tag) {
if (type->tag != target->tag) {
const char *kind = getter ? "getter" : "setter";
error(128, "getter", map->name, decl->type);
error(128, "getter", map->name, type_to_name(type->tag));
}
if (!check_this_tag(map, target)) {
@ -3553,11 +3784,12 @@ int parse_property_accessor(const declinfo_t *decl, methodmap_t *map, methodmap_
methodmap_method_t *parse_property(methodmap_t *map)
{
declinfo_t decl;
typeinfo_t type;
token_ident_t ident;
methodmap_method_t *method;
if (!parse_decl(&decl, NULL, DECLFLAG_ONLY_NEW_TYPES))
memset(&type, 0, sizeof(type));
if (!parse_new_typeexpr(&type, NULL, TYPEFLAG_RETURN))
return NULL;
if (!needsymbol(&ident))
return NULL;
@ -3573,7 +3805,7 @@ methodmap_method_t *parse_property(methodmap_t *map)
return method;
while (!matchtoken('}')) {
if (!parse_property_accessor(&decl, map,method)) {
if (!parse_property_accessor(&type, map,method)) {
if (!consume_line())
return NULL;
}
@ -3601,8 +3833,10 @@ methodmap_method_t *parse_method(methodmap_t *map)
token_ident_t bindsource;
strcpy(bindsource.name, "<unknown>");
typeinfo_t type;
memset(&type, 0, sizeof(type));
token_t tok;
declinfo_t decl;
if (matchtoken('~')) {
// We got something like "public ~Blah = X"
is_bind = TRUE;
@ -3657,7 +3891,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_decl(&decl, first, DECLFLAG_ONLY_NEW_TYPES))
if (!parse_new_typeexpr(&type, first, TYPEFLAG_RETURN))
return NULL;
// Now, we should get an identifier.
@ -3697,7 +3931,7 @@ methodmap_method_t *parse_method(methodmap_t *map)
else if (target->ident != iFUNCTN)
error(10);
} else {
target = parse_inline_function(map, &decl, ident.name, is_native, is_ctor, is_dtor);
target = parse_inline_function(map, &type, ident.name, is_native, is_ctor, is_dtor);
}
if (!target)
@ -3796,7 +4030,7 @@ static void domethodmap(LayoutSpec spec)
map->spec = spec;
strcpy(map->name, mapname);
if (spec == Layout_MethodMap) {
map->tag = pc_addtag(mapname);
map->tag = pc_addtag_flags(mapname, FIXEDTAG | METHODMAPTAG);
} else {
constvalue *tagptr = pc_tagptr(mapname);
if (!tagptr) {
@ -4166,7 +4400,10 @@ static void decl_enum(int vclass)
* pc_addtag() here
*/
if (lex(&val,&str)==tLABEL) {
tag = pc_addtag(str);
int flags = ENUMTAG;
if (isupper(*str))
flags |= FIXEDTAG;
tag = pc_addtag_flags(str, flags);
spec = deduce_layout_spec_by_tag(tag);
if (!can_redef_layout_spec(spec, Layout_Enum))
error(110, str, layout_spec_name(spec));
@ -4181,7 +4418,10 @@ static void decl_enum(int vclass)
if (lex(&val,&str)==tSYMBOL) { /* read in (new) token */
strcpy(enumname,str); /* save enum name (last constant) */
if (!explicittag) {
tag=pc_addtag(enumname);
int flags = ENUMTAG;
if (isupper(*str))
flags |= FIXEDTAG;
tag=pc_addtag_flags(enumname, flags);
spec = deduce_layout_spec_by_tag(tag);
if (!can_redef_layout_spec(spec, Layout_Enum))
error(110, enumname, layout_spec_name(spec));
@ -4398,6 +4638,15 @@ static void attachstatelist(symbol *sym, int state_id)
} /* if */
}
// This simpler version of matchtag() only checks whether two tags represent
// the same type. Because methodmaps are attached to types and are not actually
// types themselves, we strip out the methodmap bit in case a methodmap was
// seen later than another instance of a tag.
static int compare_tag(int tag1, int tag2)
{
return (tag1 & (~METHODMAPTAG)) == (tag2 & (~METHODMAPTAG));
}
/*
* Finds a function in the global symbol table or creates a new entry.
* It does some basic processing and error checking.
@ -4414,7 +4663,7 @@ 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 && sym->tag!=tag)
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 */
@ -4616,7 +4865,7 @@ static int check_operatortag(int opertok,int resulttag,char *opername)
case tlNE:
case tlLE:
case tlGE:
if (resulttag!=pc_addtag("bool")) {
if (resulttag!=pc_tag_bool) {
error(63,opername,"bool:"); /* operator X requires a "bool:" result tag */
return FALSE;
} /* if */
@ -5103,11 +5352,7 @@ static int argcompare(arginfo *a1,arginfo *a2)
{
int result,level,i;
#if 0 /* SourceMod uses case insensitive args for forwards */
result= strcmp(a1->name,a2->name)==0; /* name */
#else
result=1;
#endif
if (result)
result= a1->ident==a2->ident; /* type/class */
if (result)
@ -5115,13 +5360,13 @@ static int argcompare(arginfo *a1,arginfo *a2)
if (result)
result= a1->numtags==a2->numtags; /* tags (number and names) */
for (i=0; result && i<a1->numtags; i++)
result= a1->tags[i]==a2->tags[i];
result= compare_tag(a1->tags[i], a2->tags[i]);
if (result)
result= a1->numdim==a2->numdim; /* array dimensions & index tags */
for (level=0; result && level<a1->numdim; level++)
result= a1->dim[level]==a2->dim[level];
for (level=0; result && level<a1->numdim; level++)
result= a1->idxtag[level]==a2->idxtag[level];
result= compare_tag(a1->idxtag[level], a2->idxtag[level]);
if (result)
result= a1->hasdefault==a2->hasdefault; /* availability of default value */
if (a1->hasdefault) {
@ -5144,7 +5389,7 @@ static int argcompare(arginfo *a1,arginfo *a2)
} /* if */
} /* if */
if (result)
result= a1->defvalue_tag==a2->defvalue_tag;
result= compare_tag(a1->defvalue_tag, a2->defvalue_tag);
} /* if */
return result;
}
@ -5156,13 +5401,12 @@ static int argcompare(arginfo *a1,arginfo *a2)
*/
static int declargs(symbol *sym, int chkshadow, const int *thistag)
{
#define MAXTAGS 16
char *ptr;
int argcnt,oldargcnt,tok,tags[MAXTAGS],numtags;
int argcnt,oldargcnt,tok;
cell val;
arginfo arg, *arglist;
char name[sNAMEMAX+1];
int ident,fpublic,fconst;
int ident,fpublic;
int idx;
/* if the function is already defined earlier, get the number of arguments
@ -5173,9 +5417,6 @@ static int declargs(symbol *sym, int chkshadow, const int *thistag)
while (sym->dim.arglist[oldargcnt].ident!=0)
oldargcnt++;
argcnt=0; /* zero aruments up to now */
ident=iVARIABLE;
numtags=0;
fconst=FALSE;
fpublic = (sym->usage & (uPUBLIC|uSTOCK))!=0;
if (thistag && *thistag != -1) {
@ -5210,52 +5451,43 @@ static int declargs(symbol *sym, int chkshadow, const int *thistag)
/* the '(' parantheses has already been parsed */
if (!matchtoken(')')){
do { /* there are arguments; process them */
/* any legal name increases argument count (and stack offset) */
tok=lex(&val,&ptr);
switch (tok) {
case 0:
/* nothing */
break;
case '&':
if (ident!=iVARIABLE || numtags>0)
error(1,"-identifier-","&");
ident=iREFERENCE;
break;
case tCONST:
if (ident!=iVARIABLE || numtags>0)
error(1,"-identifier-","const");
fconst=TRUE;
break;
case tLABEL:
if (numtags>0)
error(1,"-identifier-","-tagname-");
tags[0]=pc_addtag(ptr);
numtags=1;
break;
case '{':
if (numtags>0)
error(1,"-identifier-","-tagname-");
numtags=0;
while (numtags<MAXTAGS) {
if (!matchtoken('_') && !needtoken(tSYMBOL))
break;
tokeninfo(&val,&ptr);
tags[numtags++]=pc_addtag(ptr);
if (matchtoken('}'))
break;
needtoken(',');
} /* for */
needtoken(':');
tok=tLABEL; /* for outer loop: flag that we have seen a tagname */
break;
case tSYMBOL:
declinfo_t decl;
parse_decl(&decl, TYPEFLAG_ARGUMENT|TYPEFLAG_ENUMROOT);
assert(decl.type.numtags > 0);
if (decl.type.ident == iVARARGS) {
assert(decl.type.numtags > 0);
if ((sym->usage & uPROTOTYPED)==0) {
/* redimension the argument list, add the entry iVARARGS */
sym->dim.arglist=(arginfo*)realloc(sym->dim.arglist,(argcnt+2)*sizeof(arginfo));
if (sym->dim.arglist==0)
error(163); /* insufficient memory */
memset(&sym->dim.arglist[argcnt+1],0,sizeof(arginfo)); /* keep the list terminated */
sym->dim.arglist[argcnt].ident=iVARARGS;
sym->dim.arglist[argcnt].hasdefault=FALSE;
sym->dim.arglist[argcnt].defvalue.val=0;
sym->dim.arglist[argcnt].defvalue_tag=0;
sym->dim.arglist[argcnt].numtags=decl.type.numtags;
sym->dim.arglist[argcnt].tags=(int*)malloc(decl.type.numtags*sizeof decl.type.tags[0]);
if (sym->dim.arglist[argcnt].tags==NULL)
error(163); /* insufficient memory */
memcpy(sym->dim.arglist[argcnt].tags,decl.type.tags,decl.type.numtags*sizeof decl.type.tags[0]);
} else {
if (argcnt>oldargcnt || sym->dim.arglist[argcnt].ident!=iVARARGS)
error(25); /* function definition does not match prototype */
} /* if */
argcnt++;
continue;
}
if (argcnt>=sMAXARGS)
error(45); /* too many function arguments */
strcpy(name,ptr); /* save symbol name */
if (name[0]==PUBLIC_CHAR)
error(45);
if (decl.name[0] == PUBLIC_CHAR)
error(56,name); /* function arguments cannot be public */
if (numtags==0)
tags[numtags++]=0; /* default tag */
if (1) {
if (decl.type.ident == iARRAY)
decl.type.ident = iREFARRAY;
/* Stack layout:
* base + 0*sizeof(cell) == previous "base"
* base + 1*sizeof(cell) == function return address
@ -5263,10 +5495,11 @@ static int declargs(symbol *sym, int chkshadow, const int *thistag)
* base + 3*sizeof(cell) == first argument of the function
* So the offset of each argument is "(argcnt+3) * sizeof(cell)".
*/
doarg(name,ident,(argcnt+3)*sizeof(cell),tags,numtags,fpublic,fconst,chkshadow,&arg);
/* :TODO: fix this so stocks that are func pointers can't have default arguments? */
doarg(&decl,(argcnt+3)*sizeof(cell),fpublic,chkshadow,&arg);
if ((sym->usage & uPUBLIC) && arg.hasdefault)
error(59,name); /* arguments of a public function may not have a default value */
if ((sym->usage & uPROTOTYPED)==0) {
/* redimension the argument list, add the entry */
sym->dim.arglist=(arginfo*)realloc(sym->dim.arglist,(argcnt+2)*sizeof(arginfo));
@ -5287,41 +5520,8 @@ static int declargs(symbol *sym, int chkshadow, const int *thistag)
free(arg.tags);
} /* if */
argcnt++;
ident=iVARIABLE;
numtags=0;
fconst=FALSE;
break;
case tELLIPS:
if (ident!=iVARIABLE)
error(10); /* illegal function or declaration */
if (numtags==0)
tags[numtags++]=0; /* default tag */
if ((sym->usage & uPROTOTYPED)==0) {
/* redimension the argument list, add the entry iVARARGS */
sym->dim.arglist=(arginfo*)realloc(sym->dim.arglist,(argcnt+2)*sizeof(arginfo));
if (sym->dim.arglist==0)
error(163); /* insufficient memory */
memset(&sym->dim.arglist[argcnt+1],0,sizeof(arginfo)); /* keep the list terminated */
sym->dim.arglist[argcnt].ident=iVARARGS;
sym->dim.arglist[argcnt].hasdefault=FALSE;
sym->dim.arglist[argcnt].defvalue.val=0;
sym->dim.arglist[argcnt].defvalue_tag=0;
sym->dim.arglist[argcnt].numtags=numtags;
sym->dim.arglist[argcnt].tags=(int*)malloc(numtags*sizeof tags[0]);
if (sym->dim.arglist[argcnt].tags==NULL)
error(163); /* insufficient memory */
memcpy(sym->dim.arglist[argcnt].tags,tags,numtags*sizeof tags[0]);
} else {
if (argcnt>oldargcnt || sym->dim.arglist[argcnt].ident!=iVARARGS)
error(25); /* function definition does not match prototype */
} /* if */
argcnt++;
break;
default:
error(10); /* illegal function or declaration */
} /* switch */
} while (tok=='&' || tok==tLABEL || tok==tCONST
|| (tok!=tELLIPS && matchtoken(','))); /* more? */
}
} while (matchtoken(','));
/* if the next token is not ",", it should be ")" */
needtoken(')');
} /* if */
@ -5380,50 +5580,29 @@ static int declargs(symbol *sym, int chkshadow, const int *thistag)
* "fpublic" indicates whether the function for this argument list is public.
* The arguments themselves are never public.
*/
static void doarg(char *name,int ident,int offset,int tags[],int numtags,
int fpublic,int fconst,int chkshadow,arginfo *arg)
static void doarg(declinfo_t *decl, int offset, int fpublic, int chkshadow, arginfo *arg)
{
symbol *argsym;
constvalue *enumroot;
cell size;
int slength=0;
typeinfo_t *type = &decl->type;
strcpy(arg->name,name);
strcpy(arg->name, decl->name);
arg->hasdefault=FALSE; /* preset (most common case) */
arg->defvalue.val=0; /* clear */
arg->defvalue_tag=0;
arg->numdim=0;
if (matchtoken('[')) {
if (ident==iREFERENCE)
error(67,name); /* illegal declaration ("&name[]" is unsupported) */
do {
if (arg->numdim == sDIMEN_MAX) {
error(53); /* exceeding maximum number of dimensions */
return;
} /* if */
size=needsub(&arg->idxtag[arg->numdim],&enumroot);/* may be zero here, it is a pointer anyway */
#if INT_MAX < LONG_MAX
if (size > INT_MAX)
error(165); /* overflow, exceeding capacity */
#endif
arg->dim[arg->numdim]=(int)size;
arg->numdim+=1;
} while (matchtoken('['));
ident=iREFARRAY; /* "reference to array" (is a pointer) */
#if 0 /* For SM, multiple tags including string don't make sense,
so just check the first tag. Done manually so the string
tag isn't matched with the any tag. */
if (checktag(tags, numtags, pc_tag_string)) {
#endif
assert(tags!=0);
assert(numtags>0);
if (tags[0] == pc_tag_string) {
if (type->ident == iREFARRAY) {
arg->numdim = type->numdim;
memcpy(arg->dim, type->dim, sizeof(int) * type->numdim);
memcpy(arg->idxtag, type->idxtag, sizeof(int) * type->numdim);
assert(type->numtags > 0);
if (type->tags[0] == pc_tag_string) {
slength = arg->dim[arg->numdim - 1];
arg->dim[arg->numdim - 1] = (size + sizeof(cell) - 1) / sizeof(cell);
arg->dim[arg->numdim - 1] = (type->array_size + sizeof(cell) - 1) / sizeof(cell);
}
if (matchtoken('=')) {
assert(litidx==0); /* at the start of a function, this is reset */
assert(numtags>0);
/* Check if there is a symbol */
if (matchtoken(tSYMBOL)) {
symbol *sym;
@ -5443,8 +5622,8 @@ static void doarg(char *name,int ident,int offset,int tags[],int numtags,
}
}
} else {
initials2(ident,tags[0],&size,arg->dim,arg->numdim,enumroot, 1, 0);
assert(size>=litidx);
initials2(type->ident, type->tags[0], &type->array_size, arg->dim, arg->numdim, type->enumroot, 1, 0);
assert(type->array_size >= litidx);
/* allocate memory to hold the initial values */
arg->defvalue.array.data=(cell *)malloc(litidx*sizeof(cell));
if (arg->defvalue.array.data!=NULL) {
@ -5466,7 +5645,7 @@ static void doarg(char *name,int ident,int offset,int tags[],int numtags,
} else {
if (matchtoken('=')) {
unsigned char size_tag_token;
assert(ident==iVARIABLE || ident==iREFERENCE);
assert(type->ident==iVARIABLE || type->ident==iREFERENCE);
arg->hasdefault=TRUE; /* argument has a default value */
size_tag_token=(unsigned char)(matchtoken(tSIZEOF) ? uSIZEOF : 0);
if (size_tag_token==0)
@ -5475,8 +5654,8 @@ static void doarg(char *name,int ident,int offset,int tags[],int numtags,
size_tag_token=(unsigned char)(matchtoken(tCELLSOF) ? uCOUNTOF : 0);
if (size_tag_token!=0) {
int paranthese;
if (ident==iREFERENCE)
error(66,name); /* argument may not be a reference */
if (type->ident==iREFERENCE)
error(66, decl->name); /* argument may not be a reference */
paranthese=0;
while (matchtoken('('))
paranthese++;
@ -5494,41 +5673,41 @@ static void doarg(char *name,int ident,int offset,int tags[],int numtags,
needtoken(']');
} /* while */
} /* if */
if (ident==iVARIABLE) /* make sure we set this only if not a reference */
if (type->ident==iVARIABLE) /* make sure we set this only if not a reference */
arg->hasdefault |= size_tag_token; /* uSIZEOF or uTAGOF */
} /* if */
while (paranthese--)
needtoken(')');
} else {
constexpr(&arg->defvalue.val,&arg->defvalue_tag,NULL);
assert(numtags>0);
matchtag(tags[0],arg->defvalue_tag,TRUE);
assert(type->numtags > 0);
matchtag(type->tags[0], arg->defvalue_tag, TRUE);
} /* if */
} /* if */
} /* if */
arg->ident=(char)ident;
arg->usage=(char)(fconst ? uCONST : 0);
arg->numtags=numtags;
arg->tags=(int*)malloc(numtags*sizeof tags[0]);
arg->ident=(char)type->ident;
arg->usage=type->usage;
arg->numtags=type->numtags;
arg->tags=(int*)malloc(type->numtags * sizeof(type->tags[0]));
if (arg->tags==NULL)
error(163); /* insufficient memory */
memcpy(arg->tags,tags,numtags*sizeof tags[0]);
argsym=findloc(name);
memcpy(arg->tags, type->tags, type->numtags * sizeof(type->tags[0]));
argsym=findloc(decl->name);
if (argsym!=NULL) {
error(21,name); /* symbol already defined */
error(21, decl->name); /* symbol already defined */
} else {
if (chkshadow && (argsym=findglb(name,sSTATEVAR))!=NULL && argsym->ident!=iFUNCTN)
error(219,name); /* variable shadows another symbol */
if (chkshadow && (argsym=findglb(decl->name,sSTATEVAR))!=NULL && argsym->ident!=iFUNCTN)
error(219, decl->name); /* variable shadows another symbol */
/* add details of type and address */
assert(numtags>0);
argsym=addvariable2(name,offset,ident,sLOCAL,tags[0],
assert(type->numtags > 0);
argsym=addvariable2(decl->name,offset,type->ident,sLOCAL,type->tags[0],
arg->dim,arg->numdim,arg->idxtag,slength);
argsym->compound=0;
if (ident==iREFERENCE)
if (type->ident==iREFERENCE)
argsym->usage|=uREAD; /* because references are passed back */
if (fpublic)
argsym->usage|=uREAD; /* arguments of public functions are always "used" */
if (fconst)
if (type->usage & uCONST)
argsym->usage|=uCONST;
} /* if */
}
@ -6375,7 +6554,7 @@ SC_FUNC symbol *add_constant(char *name,cell val,int vclass,int tag)
*/
if (!redef)
goto redef_enumfield;
} else if (sym->tag!=tag) {
} else if (!compare_tag(sym->tag, tag)) {
redef=1; /* redefinition of a constant (non-enum) to a different tag is not allowed */
} /* if */
if (redef) {
@ -6753,9 +6932,10 @@ static int test(int label,int parens,int invert)
} /* if */
return testtype;
} /* if */
if (tag!=0 && tag!=pc_addtag("bool"))
if (tag!=0 && tag!=pc_tag_bool) {
if (check_userop(lneg,tag,0,1,NULL,&tag))
invert= !invert; /* user-defined ! operator inverted result */
}
if (invert)
jmp_ne0(label); /* jump to label if true (different from 0) */
else

View File

@ -1151,6 +1151,10 @@ static int command(void)
cell val;
preproc_expr(&val,NULL);
sc_needsemicolon=(int)val;
} else if (strcmp(str, "require_newdecls")==0) {
cell val;
preproc_expr(&val,NULL);
sc_require_newdecls = (int)val;
} else if (strcmp(str,"tabsize")==0) {
cell val;
preproc_expr(&val,NULL);
@ -2264,6 +2268,16 @@ SC_FUNC void lexclr(int clreol)
} /* if */
}
// Return true if the symbol is ahead, false otherwise.
SC_FUNC int lexpeek(int id)
{
if (matchtoken(id)) {
lexpush();
return TRUE;
}
return FALSE;
}
/* matchtoken
*
* This routine is useful if only a simple check is needed. If the token
@ -3119,6 +3133,15 @@ SC_FUNC int expecttoken(int id, token_t *tok)
return FALSE;
}
SC_FUNC int matchtoken2(int id, token_t *tok)
{
if (matchtoken(id)) {
tok->id = tokeninfo(&tok->val, &tok->str);
return TRUE;
}
return FALSE;
}
SC_FUNC int matchsymbol(token_ident_t *ident)
{
if (lextok(&ident->tok) != tSYMBOL) {

View File

@ -314,6 +314,24 @@ SC_FUNC int checktag_string(value *sym1, value *sym2)
return FALSE;
}
SC_FUNC const char *type_to_name(int tag)
{
if (tag == 0)
return "int";
if (tag == sc_rationaltag)
return "float";
if (tag == pc_tag_string)
return "char";
const char *name = pc_tagname(tag);
if (name)
return NULL;
if (tag & FUNCTAG)
return "function";
return "unknown";
}
SC_FUNC int matchtag_string(int ident, int tag)
{
if (ident == iARRAY || ident == iREFARRAY)

View File

@ -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}, {105,110}, {100,32}, {97,114}, {116,105}, {37,115}, {101,114}, {110,111}, {101,110}, {97,108}, {97,110}, {135,130}, {34,136},
{143,34}, {111,114}, {114,101}, {117,110}, {121,32}, {138,129}, {97,116}, {115,116}, {115,105}, {100,101}, {101,133}, {32,144}, {117,109}, {41,10}, {116,104}, {117,115},
{145,32}, {147,99}, {98,108}, {142,32}, {102,161}, {97,32}, {98,111}, {101,120}, {118,140}, {114,97}, {115,121}, {109,166}, {170,171}, {172,108}, {103,32}, {156,139},
{99,141}, {137,32}, {103,175}, {134,178}, {116,111}, {105,131}, {115,10}, {176,149}, {115,152}, {134,169}, {99,104}, {105,133}, {102,132}, {97,162}, {116,121}, {101,131},
{159,129}, {164,163}, {168,187}, {109,192}, {104,97}, {101,100}, {111,102}, {99,116}, {132,194}, {109,97}, {109,101}, {190,112}, {37,131}, {173,155}, {44,32}, {116,97},
{99,111}, {167,112}, {98,128}, {99,130}, {118,134}, {198,32}, {105,189}, {212,214}, {117,108}, {109,139}, {185,148}, {153,188}, {134,97}, {118,128}, {179,129}, {101,10},
{130,32}, {102,105}, {111,112}, {97,115}, {136,10}, {155,10}, {151,150}, {109,150}, {110,32}, {226,137}, {128,144}, {205,157}, {34,32}, {100,105}, {119,105}, {40,235},
{99,108}, {211,151}, {140,32}, {141,32}, {196,221}, {101,108}, {152,122}, {108,128}, {164,142}, {132,32}, {132,174}, {207,174}, {231,186}, {158,128}, {97,131}
{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}
};
/*-*SCPACK end of pair table, do not change or remove this line */
@ -164,7 +164,7 @@ static char *errmsg[] = {
/*118*/ "destructors must be native functions\n",
/*119*/ "destructors cannot have extra arguments\n",
/*120*/ "methodmap and class signatures must use new-style type declarations\n",
/*121*/ "this syntax is not yet supported\n",
/*121*/ "cannot specify array dimensions on both type and name\n",
/*122*/ "expected type expression\n",
/*123*/ "fully-qualified name \"%s\" is too long, would be truncated to \"%s\"\n",
/*124*/ "unexpected token, expected method or property\n",
@ -179,142 +179,151 @@ static char *errmsg[] = {
/*133*/ "cannot coerce unrelated object types %s and %s\n",
/*134*/ "type mismatch (%s and %s)\n",
/*135*/ "cannot use an object in a multi-tag selector\n",
/*136*/ "arrays are not supported as return types\n",
/*137*/ "cannot mix reference and array types\n",
/*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",
#else
"\321e\307\232\264k\213:\233\316bu\201fo\223\205\220\012",
"\202l\224\245s\204g\367\346e\331\201(\240\321\222\270\202) \260 follow ea\272 \042c\343e\042\012",
"\231\360\334\243\325\245loc\362\327\200\303appe\206 \371\245\320mpo\223\205\242ock\012",
"\370\233 \265\225imple\331t\305\012",
"\301\311\224\225\364\263t\266",
"\303\322a\270gn\232\264 \363\271y\012",
"\351\226\240\267\322\222\333\305\012",
"\303\322\245\361\215\201\321\222\270\202; \343s\234\232z\211o\012",
"\310\332\366\200(nega\207ve\316z\211o \240ou\201\325\246\223ds\235",
"\310\301\240\231\360\334\216\012",
"\310out\230d\200\370\266",
"\310\301c\214l\316\225\245\302add\222s\266",
"\212 \213tr\224po\204\201(\212 pu\242ic \370s\235",
"\310\346e\331t; \225\371s\356t\272\012",
"\042\231fa\330t\354c\343\200\303\322\375l\343\201c\343\200\371s\356t\272 \346e\331t\012",
"m\330\207p\367\231fa\330t\203\371\042s\356t\272\042\012",
"\223\333\232\315\012",
"\204i\207\214iza\243d\226\245\247ce\305\203\231\360\206\232\366\337",
"\225\245lab\365:\345",
"\310\255 nam\352\012",
"\255 \214\222ad\224\333\305:\345",
"\303\322l\250u\200(n\202-\361\215t\235",
"\332a\270gn\331\201\303\322\230mp\367a\270gn\331t\012",
"\042b\222ak\354\240\042\323t\204ue\354\265ou\201\325\323t\247t\012",
"\301head\372\355ff\211\203from pro\264\313\337",
"\212 \374\372\042#if...\042\012",
"\310\272\334\307\261\361\215t\012",
"\310subscrip\201(\225\363\332\240\264o m\215\224subscripts):\345",
"\310\321\222\270\202\316\343s\234\232z\211o\012",
"\320mpo\223\205\346e\331\201\225\360os\232a\201\375\213\205\325\341\367(\227\206t\232a\201l\204\200%d\235",
"\223k\212w\350\355\222c\207v\337",
"\332\204\231x ou\201\325\246\223d\203(\327\352\235",
"\332\303\322\204\231x\232(\327\352\235",
"\336do\277\225\364\245\231fa\330\201\250u\200(\336%d\235",
"\336\313\200mis\374 (\336%d\235",
"empt\224\346e\331t\012",
"\310\227r\372(po\270\242\224n\202-t\211m\204\226\232\227r\204g\235",
"\247tr\245\272\334\307\211\203\340l\204\337",
"\361\215\201\255 \304\203\212 \366\337",
"duplic\226\200\042c\343e\354lab\365 (\250u\200%d\235",
"\310\365lip\230s\316\332\366\200\265\225k\212wn\012",
"\310\320mb\204a\243\325\360\343\203speci\341\211\266",
"\272\334\307\261\361\215\201\247ce\305\203r\215g\200f\240pack\232\227r\204g\012",
"po\230\216\362p\334\312t\211\203\303p\222c\305\200\214l nam\232p\334\312t\211\266",
"\264o m\215\224\301\263t\266",
"\223k\212w\350\332\366\200(\327\352\235",
"\332\366\277do \225\374\316\240\231\227\204a\243\332\265\264o sm\214l\012",
"\332(\203do \225\374\012",
"\310l\204\200\323t\204ua\216\012",
"\310r\215g\337",
"\310subscript\316\237\200\042[ ]\354\351\226\221\203\340\311j\240\355\331\230\202\266",
"m\330\207-\355\331\230\202\362\271y\203\303\322f\330l\224\204i\207\214iz\305\012",
"\247ce\305\372\311xim\234 n\234b\261\325\355\331\230\202\266",
"\223\374\232\360os\372b\251c\200(\042}\042\235",
"\227\206\201\325\301\246d\224\356\236ou\201\301head\211\012",
"\271ys\316loc\362\327\277\215\205\301\263t\203\267\322pu\242ic (\327\352\235",
"\223\274ish\232\321\222\270\340bef\221\200\320mpil\261\355\222c\207v\337",
"duplic\226\200\263t; sam\200\336\265p\343s\232t\356c\337",
"\301\336\311\224\225\364\245\231fa\330\201\250u\200(\327\352\235",
"m\330\207p\367\042#\365se\354\355\222c\207v\277betwe\213 \042#if ... #\213\355f\042\012",
"\042#\365seif\354\355\222c\207\335follow\203\363\042#\365se\354\355\222c\207v\337",
"n\234b\261\325\351\215d\203do\277\225\341\201\375\351\226\221\012",
"\301\222s\330\201\373\325\351\226\221\233 \303\322\220\012",
"\267\272\215g\200p\222\333\232\351\226\221\266",
"\301\336\311\224\202l\224\364\245s\204g\367\373(\336%d\235",
"\301\336\311\224\225\322\245\222f\211\213c\200\336\240\363\332(\336\220\235",
"\327\200\267\322\246\236 \245\222f\211\213c\200\215\205\363\332(\327\352\235",
"\310\251\216\362n\234b\261p\222ci\230\340\371#p\251g\311\012",
"\251\216\362n\234b\261f\221\311\201\214\222ad\224\333\305\012",
"\251\216\362n\234b\261supp\221\201w\376\225\213\275\305\012",
"\237\211-\333\232\351\226\240\303\322\231\360\206\232bef\221\200\237\200(\370\233\235",
"\042\366e\306\354\351\226\240\265\310\340\042\370\354\255\266",
"\301\336\303\322\363\332(\336\220\235",
"#\333\200p\226t\211\350\303\227\206\201\356\236 \363\214p\304be\207c \272\334\307\211\012",
"\204pu\201l\204\200\264o l\202\256(aft\261subs\207tu\216s\235",
"\252n\317x \211r\240\371\375\321\222\270\202\316\240\310\301c\214l\012",
"m\214f\221m\232UTF-8 \213\320d\204g\316\240c\221rupt\232\341le: \344",
"\301\237\277\246\236 \042\222turn\354\215\205\042\222tur\350<\250ue>\042\012",
"\204\323\230\227\213\201\222tur\350\313\277(\332& n\202-\271y\235",
"\223k\212w\350\255\316\240\225\245\361\215\201\255 \357",
"\267\317k\200\245\373\376\245\231fa\330\201\250u\200f\240\363\204\231x\232\332p\334\312t\261\357",
"\237\211-\333\232\351\226\221\203\215\205na\207\335\370\203\311\224\225\364\346e\266",
"\245\301\240\327\200\311\224\202l\224b\365\202\256\264 \245s\204g\367au\264\347\340\357",
"\346\200\323fli\307: \202\200\325\375\346\277\265\214\222ad\224a\270gn\232\264 a\212\236\261imple\331\317\243\357",
"\212 \346\277\206\200\333\232f\240\315\012",
"\223k\212w\350au\264\347\202\345",
"\223k\212w\350\346\352 f\240au\264\347\202\345",
"pu\242ic \327\277\215\205loc\362\327\277\311\224\225\364\346\277\357",
"\346\200\327\277\311\224\225\322\204i\207\214iz\232\357",
"pu\242ic \370\203\311\224\225\222tur\350\271y\203\357",
"ambiguou\203\361\215t; \373ov\211rid\200\265\222qui\222\205\357",
"n\234b\261\325\263t\203do\277\225\374 \333i\216\012",
"\321e\307\232\373nam\200id\213\207\341\211\012",
"\301\213\234\211a\243\222qui\222\203\223iqu\200\317g\012",
"\267\364\222qui\222\205p\334\312t\211\203aft\261\342\216\362p\334\312t\211\266",
"\320\330\205\225\274\205\312mb\211\233 \371\227ruc\201\220\012",
"\315 do\277\225\364\245\374\372\313\337",
"\313\352 sho\330\205\322\220 \371new-\227y\367\231\360\334\216\266",
"\314sho\330\205\225\364\363\321lici\201\222tur\350\313\337",
"\301pro\264\313\277do \225\374\012",
"specif\224ei\236\261\214l \355\331\230\202\203\240\202l\224\375l\343\201\355\331\230\202\012",
"\267\274\205\314\344",
"\314w\376\214\222ad\224\333\232\340\236\265\344",
"\267\274\205\215\224\312\236od\203f\240\344",
"\267\274\205\312\236o\205\240pr\351t\224\210.\344",
"\267c\214l \312\236od\203\340\363\271y\012",
"\267c\214l \312\236od\203\340\245\370\012",
"\312\236o\205\303\364\245\341rs\201\336\320mpa\207\242\200\356\236 \375\314\313\200(\210\235",
"\314nam\200\303\227\206\201\356\236 \363upp\211c\343\200lett\211\012",
"\314\304\203\214\222ad\224be\213 \333\232(p\222vio\237l\224se\213 \376\210\235",
"\321e\307\232id\213\207\341\261- d\273you f\221ge\201\245\313e?\012",
"\361ru\307\240\301\303\222tur\350\373\344",
"\267\333\200\361ru\307\240f\221\233; \214\222ad\224\247i\227\203\376\245\344",
"miss\372\313e\316\240\314\303\364\375sam\200nam\200\376\314\220\012",
"\267\237\200\231lete\316\314\314\304\203\212 \231\227ru\307\221\012",
"\212 \312\236od\311p \240\360\343\203w\376fo\223\205f\240\344",
"\212 \231\227ru\307\240w\376fo\223\205f\240\314\344",
"\231\227ru\307\221\203\303\322na\207\335\370\266",
"\231\227ru\307\221\203\267\364\247tr\245\263t\266",
"\312\236od\311p \215\205\360\343\203\230gn\226u\222\203\303\237\200new-\227y\367\313\200\231\360\334\216\266",
"\236\265\252n\317x \265\225ye\201supp\221t\305\012",
"\321e\307\232\313\200\321\222\270\202\012",
"f\330ly-qu\214i\341\232nam\352 \265\264o l\202g\316wo\330\205\322tr\241\226\232\264\345",
"\223\321e\307\232\264k\213\316\321e\307\232\312\236o\205\240pr\351\276\012",
"\321e\307\232\042na\207ve\354\240\042get\042\012",
"\314f\240\314\214\222ad\224\247i\227\266",
"pr\351t\224gett\211\203\267accep\201\247tr\245\263t\266",
"\314\303\364\375sam\200\222tur\350\313\200\376pr\351t\224\314(\210\235",
"\267mix \312\236od\311p\203\215\205\360\343s\277\356\236 \204h\211it\215c\337",
"\267\320\211c\200\370\203\264 \250ue\266",
"\267\320\211c\200objec\201\313\200\314\264 n\202-objec\201\313\200\344",
"\267\320\211c\200n\202-objec\201\313\200\314\264 objec\201\313\200\344",
"\267\320\211c\200\223\222l\226\232objec\201\313\277\314\215\205\344",
"\313\200mis\374 (\314\215\205\210\235",
"\267\237\200\363objec\201\371\245m\330\207-\373s\365e\307\221\012"
"\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"
#endif
};
@ -339,18 +348,18 @@ static char *fatalmsg[] = {
/*170*/ "assertion failed: %s\n",
/*171*/ "user error: %s\n",
#else
"\267\222a\205from \341le:\345",
"\267writ\200\264 \341le:\345",
"t\275\200ov\211flow:\345",
"\204suf\341ci\213\201\312m\221y\012",
"\310\343sem\242\261\204\227ruc\216\345",
"n\234\211ic ov\211flow\316\247ce\305\372capaci\276\012",
"\320mpil\232scrip\201\247ce\305\203\375\311xim\234 \312m\221\224\366\200(%l\205bytes\235",
"\264o m\215\224\211r\240\312ssag\277\340\202\200l\204\337",
"\320\231pag\200\311pp\372\341\367\225fo\223d\012",
"\310p\226h:\345",
"\343s\211\243fail\305: \344",
"\237\261\211r\221: \344"
"\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"
#endif
};
@ -394,43 +403,43 @@ static char *warnmsg[] = {
/*235*/ "public function lacks forward declaration (symbol \"%s\")\n",
/*236*/ "unknown parameter in substitution (incorrect #define pattern)\n"
#else
"\315 \265tr\241\226\232\264 %\205\272\334\307\211\266",
"\222\333i\243\325\361\215t/\311cro \357",
"n\234b\261\325\263t\203do\277\225\374 \333i\216\012",
"\255 \265nev\261\237\305:\345",
"\255 \265a\270gn\232\245\250u\200\236a\201\265nev\261\237\305:\345",
"\222d\223d\215\201\320\231: \361\215\201\321\222\270\340\265z\211o\012",
"\222d\223d\215\201te\227: \361\215\201\321\222\270\340\265n\202-z\211o\012",
"\223k\212w\350#p\251g\311\012",
"\301\356\236 \373\222s\330\201\237\232bef\221\200\333i\216\316f\221c\372\222p\206s\337",
"\370\233 sho\330\205\222tur\350\245\250u\337",
"po\270\242\200\237\200\325\255 bef\221\200\204i\207\214iza\216:\345",
"po\270\242\224\223\204t\213\231\205a\270gn\331t\012",
"po\270\242\224\223\204t\213\231\205bit\356s\200\351a\216\012",
"\373mis\374\012",
"po\270\242\224\245\042\361\354\332\336w\376\204t\213\231d:\345",
"\321\222\270\340\304\203\212 effe\307\012",
"ne\227\232\320m\331t\012",
"loos\200\204d\213\317\216\012",
"ol\205\227y\367pro\264\313\277\237\232\356\236 \342\216\362semi\320l\234n\266",
"loc\362\327\352 s\304dow\203\245\327\200a\201\245p\222c\305\372lev\365\012",
"\321\222\270\340\356\236 \373ov\211rid\200\303appe\206 betwe\213 p\206\213\236ese\266",
"lab\365 nam\352 s\304dow\203\373na\312\012",
"n\234b\261\325\355git\203\247ce\305\203\251\216\362n\234b\261p\222ci\230\202\012",
"\222d\223d\215\201\042\366e\306\042: \336\366\200\265\214way\2031 \357",
"\204\231t\211m\204\226\200\332\366\200\371\042\366e\306\354\321\222\270\340\357",
"\223\222a\272\275\200\320\231\012",
"\245\327\200\265a\270gn\232\264 its\365f \357",
"m\221\200\204i\207\214iz\211\203\236\363\213\234 \341\365d\266",
"l\213g\236 \325\204i\207\214iz\261\247ce\305\203\366\200\325\375\213\234 \341\365d\012",
"\204\231x \373mis\374 \357",
"\212 imple\331\317\243f\240\346\352 \371\370\233\316\212 f\214l-back\012",
"\346\200speci\341ca\243\340f\221w\206\205\231\360\334\243\265ig\212\222d\012",
"outpu\201\341\367\265writt\213\316bu\201\356\236 \320mpac\201\213\320d\372\355s\275\305\012",
"\346\200\327\352 s\304dow\203\245glob\362\327\337",
"\315 \265m\206k\232\376\231p\222c\226\305: \344",
"pu\242ic \301lack\203f\221w\206\205\231\360\334\243\357",
"\223k\212w\350p\334\312t\261\371subs\207tu\243(\204c\221\222c\201#\333\200p\226t\211n\235"
"\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",
"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"
#endif
};

View File

@ -92,6 +92,7 @@ SC_VDEFINE int sc_curstates=0; /* ID of the current state list */
SC_VDEFINE int pc_optimize=sOPTIMIZE_NOMACRO; /* (peephole) optimization level */
SC_VDEFINE int pc_memflags=0; /* special flags for the stack/heap usage */
SC_VDEFINE int sc_showincludes=0; /* show include files */
SC_VDEFINE int sc_require_newdecls=0; /* Require new-style declarations */
SC_VDEFINE constvalue sc_automaton_tab = { NULL, "", 0, 0}; /* automaton table */
SC_VDEFINE constvalue sc_state_tab = { NULL, "", 0, 0}; /* state table */

View File

@ -0,0 +1,15 @@
stock A(int)
{
}
stock B(int[5] N)
{
}
stock C(int:N)
{
}
public main()
{
}

View File

@ -0,0 +1,3 @@
(1) : error 001: expected token: "-identifier-", but found ")"
(5) : error 140: new-style array types cannot specify dimension sizes as part of their type
(9) : error 001: expected token: "-identifier-", but found ":"

View File

@ -0,0 +1,44 @@
stock A(int n)
{
}
stock B(int n[])
{
}
stock C(int[] n)
{
}
enum E1: {
}
enum E2 {
}
stock D(E1 t)
{
}
stock E(E2 t)
{
}
stock F(const int n[10]) {
}
stock G(int& n)
{
}
public main()
{
new x[10]
new t
A(1)
B(x)
C(x)
D(E1:5)
E(E2:5)
F(x)
G(t)
}

View File

@ -22,7 +22,7 @@ def run_tests(args):
kind = 'pass'
try:
argv = [args.spcomp, os.path.join(testdir, test + '.sp')]
argv = [os.path.abspath(args.spcomp), os.path.join(testdir, test + '.sp')]
p = subprocess.Popen(argv, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = p.communicate()
stdout = stdout.decode('utf-8')