luaconf.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751
  1. /*
  2. ** $Id: luaconf.h,v 1.92 2007/09/14 13:26:03 roberto Exp roberto $
  3. ** Configuration file for Lua
  4. ** See Copyright Notice in lua.h
  5. */
  6. #ifndef lconfig_h
  7. #define lconfig_h
  8. #include <limits.h>
  9. #include <stddef.h>
  10. /*
  11. ** ==================================================================
  12. ** Search for "@@" to find all configurable definitions.
  13. ** ===================================================================
  14. */
  15. /*
  16. @@ LUA_ANSI controls the use of non-ansi features.
  17. ** CHANGE it (define it) if you want Lua to avoid the use of any
  18. ** non-ansi feature or library.
  19. */
  20. #if !defined(LUA_ANSI) && defined(__STRICT_ANSI__)
  21. #define LUA_ANSI
  22. #endif
  23. #if !defined(LUA_ANSI) && defined(_WIN32)
  24. #define LUA_WIN
  25. #endif
  26. #if defined(LUA_WIN)
  27. #include <windows.h>
  28. #endif
  29. #if defined(LUA_USE_LINUX)
  30. #define LUA_USE_POSIX
  31. #define LUA_USE_DLOPEN /* needs an extra library: -ldl */
  32. #define LUA_USE_READLINE /* needs some extra libraries */
  33. #endif
  34. #if defined(LUA_USE_MACOSX)
  35. #define LUA_USE_POSIX
  36. #define LUA_DL_DYLD /* does not need extra library */
  37. #endif
  38. /*
  39. @@ LUA_USE_POSIX includes all functionallity listed as X/Open System
  40. @* Interfaces Extension (XSI).
  41. ** CHANGE it (define it) if your system is XSI compatible.
  42. */
  43. #if defined(LUA_USE_POSIX)
  44. #define LUA_USE_MKSTEMP
  45. #define LUA_USE_ISATTY
  46. #define LUA_USE_POPEN
  47. #define LUA_USE_ULONGJMP
  48. #endif
  49. /*
  50. @@ LUA_PATH and LUA_CPATH are the names of the environment variables that
  51. @* Lua check to set its paths.
  52. @@ LUA_INIT is the name of the environment variable that Lua
  53. @* checks for initialization code.
  54. ** CHANGE them if you want different names.
  55. */
  56. #define LUA_PATH "LUA_PATH"
  57. #define LUA_CPATH "LUA_CPATH"
  58. #define LUA_INIT "LUA_INIT"
  59. /*
  60. @@ LUA_PATH_DEFAULT is the default path that Lua uses to look for
  61. @* Lua libraries.
  62. @@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for
  63. @* C libraries.
  64. ** CHANGE them if your machine has a non-conventional directory
  65. ** hierarchy or if you want to install your libraries in
  66. ** non-conventional directories.
  67. */
  68. #if defined(_WIN32)
  69. /*
  70. ** In Windows, any exclamation mark ('!') in the path is replaced by the
  71. ** path of the directory of the executable file of the current process.
  72. */
  73. #define LUA_LDIR "!\\lua\\"
  74. #define LUA_CDIR "!\\"
  75. #define LUA_PATH_DEFAULT \
  76. ".\\?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \
  77. LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua"
  78. #define LUA_CPATH_DEFAULT \
  79. ".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
  80. #else
  81. #define LUA_ROOT "/usr/local/"
  82. #define LUA_LDIR LUA_ROOT "share/lua/5.1/"
  83. #define LUA_CDIR LUA_ROOT "lib/lua/5.1/"
  84. #define LUA_PATH_DEFAULT \
  85. "./?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \
  86. LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua"
  87. #define LUA_CPATH_DEFAULT \
  88. "./?.so;" LUA_CDIR"?.so;" LUA_CDIR"loadall.so"
  89. #endif
  90. /*
  91. @@ LUA_DIRSEP is the directory separator (for submodules).
  92. ** CHANGE it if your machine does not use "/" as the directory separator
  93. ** and is not Windows. (On Windows Lua automatically uses "\".)
  94. */
  95. #if defined(_WIN32)
  96. #define LUA_DIRSEP "\\"
  97. #else
  98. #define LUA_DIRSEP "/"
  99. #endif
  100. /*
  101. @@ LUA_PATHSEP is the character that separates templates in a path.
  102. @@ LUA_PATH_MARK is the string that marks the substitution points in a
  103. @* template.
  104. @@ LUA_EXECDIR in a Windows path is replaced by the executable's
  105. @* directory.
  106. @@ LUA_IGMARK is a mark to ignore all before it when bulding the
  107. @* luaopen_ function name.
  108. ** CHANGE them if for some reason your system cannot use those
  109. ** characters. (E.g., if one of those characters is a common character
  110. ** in file/directory names.) Probably you do not need to change them.
  111. */
  112. #define LUA_PATHSEP ";"
  113. #define LUA_PATH_MARK "?"
  114. #define LUA_EXECDIR "!"
  115. #define LUA_IGMARK "-"
  116. /*
  117. @@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger.
  118. ** CHANGE that if ptrdiff_t is not adequate on your machine. (On most
  119. ** machines, ptrdiff_t gives a good choice between int or long.)
  120. */
  121. #define LUA_INTEGER ptrdiff_t
  122. /*
  123. @@ LUA_API is a mark for all core API functions.
  124. @@ LUALIB_API is a mark for all standard library functions.
  125. ** CHANGE them if you need to define those functions in some special way.
  126. ** For instance, if you want to create one Windows DLL with the core and
  127. ** the libraries, you may want to use the following definition (define
  128. ** LUA_BUILD_AS_DLL to get it).
  129. */
  130. #if defined(LUA_BUILD_AS_DLL)
  131. #if defined(LUA_CORE) || defined(LUA_LIB)
  132. #define LUA_API __declspec(dllexport)
  133. #else
  134. #define LUA_API __declspec(dllimport)
  135. #endif
  136. #else
  137. #define LUA_API extern
  138. #endif
  139. /* more often than not the libs go together with the core */
  140. #define LUALIB_API LUA_API
  141. /*
  142. @@ LUAI_FUNC is a mark for all extern functions that are not to be
  143. @* exported to outside modules.
  144. @@ LUAI_DATA is a mark for all extern (const) variables that are not to
  145. @* be exported to outside modules.
  146. ** CHANGE them if you need to mark them in some special way. Elf/gcc
  147. ** (versions 3.2 and later) mark them as "hidden" to optimize access
  148. ** when Lua is compiled as a shared library.
  149. */
  150. #if defined(luaall_c)
  151. #define LUAI_FUNC static
  152. #define LUAI_DATA /* empty */
  153. #elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
  154. defined(__ELF__)
  155. #define LUAI_FUNC __attribute__((visibility("hidden"))) extern
  156. #define LUAI_DATA LUAI_FUNC
  157. #else
  158. #define LUAI_FUNC extern
  159. #define LUAI_DATA extern
  160. #endif
  161. /*
  162. @@ LUA_QL describes how error messages quote program elements.
  163. ** CHANGE it if you want a different appearance.
  164. */
  165. #define LUA_QL(x) "'" x "'"
  166. #define LUA_QS LUA_QL("%s")
  167. /*
  168. @@ LUA_IDSIZE gives the maximum size for the description of the source
  169. @* of a function in debug information.
  170. ** CHANGE it if you want a different size.
  171. */
  172. #define LUA_IDSIZE 60
  173. /*
  174. ** {==================================================================
  175. ** Stand-alone configuration
  176. ** ===================================================================
  177. */
  178. #if defined(lua_c) || defined(luaall_c)
  179. /*
  180. @@ lua_stdin_is_tty detects whether the standard input is a 'tty' (that
  181. @* is, whether we're running lua interactively).
  182. ** CHANGE it if you have a better definition for non-POSIX/non-Windows
  183. ** systems.
  184. */
  185. #if defined(LUA_USE_ISATTY)
  186. #include <unistd.h>
  187. #define lua_stdin_is_tty() isatty(0)
  188. #elif defined(LUA_WIN)
  189. #include <io.h>
  190. #include <stdio.h>
  191. #define lua_stdin_is_tty() _isatty(_fileno(stdin))
  192. #else
  193. #define lua_stdin_is_tty() 1 /* assume stdin is a tty */
  194. #endif
  195. /*
  196. @@ LUA_PROMPT is the default prompt used by stand-alone Lua.
  197. @@ LUA_PROMPT2 is the default continuation prompt used by stand-alone Lua.
  198. ** CHANGE them if you want different prompts. (You can also change the
  199. ** prompts dynamically, assigning to globals _PROMPT/_PROMPT2.)
  200. */
  201. #define LUA_PROMPT "> "
  202. #define LUA_PROMPT2 ">> "
  203. /*
  204. @@ LUA_PROGNAME is the default name for the stand-alone Lua program.
  205. ** CHANGE it if your stand-alone interpreter has a different name and
  206. ** your system is not able to detect that name automatically.
  207. */
  208. #define LUA_PROGNAME "lua"
  209. /*
  210. @@ LUA_MAXINPUT is the maximum length for an input line in the
  211. @* stand-alone interpreter.
  212. ** CHANGE it if you need longer lines.
  213. */
  214. #define LUA_MAXINPUT 512
  215. /*
  216. @@ lua_readline defines how to show a prompt and then read a line from
  217. @* the standard input.
  218. @@ lua_saveline defines how to "save" a read line in a "history".
  219. @@ lua_freeline defines how to free a line read by lua_readline.
  220. ** CHANGE them if you want to improve/adapt this functionality.
  221. */
  222. #if defined(LUA_USE_READLINE)
  223. #include <stdio.h>
  224. #include <readline/readline.h>
  225. #include <readline/history.h>
  226. #define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL)
  227. #define lua_saveline(L,idx) \
  228. if (lua_objlen(L,idx) > 0) /* non-empty line? */ \
  229. add_history(lua_tostring(L, idx)); /* add it to history */
  230. #define lua_freeline(L,b) ((void)L, free(b))
  231. #else
  232. #define lua_readline(L,b,p) \
  233. ((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \
  234. fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */
  235. #define lua_saveline(L,idx) { (void)L; (void)idx; }
  236. #define lua_freeline(L,b) { (void)L; (void)b; }
  237. #endif
  238. #endif
  239. /* }================================================================== */
  240. /*
  241. @@ LUAI_GCPAUSE defines the default pause between garbage-collector cycles
  242. @* as a percentage.
  243. ** CHANGE it if you want the GC to run faster or slower (higher values
  244. ** mean larger pauses which mean slower collection.) You can also change
  245. ** this value dynamically.
  246. */
  247. #define LUAI_GCPAUSE 200 /* 200% (wait memory to double before next GC) */
  248. /*
  249. @@ LUAI_GCMUL defines the default speed of garbage collection relative to
  250. @* memory allocation as a percentage.
  251. ** CHANGE it if you want to change the granularity of the garbage
  252. ** collection. (Higher values mean coarser collections. 0 represents
  253. ** infinity, where each step performs a full collection.) You can also
  254. ** change this value dynamically.
  255. */
  256. #define LUAI_GCMUL 200 /* GC runs 'twice the speed' of memory allocation */
  257. /*
  258. @@ LUA_COMPAT_VARARG controls compatibility with old vararg feature.
  259. ** CHANGE it to undefined as soon as your programs use only '...' to
  260. ** access vararg parameters (instead of the old 'arg' table).
  261. */
  262. #define LUA_COMPAT_VARARG
  263. /*
  264. @@ LUA_COMPAT_GFIND controls compatibility with old 'string.gfind' name.
  265. ** CHANGE it to undefined as soon as you rename 'string.gfind' to
  266. ** 'string.gmatch'.
  267. */
  268. #define LUA_COMPAT_GFIND
  269. /*
  270. @@ LUA_COMPAT_DEBUGLIB controls compatibility with preloading
  271. @* the debug library.
  272. ** CHANGE it to undefined as soon as you add 'require"debug"' everywhere
  273. ** you need the debug library.
  274. */
  275. #define LUA_COMPAT_DEBUGLIB
  276. /*
  277. @@ luai_apicheck is the assert macro used by the Lua-C API.
  278. ** CHANGE luai_apicheck if you want Lua to perform some checks in the
  279. ** parameters it gets from API calls. This may slow down the interpreter
  280. ** a bit, but may be quite useful when debugging C code that interfaces
  281. ** with Lua. A useful redefinition is to use assert.h.
  282. */
  283. #if defined(LUA_USE_APICHECK)
  284. #include <assert.h>
  285. #define luai_apicheck(L,o) { (void)L; assert(o); }
  286. #else
  287. #define luai_apicheck(L,o) { (void)L; }
  288. #endif
  289. /*
  290. @@ LUAI_BITSINT defines the number of bits in an int.
  291. ** CHANGE here if Lua cannot automatically detect the number of bits of
  292. ** your machine. Probably you do not need to change this.
  293. */
  294. /* avoid overflows in comparison */
  295. #if INT_MAX-20 < 32760
  296. #define LUAI_BITSINT 16
  297. #elif INT_MAX > 2147483640L
  298. /* int has at least 32 bits */
  299. #define LUAI_BITSINT 32
  300. #else
  301. #error "you must define LUA_BITSINT with number of bits in an integer"
  302. #endif
  303. /*
  304. @@ LUAI_UINT32 is an unsigned integer with at least 32 bits.
  305. @@ LUAI_INT32 is an signed integer with at least 32 bits.
  306. @@ LUAI_UMEM is an unsigned integer big enough to count the total
  307. @* memory used by Lua.
  308. @@ LUAI_MEM is a signed integer big enough to count the total memory
  309. @* used by Lua.
  310. ** CHANGE here if for some weird reason the default definitions are not
  311. ** good enough for your machine. (The definitions in the 'else'
  312. ** part always works, but may waste space on machines with 64-bit
  313. ** longs.) Probably you do not need to change this.
  314. */
  315. #if LUAI_BITSINT >= 32
  316. #define LUAI_UINT32 unsigned int
  317. #define LUAI_INT32 int
  318. #define LUAI_MAXINT32 INT_MAX
  319. #define LUAI_UMEM size_t
  320. #define LUAI_MEM ptrdiff_t
  321. #else
  322. /* 16-bit ints */
  323. #define LUAI_UINT32 unsigned long
  324. #define LUAI_INT32 long
  325. #define LUAI_MAXINT32 LONG_MAX
  326. #define LUAI_UMEM unsigned long
  327. #define LUAI_MEM long
  328. #endif
  329. /*
  330. @@ LUAI_MAXCALLS limits the number of nested calls.
  331. ** CHANGE it if you need really deep recursive calls. This limit is
  332. ** arbitrary; its only purpose is to stop infinite recursion before
  333. ** exhausting memory.
  334. */
  335. #define LUAI_MAXCALLS 20000
  336. /*
  337. @@ LUAI_MAXCSTACK limits the number of Lua stack slots that a C function
  338. @* can use.
  339. ** CHANGE it if you need lots of (Lua) stack space for your C
  340. ** functions. This limit is arbitrary; its only purpose is to stop C
  341. ** functions to consume unlimited stack space.
  342. */
  343. #define LUAI_MAXCSTACK 2048
  344. /*
  345. ** {==================================================================
  346. ** CHANGE (to smaller values) the following definitions if your system
  347. ** has a small C stack. (Or you may want to change them to larger
  348. ** values if your system has a large C stack and these limits are
  349. ** too rigid for you.) Some of these constants control the size of
  350. ** stack-allocated arrays used by the compiler or the interpreter, while
  351. ** others limit the maximum number of recursive calls that the compiler
  352. ** or the interpreter can perform. Values too large may cause a C stack
  353. ** overflow for some forms of deep constructs.
  354. ** ===================================================================
  355. */
  356. /*
  357. @@ LUAI_MAXCCALLS is the maximum depth for nested C calls (short) and
  358. @* syntactical nested non-terminals in a program.
  359. */
  360. #define LUAI_MAXCCALLS 200
  361. /*
  362. @@ LUAI_MAXVARS is the maximum number of local variables per function
  363. @* (must be smaller than 250).
  364. */
  365. #define LUAI_MAXVARS 200
  366. /*
  367. @@ LUAI_MAXUPVALUES is the maximum number of upvalues per function
  368. @* (must be smaller than 250).
  369. */
  370. #define LUAI_MAXUPVALUES 60
  371. /*
  372. @@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.
  373. */
  374. #define LUAL_BUFFERSIZE BUFSIZ
  375. /* }================================================================== */
  376. /*
  377. ** {==================================================================
  378. @@ LUA_NUMBER is the type of numbers in Lua.
  379. ** CHANGE the following definitions only if you want to build Lua
  380. ** with a number type different from double. You may also need to
  381. ** change lua_number2int & lua_number2integer.
  382. ** ===================================================================
  383. */
  384. #define LUA_NUMBER_DOUBLE
  385. #define LUA_NUMBER double
  386. /*
  387. @@ LUAI_UACNUMBER is the result of an 'usual argument conversion'
  388. @* over a number.
  389. */
  390. #define LUAI_UACNUMBER double
  391. /*
  392. @@ LUA_NUMBER_SCAN is the format for reading numbers.
  393. @@ LUA_NUMBER_FMT is the format for writing numbers.
  394. @@ lua_number2str converts a number to a string.
  395. @@ LUAI_MAXNUMBER2STR is maximum size of previous conversion.
  396. @@ lua_str2number converts a string to a number.
  397. */
  398. #define LUA_NUMBER_SCAN "%lf"
  399. #define LUA_NUMBER_FMT "%.14g"
  400. #define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n))
  401. #define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */
  402. #define lua_str2number(s,p) strtod((s), (p))
  403. /*
  404. @@ The luai_num* macros define the primitive operations over numbers.
  405. */
  406. #if defined(LUA_CORE)
  407. #include <math.h>
  408. #define luai_numadd(L,a,b) ((a)+(b))
  409. #define luai_numsub(L,a,b) ((a)-(b))
  410. #define luai_nummul(L,a,b) ((a)*(b))
  411. #define luai_numdiv(L,a,b) ((a)/(b))
  412. #define luai_nummod(L,a,b) ((a) - floor((a)/(b))*(b))
  413. #define luai_numpow(L,a,b) (pow(a,b))
  414. #define luai_numunm(L,a) (-(a))
  415. #define luai_numeq(a,b) ((a)==(b))
  416. #define luai_numlt(L,a,b) ((a)<(b))
  417. #define luai_numle(L,a,b) ((a)<=(b))
  418. #define luai_numisnan(L,a) (!luai_numeq((a), (a)))
  419. #endif
  420. /*
  421. @@ lua_number2int is a macro to convert lua_Number to int.
  422. @@ lua_number2integer is a macro to convert lua_Number to lua_Integer.
  423. ** CHANGE them if you know a faster way to convert a lua_Number to
  424. ** int (with any rounding method and without throwing errors) in your
  425. ** system. In Pentium machines, a naive typecast from double to int
  426. ** in C is extremely slow, so any alternative is worth trying.
  427. */
  428. /* On a Pentium, resort to a trick */
  429. #if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) && !defined(__SSE2__) && \
  430. (defined(__i386) || defined (_M_IX86) || defined(__i386__))
  431. /* On a Microsoft compiler, use assembler */
  432. #if defined(_MSC_VER)
  433. #define lua_number2int(i,d) __asm fld d __asm fistp i
  434. #define lua_number2integer(i,n) lua_number2int(i, n)
  435. /* the next trick should work on any Pentium, but sometimes clashes
  436. with a DirectX idiosyncrasy */
  437. #else
  438. union luai_Cast { double l_d; long l_l; };
  439. #define lua_number2int(i,d) \
  440. { volatile union luai_Cast u; u.l_d = (d) + 6755399441055744.0; (i) = u.l_l; }
  441. #define lua_number2integer(i,n) lua_number2int(i, n)
  442. #endif
  443. /* this option always works, but may be slow */
  444. #else
  445. #define lua_number2int(i,d) ((i)=(int)(d))
  446. #define lua_number2integer(i,d) ((i)=(lua_Integer)(d))
  447. #endif
  448. /* }================================================================== */
  449. /*
  450. @@ LUAI_USER_ALIGNMENT_T is a type that requires maximum alignment.
  451. ** CHANGE it if your system requires alignments larger than double. (For
  452. ** instance, if your system supports long doubles and they must be
  453. ** aligned in 16-byte boundaries, then you should add long double in the
  454. ** union.) Probably you do not need to change this.
  455. */
  456. #define LUAI_USER_ALIGNMENT_T union { double u; void *s; long l; }
  457. /*
  458. @@ LUAI_THROW/LUAI_TRY define how Lua does exception handling.
  459. ** CHANGE them if you prefer to use longjmp/setjmp even with C++
  460. ** or if want/don't to use _longjmp/_setjmp instead of regular
  461. ** longjmp/setjmp. By default, Lua handles errors with exceptions when
  462. ** compiling as C++ code, with _longjmp/_setjmp when asked to use them,
  463. ** and with longjmp/setjmp otherwise.
  464. */
  465. #if defined(__cplusplus)
  466. /* C++ exceptions */
  467. #define LUAI_THROW(L,c) throw(c)
  468. #define LUAI_TRY(L,c,a) try { a } catch(...) \
  469. { if ((c)->status == 0) (c)->status = -1; }
  470. #define luai_jmpbuf int /* dummy variable */
  471. #elif defined(LUA_USE_ULONGJMP)
  472. /* in Unix, try _longjmp/_setjmp (more efficient) */
  473. #define LUAI_THROW(L,c) _longjmp((c)->b, 1)
  474. #define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a }
  475. #define luai_jmpbuf jmp_buf
  476. #else
  477. /* default handling with long jumps */
  478. #define LUAI_THROW(L,c) longjmp((c)->b, 1)
  479. #define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a }
  480. #define luai_jmpbuf jmp_buf
  481. #endif
  482. /*
  483. @@ LUA_MAXCAPTURES is the maximum number of captures that a pattern
  484. @* can do during pattern-matching.
  485. ** CHANGE it if you need more captures. This limit is arbitrary.
  486. */
  487. #define LUA_MAXCAPTURES 32
  488. /*
  489. @@ lua_tmpnam is the function that the OS library uses to create a
  490. @* temporary name.
  491. @@ LUA_TMPNAMBUFSIZE is the maximum size of a name created by lua_tmpnam.
  492. ** CHANGE them if you have an alternative to tmpnam (which is considered
  493. ** insecure) or if you want the original tmpnam anyway. By default, Lua
  494. ** uses tmpnam except when POSIX is available, where it uses mkstemp.
  495. */
  496. #if defined(loslib_c) || defined(luaall_c)
  497. #if defined(LUA_USE_MKSTEMP)
  498. #include <unistd.h>
  499. #define LUA_TMPNAMBUFSIZE 32
  500. #define lua_tmpnam(b,e) { \
  501. strcpy(b, "/tmp/lua_XXXXXX"); \
  502. e = mkstemp(b); \
  503. if (e != -1) close(e); \
  504. e = (e == -1); }
  505. #else
  506. #define LUA_TMPNAMBUFSIZE L_tmpnam
  507. #define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); }
  508. #endif
  509. #endif
  510. /*
  511. @@ LUA_STRFTIMEOPTIONS is the list of valid conversion specifier
  512. @* characters for the 'strftime' function;
  513. @@ LUA_STRFTIMEPREFIX is the list of valid modifiers for
  514. @* that function.
  515. ** CHANGE them if you want to use non-ansi options specific to your system.
  516. */
  517. #define LUA_STRFTIMEOPTIONS "aAbBcdHIjmMpSUwWxXyYz%"
  518. #define LUA_STRFTIMEPREFIX ""
  519. /*
  520. @@ lua_popen spawns a new process connected to the current one through
  521. @* the file streams.
  522. ** CHANGE it if you have a way to implement it in your system.
  523. */
  524. #if defined(LUA_USE_POPEN)
  525. #define lua_popen(L,c,m) ((void)L, fflush(NULL), popen(c,m))
  526. #define lua_pclose(L,file) ((void)L, (pclose(file) != -1))
  527. #elif defined(LUA_WIN)
  528. #define lua_popen(L,c,m) ((void)L, _popen(c,m))
  529. #define lua_pclose(L,file) ((void)L, (_pclose(file) != -1))
  530. #else
  531. #define lua_popen(L,c,m) ((void)((void)c, m), \
  532. luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0)
  533. #define lua_pclose(L,file) ((void)((void)L, file), 0)
  534. #endif
  535. /*
  536. @@ LUA_DL_* define which dynamic-library system Lua should use.
  537. ** CHANGE here if Lua has problems choosing the appropriate
  538. ** dynamic-library system for your platform (either Windows' DLL, Mac's
  539. ** dyld, or Unix's dlopen). If your system is some kind of Unix, there
  540. ** is a good chance that it has dlopen, so LUA_DL_DLOPEN will work for
  541. ** it. To use dlopen you also need to adapt the src/Makefile (probably
  542. ** adding -ldl to the linker options), so Lua does not select it
  543. ** automatically. (When you change the makefile to add -ldl, you must
  544. ** also add -DLUA_USE_DLOPEN.)
  545. ** If you do not want any kind of dynamic library, undefine all these
  546. ** options.
  547. ** By default, _WIN32 gets LUA_DL_DLL and MAC OS X gets LUA_DL_DYLD.
  548. */
  549. #if defined(LUA_USE_DLOPEN)
  550. #define LUA_DL_DLOPEN
  551. #endif
  552. #if defined(LUA_WIN)
  553. #define LUA_DL_DLL
  554. #endif
  555. /*
  556. @@ LUAI_EXTRASPACE allows you to add user-specific data in a lua_State
  557. @* (the data goes just *before* the lua_State pointer).
  558. ** CHANGE (define) this if you really need that. This value must be
  559. ** a multiple of the maximum alignment required for your machine.
  560. */
  561. #define LUAI_EXTRASPACE 0
  562. /*
  563. @@ luai_userstate* allow user-specific actions on threads.
  564. ** CHANGE them if you defined LUAI_EXTRASPACE and need to do something
  565. ** extra when a thread is created/deleted/resumed/yielded.
  566. */
  567. #define luai_userstateopen(L) ((void)L)
  568. #define luai_userstateclose(L) ((void)L)
  569. #define luai_userstatethread(L,L1) ((void)L)
  570. #define luai_userstatefree(L) ((void)L)
  571. #define luai_userstateresume(L,n) ((void)L)
  572. #define luai_userstateyield(L,n) ((void)L)
  573. /*
  574. @@ LUA_INTFRMLEN is the length modifier for integer conversions
  575. @* in 'string.format'.
  576. @@ LUA_INTFRM_T is the integer type correspoding to the previous length
  577. @* modifier.
  578. ** CHANGE them if your system supports long long or does not support long.
  579. */
  580. #if defined(LUA_USELONGLONG)
  581. #define LUA_INTFRMLEN "ll"
  582. #define LUA_INTFRM_T long long
  583. #else
  584. #define LUA_INTFRMLEN "l"
  585. #define LUA_INTFRM_T long
  586. #endif
  587. /* =================================================================== */
  588. /*
  589. ** Local configuration. You can use this space to add your redefinitions
  590. ** without modifying the main part of the file.
  591. */
  592. #endif