src/lj_errmsg.h - luajit-2.0-src

Macros defined

Source code

  1. /*
  2. ** VM error messages.
  3. ** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
  4. */

  5. /* This file may be included multiple times with different ERRDEF macros. */

  6. /* Basic error handling. */
  7. ERRDEF(ERRMEM,        "not enough memory")
  8. ERRDEF(ERRERR,        "error in error handling")
  9. ERRDEF(ERRCPP,        "C++ exception")

  10. /* Allocations. */
  11. ERRDEF(STROV,        "string length overflow")
  12. ERRDEF(UDATAOV,        "userdata length overflow")
  13. ERRDEF(STKOV,        "stack overflow")
  14. ERRDEF(STKOVM,        "stack overflow (%s)")
  15. ERRDEF(TABOV,        "table overflow")

  16. /* Table indexing. */
  17. ERRDEF(NANIDX,        "table index is NaN")
  18. ERRDEF(NILIDX,        "table index is nil")
  19. ERRDEF(NEXTIDX,        "invalid key to " LUA_QL("next"))

  20. /* Metamethod resolving. */
  21. ERRDEF(BADCALL,        "attempt to call a %s value")
  22. ERRDEF(BADOPRT,        "attempt to %s %s " LUA_QS " (a %s value)")
  23. ERRDEF(BADOPRV,        "attempt to %s a %s value")
  24. ERRDEF(BADCMPT,        "attempt to compare %s with %s")
  25. ERRDEF(BADCMPV,        "attempt to compare two %s values")
  26. ERRDEF(GETLOOP,        "loop in gettable")
  27. ERRDEF(SETLOOP,        "loop in settable")
  28. ERRDEF(OPCALL,        "call")
  29. ERRDEF(OPINDEX,        "index")
  30. ERRDEF(OPARITH,        "perform arithmetic on")
  31. ERRDEF(OPCAT,        "concatenate")
  32. ERRDEF(OPLEN,        "get length of")

  33. /* Type checks. */
  34. ERRDEF(BADSELF,        "calling " LUA_QS " on bad self (%s)")
  35. ERRDEF(BADARG,        "bad argument #%d to " LUA_QS " (%s)")
  36. ERRDEF(BADTYPE,        "%s expected, got %s")
  37. ERRDEF(BADVAL,        "invalid value")
  38. ERRDEF(NOVAL,        "value expected")
  39. ERRDEF(NOCORO,        "coroutine expected")
  40. ERRDEF(NOTABN,        "nil or table expected")
  41. ERRDEF(NOLFUNC,        "Lua function expected")
  42. ERRDEF(NOFUNCL,        "function or level expected")
  43. ERRDEF(NOSFT,        "string/function/table expected")
  44. ERRDEF(NOPROXY,        "boolean or proxy expected")
  45. ERRDEF(FORINIT,        LUA_QL("for") " initial value must be a number")
  46. ERRDEF(FORLIM,        LUA_QL("for") " limit must be a number")
  47. ERRDEF(FORSTEP,        LUA_QL("for") " step must be a number")

  48. /* C API checks. */
  49. ERRDEF(NOENV,        "no calling environment")
  50. ERRDEF(CYIELD,        "attempt to yield across C-call boundary")
  51. ERRDEF(BADLU,        "bad light userdata pointer")
  52. ERRDEF(NOGCMM,        "bad action while in __gc metamethod")
  53. #if LJ_TARGET_WINDOWS
  54. ERRDEF(BADFPU,        "bad FPU precision (use D3DCREATE_FPU_PRESERVE with DirectX)")
  55. #endif

  56. /* Standard library function errors. */
  57. ERRDEF(ASSERT,        "assertion failed!")
  58. ERRDEF(PROTMT,        "cannot change a protected metatable")
  59. ERRDEF(UNPACK,        "too many results to unpack")
  60. ERRDEF(RDRSTR,        "reader function must return a string")
  61. ERRDEF(PRTOSTR,        LUA_QL("tostring") " must return a string to " LUA_QL("print"))
  62. ERRDEF(IDXRNG,        "index out of range")
  63. ERRDEF(BASERNG,        "base out of range")
  64. ERRDEF(LVLRNG,        "level out of range")
  65. ERRDEF(INVLVL,        "invalid level")
  66. ERRDEF(INVOPT,        "invalid option")
  67. ERRDEF(INVOPTM,        "invalid option " LUA_QS)
  68. ERRDEF(INVFMT,        "invalid format")
  69. ERRDEF(SETFENV,        LUA_QL("setfenv") " cannot change environment of given object")
  70. ERRDEF(CORUN,        "cannot resume running coroutine")
  71. ERRDEF(CODEAD,        "cannot resume dead coroutine")
  72. ERRDEF(COSUSP,        "cannot resume non-suspended coroutine")
  73. ERRDEF(TABINS,        "wrong number of arguments to " LUA_QL("insert"))
  74. ERRDEF(TABCAT,        "invalid value (%s) at index %d in table for " LUA_QL("concat"))
  75. ERRDEF(TABSORT,        "invalid order function for sorting")
  76. ERRDEF(IOCLFL,        "attempt to use a closed file")
  77. ERRDEF(IOSTDCL,        "standard file is closed")
  78. ERRDEF(OSUNIQF,        "unable to generate a unique filename")
  79. ERRDEF(OSDATEF,        "field " LUA_QS " missing in date table")
  80. ERRDEF(STRDUMP,        "unable to dump given function")
  81. ERRDEF(STRSLC,        "string slice too long")
  82. ERRDEF(STRPATB,        "missing " LUA_QL("[") " after " LUA_QL("%f") " in pattern")
  83. ERRDEF(STRPATC,        "invalid pattern capture")
  84. ERRDEF(STRPATE,        "malformed pattern (ends with " LUA_QL("%") ")")
  85. ERRDEF(STRPATM,        "malformed pattern (missing " LUA_QL("]") ")")
  86. ERRDEF(STRPATU,        "unbalanced pattern")
  87. ERRDEF(STRPATX,        "pattern too complex")
  88. ERRDEF(STRCAPI,        "invalid capture index")
  89. ERRDEF(STRCAPN,        "too many captures")
  90. ERRDEF(STRCAPU,        "unfinished capture")
  91. ERRDEF(STRFMT,        "invalid option " LUA_QS " to " LUA_QL("format"))
  92. ERRDEF(STRGSRV,        "invalid replacement value (a %s)")
  93. ERRDEF(BADMODN,        "name conflict for module " LUA_QS)
  94. #if LJ_HASJIT
  95. ERRDEF(JITPROT,        "runtime code generation failed, restricted kernel?")
  96. #if LJ_TARGET_X86ORX64
  97. ERRDEF(NOJIT,        "JIT compiler disabled, CPU does not support SSE2")
  98. #else
  99. ERRDEF(NOJIT,        "JIT compiler disabled")
  100. #endif
  101. #elif defined(LJ_ARCH_NOJIT)
  102. ERRDEF(NOJIT,        "no JIT compiler for this architecture (yet)")
  103. #else
  104. ERRDEF(NOJIT,        "JIT compiler permanently disabled by build option")
  105. #endif
  106. ERRDEF(JITOPT,        "unknown or malformed optimization flag " LUA_QS)

  107. /* Lexer/parser errors. */
  108. ERRDEF(XMODE,        "attempt to load chunk with wrong mode")
  109. ERRDEF(XNEAR,        "%s near " LUA_QS)
  110. ERRDEF(XLINES,        "chunk has too many lines")
  111. ERRDEF(XLEVELS,        "chunk has too many syntax levels")
  112. ERRDEF(XNUMBER,        "malformed number")
  113. ERRDEF(XLSTR,        "unfinished long string")
  114. ERRDEF(XLCOM,        "unfinished long comment")
  115. ERRDEF(XSTR,        "unfinished string")
  116. ERRDEF(XESC,        "invalid escape sequence")
  117. ERRDEF(XLDELIM,        "invalid long string delimiter")
  118. ERRDEF(XTOKEN,        LUA_QS " expected")
  119. ERRDEF(XJUMP,        "control structure too long")
  120. ERRDEF(XSLOTS,        "function or expression too complex")
  121. ERRDEF(XLIMC,        "chunk has more than %d local variables")
  122. ERRDEF(XLIMM,        "main function has more than %d %s")
  123. ERRDEF(XLIMF,        "function at line %d has more than %d %s")
  124. ERRDEF(XMATCH,        LUA_QS " expected (to close " LUA_QS " at line %d)")
  125. ERRDEF(XFIXUP,        "function too long for return fixup")
  126. ERRDEF(XPARAM,        "<name> or " LUA_QL("...") " expected")
  127. #if !LJ_52
  128. ERRDEF(XAMBIG,        "ambiguous syntax (function call x new statement)")
  129. #endif
  130. ERRDEF(XFUNARG,        "function arguments expected")
  131. ERRDEF(XSYMBOL,        "unexpected symbol")
  132. ERRDEF(XDOTS,        "cannot use " LUA_QL("...") " outside a vararg function")
  133. ERRDEF(XSYNTAX,        "syntax error")
  134. ERRDEF(XFOR,        LUA_QL("=") " or " LUA_QL("in") " expected")
  135. ERRDEF(XBREAK,        "no loop to break")
  136. ERRDEF(XLUNDEF,        "undefined label " LUA_QS)
  137. ERRDEF(XLDUP,        "duplicate label " LUA_QS)
  138. ERRDEF(XGSCOPE,        "<goto %s> jumps into the scope of local " LUA_QS)

  139. /* Bytecode reader errors. */
  140. ERRDEF(BCFMT,        "cannot load incompatible bytecode")
  141. ERRDEF(BCBAD,        "cannot load malformed bytecode")

  142. #if LJ_HASFFI
  143. /* FFI errors. */
  144. ERRDEF(FFI_INVTYPE,        "invalid C type")
  145. ERRDEF(FFI_INVSIZE,        "size of C type is unknown or too large")
  146. ERRDEF(FFI_BADSCL,        "bad storage class")
  147. ERRDEF(FFI_DECLSPEC,        "declaration specifier expected")
  148. ERRDEF(FFI_BADTAG,        "undeclared or implicit tag " LUA_QS)
  149. ERRDEF(FFI_REDEF,        "attempt to redefine " LUA_QS)
  150. ERRDEF(FFI_NUMPARAM,        "wrong number of type parameters")
  151. ERRDEF(FFI_INITOV,        "too many initializers for " LUA_QS)
  152. ERRDEF(FFI_BADCONV,        "cannot convert " LUA_QS " to " LUA_QS)
  153. ERRDEF(FFI_BADLEN,        "attempt to get length of " LUA_QS)
  154. ERRDEF(FFI_BADCONCAT,        "attempt to concatenate " LUA_QS " and " LUA_QS)
  155. ERRDEF(FFI_BADARITH,        "attempt to perform arithmetic on " LUA_QS " and " LUA_QS)
  156. ERRDEF(FFI_BADCOMP,        "attempt to compare " LUA_QS " with " LUA_QS)
  157. ERRDEF(FFI_BADCALL,        LUA_QS " is not callable")
  158. ERRDEF(FFI_NUMARG,        "wrong number of arguments for function call")
  159. ERRDEF(FFI_BADMEMBER,        LUA_QS " has no member named " LUA_QS)
  160. ERRDEF(FFI_BADIDX,        LUA_QS " cannot be indexed")
  161. ERRDEF(FFI_BADIDXW,        LUA_QS " cannot be indexed with " LUA_QS)
  162. ERRDEF(FFI_BADMM,        LUA_QS " has no " LUA_QS " metamethod")
  163. ERRDEF(FFI_WRCONST,        "attempt to write to constant location")
  164. ERRDEF(FFI_NODECL,        "missing declaration for symbol " LUA_QS)
  165. ERRDEF(FFI_BADCBACK,        "bad callback")
  166. #if LJ_OS_NOJIT
  167. ERRDEF(FFI_CBACKOV,        "no support for callbacks on this OS")
  168. #else
  169. ERRDEF(FFI_CBACKOV,        "too many callbacks")
  170. #endif
  171. ERRDEF(FFI_NYIPACKBIT,        "NYI: packed bit fields")
  172. ERRDEF(FFI_NYICALL,        "NYI: cannot call this C function (yet)")
  173. #endif

  174. #undef ERRDEF

  175. /* Detecting unused error messages:
  176.    awk -F, '/^ERRDEF/ { gsub(/ERRDEF./, ""); printf "grep -q LJ_ERR_%s *.[ch] || echo %s\n", $1, $1}' lj_errmsg.h | sh
  177. */