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