ljx

FORK: LuaJIT with native 5.2 and 5.3 support
git clone https://git.neptards.moe/neptards/ljx.git
Log | Files | Refs | README

luaconf.h (5739B)


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