FFI: Don't touch frame in callbacks with tailcalls to fast functions.
[luajit-2.0.git] / src / luaconf.h
blob5b04ad438611f895bd8bb54a5fde1a24cf800598
1 /*
2 ** Configuration header.
3 ** Copyright (C) 2005-2011 Mike Pall. See Copyright Notice in luajit.h
4 */
6 #ifndef luaconf_h
7 #define luaconf_h
9 #include <limits.h>
10 #include <stddef.h>
12 /* Default path for loading Lua and C modules with require(). */
13 #if defined(_WIN32)
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.
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 #define LUA_ROOT "/usr/local/"
26 #define LUA_LDIR LUA_ROOT "share/lua/5.1/"
27 #define LUA_CDIR LUA_ROOT "lib/lua/5.1/"
28 #ifdef LUA_XROOT
29 #define LUA_JDIR LUA_XROOT "share/luajit-2.0.0-beta9/"
30 #define LUA_XPATH \
31 ";" LUA_XROOT "share/lua/5.1/?.lua;" LUA_XROOT "share/lua/5.1/?/init.lua"
32 #define LUA_XCPATH LUA_XROOT "lib/lua/5.1/?.so;"
33 #else
34 #define LUA_JDIR LUA_ROOT "share/luajit-2.0.0-beta9/"
35 #define LUA_XPATH
36 #define LUA_XCPATH
37 #endif
38 #define LUA_PATH_DEFAULT \
39 "./?.lua;" LUA_JDIR"?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua" LUA_XPATH
40 #define LUA_CPATH_DEFAULT \
41 "./?.so;" LUA_CDIR"?.so;" LUA_XCPATH LUA_CDIR"loadall.so"
42 #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"
49 /* Special file system characters. */
50 #if defined(_WIN32)
51 #define LUA_DIRSEP "\\"
52 #else
53 #define LUA_DIRSEP "/"
54 #endif
55 #define LUA_PATHSEP ";"
56 #define LUA_PATH_MARK "?"
57 #define LUA_EXECDIR "!"
58 #define LUA_IGMARK "-"
59 #define LUA_PATH_CONFIG \
60 LUA_DIRSEP "\n" LUA_PATHSEP "\n" LUA_PATH_MARK "\n" \
61 LUA_EXECDIR "\n" LUA_IGMARK
63 /* Quoting in error messages. */
64 #define LUA_QL(x) "'" x "'"
65 #define LUA_QS LUA_QL("%s")
67 /* Various tunables. */
68 #define LUAI_MAXSTACK 65500 /* Max. # of stack slots for a thread (<64K). */
69 #define LUAI_MAXCSTACK 8000 /* Max. # of stack slots for a C func (<10K). */
70 #define LUAI_GCPAUSE 200 /* Pause GC until memory is at 200%. */
71 #define LUAI_GCMUL 200 /* Run GC at 200% of allocation speed. */
72 #define LUA_MAXCAPTURES 32 /* Max. pattern captures. */
74 /* Compatibility with older library function names. */
75 #define LUA_COMPAT_MOD /* OLD: math.mod, NEW: math.fmod */
76 #define LUA_COMPAT_GFIND /* OLD: string.gfind, NEW: string.gmatch */
78 /* Configuration for the frontend (the luajit executable). */
79 #if defined(luajit_c)
80 #define LUA_PROGNAME "luajit" /* Fallback frontend name. */
81 #define LUA_PROMPT "> " /* Interactive prompt. */
82 #define LUA_PROMPT2 ">> " /* Continuation prompt. */
83 #define LUA_MAXINPUT 512 /* Max. input line length. */
84 #endif
86 /* Note: changing the following defines breaks the Lua 5.1 ABI. */
87 #define LUA_INTEGER ptrdiff_t
88 #define LUA_IDSIZE 60 /* Size of lua_Debug.short_src. */
89 #define LUAL_BUFFERSIZE BUFSIZ /* Size of lauxlib and io.* buffers. */
91 /* The following defines are here only for compatibility with luaconf.h
92 ** from the standard Lua distribution. They must not be changed for LuaJIT.
94 #define LUA_NUMBER_DOUBLE
95 #define LUA_NUMBER double
96 #define LUAI_UACNUMBER double
97 #define LUA_NUMBER_SCAN "%lf"
98 #define LUA_NUMBER_FMT "%.14g"
99 #define lua_number2str(s, n) sprintf((s), LUA_NUMBER_FMT, (n))
100 #define LUAI_MAXNUMBER2STR 32
101 #define lua_str2number(s, p) strtod((s), (p))
102 #define LUA_INTFRMLEN "l"
103 #define LUA_INTFRM_T long
105 /* Linkage of public API functions. */
106 #if defined(LUA_BUILD_AS_DLL)
107 #if defined(LUA_CORE) || defined(LUA_LIB)
108 #define LUA_API __declspec(dllexport)
109 #else
110 #define LUA_API __declspec(dllimport)
111 #endif
112 #else
113 #define LUA_API extern
114 #endif
116 #define LUALIB_API LUA_API
118 /* Support for internal assertions. */
119 #if defined(LUA_USE_ASSERT) || defined(LUA_USE_APICHECK)
120 #include <assert.h>
121 #endif
122 #ifdef LUA_USE_ASSERT
123 #define lua_assert(x) assert(x)
124 #endif
125 #ifdef LUA_USE_APICHECK
126 #define luai_apicheck(L, o) { (void)L; assert(o); }
127 #else
128 #define luai_apicheck(L, o) { (void)L; }
129 #endif
131 #endif