New type system.

This commit is contained in:
David Anderson 2014-06-24 23:37:14 -07:00
parent 2ae04ee1df
commit 99f4cdb3e4
25 changed files with 656 additions and 479 deletions

View File

@ -38,25 +38,25 @@
#include <menus>
/**
* Actions a top menu will take on an object.
* Actions a top menu will take on an topobj.
*/
enum TopMenuAction
{
/**
* An option is being drawn for a menu (or for sorting purposes).
*
* INPUT : TopMenu Handle, object ID, client index.
* INPUT : TopMenu Handle, topobj ID, client index.
* OUTPUT: Buffer for rendering, maxlength of buffer.
*/
TopMenuAction_DisplayOption = 0,
/**
* The title of a menu is being drawn for a given object.
* The title of a menu is being drawn for a given topobj.
*
* Note: The Object ID will be INVALID_TOPMENUOBJECT if drawing the
* root title. Otherwise, the Object ID is a category.
*
* INPUT : TopMenu Handle, object ID, client index.
* INPUT : TopMenu Handle, topobj ID, client index.
* OUTPUT: Buffer for rendering, maxlength of buffer.
*/
TopMenuAction_DisplayTitle = 1,
@ -66,14 +66,14 @@ enum TopMenuAction
*
* The Object ID will always be an item (not a category).
*
* INPUT : TopMenu Handle, object ID, client index.
* INPUT : TopMenu Handle, topobj ID, client index.
*/
TopMenuAction_SelectOption = 2,
/**
* A menu option is being drawn and its flags can be overridden.
*
* INPUT : TopMenu Handle, object ID, client index.
* INPUT : TopMenu Handle, topobj ID, client index.
* OUTPUT: The first byte of the 'buffer' string should be set
* to the desired flags. By default, it will contain
* ITEMDRAW_DEFAULT.
@ -81,16 +81,16 @@ enum TopMenuAction
TopMenuAction_DrawOption = 3,
/**
* Called when an object is being removed from the menu.
* Called when an topobj is being removed from the menu.
* This can be used to clean up data stored in the info string.
*
* INPUT : TopMenu Handle, object ID.
* INPUT : TopMenu Handle, topobj ID.
*/
TopMenuAction_RemoveObject = 4,
};
/**
* Top menu object types.
* Top menu topobj types.
*/
enum TopMenuObjectType
{
@ -109,7 +109,7 @@ enum TopMenuPosition
};
/**
* Top menu object tag for type checking.
* Top menu topobj tag for type checking.
*/
enum TopMenuObject
{
@ -121,7 +121,7 @@ enum TopMenuObject
*
* @param topmenu Handle to the TopMenu.
* @param action TopMenuAction being performed.
* @param object_id The object ID (if used).
* @param topobj_id The topobj ID (if used).
* @param param Extra parameter (if used).
* @param buffer Output buffer (if used).
* @param maxlength Output buffer (if used).
@ -129,7 +129,7 @@ enum TopMenuObject
*/
functag public TopMenuHandler(Handle:topmenu,
TopMenuAction:action,
TopMenuObject:object_id,
TopMenuObject:topobj_id,
param,
String:buffer[],
maxlength);
@ -172,13 +172,13 @@ native Handle:CreateTopMenu(TopMenuHandler:handler);
native bool:LoadTopMenuConfig(Handle:topmenu, const String:file[], String:error[], maxlength);
/**
* Adds an object to a TopMenu.
* Adds an topobj to a TopMenu.
*
* @param topmenu TopMenu Handle.
* @param name Object name (MUST be unique).
* @param type Object type.
* @param handler Handler for object.
* @param parent Parent object ID, or INVALID_TOPMENUOBJECT for none.
* @param handler Handler for topobj.
* @param parent Parent topobj ID, or INVALID_TOPMENUOBJECT for none.
* Items must have a category parent.
* Categories must not have a parent.
* @param cmdname Command name (for access overrides).
@ -214,27 +214,27 @@ native GetTopMenuInfoString(Handle:topmenu, TopMenuObject:parent, String:buffer[
* Retrieves the name string of a top menu item.
*
* @param topmenu TopMenu Handle.
* @param object TopMenuObject ID.
* @param topobj TopMenuObject ID.
* @param buffer Buffer to store info string.
* @param maxlength Maximum size of info string.
* @return Number of bytes written, not including the
* null terminator.
* @error Invalid TopMenu Handle or TopMenuObject ID.
*/
native GetTopMenuObjName(Handle:topmenu, TopMenuObject:object, String:buffer[], maxlength);
native GetTopMenuObjName(Handle:topmenu, TopMenuObject:topobj, String:buffer[], maxlength);
/**
* Removes an object from a TopMenu.
* Removes an topobj from a TopMenu.
*
* Plugins' objects are automatically removed all TopMenus when the given
* Plugins' topobjs are automatically removed all TopMenus when the given
* plugin unloads or pauses. In the case of unpausing, all items are restored.
*
* @param topmenu TopMenu Handle.
* @param object TopMenuObject ID.
* @param topobj TopMenuObject ID.
* @noreturn
* @error Invalid TopMenu Handle.
*/
native RemoveFromTopMenu(Handle:topmenu, TopMenuObject:object);
native RemoveFromTopMenu(Handle:topmenu, TopMenuObject:topobj);
/**
* Displays a TopMenu to a client.
@ -251,7 +251,7 @@ native bool:DisplayTopMenu(Handle:topmenu, client, TopMenuPosition:position);
* Displays a TopMenu category to a client.
*
* @param topmenu TopMenu Handle.
* @param category Category object id.
* @param category Category topobj id.
* @param client Client index.
* @return True on success, false on failure.
* @error Invalid TopMenu Handle or client not in game.
@ -259,7 +259,7 @@ native bool:DisplayTopMenu(Handle:topmenu, client, TopMenuPosition:position);
native bool:DisplayTopMenuCategory(Handle:topmenu, TopMenuObject:category, client);
/**
* Finds a category's object ID in a TopMenu.
* Finds a category's topobj ID in a TopMenu.
*
* @param topmenu TopMenu Handle.
* @param name Object's unique name.

View File

@ -363,8 +363,10 @@ enum {
tCASE,
tCELLSOF,
tCHAR,
tCLASS,
tCONST,
tCONTINUE,
tDECL,
tDEFAULT,
tDEFINED,
tDELETE,
@ -383,7 +385,7 @@ enum {
tMETHODMAP,
tNATIVE,
tNEW,
tDECL,
tOBJECT,
tOPERATOR,
tPUBLIC,
tRETURN,
@ -486,16 +488,12 @@ typedef enum s_optmark {
#define suSLEEP_INSTR 0x01 /* the "sleep" instruction was used */
#if INT_MAX<0x8000u
#define PUBLICTAG 0x8000u
#define FIXEDTAG 0x4000u
#define FUNCTAG 0x2000u
#else
#define PUBLICTAG 0x80000000Lu
#define FIXEDTAG 0x40000000Lu
#define FUNCTAG 0x20000000Lu
#endif
#define OBJECTTAG 0x10000000Lu
#define TAGMASK (~PUBLICTAG)
#define TAGFLAGMASK (FIXEDTAG | FUNCTAG | OBJECTTAG)
#define CELL_MAX (((ucell)1 << (sizeof(cell)*8-1)) - 1)
@ -512,7 +510,7 @@ int pc_addconstant(char *name,cell value,int tag);
int pc_addtag(char *name);
int pc_addtag_flags(char *name, int flags);
int pc_findtag(const char *name);
int pc_addfunctag(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);
@ -629,6 +627,9 @@ SC_FUNC symbol *addvariable2(const char *name,cell addr,int ident,int vclass,int
SC_FUNC int getlabel(void);
SC_FUNC char *itoh(ucell val);
#define MATCHTAG_COERCE 0x1 // allow coercion
#define MATCHTAG_SILENT 0x2 // silence the error(213) warning
/* function prototypes in SC3.C */
SC_FUNC int check_userop(void (*oper)(void),int tag1,int tag2,int numparam,
value *lval,int *resulttag);
@ -886,6 +887,7 @@ SC_VDECL int pc_memflags; /* special flags for the stack/heap usage */
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_anytag; /* global any tag */
SC_VDECL int glbstringread; /* last global string read */

View File

@ -77,6 +77,7 @@ int pc_anytag = 0;
int pc_functag = 0;
int pc_tag_string = 0;
int pc_tag_void = 0;
int pc_tag_object = 0;
typedef struct funcstub_setup_s {
const char *name;
@ -652,6 +653,16 @@ const char *pc_tagname(int tag)
return "<unknown>";
}
constvalue *pc_tagptr(const char *name)
{
constvalue *ptr=tagname_tab.next;
for (; ptr; ptr=ptr->next) {
if (strcmp(name, ptr->name)==0)
return ptr;
}
return NULL;
}
int pc_findtag(const char *name)
{
constvalue *ptr=tagname_tab.next;
@ -696,8 +707,7 @@ int pc_addtag_flags(char *name, int flags)
tag=(int)(ptr->value & TAGMASK);
if (strcmp(name,ptr->name)==0)
return tag; /* tagname is known, return its sequence number */
tag &= (int)~FIXEDTAG;
tag &= (int)~FUNCTAG;
tag &= ~TAGFLAGMASK;
if (tag>last)
last=tag;
ptr=ptr->next;
@ -710,43 +720,6 @@ int pc_addtag_flags(char *name, int flags)
return tag;
}
int pc_addfunctag(char *name)
{
cell val;
constvalue *ptr;
int last,tag;
if (name==NULL) {
/* no tagname was given, check for one */
if (lex(&val,&name)!=tLABEL) {
lexpush();
return 0; /* untagged */
} /* if */
} /* if */
assert(strchr(name,':')==NULL); /* colon should already have been stripped */
last=0;
ptr=tagname_tab.next;
while (ptr!=NULL) {
tag=(int)(ptr->value & TAGMASK);
if (strcmp(name,ptr->name)==0)
return tag; /* tagname is known, return its sequence number */
tag &= (int)~FIXEDTAG;
tag &= (int)~FUNCTAG;
if (tag>last)
last=tag;
ptr=ptr->next;
} /* while */
/* tagname currently unknown, add it */
tag=last+1; /* guaranteed not to exist already */
if (isupper(*name))
tag |= (int)FIXEDTAG;
tag |= (int)FUNCTAG;
append_constval(&tagname_tab,name,(cell)tag,0);
return tag;
}
static void resetglobals(void)
{
/* reset the subset of global variables that is modified by the first pass */
@ -1367,10 +1340,11 @@ static void setconstants(void)
append_constval(&tagname_tab,"bool",1,0);
pc_anytag = pc_addtag("any");
pc_functag = pc_addfunctag("Function");
pc_functag = pc_addtag_flags("Function", FIXEDTAG|FUNCTAG);
pc_tag_string = pc_addtag("String");
pc_tag_void = pc_addtag_flags("void", FIXEDTAG);
sc_rationaltag = pc_addtag("Float");
pc_tag_void = pc_addtag_flags("void", FIXEDTAG);
pc_tag_object = pc_addtag_flags("object", FIXEDTAG|OBJECTTAG);
add_constant("true",1,sGLOBAL,1); /* boolean flags */
add_constant("false",0,sGLOBAL,1);
@ -1536,6 +1510,9 @@ static void parse(void)
case tMETHODMAP:
domethodmap(Layout_MethodMap);
break;
case tCLASS:
domethodmap(Layout_Class);
break;
case tFUNCTAG:
dofuncenum(FALSE);
break;
@ -2526,13 +2503,8 @@ static int declloc(int fstatic)
assert(staging); /* end staging phase (optimize expression) */
stgout(staging_start);
stgset(FALSE);
if (!matchtag_string(cident, ctag) && !matchtag(tag,ctag,TRUE))
{
if (tag & FUNCTAG)
error(100); /* error - function prototypes do not match */
else
error(213); /* warning - tag mismatch */
}
if (!matchtag_string(cident, ctag))
matchtag(tag,ctag,TRUE);
/* if the variable was not explicitly initialized, reset the
* "uWRITTEN" flag that store() set */
if (!explicit_init)
@ -2838,13 +2810,7 @@ static void initials2(int ident,int tag,cell *size,int dim[],int numdim,
if (ident==iVARIABLE) {
assert(*size==1);
init(ident,&ctag,NULL);
if (!matchtag(tag,ctag,TRUE))
{
if (tag & FUNCTAG)
error(100); /* error - function prototypes do not match */
else
error(213); /* warning - tag mismatch */
}
matchtag(tag,ctag,TRUE);
} else {
assert(numdim>0);
if (numdim==1) {
@ -3042,19 +3008,12 @@ static cell initvector(int ident,int tag,cell size,int fillzero,
rtag=symfield->x.tags.index; /* set the expected tag to the index tag */
enumfield=enumfield->next;
} /* if */
if (!matchtag(rtag,ctag,TRUE))
{
if (rtag & FUNCTAG)
error(100); /* error - function prototypes do not match */
else
error(213); /* warning - tag mismatch */
}
matchtag(rtag,ctag,TRUE);
} while (matchtoken(',')); /* do */
needtoken('}');
} else {
init(ident,&ctag,errorfound);
if (!matchtag(tag,ctag,TRUE))
error(213); /* tagname mismatch */
matchtag(tag,ctag,TRUE);
} /* if */
/* fill up the literal queue with a series */
if (ellips) {
@ -3156,6 +3115,8 @@ static void decl_const(int vclass)
insert_docstring_separator(); /* see comment in newfunc() */
do {
int orgfline;
tag=pc_addtag(NULL);
if (lex(&val,&str)!=tSYMBOL) /* read in (new) token */
error(20,str); /* invalid symbol name */
@ -3163,14 +3124,14 @@ static void decl_const(int vclass)
strcpy(constname,str); /* save symbol name */
needtoken('=');
constexpr(&val,&exprtag,NULL); /* get value */
/* add_constant() checks for duplicate definitions */
if (!matchtag(tag,exprtag,FALSE)) {
/* temporarily reset the line number to where the symbol was defined */
int orgfline=fline;
orgfline=fline;
fline=symbolline;
error(213); /* tagname mismatch */
matchtag(tag,exprtag,FALSE);
fline=orgfline;
} /* if */
sym=add_constant(constname,val,vclass,tag);
if (sym!=NULL)
sc_attachdocumentation(sym);/* attach any documenation to the constant */
@ -3319,6 +3280,10 @@ int parse_typeexpr(declinfo_t *decl, const token_t *first, int flags)
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) {
@ -3821,15 +3786,26 @@ static void domethodmap(LayoutSpec spec)
if ((parent = methodmap_find_by_name(str)) == NULL) {
error(102, str);
} else if (parent->spec != spec) {
error(129);
}
}
methodmap_t *map = (methodmap_t *)calloc(1, sizeof(methodmap_t));
map->parent = parent;
map->tag = pc_addtag(mapname);
map->spec = spec;
strcpy(map->name, mapname);
if (spec == Layout_MethodMap) {
map->tag = pc_addtag(mapname);
} else {
constvalue *tagptr = pc_tagptr(mapname);
if (!tagptr) {
map->tag = pc_addtag_flags(mapname, FIXEDTAG | OBJECTTAG);
} else {
tagptr->value |= OBJECTTAG;
map->tag = (tagptr->value & TAGMASK);
}
}
methodmap_add(map);
needtoken('{');
@ -5526,8 +5502,7 @@ static void doarg(char *name,int ident,int offset,int tags[],int numtags,
} else {
constexpr(&arg->defvalue.val,&arg->defvalue_tag,NULL);
assert(numtags>0);
if (!matchtag(tags[0],arg->defvalue_tag,TRUE))
error(213); /* tagname mismatch */
matchtag(tags[0],arg->defvalue_tag,TRUE);
} /* if */
} /* if */
} /* if */
@ -7246,8 +7221,8 @@ static void doreturn(void)
rettype|=uRETVALUE; /* function returns a value */
/* check tagname with function tagname */
assert(curfunc!=NULL);
if (!matchtag_string(ident, tag) && !matchtag(curfunc->tag,tag,TRUE))
error(213); /* tagname mismatch */
if (!matchtag_string(ident, tag))
matchtag(curfunc->tag,tag,TRUE);
if (ident==iARRAY || ident==iREFARRAY) {
int dim[sDIMEN_MAX],numdim;
cell arraysize;

View File

@ -1943,11 +1943,23 @@ char *sc_tokens[] = {
"*=", "/=", "%=", "+=", "-=", "<<=", ">>>=", ">>=", "&=", "^=", "|=",
"||", "&&", "==", "!=", "<=", ">=", "<<", ">>>", ">>", "++", "--",
"...", "..", "::",
"assert", "*begin", "break", "case", "cellsof", "chars", "const", "continue", "default",
"defined", "delete", "do", "else", "*end", "enum", "exit", "for", "forward", "funcenum",
"functag", "goto",
"if", "int", "methodmap", "native", "new", "decl", "operator", "public", "return", "sizeof",
"sleep", "static", "stock", "struct", "switch", "tagof", "*then", "void", "while",
"assert",
"*begin", "break",
"case", "cellsof", "chars", "class", "const", "continue",
"decl", "default", "defined", "delete", "do",
"else", "*end", "enum", "exit",
"for", "forward", "funcenum", "functag",
"goto",
"if", "int",
"methodmap",
"native", "new",
"object", "operator",
"public",
"return",
"sizeof", "sleep", "static", "stock", "struct", "switch",
"tagof", "*then",
"void",
"while",
"#assert", "#define", "#else", "#elseif", "#emit", "#endif", "#endinput",
"#endscript", "#error", "#file", "#if", "#include", "#line", "#pragma",
"#tryinclude", "#undef",

View File

@ -321,21 +321,44 @@ SC_FUNC int matchtag_string(int ident, int tag)
return (tag == pc_tag_string) ? TRUE : FALSE;
}
SC_FUNC int matchtag(int formaltag, int actualtag, int allowcoerce)
static int obj_typeerror(int id, int tag1, int tag2)
{
if (formaltag == actualtag)
const char *left = pc_tagname(tag1);
const char *right = pc_tagname(tag2);
if (!left || strcmp(left, "_") == 0)
left = "int";
if (!right || strcmp(right, "_") == 0)
right = "int";
error(id, right, left);
return FALSE;
}
static int matchobjecttags(int formaltag, int actualtag, int flags)
{
// objects never coerce to non-objects, YET.
if ((formaltag & OBJECTTAG) && !(actualtag & OBJECTTAG))
return obj_typeerror(132, formaltag, actualtag);
if (!(formaltag & OBJECTTAG) && (actualtag & OBJECTTAG))
return obj_typeerror(131, formaltag, actualtag);
// Every object coerces to "object".
if (formaltag == pc_tag_object)
return TRUE;
/* if the formal tag is zero and the actual tag is not "fixed", the actual
* tag is "coerced" to zero
*/
if (allowcoerce && !formaltag && !(actualtag & FIXEDTAG))
return TRUE;
if (flags & MATCHTAG_COERCE)
return obj_typeerror(134, formaltag, actualtag);
if (formaltag == pc_anytag || actualtag == pc_anytag)
methodmap_t *map = methodmap_find_by_tag(actualtag);
for (; map; map = map->parent) {
if (map->tag == formaltag)
return TRUE;
}
if (formaltag & FUNCTAG) {
return obj_typeerror(133, formaltag, actualtag);
}
static int matchfunctags(int formaltag, int actualtag)
{
if (actualtag == pc_functag || (formaltag == pc_functag && actualtag & FUNCTAG))
return TRUE;
@ -370,13 +393,10 @@ SC_FUNC int matchtag(int formaltag, int actualtag, int allowcoerce)
assert(index >= 0);
/* Find the function, either by public idx or code addr */
if (usage == uPUBLIC)
{
if (usage == uPUBLIC) {
for (sym=glbtab.next; sym!=NULL; sym=sym->next) {
if (sym->ident==iFUNCTN && (sym->usage & uPUBLIC)!=0 && (sym->vclass == sGLOBAL))
{
if (index-- == 0)
{
if (sym->ident==iFUNCTN && (sym->usage & uPUBLIC)!=0 && (sym->vclass == sGLOBAL)) {
if (index-- == 0) {
found = sym;
break;
}
@ -384,10 +404,8 @@ SC_FUNC int matchtag(int formaltag, int actualtag, int allowcoerce)
}
} else if (usage == uSTOCK) {
for (sym=glbtab.next; sym!=NULL; sym=sym->next) {
if (sym->ident==iFUNCTN && (sym->vclass == sGLOBAL))
{
if (sym->codeaddr == index)
{
if (sym->ident==iFUNCTN && (sym->vclass == sGLOBAL)) {
if (sym->codeaddr == index) {
found = sym;
break;
}
@ -395,8 +413,7 @@ SC_FUNC int matchtag(int formaltag, int actualtag, int allowcoerce)
}
}
if (!found)
{
if (!found) {
assert(found);
return FALSE;
}
@ -407,33 +424,27 @@ SC_FUNC int matchtag(int formaltag, int actualtag, int allowcoerce)
* Now we have to check if it matches any one of the functags inside the enum.
*/
t = e->first;
while (t)
{
while (t) {
int curarg,skip=0,i;
arginfo *func_arg;
funcarg_t *enum_arg;
/* Check return type first. */
if (t->ret_tag != sym->tag)
{
if (t->ret_tag != sym->tag) {
t = t->next;
continue;
}
/* Check usage */
if (t->type != usage)
{
if (t->type != usage) {
t = t->next;
continue;
}
/* Begin iterating arguments */
for (curarg=0; curarg<t->argcount; curarg++)
{
for (curarg=0; curarg<t->argcount; curarg++) {
enum_arg = &t->args[curarg];
/* Check whether we've exhausted our arguments */
if (sym->dim.arglist[curarg].ident == 0)
{
if (sym->dim.arglist[curarg].ident == 0) {
/* Can we bail out early? */
if (!enum_arg->ommittable)
{
if (!enum_arg->ommittable) {
/* No! */
skip = 1;
}
@ -441,23 +452,18 @@ SC_FUNC int matchtag(int formaltag, int actualtag, int allowcoerce)
}
func_arg = &sym->dim.arglist[curarg];
/* First check the ident type */
if (enum_arg->ident != func_arg->ident)
{
if (enum_arg->ident != func_arg->ident) {
skip = 1;
break;
}
/* Next check arrayness */
if (enum_arg->dimcount != func_arg->numdim)
{
if (enum_arg->dimcount != func_arg->numdim) {
skip = 1;
break;
}
if (enum_arg->dimcount > 0)
{
for (i=0; i<enum_arg->dimcount; i++)
{
if (enum_arg->dims[i] != func_arg->dim[i])
{
if (enum_arg->dimcount > 0) {
for (i=0; i<enum_arg->dimcount; i++) {
if (enum_arg->dims[i] != func_arg->dim[i]) {
skip = 1;
break;
}
@ -466,16 +472,13 @@ SC_FUNC int matchtag(int formaltag, int actualtag, int allowcoerce)
break;
}
/* Lastly, check the tags */
if (enum_arg->tagcount != func_arg->numtags)
{
if (enum_arg->tagcount != func_arg->numtags) {
skip = 1;
break;
}
/* They should all be in the same order just for clarity... */
for (i=0; i<enum_arg->tagcount; i++)
{
if (enum_arg->tags[i] != func_arg->tags[i])
{
for (i=0; i<enum_arg->tagcount; i++) {
if (enum_arg->tags[i] != func_arg->tags[i]) {
skip = 1;
break;
}
@ -483,8 +486,7 @@ SC_FUNC int matchtag(int formaltag, int actualtag, int allowcoerce)
if (skip)
break;
}
if (!skip)
{
if (!skip) {
/* Make sure there are no trailing arguments */
if (sym->dim.arglist[curarg].ident == 0)
return TRUE;
@ -492,8 +494,42 @@ SC_FUNC int matchtag(int formaltag, int actualtag, int allowcoerce)
t = t->next;
}
}
return FALSE;
}
SC_FUNC int matchtag(int formaltag, int actualtag, int flags)
{
if (formaltag == actualtag)
return TRUE;
if ((formaltag & OBJECTTAG) || (actualtag & OBJECTTAG))
return matchobjecttags(formaltag, actualtag, flags);
if ((actualtag & FUNCTAG) && !(formaltag & FUNCTAG)) {
// We're being given a function, but the destination is not a function.
error(130);
return FALSE;
}
/* if the formal tag is zero and the actual tag is not "fixed", the actual
* tag is "coerced" to zero
*/
if ((flags & MATCHTAG_COERCE) && !formaltag && !(actualtag & FIXEDTAG))
return TRUE;
if (formaltag == pc_anytag || actualtag == pc_anytag)
return TRUE;
if (formaltag & FUNCTAG) {
if (!matchfunctags(formaltag, actualtag)) {
error(100);
return FALSE;
}
return TRUE;
}
if (flags & MATCHTAG_COERCE) {
// See if the tag has a methodmap associated with it. If so, see if the given
// tag is anywhere on the inheritance chain.
methodmap_t *map = methodmap_find_by_tag(actualtag);
@ -503,7 +539,10 @@ SC_FUNC int matchtag(int formaltag, int actualtag, int allowcoerce)
return TRUE;
}
}
}
if (!(flags & MATCHTAG_SILENT))
error(213);
return FALSE;
}
@ -823,12 +862,11 @@ static void plnge2(void (*oper)(void),
} else if (lval1->ident==iCONSTEXPR && lval2->ident==iCONSTEXPR) {
/* only constant expression if both constant */
stgdel(index,cidx); /* scratch generated code and calculate */
if (!matchtag(lval1->tag,lval2->tag,FALSE))
error(213); /* tagname mismatch */
matchtag(lval1->tag,lval2->tag,FALSE);
lval1->constval=calc(lval1->constval,oper,lval2->constval,&lval1->boolresult);
} else {
if (!checktag_string(lval1, lval2) && !matchtag(lval1->tag,lval2->tag,FALSE))
error(213); /* tagname mismatch */
if (!checktag_string(lval1, lval2))
matchtag(lval1->tag,lval2->tag,FALSE);
(*oper)(); /* do the (signed) operation */
lval1->ident=iEXPRESSION;
} /* if */
@ -1213,7 +1251,7 @@ static int hier14(value *lval1)
return error(47); /* array dimensions must match */
else if (ltlength<val || (exactmatch && ltlength>val) || val==0)
return error(47); /* array sizes must match */
else if (lval3.ident!=iARRAYCELL && !matchtag(lval3.sym->x.tags.index,idxtag,TRUE))
else if (lval3.ident!=iARRAYCELL && !matchtag(lval3.sym->x.tags.index,idxtag,MATCHTAG_COERCE|MATCHTAG_SILENT))
error(229,(lval2.sym!=NULL) ? lval2.sym->name : lval3.sym->name); /* index tag mismatch */
if (level>0) {
/* check the sizes of all sublevels too */
@ -1236,7 +1274,7 @@ static int hier14(value *lval1)
*/
if (sym1->dim.array.length!=sym2->dim.array.length)
error(47); /* array sizes must match */
else if (!matchtag(sym1->x.tags.index,sym2->x.tags.index,TRUE))
else if (!matchtag(sym1->x.tags.index,sym2->x.tags.index,MATCHTAG_COERCE|MATCHTAG_SILENT))
error(229,sym2->name); /* index tag mismatch */
} /* for */
/* get the total size in cells of the multi-dimensional array */
@ -1254,8 +1292,8 @@ static int hier14(value *lval1)
check_userop(NULL,lval2.tag,lval3.tag,2,&lval3,&lval2.tag);
store(&lval3); /* now, store the expression result */
} /* if */
if (!oper && !checktag_string(&lval3, &lval2) && !matchtag(lval3.tag,lval2.tag,TRUE))
error(213); /* tagname mismatch (if "oper", warning already given in plunge2()) */
if (!oper && !checktag_string(&lval3, &lval2))
matchtag(lval3.tag,lval2.tag,TRUE);
if (lval3.sym)
markusage(lval3.sym,uWRITTEN);
sideeffect=TRUE;
@ -1343,8 +1381,7 @@ static int hier13(value *lval)
error(33,ptr); /* array must be indexed */
} /* if */
/* ??? if both are arrays, should check dimensions */
if (!matchtag(lval->tag,lval2.tag,FALSE))
error(213); /* tagname mismatch ('true' and 'false' expressions) */
matchtag(lval->tag,lval2.tag,FALSE);
heap=popsaveheaplist();
total2=dynarray_from_heaplist(heap);
setlabel(flab2);
@ -1518,6 +1555,8 @@ static int hier2(value *lval)
tag=pc_addtag(st);
lval->cmptag=tag;
lvalue=hier2(lval);
if ((lval->tag & OBJECTTAG) || (tag & OBJECTTAG))
matchtag(tag, lval->tag, MATCHTAG_COERCE);
lval->tag=tag;
return lvalue;
case tDEFINED:
@ -1869,8 +1908,8 @@ restart:
if (lval2.ident==iARRAY || lval2.ident==iREFARRAY)
error(33,lval2.sym->name); /* array must be indexed */
needtoken(close);
if ((sym->usage & uENUMROOT) && !matchtag(sym->x.tags.index,lval2.tag,TRUE))
error(213);
if ((sym->usage & uENUMROOT))
matchtag(sym->x.tags.index,lval2.tag,TRUE);
if (lval2.ident==iCONSTEXPR) { /* constant expression */
stgdel(index,cidx); /* scratch generated code */
if (lval1->arrayidx!=NULL) { /* keep constant index, for checking */
@ -2120,7 +2159,7 @@ restart:
lval1->constval=(code_addr<<1)|0;
snprintf(faketag, sizeof(faketag)-1, "$Func!%d", code_addr);
}
lval1->tag=pc_addfunctag(faketag);
lval1->tag=pc_addtag_flags(faketag, FIXEDTAG|FUNCTAG);
oldsym->usage |= uREAD;
sym->usage |= uREAD;
} else {
@ -2309,12 +2348,27 @@ static int findnamedarg(arginfo *arg,char *name)
int checktag(int tags[],int numtags,int exprtag)
{
int i;
int errcount = errnum;
if (numtags > 1 && (exprtag & OBJECTTAG)) {
// This would allow leaking of the pointer, unless we verify that all tags
// are object tags. It's easiest to just forbid this. The feature is broken
// anyway since there is no way to determine the actual value's type.
error(135);
return FALSE;
}
assert(tags!=0);
assert(numtags>0);
for (i=0; i<numtags; i++)
if (matchtag(tags[i],exprtag,TRUE))
for (i=0; i<numtags; i++) {
if (matchtag(tags[i],exprtag,MATCHTAG_COERCE|MATCHTAG_SILENT))
return TRUE; /* matching tag */
}
// If matchtag() didn't error, report an error.
if (errnum == errcount)
error(213);
return FALSE; /* no tag matched */
}
@ -2520,14 +2574,8 @@ static int nesting=0;
/* otherwise, the expression result is already in PRI */
assert(arg[argidx].numtags>0);
check_userop(NULL,lval.tag,arg[argidx].tags[0],2,NULL,&lval.tag);
if (!checktags_string(arg[argidx].tags, arg[argidx].numtags, &lval) &&
!checktag(arg[argidx].tags, arg[argidx].numtags, lval.tag))
{
if (arg[argidx].numtags == 1 && arg[argidx].tags[0] & FUNCTAG)
error(100); /* error - function prototypes do not match */
else
error(213); /* warning - tag mismatch */
}
if (!checktags_string(arg[argidx].tags, arg[argidx].numtags, &lval))
checktag(arg[argidx].tags, arg[argidx].numtags, lval.tag);
if (lval.tag!=0)
append_constval(&taglst,arg[argidx].name,lval.tag,0);
argidx++; /* argument done */
@ -2548,8 +2596,7 @@ static int nesting=0;
} /* if */
} /* if */
/* otherwise, the address is already in PRI */
if (!checktag(arg[argidx].tags,arg[argidx].numtags,lval.tag))
error(213);
checktag(arg[argidx].tags,arg[argidx].numtags,lval.tag);
if (lval.tag!=0)
append_constval(&taglst,arg[argidx].name,lval.tag,0);
argidx++; /* argument done */
@ -2625,8 +2672,7 @@ static int nesting=0;
append_constval(&arrayszlst,arg[argidx].name,sym->dim.array.length,level);
} /* if */
/* address already in PRI */
if (!checktag(arg[argidx].tags,arg[argidx].numtags,lval.tag))
error(213);
checktag(arg[argidx].tags,arg[argidx].numtags,lval.tag);
if (lval.tag!=0)
append_constval(&taglst,arg[argidx].name,lval.tag,0);
// ??? set uWRITTEN?
@ -2918,8 +2964,8 @@ static int constant(value *lval)
error(8); /* must be constant expression */
if (lasttag<0)
lasttag=tag;
else if (!matchtag(lasttag,tag,FALSE))
error(213); /* tagname mismatch */
else
matchtag(lasttag,tag,FALSE);
litadd(item); /* store expression result in literal table */
} while (matchtoken(','));
if (!needtoken('}'))

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}, {101,110}, {97,108}, {110,111}, {135,130}, {34,136}, {142,34},
{111,114}, {114,101}, {117,110}, {97,110}, {121,32}, {115,116}, {115,105}, {97,116}, {100,101}, {140,129}, {101,133}, {32,143}, {117,109}, {41,10}, {116,104}, {144,32},
{98,108}, {117,115}, {141,32}, {146,99}, {114,97}, {98,111}, {102,163}, {101,120}, {115,121}, {118,139}, {97,32}, {109,165}, {168,171}, {172,108}, {103,32}, {156,138},
{137,32}, {103,175}, {134,177}, {105,131}, {115,150}, {134,164}, {105,133}, {102,132}, {115,10}, {97,160}, {99,104}, {161,129}, {166,162}, {169,182}, {109,187}, {104,97},
{101,100}, {111,102}, {116,111}, {132,189}, {112,101}, {99,116}, {173,155}, {44,32}, {109,97}, {109,101}, {98,128}, {99,130}, {118,134}, {112,145}, {99,147}, {193,32},
{105,185}, {204,208}, {116,97}, {109,138}, {181,148}, {206,153}, {152,183}, {134,97}, {117,108}, {118,128}, {101,131}, {178,129}, {130,32}, {102,105}, {111,112}, {116,121},
{37,131}, {155,10}, {149,151}, {110,32}, {99,111}, {97,115}, {222,137}, {128,143}, {109,151}, {198,157}, {34,32}, {100,105}, {40,233}, {203,149}, {139,32}, {191,217},
{119,105}, {99,108}, {150,122}, {108,128}, {136,10}, {101,10}, {147,32}, {132,174}, {98,101}, {158,128}, {97,131}, {166,141}, {102,144}, {111,32}, {132,32}
{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}
};
/*-*SCPACK end of pair table, do not change or remove this line */
@ -172,135 +172,149 @@ static char *errmsg[] = {
/*126*/ "%s for %s already exists\n",
/*127*/ "property getters cannot accept extra arguments\n",
/*128*/ "%s must have the same return type as property %s (%s)\n",
/*129*/ "cannot mix methodmaps and classes with inheritance\n",
/*130*/ "cannot coerce functions to values\n",
/*131*/ "cannot coerce object type %s to non-object type %s\n",
/*132*/ "cannot coerce non-object type %s to object type %s\n",
/*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",
#else
"\247\304\305\232\302k\212:\233\307bu\201fo\222\205\217\012",
"\202l\224\252s\204g\363\342e\323\201(\237\247\315\264\202) \316 follow ea\272 \042c\345e\042\012",
"\230\361\327\242\317\252loc\356\321\200\276ap\304\206 \376\252\344mpo\222\205\240ock\012",
"\373\233 \263\231imple\323t\300\012",
"\274\310\224\231\357\262t\270",
"\276\312a\264gn\232\302 \366\265y\012",
"\346\227\237\325\312\221\326\300\012",
"\276\312\252\355\223\201\247\315\264\202; \345s\234\232z\211o\012",
"\303\324\362\200(nega\207ve\307z\211\375\237ou\201\317\245\222ds\235",
"\303\274\237\230\361\327\215\012",
"\303out\226d\200\373\270",
"\303\274c\213l\307\231\252\275add\221s\270",
"\214 \212tr\224po\204\201(\214 pu\240ic \373s\235",
"\303\342e\323t; \231\376s\360t\272\012",
"\042\230fa\330t\352c\345\200\276\312\371l\345\201c\345\200\376s\360t\272 \342e\323t\012",
"m\330\207p\363\230fa\330t\203\376\042s\360t\272\042\012",
"\222\326\232\306\012",
"\204i\207\213iza\242d\227\252\247ce\300\203\230\361\206\232\362\365",
"\231\252la\370l:\341",
"\303\255 nam\347\012",
"\255 \213\221ad\224\326\300:\341",
"\276\312l\251u\200(n\202-\355\223t\235",
"\324a\264gn\323\201\276\312\226mp\363a\264gn\323t\012",
"\042b\221ak\352\237\042\313t\204ue\352\263ou\201\317\313t\247t\012",
"\274head\367\353ff\211\203from pro\302\337\304\012",
"\214 \350\272\367\042#if...\042\012",
"\303\272\327\305\260\355\223t\012",
"\303subscrip\201(\231\366\324\237\302\375m\223\224subscripts):\341",
"\303\247\315\264\202\307\345s\234\232z\211o\012",
"\344mpo\222\205\342e\323\201\231\361os\232a\201\371\212\205\317\335\363(\225\206t\232a\201l\204\200%d\235",
"\222k\214w\343\353\221c\207v\365",
"\324\204\230x ou\201\317\245\222d\203(\321\347\235",
"\324\276\312\204\230x\232(\321\347\235",
"\333do\332\231\357\252\230fa\330\201\251u\200(\333%d\235",
"\333\337p\200mis\350\272 (\333%d\235",
"empt\224\342e\323t\012",
"\303\225r\367(po\264\240\224n\202-t\211m\204\227\232\225r\204g\235",
"\247t\244 \272\327\305\211\203\334l\204\365",
"\355\223\201\255 \277\203\214 \362\365",
"duplic\227\200\042c\345e\352la\370l (\251u\200%d\235",
"\303ellip\226s\307\324\362\200\263\231k\214wn\012",
"\303\344mb\204a\242\317\361\345\203s\304ci\335\211\270",
"\272\327\305\260\355\223\201\247ce\300\203r\223g\200f\237pack\232\225r\204g\012",
"po\226\215\356p\327\311t\211\203\276\315c\300\200\213l nam\232p\327\311t\211\270",
"\302\375m\223\224\274\262t\270",
"\222k\214w\343\324\362\200(\321\347\235",
"\324\362\332d\375\231\350\272\307\237\230\225\204a\242\324\263\302\375sm\213l\012",
"\324(\203d\375\231\350\272\012",
"\303l\204\200\313t\204ua\215\012",
"\303r\223g\365",
"\303subscript\307\241\200\042[ ]\352\346\227\220\203\334\310j\237\353\323\226\202\270",
"m\330\207-\353\323\226\202\356\265y\203\276\312f\330l\224\204i\207\213iz\300\012",
"\247ce\300\367\310xim\234 n\234b\260\317\353\323\226\202\270",
"\222\350\272\232\361os\367b\244c\200(\042}\042\235",
"\225\206\201\317\274\245d\224\360\236ou\201\274head\211\012",
"\265ys\307loc\356\321\332\223\205\274\262t\203\325\312pu\240ic (\321\347\235",
"\222\267ish\232\247\315\264\334\370\374\200\344mpil\260\353\221c\207v\365",
"duplic\227\200\262t; sam\200\333\263p\345s\232t\360c\365",
"\274\333\310\224\231\357\252\230fa\330\201\251u\200(\321\347\235",
"m\330\207p\363\042#else\352\353\221c\207v\332\370twe\212 \042#if ... #\212\353f\042\012",
"\042#elseif\352\353\221c\207\331follow\203\366\042#else\352\353\221c\207v\365",
"n\234b\260\317\346\223d\203do\332\231\335\201\371\346\227\220\012",
"\274\221s\330\201\322\256\317\346\227\220\233 \276\312\217\012",
"\325\272\223g\200\315\326\232\346\227\220\270",
"\274\333\310\224\202l\224\357\252s\204g\363\322\256(\333%d\235",
"\274\333\310\224\231\312\252\221f\211\212c\200\333\237\366\324(\333\217\235",
"\321\200\325\312\245\236 \252\221f\211\212c\200\223\205\366\324(\321\347\235",
"\303\244\215\356n\234b\260\315ci\226\334\376#p\244g\310\012",
"\244\215\356n\234b\260\374\310\201\213\221ad\224\326\300\012",
"\244\215\356n\234b\260supp\220\201w\372\231\212\271\300\012",
"\241\211-\326\232\346\227\237\276\312\230\361\206\232\370\374\200\241\200(\373\233\235",
"\042\362e\301\352\346\227\237\263\303\334\042\373\352\255\270",
"\274\333\276\312\366\324(\333\217\235",
"#\326\200p\227t\211\343\276\225\206\201\360\236 \366\213p\277\370\207c \272\327\305\211\012",
"\204pu\201l\204\200\302\375l\202\256(aft\260subs\207tu\215s\235",
"\250n\322x \211r\237\376\371\247\315\264\202\307\237\303\274c\213l\012",
"m\213\374m\232UTF-8 \212\344d\204g\307\237c\220rupt\232\335le: \364",
"\274\241\332\245\236 \042\221turn\352\223\205\042\221tur\343<\251ue>\042\012",
"\204\313\226\225\212\201\221tur\343\337\304\203(\324& n\202-\265y\235",
"\222k\214w\343\255\307\237\231\252\355\223\201\255 \354",
"\325\322k\200\252\322\256\372\252\230fa\330\201\251u\200f\237\366\204\230x\232\324p\327\311t\260\354",
"\241\211-\326\232\346\227\220\203\223\205na\207\331\373\203\310\224\231\357\342e\270",
"\252\274\237\321\200\310\224\202l\224\370l\202\256\302 \252s\204g\363au\302\350\334\354",
"\342\200\313fli\305: \202\200\317\371\342\332\263\213\221ad\224a\264gn\232\302 a\214\236\260imple\323\322\242\354",
"\214 \342\332\206\200\326\232f\237\306\012",
"\222k\214w\343au\302\350\202\341",
"\222k\214w\343\342\347 f\237au\302\350\202\341",
"pu\240ic \321\332\223\205loc\356\321\332\310\224\231\357\342\332\354",
"\342\200\321\332\310\224\231\312\204i\207\213iz\232\354",
"pu\240ic \373\203\310\224\231\221tur\343\265y\203\354",
"ambiguou\203\355\223t; \322\256ov\211rid\200\263\221qui\221\205\354",
"n\234b\260\317\262t\203do\332\231\350\272 \326i\215\012",
"\247\304\305\232\322\256nam\200id\212\207\335\211\012",
"\274\212\234\211a\242\221qui\221\203\222iqu\200\322g\012",
"\325\357\221qui\221\205p\327\311t\211\203aft\260\336\215\356p\327\311t\211\270",
"\344\330\205\231\267\205\311mb\211\233 \376\225ruc\201\217\012",
"\306 do\332\231\357\252\350\272\367\337\304\012",
"\337p\347 sho\330\205\312\217 \376new-\225y\363\230\361\327\215\270",
"\340sho\330\205\231\357\366\247plici\201\221tur\343\337\304\012",
"\274pro\302\337\304\203d\375\231\350\272\012",
"s\304cif\224ei\236\260\213l \353\323\226\202\203\237\202l\224\371l\345\201\353\323\226\202\012",
"\325\267\205\340\364",
"\340w\372\213\221ad\224\326\232\334\236\263\364",
"\325\267\205\223\224\311\236od\203f\237\364",
"\325\267\205\311\236o\205\237pr\346t\224\210.\364",
"\325c\213l \311\236od\203\334\366\265y\012",
"\325c\213l \311\236od\203\334\252\373\012",
"\311\236o\205\276\357\252\335rs\201\333\344mpa\207\240\200\360\236 \371\340\337p\200(\210\235",
"\340nam\200\276\225\206\201\360\236 \366upp\211c\345\200lett\211\012",
"\340\277\203\213\221ad\224\370\212 \326\232(\315vio\241l\224se\212 \372\210\235",
"\247\304\305\232id\212\207\335\260- d\266you \374ge\201\252\337\304?\012",
"\355ru\305\237\274\276\221tur\343\322\256\364",
"\325\326\200\355ru\305\237\374\233; \213\221ad\224\247i\225\203\372\252\364",
"miss\367\337\304\307\237\340\276\357\371sam\200nam\200\372\340\217\012",
"\325\241\200\230lete\307\340\340\277\203\214 \230\225ru\305\220\012",
"\214 \311\236od\310p \237\361\345\203w\372fo\222\205f\237\364",
"\214 \230\225ru\305\237w\372fo\222\205f\237\340\364",
"\230\225ru\305\220\203\276\312na\207\331\373\270",
"\230\225ru\305\220\203\325\357\247t\244 \262t\270",
"\311\236od\310p \223\205\361\345\203\226gn\227u\221\203\276\241\200new-\225y\363\337p\200\230\361\327\215\270",
"\236\263\250n\322x \263\231ye\201supp\220t\300\012",
"\247\304\305\232\337p\200\247\315\264\202\012",
"f\330ly-qu\213i\335\232nam\347 \263\302\375l\202g\307wo\330\205\312tr\243\227\232\302\341",
"\222\247\304\305\232\302k\212\307\247\304\305\232\311\236o\205\237pr\346\337\012",
"\247\304\305\232\042na\207ve\352\237\042get\042\012",
"\340f\237\340\213\221ad\224\247i\225\270",
"pr\346t\224gett\211\203\325accep\201\247t\244 \262t\270",
"\340\276\357\371sam\200\221tur\343\337p\200\372pr\346t\224\340(\210\235"
"\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"
#endif
};
@ -325,18 +339,18 @@ static char *fatalmsg[] = {
/*170*/ "assertion failed: %s\n",
/*171*/ "user error: %s\n",
#else
"\325\221a\205from \335le:\341",
"\325writ\200\302 \335le:\341",
"t\271\200ov\211flow:\341",
"\204suf\335ci\212\201\311m\220y\012",
"\303\345sem\240\260\204\225ruc\215\341",
"n\234\211ic ov\211flow\307\247ce\300\367capaci\337\012",
"\344mpil\232scrip\201\247ce\300\203\371\310xim\234 \311m\220\224\362\200(%l\205bytes\235",
"\302\375m\223\224\211r\237\311ssag\332\334\202\200l\204\365",
"\344\230pag\200\310pp\367\335\363\231fo\222d\012",
"\303p\227h:\341",
"\345s\211\242fail\300: \364",
"\241\260\211r\220: \364"
"\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"
#endif
};
@ -380,43 +394,43 @@ static char *warnmsg[] = {
/*235*/ "public function lacks forward declaration (symbol \"%s\")\n",
/*236*/ "unknown parameter in substitution (incorrect #define pattern)\n"
#else
"\306 \263tr\243\227\232\302 %\205\272\327\305\211\270",
"\221\326i\242\317\355\223t/\310cr\375\354",
"n\234b\260\317\262t\203do\332\231\350\272 \326i\215\012",
"\255 \263nev\260\241\300:\341",
"\255 \263a\264gn\232\252\251u\200\236a\201\263nev\260\241\300:\341",
"\221d\222d\223\201\344\230: \355\223\201\247\315\264\334\263z\211o\012",
"\221d\222d\223\201te\225: \355\223\201\247\315\264\334\263n\202-z\211o\012",
"\222k\214w\343#p\244g\310\012",
"\274\360\236 \322\256\221s\330\201\241\232\370\374\200\326i\215\307\374c\367\221p\206s\365",
"\373\233 sho\330\205\221tur\343\252\251u\365",
"po\264\240\200\241\200\317\255 \370\374\200\204i\207\213iza\215:\341",
"po\264\240\224\222\204t\212\230\205a\264gn\323t\012",
"po\264\240\224\222\204t\212\230\205bit\360s\200\346a\215\012",
"\322\256mis\350\272\012",
"po\264\240\224\252\042\355\352\324\333w\372\204t\212\230d:\341",
"\247\315\264\334\277\203\214 effe\305\012",
"ne\225\232\344m\323t\012",
"loos\200\204d\212\322\215\012",
"ol\205\225y\363pro\302\337\304\203\241\232\360\236 \336\215\356semi\344l\234n\270",
"loc\356\321\347 s\277dow\203\252\321\200a\201\252\315c\300\367level\012",
"\247\315\264\334\360\236 \322\256ov\211rid\200\276ap\304\206 \370twe\212 p\206\212\236ese\270",
"la\370l nam\347 s\277dow\203\322\256na\311\012",
"n\234b\260\317\353git\203\247ce\300\203\244\215\356n\234b\260\315ci\226\202\012",
"\221d\222d\223\201\042\362e\301\042: \333\362\200\263\213way\2031 \354",
"\204\230t\211m\204\227\200\324\362\200\376\042\362e\301\352\247\315\264\334\354",
"\222\221a\272\271\200\344\230\012",
"\252\321\200\263a\264gn\232\302 itself \354",
"m\220\200\204i\207\213iz\211\203\236\366\212\234 \335eld\270",
"l\212g\236 \317\204i\207\213iz\260\247ce\300\203\362\200\317\371\212\234 \335eld\012",
"\204\230x \322\256mis\350\272 \354",
"\214 imple\323\322\242f\237\342\347 \376\373\233\307\214 f\213l-back\012",
"\342\200s\304ci\335ca\242\334\374w\206\205\230\361\327\242\263ig\214\221d\012",
"outpu\201\335\363\263writt\212\307bu\201\360\236 \344mpac\201\212\344d\367\353s\271\300\012",
"\342\200\321\347 s\277dow\203\252glob\356\321\365",
"\306 \263m\206k\232\372\230\315c\227\300: \364",
"pu\240ic \274lack\203\374w\206\205\230\361\327\242\354",
"\222k\214w\343p\327\311t\260\376subs\207tu\242(\204c\220\221c\201#\326\200p\227t\211n\235"
"\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"
#endif
};

View File

@ -174,7 +174,7 @@ funcenum_t *funcenums_add(const char *name)
}
strcpy(e->name, name);
e->value = pc_addfunctag((char *)name);
e->value = pc_addtag_flags((char *)name, FIXEDTAG|FUNCTAG);
return e;
}

View File

@ -0,0 +1,11 @@
methodmap Y
{
};
class X < Y
{
};
public main()
{
}

View File

@ -0,0 +1 @@
cannot mix methodmaps and classes with inheritance

View File

@ -0,0 +1,11 @@
class Y
{
};
methodmap X < Y
{
};
public main()
{
}

View File

@ -0,0 +1 @@
cannot mix methodmaps and classes with inheritance

View File

@ -0,0 +1,13 @@
class X
{
};
f(X:x)
{
return 3
}
public main()
{
return f(2);
}

View File

@ -0,0 +1 @@
cannot coerce non-object type int to object type X

View File

@ -0,0 +1,14 @@
class X
{
};
f(any:x)
{
return 3
}
public main()
{
new X:x;
return f(x);
}

View File

@ -0,0 +1 @@
cannot coerce object type X to non-object type any

View File

@ -0,0 +1,14 @@
class X
{
};
f({X,Float}:x)
{
return 3
}
public main()
{
new X:x;
return f(x);
}

View File

@ -0,0 +1 @@
cannot use an object in a multi-tag selector

View File

@ -0,0 +1,14 @@
class X
{
};
f(x)
{
return 3
}
public main()
{
new X:x;
return f(x);
}

View File

@ -0,0 +1 @@
cannot coerce object type X to non-object type int

View File

@ -0,0 +1,14 @@
class X
{
};
f(...)
{
return 3
}
public main()
{
new X:x;
return f(x);
}

View File

@ -0,0 +1 @@
cannot coerce object type X to non-object type int

View File

@ -0,0 +1,14 @@
class X
{
};
f(X:x)
{
return 3
}
public main()
{
new x;
return f(X:x);
}

View File

@ -0,0 +1 @@
cannot coerce non-object type int to object type X

View File

@ -0,0 +1,14 @@
class X
{
};
f(x)
{
return 3
}
public main()
{
new X:x;
return f(_:x);
}

View File

@ -0,0 +1 @@
cannot coerce object type X to non-object type int