luaconf.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. /*
  2. ** Configuration header.
  3. ** Copyright (C) 2005-2023 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/"
  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 "\n"
  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. /* Configuration for the frontend (the luajit executable). */
  85. #if defined(luajit_c)
  86. #define LUA_PROGNAME "luajit" /* Fallback frontend name. */
  87. #define LUA_PROMPT "> " /* Interactive prompt. */
  88. #define LUA_PROMPT2 ">> " /* Continuation prompt. */
  89. #define LUA_MAXINPUT 512 /* Max. input line length. */
  90. #endif
  91. /* Note: changing the following defines breaks the Lua 5.1 ABI. */
  92. #define LUA_INTEGER ptrdiff_t
  93. #define LUA_IDSIZE 60 /* Size of lua_Debug.short_src. */
  94. /*
  95. ** Size of lauxlib and io.* on-stack buffers. Weird workaround to avoid using
  96. ** unreasonable amounts of stack space, but still retain ABI compatibility.
  97. ** Blame Lua for depending on BUFSIZ in the ABI, blame **** for wrecking it.
  98. */
  99. #define LUAL_BUFFERSIZE (BUFSIZ > 16384 ? 8192 : BUFSIZ)
  100. /* The following defines are here only for compatibility with luaconf.h
  101. ** from the standard Lua distribution. They must not be changed for LuaJIT.
  102. */
  103. #define LUA_NUMBER_DOUBLE
  104. #define LUA_NUMBER double
  105. #define LUAI_UACNUMBER double
  106. #define LUA_NUMBER_SCAN "%lf"
  107. #define LUA_NUMBER_FMT "%.14g"
  108. #define lua_number2str(s, n) sprintf((s), LUA_NUMBER_FMT, (n))
  109. #define LUAI_MAXNUMBER2STR 32
  110. #define LUA_INTFRMLEN "l"
  111. #define LUA_INTFRM_T long
  112. /* Linkage of public API functions. */
  113. #if defined(LUA_BUILD_AS_DLL)
  114. #if defined(LUA_CORE) || defined(LUA_LIB)
  115. #define LUA_API __declspec(dllexport)
  116. #else
  117. #define LUA_API __declspec(dllimport)
  118. #endif
  119. #else
  120. #define LUA_API extern
  121. #endif
  122. #define LUALIB_API LUA_API
  123. /* Compatibility support for assertions. */
  124. #if defined(LUA_USE_ASSERT) || defined(LUA_USE_APICHECK)
  125. #include <assert.h>
  126. #endif
  127. #ifdef LUA_USE_ASSERT
  128. #define lua_assert(x) assert(x)
  129. #endif
  130. #ifdef LUA_USE_APICHECK
  131. #define luai_apicheck(L, o) { (void)L; assert(o); }
  132. #else
  133. #define luai_apicheck(L, o) { (void)L; }
  134. #endif
  135. #endif