ljx

FORK: LuaJIT with native 5.2 and 5.3 support
git clone https://git.neptards.moe/neptards/ljx.git
Log | Files | Refs | README

lj_errmsg.h (8328B)


      1 /*
      2 ** VM error messages.
      3 ** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
      4 */
      5 
      6 /* This file may be included multiple times with different ERRDEF macros. */
      7 
      8 /* Basic error handling. */
      9 ERRDEF(ERRMEM,	"not enough memory")
     10 ERRDEF(ERRERR,	"error in error handling")
     11 ERRDEF(ERRCPP,	"C++ exception")
     12 
     13 /* Allocations. */
     14 ERRDEF(STROV,	"string length overflow")
     15 ERRDEF(UDATAOV,	"userdata length overflow")
     16 ERRDEF(CSTKOV,	"C stack overflow")
     17 ERRDEF(STKOV,	"stack overflow")
     18 ERRDEF(STKOVM,	"stack overflow (%s)")
     19 ERRDEF(TABOV,	"table overflow")
     20 
     21 /* Table indexing. */
     22 ERRDEF(NANIDX,	"table index is NaN")
     23 ERRDEF(NILIDX,	"table index is nil")
     24 ERRDEF(NEXTIDX,	"invalid key to " LUA_QL("next"))
     25 
     26 /* Metamethod resolving. */
     27 ERRDEF(BADCALL,	"attempt to call a %s value")
     28 ERRDEF(BADOPRT,	"attempt to %s %s " LUA_QS " (a %s value)")
     29 ERRDEF(BADOPRV,	"attempt to %s a %s value")
     30 ERRDEF(BADCMPT,	"attempt to compare %s with %s")
     31 ERRDEF(BADCMPV,	"attempt to compare two %s values")
     32 ERRDEF(GETLOOP,	"loop in gettable")
     33 ERRDEF(SETLOOP,	"loop in settable")
     34 ERRDEF(OPCALL,	"call")
     35 ERRDEF(OPINDEX,	"index")
     36 ERRDEF(OPARITH,	"perform arithmetic on")
     37 ERRDEF(OPCAT,	"concatenate")
     38 ERRDEF(OPLEN,	"get length of")
     39 
     40 /* Type checks. */
     41 ERRDEF(BADSELF,	"calling " LUA_QS " on bad self (%s)")
     42 ERRDEF(BADARG,	"bad argument #%d to " LUA_QS " (%s)")
     43 ERRDEF(BADTYPE,	"%s expected, got %s")
     44 ERRDEF(BADVAL,	"invalid value")
     45 ERRDEF(NOVAL,	"value expected")
     46 ERRDEF(NOCORO,	"coroutine expected")
     47 ERRDEF(NOTABN,	"nil or table expected")
     48 ERRDEF(NOLFUNC,	"Lua function expected")
     49 ERRDEF(NOFUNCL,	"function or level expected")
     50 ERRDEF(NOSFT,	"string/function/table expected")
     51 ERRDEF(NOPROXY,	"boolean or proxy expected")
     52 ERRDEF(FORINIT,	LUA_QL("for") " initial value must be a number")
     53 ERRDEF(FORLIM,	LUA_QL("for") " limit must be a number")
     54 ERRDEF(FORSTEP,	LUA_QL("for") " step must be a number")
     55 
     56 /* C API checks. */
     57 ERRDEF(NOENV,	"no calling environment")
     58 ERRDEF(CYIELD,	"attempt to yield across C-call boundary")
     59 ERRDEF(BADLU,	"bad light userdata pointer")
     60 ERRDEF(NOGCMM,	"bad action while in __gc metamethod")
     61 #if LJ_TARGET_WINDOWS
     62 ERRDEF(BADFPU,	"bad FPU precision (use D3DCREATE_FPU_PRESERVE with DirectX)")
     63 #endif
     64 
     65 /* Standard library function errors. */
     66 ERRDEF(ASSERT,	"assertion failed!")
     67 ERRDEF(PROTMT,	"cannot change a protected metatable")
     68 ERRDEF(UNPACK,	"too many results to unpack")
     69 ERRDEF(RDRSTR,	"reader function must return a string")
     70 ERRDEF(PRTOSTR,	LUA_QL("tostring") " must return a string to " LUA_QL("print"))
     71 ERRDEF(IDXRNG,	"index out of range")
     72 ERRDEF(BASERNG,	"base out of range")
     73 ERRDEF(LVLRNG,	"level out of range")
     74 ERRDEF(INVLVL,	"invalid level")
     75 ERRDEF(INVOPT,	"invalid option")
     76 ERRDEF(INVOPTM,	"invalid option " LUA_QS)
     77 ERRDEF(INVFMT,	"invalid format")
     78 ERRDEF(SETFENV,	LUA_QL("setfenv") " cannot change environment of given object")
     79 ERRDEF(CORUN,	"cannot resume running coroutine")
     80 ERRDEF(CODEAD,	"cannot resume dead coroutine")
     81 ERRDEF(COSUSP,	"cannot resume non-suspended coroutine")
     82 ERRDEF(TABINS,	"wrong number of arguments to " LUA_QL("insert"))
     83 ERRDEF(TABCAT,	"invalid value (%s) at index %d in table for " LUA_QL("concat"))
     84 ERRDEF(TABSORT,	"invalid order function for sorting")
     85 ERRDEF(IOCLFL,	"attempt to use a closed file")
     86 ERRDEF(IOSTDCL,	"standard file is closed")
     87 ERRDEF(OSUNIQF,	"unable to generate a unique filename")
     88 ERRDEF(OSDATEF,	"field " LUA_QS " missing in date table")
     89 ERRDEF(STRDUMP,	"unable to dump given function")
     90 ERRDEF(STRSLC,	"string slice too long")
     91 ERRDEF(STRPATB,	"missing " LUA_QL("[") " after " LUA_QL("%f") " in pattern")
     92 ERRDEF(STRPATC,	"invalid pattern capture")
     93 ERRDEF(STRPATE,	"malformed pattern (ends with " LUA_QL("%") ")")
     94 ERRDEF(STRPATM,	"malformed pattern (missing " LUA_QL("]") ")")
     95 ERRDEF(STRPATPB,"malformed pattern (missing arguments to " LUA_QL("%%b") ")")
     96 ERRDEF(STRPATU,	"unbalanced pattern")
     97 ERRDEF(STRPATX,	"pattern too complex")
     98 ERRDEF(STRCAPI,	"invalid capture index")
     99 ERRDEF(STRCAPN,	"too many captures")
    100 ERRDEF(STRCAPU,	"unfinished capture")
    101 ERRDEF(STRFMT,	"invalid option " LUA_QS " to " LUA_QL("format"))
    102 ERRDEF(STRGSRV,	"invalid replacement value (a %s)")
    103 ERRDEF(BADMODN,	"name conflict for module " LUA_QS)
    104 ERRDEF(MULTIVM,	"multiple Lua VMs detected")
    105 ERRDEF(BADVER, "version mismatch: app. needs %f, Lua core provides %f")
    106 ERRDEF(BADCONV,	"cannot convert " LUA_QS " to " LUA_QS)
    107 
    108 #if LJ_HASJIT
    109 ERRDEF(JITPROT,	"runtime code generation failed, restricted kernel?")
    110 #if LJ_TARGET_X86ORX64
    111 ERRDEF(NOJIT,	"JIT compiler disabled, CPU does not support SSE2")
    112 #else
    113 ERRDEF(NOJIT,	"JIT compiler disabled")
    114 #endif
    115 #elif defined(LJ_ARCH_NOJIT)
    116 ERRDEF(NOJIT,	"no JIT compiler for this architecture (yet)")
    117 #else
    118 ERRDEF(NOJIT,	"JIT compiler permanently disabled by build option")
    119 #endif
    120 ERRDEF(JITOPT,	"unknown or malformed optimization flag " LUA_QS)
    121 
    122 /* Lexer/parser errors. */
    123 ERRDEF(XMODE,   "attempt to load a %s chunk (mode is " LUA_QS ")")
    124 ERRDEF(XNEAR,	"%s near %s")
    125 ERRDEF(XNEARQ,	"%s near " LUA_QS)
    126 ERRDEF(XLINES,	"chunk has too many lines")
    127 ERRDEF(XLEVELS,	"chunk has too many syntax levels")
    128 ERRDEF(XNUMBER,	"malformed number")
    129 ERRDEF(XLSTR,	"unfinished long string")
    130 ERRDEF(XLCOM,	"unfinished long comment")
    131 ERRDEF(XSTR,	"unfinished string")
    132 ERRDEF(XESC,	"invalid escape sequence")
    133 ERRDEF(XHEX,	"hexadecimal digit expected")
    134 ERRDEF(XLDELIM,	"invalid long string delimiter")
    135 ERRDEF(XTOKEN,	LUA_QS " expected")
    136 ERRDEF(XJUMP,	"control structure too long")
    137 ERRDEF(XSLOTS,	"function or expression too complex")
    138 ERRDEF(XLIMC,	"chunk has more than %d local variables")
    139 ERRDEF(XLIMM,	"main function has more than %d %s")
    140 ERRDEF(XLIMF,	"function at line %d has more than %d %s")
    141 ERRDEF(XMATCH,	LUA_QS " expected (to close " LUA_QS " at line %d)")
    142 ERRDEF(XFIXUP,	"function too long for return fixup")
    143 ERRDEF(XPARAM,	"<name> or " LUA_QL("...") " expected")
    144 #if LJ_51
    145 ERRDEF(XAMBIG,  "ambiguous syntax (function call x new statement)")
    146 #endif
    147 ERRDEF(XFUNARG,	"function arguments expected")
    148 ERRDEF(XSYMBOL,	"unexpected symbol")
    149 ERRDEF(XDOTS,	"cannot use " LUA_QL("...") " outside a vararg function")
    150 ERRDEF(XSYNTAX,	"syntax error")
    151 ERRDEF(XFOR,	LUA_QL("=") " or " LUA_QL("in") " expected")
    152 ERRDEF(XBREAK,	"no loop to break")
    153 ERRDEF(XLUNDEF,	"undefined label " LUA_QS)
    154 ERRDEF(XLDUP,	"duplicate label " LUA_QS)
    155 ERRDEF(XGSCOPE,	"<goto %s> jumps into the scope of local " LUA_QS)
    156 ERRDEF(BADLEN,	"attempt to get length of " LUA_QS)
    157 ERRDEF(BADLENNUM,"length of " LUA_QS " is not a number")
    158 
    159 /* Bytecode reader errors. */
    160 ERRDEF(BCFMT,	"cannot load incompatible bytecode")
    161 ERRDEF(BCBAD,	"cannot load malformed bytecode")
    162 
    163 #if LJ_HASFFI
    164 /* FFI errors. */
    165 ERRDEF(FFI_INVTYPE,	"invalid C type")
    166 ERRDEF(FFI_INVSIZE,	"size of C type is unknown or too large")
    167 ERRDEF(FFI_BADSCL,	"bad storage class")
    168 ERRDEF(FFI_DECLSPEC,	"declaration specifier expected")
    169 ERRDEF(FFI_BADTAG,	"undeclared or implicit tag " LUA_QS)
    170 ERRDEF(FFI_REDEF,	"attempt to redefine " LUA_QS)
    171 ERRDEF(FFI_NUMPARAM,	"wrong number of type parameters")
    172 ERRDEF(FFI_INITOV,	"too many initializers for " LUA_QS)
    173 ERRDEF(FFI_BADCONV,	"cannot convert " LUA_QS " to " LUA_QS)
    174 ERRDEF(FFI_BADLEN,	"attempt to get length of " LUA_QS)
    175 ERRDEF(FFI_BADLENNUM,	"length of " LUA_QS " is not a number")
    176 ERRDEF(FFI_BADCONCAT,	"attempt to concatenate " LUA_QS " and " LUA_QS)
    177 ERRDEF(FFI_BADARITH,	"attempt to perform arithmetic on " LUA_QS " and " LUA_QS)
    178 ERRDEF(FFI_BADCOMP,	"attempt to compare " LUA_QS " with " LUA_QS)
    179 ERRDEF(FFI_BADCALL,	LUA_QS " is not callable")
    180 ERRDEF(FFI_NUMARG,	"wrong number of arguments for function call")
    181 ERRDEF(FFI_BADMEMBER,	LUA_QS " has no member named " LUA_QS)
    182 ERRDEF(FFI_BADIDX,	LUA_QS " cannot be indexed")
    183 ERRDEF(FFI_BADIDXW,	LUA_QS " cannot be indexed with " LUA_QS)
    184 ERRDEF(FFI_BADMM,	LUA_QS " has no " LUA_QS " metamethod")
    185 ERRDEF(FFI_WRCONST,	"attempt to write to constant location")
    186 ERRDEF(FFI_NODECL,	"missing declaration for symbol " LUA_QS)
    187 ERRDEF(FFI_BADCBACK,	"bad callback")
    188 #if LJ_OS_NOJIT
    189 ERRDEF(FFI_CBACKOV,	"no support for callbacks on this OS")
    190 #else
    191 ERRDEF(FFI_CBACKOV,	"too many callbacks")
    192 #endif
    193 ERRDEF(FFI_NYIPACKBIT,	"NYI: packed bit fields")
    194 ERRDEF(FFI_NYICALL,	"NYI: cannot call this C function (yet)")
    195 #endif
    196 
    197 #undef ERRDEF
    198 
    199 /* Detecting unused error messages:
    200    awk -F, '/^ERRDEF/ { gsub(/ERRDEF./, ""); printf "grep -q LJ_ERR_%s *.[ch] || echo %s\n", $1, $1}' lj_errmsg.h | sh
    201 */