luaconf.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /*
  2. ** Configuration header.
  3. ** Copyright (C) 2005-2025 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 <stddef.h>
  11. /* Default path for loading Lua and C modules with require(). */
  12. #if defined(_WIN32)
  13. /*
  14. ** In Windows, any exclamation mark ('!') in the path is replaced by the
  15. ** path of the directory of the executable file of the current process.
  16. */
  17. #define LUA_LDIR "!\\lua\\"
  18. #define LUA_CDIR "!\\"
  19. #define LUA_PATH_DEFAULT \
  20. ".\\?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;"
  21. #define LUA_CPATH_DEFAULT \
  22. ".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
  23. #else
  24. /*
  25. ** Note to distribution maintainers: do NOT patch the following lines!
  26. ** Please read ../doc/install.html#distro and pass PREFIX=/usr instead.
  27. */
  28. #ifndef LUA_MULTILIB
  29. #define LUA_MULTILIB "lib"
  30. #endif
  31. #ifndef LUA_LMULTILIB
  32. #define LUA_LMULTILIB "lib"
  33. #endif
  34. #define LUA_LROOT "/usr/local"
  35. #define LUA_LUADIR "/lua/5.1/"
  36. #ifdef LUA_ROOT
  37. #define LUA_JROOT LUA_ROOT
  38. #define LUA_RLDIR LUA_ROOT "/share" LUA_LUADIR
  39. #define LUA_RCDIR LUA_ROOT "/" LUA_MULTILIB LUA_LUADIR
  40. #define LUA_RLPATH ";" LUA_RLDIR "?.lua;" LUA_RLDIR "?/init.lua"
  41. #define LUA_RCPATH ";" LUA_RCDIR "?.so"
  42. #else
  43. #define LUA_JROOT LUA_LROOT
  44. #define LUA_RLPATH
  45. #define LUA_RCPATH
  46. #endif
  47. #ifndef LUA_LJDIR
  48. #define LUA_LJDIR LUA_JROOT "/share/luajit-2.1"
  49. #endif
  50. #define LUA_JPATH ";" LUA_LJDIR "/?.lua"
  51. #define LUA_LLDIR LUA_LROOT "/share" LUA_LUADIR
  52. #define LUA_LCDIR LUA_LROOT "/" LUA_LMULTILIB LUA_LUADIR
  53. #define LUA_LLPATH ";" LUA_LLDIR "?.lua;" LUA_LLDIR "?/init.lua"
  54. #define LUA_LCPATH1 ";" LUA_LCDIR "?.so"
  55. #define LUA_LCPATH2 ";" LUA_LCDIR "loadall.so"
  56. #define LUA_PATH_DEFAULT "./?.lua" LUA_JPATH LUA_LLPATH LUA_RLPATH
  57. #define LUA_CPATH_DEFAULT "./?.so" LUA_LCPATH1 LUA_RCPATH LUA_LCPATH2
  58. #endif
  59. /* Environment variable names for path overrides and initialization code. */
  60. #define LUA_PATH "LUA_PATH"
  61. #define LUA_CPATH "LUA_CPATH"
  62. #define LUA_INIT "LUA_INIT"
  63. /* Special file system characters. */
  64. #if defined(_WIN32)
  65. #define LUA_DIRSEP "\\"
  66. #else
  67. #define LUA_DIRSEP "/"
  68. #endif
  69. #define LUA_PATHSEP ";"
  70. #define LUA_PATH_MARK "?"
  71. #define LUA_EXECDIR "!"
  72. #define LUA_IGMARK "-"
  73. #define LUA_PATH_CONFIG \
  74. LUA_DIRSEP "\n" LUA_PATHSEP "\n" LUA_PATH_MARK "\n" \
  75. LUA_EXECDIR "\n" LUA_IGMARK "\n"
  76. /* Quoting in error messages. */
  77. #define LUA_QL(x) "'" x "'"
  78. #define LUA_QS LUA_QL("%s")
  79. /* Various tunables. */
  80. #define LUAI_MAXSTACK 65500 /* Max. # of stack slots for a thread (<64K). */
  81. #define LUAI_MAXCSTACK 8000 /* Max. # of stack slots for a C func (<10K). */
  82. #define LUAI_GCPAUSE 200 /* Pause GC until memory is at 200%. */
  83. #define LUAI_GCMUL 200 /* Run GC at 200% of allocation speed. */
  84. #define LUA_MAXCAPTURES 32 /* Max. pattern captures. */
  85. /* Configuration for the frontend (the luajit executable). */
  86. #if defined(luajit_c)
  87. #define LUA_PROGNAME "luajit" /* Fallback frontend name. */
  88. #define LUA_PROMPT "> " /* Interactive prompt. */
  89. #define LUA_PROMPT2 ">> " /* Continuation prompt. */
  90. #define LUA_MAXINPUT 512 /* Max. input line length. */
  91. #endif
  92. /* Note: changing the following defines breaks the Lua 5.1 ABI. */
  93. #define LUA_INTEGER ptrdiff_t
  94. #define LUA_IDSIZE 60 /* Size of lua_Debug.short_src. */
  95. /*
  96. ** Size of lauxlib and io.* on-stack buffers. Weird workaround to avoid using
  97. ** unreasonable amounts of stack space, but still retain ABI compatibility.
  98. ** Blame Lua for depending on BUFSIZ in the ABI, blame **** for wrecking it.
  99. */
  100. #define LUAL_BUFFERSIZE (BUFSIZ > 16384 ? 8192 : BUFSIZ)
  101. /* The following defines are here only for compatibility with luaconf.h
  102. ** from the standard Lua distribution. They must not be changed for LuaJIT.
  103. */
  104. #define LUA_NUMBER_DOUBLE
  105. #define LUA_NUMBER double
  106. #define LUAI_UACNUMBER double
  107. #define LUA_NUMBER_SCAN "%lf"
  108. #define LUA_NUMBER_FMT "%.14g"
  109. #define lua_number2str(s, n) sprintf((s), LUA_NUMBER_FMT, (n))
  110. #define LUAI_MAXNUMBER2STR 32
  111. #define LUA_INTFRMLEN "l"
  112. #define LUA_INTFRM_T long
  113. /* Linkage of public API functions. */
  114. #if defined(LUA_BUILD_AS_DLL)
  115. #if defined(LUA_CORE) || defined(LUA_LIB)
  116. #define LUA_API __declspec(dllexport)
  117. #else
  118. #define LUA_API __declspec(dllimport)
  119. #endif
  120. #else
  121. #define LUA_API extern
  122. #endif
  123. #define LUALIB_API LUA_API
  124. /* Compatibility support for assertions. */
  125. #if defined(LUA_USE_ASSERT) || defined(LUA_USE_APICHECK)
  126. #include <assert.h>
  127. #endif
  128. #ifdef LUA_USE_ASSERT
  129. #define lua_assert(x) assert(x)
  130. #endif
  131. #ifdef LUA_USE_APICHECK
  132. #define luai_apicheck(L, o) { (void)L; assert(o); }
  133. #else
  134. #define luai_apicheck(L, o) { (void)L; }
  135. #endif
  136. #endif