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