RELEASE LuaJIT-2.0.1
[luajit-2.0.git] / src / luaconf.h
blob8e3a7aaa0cf530d16ebaedf1b822b2d42b488196
1 /*
2 ** Configuration header.
3 ** Copyright (C) 2005-2013 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
26 ** Note to distribution maintainers: do NOT patch the following line!
27 ** Please read ../doc/install.html#distro and pass PREFIX=/usr instead.
29 #define LUA_ROOT "/usr/local/"
30 #define LUA_LDIR LUA_ROOT "share/lua/5.1/"
31 #define LUA_CDIR LUA_ROOT "lib/lua/5.1/"
32 #ifdef LUA_XROOT
33 #define LUA_JDIR LUA_XROOT "share/luajit-2.0.1/"
34 #define LUA_XPATH \
35 ";" LUA_XROOT "share/lua/5.1/?.lua;" LUA_XROOT "share/lua/5.1/?/init.lua"
36 #define LUA_XCPATH LUA_XROOT "lib/lua/5.1/?.so;"
37 #else
38 #define LUA_JDIR LUA_ROOT "share/luajit-2.0.1/"
39 #define LUA_XPATH
40 #define LUA_XCPATH
41 #endif
42 #define LUA_PATH_DEFAULT \
43 "./?.lua;" LUA_JDIR"?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua" LUA_XPATH
44 #define LUA_CPATH_DEFAULT \
45 "./?.so;" LUA_CDIR"?.so;" LUA_XCPATH LUA_CDIR"loadall.so"
46 #endif
48 /* Environment variable names for path overrides and initialization code. */
49 #define LUA_PATH "LUA_PATH"
50 #define LUA_CPATH "LUA_CPATH"
51 #define LUA_INIT "LUA_INIT"
53 /* Special file system characters. */
54 #if defined(_WIN32)
55 #define LUA_DIRSEP "\\"
56 #else
57 #define LUA_DIRSEP "/"
58 #endif
59 #define LUA_PATHSEP ";"
60 #define LUA_PATH_MARK "?"
61 #define LUA_EXECDIR "!"
62 #define LUA_IGMARK "-"
63 #define LUA_PATH_CONFIG \
64 LUA_DIRSEP "\n" LUA_PATHSEP "\n" LUA_PATH_MARK "\n" \
65 LUA_EXECDIR "\n" LUA_IGMARK
67 /* Quoting in error messages. */
68 #define LUA_QL(x) "'" x "'"
69 #define LUA_QS LUA_QL("%s")
71 /* Various tunables. */
72 #define LUAI_MAXSTACK 65500 /* Max. # of stack slots for a thread (<64K). */
73 #define LUAI_MAXCSTACK 8000 /* Max. # of stack slots for a C func (<10K). */
74 #define LUAI_GCPAUSE 200 /* Pause GC until memory is at 200%. */
75 #define LUAI_GCMUL 200 /* Run GC at 200% of allocation speed. */
76 #define LUA_MAXCAPTURES 32 /* Max. pattern captures. */
78 /* Compatibility with older library function names. */
79 #define LUA_COMPAT_MOD /* OLD: math.mod, NEW: math.fmod */
80 #define LUA_COMPAT_GFIND /* OLD: string.gfind, NEW: string.gmatch */
82 /* Configuration for the frontend (the luajit executable). */
83 #if defined(luajit_c)
84 #define LUA_PROGNAME "luajit" /* Fallback frontend name. */
85 #define LUA_PROMPT "> " /* Interactive prompt. */
86 #define LUA_PROMPT2 ">> " /* Continuation prompt. */
87 #define LUA_MAXINPUT 512 /* Max. input line length. */
88 #endif
90 /* Note: changing the following defines breaks the Lua 5.1 ABI. */
91 #define LUA_INTEGER ptrdiff_t
92 #define LUA_IDSIZE 60 /* Size of lua_Debug.short_src. */
94 ** Size of lauxlib and io.* on-stack buffers. Weird workaround to avoid using
95 ** unreasonable amounts of stack space, but still retain ABI compatibility.
96 ** Blame Lua for depending on BUFSIZ in the ABI, blame **** for wrecking it.
98 #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.
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
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
124 #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
139 #endif