RELEASE LuaJIT-2.0.0-rc1
[luajit-2.0.git] / src / luaconf.h
blobde519186346915a696f84d5e35740f4c1b5d43b9
1 /*
2 ** Configuration header.
3 ** Copyright (C) 2005-2012 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.0/"
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.0/"
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. */
93 #define LUAL_BUFFERSIZE BUFSIZ /* Size of lauxlib and io.* buffers. */
95 /* The following defines are here only for compatibility with luaconf.h
96 ** from the standard Lua distribution. They must not be changed for LuaJIT.
98 #define LUA_NUMBER_DOUBLE
99 #define LUA_NUMBER double
100 #define LUAI_UACNUMBER double
101 #define LUA_NUMBER_SCAN "%lf"
102 #define LUA_NUMBER_FMT "%.14g"
103 #define lua_number2str(s, n) sprintf((s), LUA_NUMBER_FMT, (n))
104 #define LUAI_MAXNUMBER2STR 32
105 #define LUA_INTFRMLEN "l"
106 #define LUA_INTFRM_T long
108 /* Linkage of public API functions. */
109 #if defined(LUA_BUILD_AS_DLL)
110 #if defined(LUA_CORE) || defined(LUA_LIB)
111 #define LUA_API __declspec(dllexport)
112 #else
113 #define LUA_API __declspec(dllimport)
114 #endif
115 #else
116 #define LUA_API extern
117 #endif
119 #define LUALIB_API LUA_API
121 /* Support for internal assertions. */
122 #if defined(LUA_USE_ASSERT) || defined(LUA_USE_APICHECK)
123 #include <assert.h>
124 #endif
125 #ifdef LUA_USE_ASSERT
126 #define lua_assert(x) assert(x)
127 #endif
128 #ifdef LUA_USE_APICHECK
129 #define luai_apicheck(L, o) { (void)L; assert(o); }
130 #else
131 #define luai_apicheck(L, o) { (void)L; }
132 #endif
134 #endif