added bytearray compilation code
This commit is contained in:
228
lib/err.c
228
lib/err.c
@ -26,9 +26,6 @@
|
||||
|
||||
#include "hcl-prv.h"
|
||||
|
||||
|
||||
/* BEGIN: GENERATED WITH generr.hcl */
|
||||
|
||||
static hcl_ooch_t errstr_0[] = {'n','o',' ','e','r','r','o','r','\0'};
|
||||
static hcl_ooch_t errstr_1[] = {'g','e','n','e','r','i','c',' ','e','r','r','o','r','\0'};
|
||||
static hcl_ooch_t errstr_2[] = {'n','o','t',' ','i','m','p','l','e','m','e','n','t','e','d','\0'};
|
||||
@ -71,95 +68,57 @@ static hcl_ooch_t* errstr[] =
|
||||
errstr_32
|
||||
};
|
||||
|
||||
#if defined(HCL_INCLUDE_COMPILER)
|
||||
static hcl_ooch_t synerrstr_0[] = {'n','o',' ','e','r','r','o','r','\0'};
|
||||
static hcl_ooch_t synerrstr_1[] = {'i','l','l','e','g','a','l',' ','c','h','a','r','a','c','t','e','r','\0'};
|
||||
static hcl_ooch_t synerrstr_2[] = {'c','o','m','m','e','n','t',' ','n','o','t',' ','c','l','o','s','e','d','\0'};
|
||||
static hcl_ooch_t synerrstr_3[] = {'s','t','r','i','n','g',' ','n','o','t',' ','c','l','o','s','e','d','\0'};
|
||||
static hcl_ooch_t synerrstr_4[] = {'n','o',' ','c','h','a','r','a','c','t','e','r',' ','a','f','t','e','r',' ','$','\0'};
|
||||
static hcl_ooch_t synerrstr_5[] = {'n','o',' ','v','a','l','i','d',' ','c','h','a','r','a','c','t','e','r',' ','a','f','t','e','r',' ','#','\0'};
|
||||
static hcl_ooch_t synerrstr_6[] = {'w','r','o','n','g',' ','c','h','a','r','a','c','t','e','r',' ','l','i','t','e','r','a','l','\0'};
|
||||
static hcl_ooch_t synerrstr_7[] = {'c','o','l','o','n',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static hcl_ooch_t synerrstr_8[] = {'s','t','r','i','n','g',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static hcl_ooch_t synerrstr_9[] = {'i','n','v','a','l','i','d',' ','r','a','d','i','x','\0'};
|
||||
static hcl_ooch_t synerrstr_10[] = {'i','n','v','a','l','i','d',' ','n','u','m','e','r','i','c',' ','l','i','t','e','r','a','l','\0'};
|
||||
static hcl_ooch_t synerrstr_11[] = {'b','y','t','e',' ','t','o','o',' ','s','m','a','l','l',' ','o','r',' ','t','o','o',' ','l','a','r','g','e','\0'};
|
||||
static hcl_ooch_t synerrstr_12[] = {'w','r','o','n','g',' ','e','r','r','o','r',' ','l','i','t','e','r','a','l','\0'};
|
||||
static hcl_ooch_t synerrstr_13[] = {'{',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static hcl_ooch_t synerrstr_14[] = {'}',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static hcl_ooch_t synerrstr_15[] = {'(',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static hcl_ooch_t synerrstr_16[] = {')',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static hcl_ooch_t synerrstr_17[] = {']',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static hcl_ooch_t synerrstr_18[] = {'.',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static hcl_ooch_t synerrstr_19[] = {',',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static hcl_ooch_t synerrstr_20[] = {'|',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static hcl_ooch_t synerrstr_21[] = {'>',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static hcl_ooch_t synerrstr_22[] = {':','=',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static hcl_ooch_t synerrstr_23[] = {'i','d','e','n','t','i','f','i','e','r',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static hcl_ooch_t synerrstr_24[] = {'i','n','t','e','g','e','r',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static hcl_ooch_t synerrstr_25[] = {'p','r','i','m','i','t','i','v','e',':',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static hcl_ooch_t synerrstr_26[] = {'w','r','o','n','g',' ','d','i','r','e','c','t','i','v','e','\0'};
|
||||
static hcl_ooch_t synerrstr_27[] = {'u','n','d','e','f','i','n','e','d',' ','c','l','a','s','s','\0'};
|
||||
static hcl_ooch_t synerrstr_28[] = {'d','u','p','l','i','c','a','t','e',' ','c','l','a','s','s','\0'};
|
||||
static hcl_ooch_t synerrstr_29[] = {'c','o','n','t','r','a','d','i','c','t','o','r','y',' ','c','l','a','s','s',' ','d','e','f','i','n','i','t','i','o','n','\0'};
|
||||
static hcl_ooch_t synerrstr_30[] = {'w','r','o','n','g',' ','c','l','a','s','s',' ','n','a','m','e','\0'};
|
||||
static hcl_ooch_t synerrstr_31[] = {'i','n','v','a','l','i','d',' ','n','o','n','-','p','o','i','n','t','e','r',' ','i','n','s','t','a','n','c','e',' ','s','i','z','e','\0'};
|
||||
static hcl_ooch_t synerrstr_32[] = {'p','r','o','h','i','b','i','t','e','d',' ','i','n','h','e','r','i','t','a','n','c','e','\0'};
|
||||
static hcl_ooch_t synerrstr_33[] = {'v','a','r','i','a','b','l','e',' ','d','e','c','l','a','r','a','t','i','o','n',' ','n','o','t',' ','a','l','l','o','w','e','d','\0'};
|
||||
static hcl_ooch_t synerrstr_34[] = {'m','o','d','i','f','i','e','r',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static hcl_ooch_t synerrstr_35[] = {'w','r','o','n','g',' ','m','o','d','i','f','i','e','r','\0'};
|
||||
static hcl_ooch_t synerrstr_36[] = {'d','i','s','a','l','l','o','w','e','d',' ','m','o','d','i','f','i','e','r','\0'};
|
||||
static hcl_ooch_t synerrstr_37[] = {'d','u','p','l','i','c','a','t','e',' ','m','o','d','i','f','i','e','r','\0'};
|
||||
static hcl_ooch_t synerrstr_38[] = {'m','e','t','h','o','d',' ','n','a','m','e',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static hcl_ooch_t synerrstr_39[] = {'d','u','p','l','i','c','a','t','e',' ','m','e','t','h','o','d',' ','n','a','m','e','\0'};
|
||||
static hcl_ooch_t synerrstr_40[] = {'i','n','v','a','l','i','d',' ','v','a','r','i','a','d','i','c',' ','m','e','t','h','o','d',' ','d','e','f','i','n','i','t','i','o','n','\0'};
|
||||
static hcl_ooch_t synerrstr_41[] = {'v','a','r','i','a','b','l','e',' ','n','a','m','e',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static hcl_ooch_t synerrstr_42[] = {'d','u','p','l','i','c','a','t','e',' ','a','r','g','u','m','e','n','t',' ','n','a','m','e','\0'};
|
||||
static hcl_ooch_t synerrstr_43[] = {'d','u','p','l','i','c','a','t','e',' ','t','e','m','p','o','r','a','r','y',' ','v','a','r','i','a','b','l','e',' ','n','a','m','e','\0'};
|
||||
static hcl_ooch_t synerrstr_44[] = {'d','u','p','l','i','c','a','t','e',' ','v','a','r','i','a','b','l','e',' ','n','a','m','e','\0'};
|
||||
static hcl_ooch_t synerrstr_45[] = {'d','u','p','l','i','c','a','t','e',' ','b','l','o','c','k',' ','a','r','g','u','m','e','n','t',' ','n','a','m','e','\0'};
|
||||
static hcl_ooch_t synerrstr_46[] = {'u','n','d','e','c','l','a','r','e','d',' ','v','a','r','i','a','b','l','e','\0'};
|
||||
static hcl_ooch_t synerrstr_47[] = {'u','n','u','s','a','b','l','e',' ','v','a','r','i','a','b','l','e',' ','i','n',' ','c','o','m','p','i','l','e','d',' ','c','o','d','e','\0'};
|
||||
static hcl_ooch_t synerrstr_48[] = {'i','n','a','c','c','e','s','s','i','b','l','e',' ','v','a','r','i','a','b','l','e','\0'};
|
||||
static hcl_ooch_t synerrstr_49[] = {'a','m','b','i','g','u','o','u','s',' ','v','a','r','i','a','b','l','e','\0'};
|
||||
static hcl_ooch_t synerrstr_50[] = {'t','o','o',' ','m','a','n','y',' ','i','n','s','t','a','n','c','e','/','c','l','a','s','s',' ','v','a','r','i','a','b','l','e','s','\0'};
|
||||
static hcl_ooch_t synerrstr_51[] = {'i','n','a','c','c','e','s','s','i','b','l','e',' ','s','e','l','f','\0'};
|
||||
static hcl_ooch_t synerrstr_52[] = {'w','r','o','n','g',' ','e','x','p','r','e','s','s','i','o','n',' ','p','r','i','m','a','r','y','\0'};
|
||||
static hcl_ooch_t synerrstr_53[] = {'t','o','o',' ','m','a','n','y',' ','t','e','m','p','o','r','a','r','i','e','s','\0'};
|
||||
static hcl_ooch_t synerrstr_54[] = {'t','o','o',' ','m','a','n','y',' ','a','r','g','u','m','e','n','t','s','\0'};
|
||||
static hcl_ooch_t synerrstr_55[] = {'t','o','o',' ','m','a','n','y',' ','b','l','o','c','k',' ','t','e','m','p','o','r','a','r','i','e','s','\0'};
|
||||
static hcl_ooch_t synerrstr_56[] = {'t','o','o',' ','m','a','n','y',' ','b','l','o','c','k',' ','a','r','g','u','m','e','n','t','s','\0'};
|
||||
static hcl_ooch_t synerrstr_57[] = {'t','o','o',' ','l','a','r','g','e',' ','b','l','o','c','k','\0'};
|
||||
static hcl_ooch_t synerrstr_58[] = {'t','o','o',' ','l','a','r','g','e',' ','a','r','r','a','y',' ','e','x','p','r','e','s','s','i','o','n','\0'};
|
||||
static hcl_ooch_t synerrstr_59[] = {'w','r','o','n','g',' ','p','r','i','m','i','t','i','v','e',' ','f','u','n','c','t','i','o','n',' ','n','u','m','b','e','r','\0'};
|
||||
static hcl_ooch_t synerrstr_60[] = {'w','r','o','n','g',' ','p','r','i','m','i','t','i','v','e',' ','f','u','n','c','t','i','o','n',' ','i','d','e','n','t','i','f','i','e','r','\0'};
|
||||
static hcl_ooch_t synerrstr_61[] = {'w','r','o','n','g',' ','p','r','i','m','i','t','i','v','e',' ','f','u','n','c','t','i','o','n',' ','a','r','g','u','m','e','n','t',' ','d','e','f','i','n','i','t','i','o','n','\0'};
|
||||
static hcl_ooch_t synerrstr_62[] = {'w','r','o','n','g',' ','m','o','d','u','l','e',' ','n','a','m','e','\0'};
|
||||
static hcl_ooch_t synerrstr_63[] = {'f','a','i','l','e','d',' ','t','o',' ','i','m','p','o','r','t',' ','m','o','d','u','l','e','\0'};
|
||||
static hcl_ooch_t synerrstr_64[] = {'#','i','n','c','l','u','d','e',' ','e','r','r','o','r','\0'};
|
||||
static hcl_ooch_t synerrstr_65[] = {'w','r','o','n','g',' ','p','r','a','g','m','a',' ','n','a','m','e','\0'};
|
||||
static hcl_ooch_t synerrstr_66[] = {'w','r','o','n','g',' ','n','a','m','e','s','p','a','c','e',' ','n','a','m','e','\0'};
|
||||
static hcl_ooch_t synerrstr_67[] = {'w','r','o','n','g',' ','p','o','o','l',' ','d','i','c','t','i','o','n','a','r','y',' ','n','a','m','e','\0'};
|
||||
static hcl_ooch_t synerrstr_68[] = {'d','u','p','l','i','c','a','t','e',' ','p','o','o','l',' ','d','i','c','t','i','o','n','a','r','y',' ','n','a','m','e','\0'};
|
||||
static hcl_ooch_t synerrstr_69[] = {'l','i','t','e','r','a','l',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static hcl_ooch_t synerrstr_70[] = {'b','r','e','a','k',' ','o','r',' ','c','o','n','t','i','n','u','e',' ','n','o','t',' ','w','i','t','h','i','n',' ','a',' ','l','o','o','p','\0'};
|
||||
static hcl_ooch_t synerrstr_71[] = {'b','r','e','a','k',' ','o','r',' ','c','o','n','t','i','n','u','e',' ','w','i','t','h','i','n',' ','a',' ','b','l','o','c','k','\0'};
|
||||
static hcl_ooch_t synerrstr_72[] = {'w','h','i','l','e',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static hcl_ooch_t* synerrstr[] =
|
||||
|
||||
static char* synerrstr[] =
|
||||
{
|
||||
synerrstr_0, synerrstr_1, synerrstr_2, synerrstr_3, synerrstr_4, synerrstr_5, synerrstr_6, synerrstr_7,
|
||||
synerrstr_8, synerrstr_9, synerrstr_10, synerrstr_11, synerrstr_12, synerrstr_13, synerrstr_14, synerrstr_15,
|
||||
synerrstr_16, synerrstr_17, synerrstr_18, synerrstr_19, synerrstr_20, synerrstr_21, synerrstr_22, synerrstr_23,
|
||||
synerrstr_24, synerrstr_25, synerrstr_26, synerrstr_27, synerrstr_28, synerrstr_29, synerrstr_30, synerrstr_31,
|
||||
synerrstr_32, synerrstr_33, synerrstr_34, synerrstr_35, synerrstr_36, synerrstr_37, synerrstr_38, synerrstr_39,
|
||||
synerrstr_40, synerrstr_41, synerrstr_42, synerrstr_43, synerrstr_44, synerrstr_45, synerrstr_46, synerrstr_47,
|
||||
synerrstr_48, synerrstr_49, synerrstr_50, synerrstr_51, synerrstr_52, synerrstr_53, synerrstr_54, synerrstr_55,
|
||||
synerrstr_56, synerrstr_57, synerrstr_58, synerrstr_59, synerrstr_60, synerrstr_61, synerrstr_62, synerrstr_63,
|
||||
synerrstr_64, synerrstr_65, synerrstr_66, synerrstr_67, synerrstr_68, synerrstr_69, synerrstr_70, synerrstr_71,
|
||||
synerrstr_72
|
||||
"no error",
|
||||
"illegal character",
|
||||
"comment not closed",
|
||||
"string not closed",
|
||||
"invalid hashed literal",
|
||||
"wrong character literal",
|
||||
"invalid numeric literal",
|
||||
"out of integer range",
|
||||
|
||||
"sudden end of input",
|
||||
"( expected",
|
||||
") expected",
|
||||
"] expected",
|
||||
"} expected",
|
||||
"| expected",
|
||||
|
||||
"string expected",
|
||||
"byte too small or too large",
|
||||
"nesting level too deep",
|
||||
|
||||
"| disallowed",
|
||||
". disallowed",
|
||||
"#include error",
|
||||
|
||||
"loop body too big",
|
||||
"if body too big",
|
||||
"lambda block too big",
|
||||
"lambda block too deep",
|
||||
"argument name list expected",
|
||||
"argument name expected",
|
||||
"duplicate argument name",
|
||||
"variable name expected",
|
||||
"wrong number of arguments",
|
||||
"too many arguments defined",
|
||||
"too many variables defined",
|
||||
"variable declaration disallowed",
|
||||
"duplicate variable name",
|
||||
"disallowed variable name",
|
||||
"disallowed argument name",
|
||||
|
||||
"elif without if",
|
||||
"else without if",
|
||||
"break outside loop",
|
||||
|
||||
"invalid callable",
|
||||
"unbalanced key/value pair",
|
||||
"empty x-list"
|
||||
};
|
||||
#endif
|
||||
/* END: GENERATED WITH generr.hcl */
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
* ERROR NUMBER TO STRING CONVERSION
|
||||
@ -170,13 +129,11 @@ const hcl_ooch_t* hcl_errnum_to_errstr (hcl_errnum_t errnum)
|
||||
return (errnum >= 0 && errnum < HCL_COUNTOF(errstr))? errstr[errnum]: e_unknown;
|
||||
}
|
||||
|
||||
#if defined(HCL_INCLUDE_COMPILER)
|
||||
const hcl_ooch_t* hcl_synerrnum_to_errstr (hcl_synerrnum_t errnum)
|
||||
static const hcl_bch_t* synerr_to_errstr (hcl_synerrnum_t errnum)
|
||||
{
|
||||
static hcl_ooch_t e_unknown[] = {'u','n','k','n','o','w','n',' ','e','r','r','o','r','\0'};
|
||||
static hcl_bch_t e_unknown[] = "unknown error";
|
||||
return (errnum >= 0 && errnum < HCL_COUNTOF(synerrstr))? synerrstr[errnum]: e_unknown;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
* SYSTEM DEPENDENT FUNCTIONS
|
||||
@ -301,6 +258,8 @@ hcl_errnum_t hcl_syserr_to_errnum (int e)
|
||||
case EBADF: return HCL_EBADHND;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if defined(EIO)
|
||||
case EIO: return HCL_EIOERR;
|
||||
#endif
|
||||
@ -346,6 +305,87 @@ void hcl_seterrwithsyserr (hcl_t* hcl, int syserr)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void hcl_getsynerr (hcl_t* hcl, hcl_synerr_t* synerr)
|
||||
{
|
||||
HCL_ASSERT (hcl, hcl->c != HCL_NULL);
|
||||
if (synerr) *synerr = hcl->c->synerr;
|
||||
}
|
||||
|
||||
void hcl_setsynerrbfmt (hcl_t* hcl, hcl_synerrnum_t num, const hcl_ioloc_t* loc, const hcl_oocs_t* tgt, const hcl_bch_t* msgfmt, ...)
|
||||
{
|
||||
if (msgfmt)
|
||||
{
|
||||
va_list ap;
|
||||
va_start (ap, msgfmt);
|
||||
hcl_seterrbfmtv (hcl, HCL_ESYNERR, msgfmt, ap);
|
||||
va_end (ap);
|
||||
}
|
||||
else
|
||||
{
|
||||
hcl_seterrbfmt (hcl, HCL_ESYNERR, "syntax error - %hs", synerr_to_errstr(num));
|
||||
}
|
||||
hcl->c->synerr.num = num;
|
||||
|
||||
/* The SCO compiler complains of this ternary operation saying:
|
||||
* error: operands have incompatible types: op ":"
|
||||
* it seems to complain of type mismatch between *loc and
|
||||
* hcl->c->tok.loc due to 'const' prefixed to loc. */
|
||||
/*hcl->c->synerr.loc = loc? *loc: hcl->c->tok.loc;*/
|
||||
if (loc)
|
||||
{
|
||||
hcl->c->synerr.loc = *loc;
|
||||
}
|
||||
else
|
||||
{
|
||||
hcl->c->synerr.loc = hcl->c->tok.loc;
|
||||
}
|
||||
|
||||
if (tgt)
|
||||
{
|
||||
hcl->c->synerr.tgt = *tgt;
|
||||
}
|
||||
else
|
||||
{
|
||||
hcl->c->synerr.tgt.ptr = HCL_NULL;
|
||||
hcl->c->synerr.tgt.len = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void hcl_setsynerrufmt (hcl_t* hcl, hcl_synerrnum_t num, const hcl_ioloc_t* loc, const hcl_oocs_t* tgt, const hcl_uch_t* msgfmt, ...)
|
||||
{
|
||||
if (msgfmt)
|
||||
{
|
||||
va_list ap;
|
||||
va_start (ap, msgfmt);
|
||||
hcl_seterrufmtv (hcl, HCL_ESYNERR, msgfmt, ap);
|
||||
va_end (ap);
|
||||
}
|
||||
else
|
||||
{
|
||||
hcl_seterrbfmt (hcl, HCL_ESYNERR, "syntax error - %hs", synerr_to_errstr(num));
|
||||
}
|
||||
hcl->c->synerr.num = num;
|
||||
|
||||
/* The SCO compiler complains of this ternary operation saying:
|
||||
* error: operands have incompatible types: op ":"
|
||||
* it seems to complain of type mismatch between *loc and
|
||||
* hcl->c->tok.loc due to 'const' prefixed to loc. */
|
||||
/*hcl->c->synerr.loc = loc? *loc: hcl->c->tok.loc;*/
|
||||
if (loc)
|
||||
hcl->c->synerr.loc = *loc;
|
||||
else
|
||||
hcl->c->synerr.loc = hcl->c->tok.loc;
|
||||
|
||||
if (tgt) hcl->c->synerr.tgt = *tgt;
|
||||
else
|
||||
{
|
||||
hcl->c->synerr.tgt.ptr = HCL_NULL;
|
||||
hcl->c->synerr.tgt.len = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
* ASSERTION FAILURE HANDLERsemaphore heap full
|
||||
* -------------------------------------------------------------------------- */
|
||||
|
Reference in New Issue
Block a user