luaconf.h 4.2 KB

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