1/*
2** Configuration header.
3** Copyright (C) 2005-2021 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.1.0-beta3/"
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 "\n"
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/* Configuration for the frontend (the luajit executable). */
96#if defined(luajit_c)
97#define LUA_PROGNAME "luajit" /* Fallback frontend name. */
98#define LUA_PROMPT "> " /* Interactive prompt. */
99#define LUA_PROMPT2 ">> " /* Continuation prompt. */
100#define LUA_MAXINPUT 512 /* Max. input line length. */
101#endif
102
103/* Note: changing the following defines breaks the Lua 5.1 ABI. */
104#define LUA_INTEGER ptrdiff_t
105#define LUA_IDSIZE 60 /* Size of lua_Debug.short_src. */
106/*
107** Size of lauxlib and io.* on-stack buffers. Weird workaround to avoid using
108** unreasonable amounts of stack space, but still retain ABI compatibility.
109** Blame Lua for depending on BUFSIZ in the ABI, blame **** for wrecking it.
110*/
111#define LUAL_BUFFERSIZE (BUFSIZ > 16384 ? 8192 : BUFSIZ)
112
113/* The following defines are here only for compatibility with luaconf.h
114** from the standard Lua distribution. They must not be changed for LuaJIT.
115*/
116#define LUA_NUMBER_DOUBLE
117#define LUA_NUMBER double
118#define LUAI_UACNUMBER double
119#define LUA_NUMBER_SCAN "%lf"
120#define LUA_NUMBER_FMT "%.14g"
121#define lua_number2str(s, n) sprintf((s), LUA_NUMBER_FMT, (n))
122#define LUAI_MAXNUMBER2STR 32
123#define LUA_INTFRMLEN "l"
124#define LUA_INTFRM_T long
125
126/* Linkage of public API functions. */
127#if defined(LUA_BUILD_AS_DLL)
128#if defined(LUA_CORE) || defined(LUA_LIB)
129#define LUA_API __declspec(dllexport)
130#else
131#define LUA_API __declspec(dllimport)
132#endif
133#else
134#define LUA_API extern
135#endif
136
137#define LUALIB_API LUA_API
138
139/* Compatibility support for assertions. */
140#if defined(LUA_USE_ASSERT) || defined(LUA_USE_APICHECK)
141#include <assert.h>
142#endif
143#ifdef LUA_USE_ASSERT
144#define lua_assert(x) assert(x)
145#endif
146#ifdef LUA_USE_APICHECK
147#define luai_apicheck(L, o) { (void)L; assert(o); }
148#else
149#define luai_apicheck(L, o) { (void)L; }
150#endif
151
152#endif
153