src/luaconf.h - luajit-2.0-src

Macros defined

Source code

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

  5. #ifndef luaconf_h
  6. ‌#define luaconf_h

  7. #ifndef WINVER
  8. ‌#define WINVER 0x0501
  9. #endif
  10. #include <limits.h>
  11. #include <stddef.h>

  12. /* Default path for loading Lua and C modules with require(). */
  13. #if defined(_WIN32)
  14. /*
  15. ** In Windows, any exclamation mark ('!') in the path is replaced by the
  16. ** path of the directory of the executable file of the current process.
  17. */
  18. ‌#define LUA_LDIR        "!\\lua\\"
  19. ‌#define LUA_CDIR        "!\\"
  20. ‌#define LUA_PATH_DEFAULT \
  21.   ".\\?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;"
  22. ‌#define LUA_CPATH_DEFAULT \
  23.   ".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
  24. #else
  25. /*
  26. ** Note to distribution maintainers: do NOT patch the following lines!
  27. ** Please read ../doc/install.html#distro and pass PREFIX=/usr instead.
  28. */
  29. #ifndef LUA_MULTILIB
  30. ‌#define LUA_MULTILIB        "lib"
  31. #endif
  32. #ifndef LUA_LMULTILIB
  33. ‌#define LUA_LMULTILIB        "lib"
  34. #endif
  35. ‌#define LUA_LROOT        "/usr/local"
  36. ‌#define LUA_LUADIR        "/lua/5.1/"
  37. ‌#define LUA_LJDIR        "/luajit-2.1.0-alpha/"

  38. #ifdef LUA_ROOT
  39. ‌#define LUA_JROOT        LUA_ROOT
  40. ‌#define LUA_RLDIR        LUA_ROOT "/share" LUA_LUADIR
  41. ‌#define LUA_RCDIR        LUA_ROOT "/" LUA_MULTILIB LUA_LUADIR
  42. ‌#define LUA_RLPATH        ";" LUA_RLDIR "?.lua;" LUA_RLDIR "?/init.lua"
  43. ‌#define LUA_RCPATH        ";" LUA_RCDIR "?.so"
  44. #else
  45. ‌#define LUA_JROOT        LUA_LROOT
  46. ‌#define LUA_RLPATH
  47. ‌#define LUA_RCPATH
  48. #endif

  49. ‌#define LUA_JPATH        ";" LUA_JROOT "/share" LUA_LJDIR "?.lua"
  50. ‌#define LUA_LLDIR        LUA_LROOT "/share" LUA_LUADIR
  51. ‌#define LUA_LCDIR        LUA_LROOT "/" LUA_LMULTILIB LUA_LUADIR
  52. ‌#define LUA_LLPATH        ";" LUA_LLDIR "?.lua;" LUA_LLDIR "?/init.lua"
  53. ‌#define LUA_LCPATH1        ";" LUA_LCDIR "?.so"
  54. ‌#define LUA_LCPATH2        ";" LUA_LCDIR "loadall.so"

  55. ‌#define LUA_PATH_DEFAULT        "./?.lua" LUA_JPATH LUA_LLPATH LUA_RLPATH
  56. ‌#define LUA_CPATH_DEFAULT        "./?.so" LUA_LCPATH1 LUA_RCPATH LUA_LCPATH2
  57. #endif

  58. /* Environment variable names for path overrides and initialization code. */
  59. ‌#define LUA_PATH        "LUA_PATH"
  60. ‌#define LUA_CPATH        "LUA_CPATH"
  61. ‌#define LUA_INIT        "LUA_INIT"

  62. /* Special file system characters. */
  63. #if defined(_WIN32)
  64. ‌#define LUA_DIRSEP        "\\"
  65. #else
  66. ‌#define LUA_DIRSEP        "/"
  67. #endif
  68. ‌#define LUA_PATHSEP        ";"
  69. ‌#define LUA_PATH_MARK        "?"
  70. ‌#define LUA_EXECDIR        "!"
  71. ‌#define LUA_IGMARK        "-"
  72. ‌#define LUA_PATH_CONFIG \
  73.   LUA_DIRSEP "\n" LUA_PATHSEP "\n" LUA_PATH_MARK "\n" \
  74.   LUA_EXECDIR "\n" LUA_IGMARK

  75. /* Quoting in error messages. */
  76. ‌#define LUA_QL(x)        "'" x "'"
  77. ‌#define LUA_QS                LUA_QL("%s")

  78. /* Various tunables. */
  79. ‌#define LUAI_MAXSTACK        65500        /* Max. # of stack slots for a thread (<64K). */
  80. ‌#define LUAI_MAXCSTACK        8000        /* Max. # of stack slots for a C func (<10K). */
  81. ‌#define LUAI_GCPAUSE        200        /* Pause GC until memory is at 200%. */
  82. ‌#define LUAI_GCMUL        200        /* Run GC at 200% of allocation speed. */
  83. ‌#define LUA_MAXCAPTURES        32        /* Max. pattern captures. */

  84. /* Compatibility with older library function names. */
  85. ‌#define LUA_COMPAT_MOD                /* OLD: math.mod, NEW: math.fmod */
  86. ‌#define LUA_COMPAT_GFIND        /* OLD: string.gfind, NEW: string.gmatch */

  87. /* Configuration for the frontend (the luajit executable). */
  88. #if defined(luajit_c)
  89. ‌#define LUA_PROGNAME        "luajit"  /* Fallback frontend name. */
  90. ‌#define LUA_PROMPT        "> "        /* Interactive prompt. */
  91. ‌#define LUA_PROMPT2        ">> "        /* Continuation prompt. */
  92. ‌#define LUA_MAXINPUT        512        /* Max. input line length. */
  93. #endif

  94. /* Note: changing the following defines breaks the Lua 5.1 ABI. */
  95. ‌#define LUA_INTEGER        ptrdiff_t
  96. ‌#define LUA_IDSIZE        60        /* Size of lua_Debug.short_src. */
  97. /*
  98. ** Size of lauxlib and io.* on-stack buffers. Weird workaround to avoid using
  99. ** unreasonable amounts of stack space, but still retain ABI compatibility.
  100. ** Blame Lua for depending on BUFSIZ in the ABI, blame **** for wrecking it.
  101. */
  102. ‌#define LUAL_BUFFERSIZE        (BUFSIZ > 16384 ? 8192 : BUFSIZ)

  103. /* The following defines are here only for compatibility with luaconf.h
  104. ** from the standard Lua distribution. They must not be changed for LuaJIT.
  105. */
  106. ‌#define LUA_NUMBER_DOUBLE
  107. ‌#define LUA_NUMBER                double
  108. ‌#define LUAI_UACNUMBER                double
  109. ‌#define LUA_NUMBER_SCAN                "%lf"
  110. ‌#define LUA_NUMBER_FMT                "%.14g"
  111. ‌#define lua_number2str(s, n)        sprintf((s), LUA_NUMBER_FMT, (n))
  112. ‌#define LUAI_MAXNUMBER2STR        32
  113. ‌#define LUA_INTFRMLEN                "l"
  114. ‌#define LUA_INTFRM_T                long

  115. /* Linkage of public API functions. */
  116. #if defined(LUA_BUILD_AS_DLL)
  117. #if defined(LUA_CORE) || defined(LUA_LIB)
  118. ‌#define LUA_API                __declspec(dllexport)
  119. #else
  120. ‌#define LUA_API                __declspec(dllimport)
  121. #endif
  122. #else
  123. ‌#define LUA_API                extern
  124. #endif

  125. ‌#define LUALIB_API        LUA_API

  126. /* Support for internal assertions. */
  127. #if defined(LUA_USE_ASSERT) || defined(LUA_USE_APICHECK)
  128. #include <assert.h>
  129. #endif
  130. #ifdef LUA_USE_ASSERT
  131. ‌#define lua_assert(x)                assert(x)
  132. #endif
  133. #ifdef LUA_USE_APICHECK
  134. ‌#define luai_apicheck(L, o)        { (void)L; assert(o); }
  135. #else
  136. ‌#define luai_apicheck(L, o)        { (void)L; }
  137. #endif

  138. #endif