luaconf.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  1. /*
  2. ** $Id: luaconf.h,v 1.43 2005/04/07 13:52:45 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. ** Index (search for keyword to find corresponding entry)
  13. ** ===================================================================
  14. */
  15. /* }================================================================== */
  16. /*
  17. @@ LUA_PATH_DEFAULT is the default path that Lua uses to look for
  18. @* Lua libraries.
  19. @@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for
  20. @* C libraries.
  21. ** CHANGE them if your machine has a non-conventional directory
  22. ** hierarchy or if you want to install your libraries in
  23. ** non-conventional directories.
  24. */
  25. #if defined(_WIN32)
  26. #define LUA_ROOT "C:\\Program Files\\Lua51"
  27. #define LUA_LDIR LUA_ROOT "\\lua"
  28. #define LUA_CDIR LUA_ROOT "\\dll"
  29. #define LUA_PATH_DEFAULT \
  30. "?.lua;" LUA_LDIR"\\?.lua;" LUA_LDIR"\\?\\init.lua"
  31. #define LUA_CPATH_DEFAULT \
  32. "?.dll;" "l?.dll;" LUA_CDIR"\\?.dll;" LUA_CDIR"\\l?.dll"
  33. #else
  34. #define LUA_ROOT "/usr/local"
  35. #define LUA_LDIR LUA_ROOT "/share/lua/5.1"
  36. #define LUA_CDIR LUA_ROOT "/lib/lua/5.1"
  37. #define LUA_PATH_DEFAULT \
  38. "./?.lua;" LUA_LDIR"/?.lua;" LUA_LDIR"/?/init.lua"
  39. #define LUA_CPATH_DEFAULT \
  40. "./?.so;" "./l?.so;" LUA_CDIR"/?.so;" LUA_CDIR"/l?.so"
  41. #endif
  42. /*
  43. @@ LUA_DIRSEP is the directory separator (for submodules).
  44. ** CHANGE it if your machine does not use "/" as the directory separator
  45. ** and is not Windows. (On Windows Lua automatically uses "\".)
  46. */
  47. #if defined(_WIN32)
  48. #define LUA_DIRSEP "\\"
  49. #else
  50. #define LUA_DIRSEP "/"
  51. #endif
  52. /*
  53. @@ LUA_PATHSEP is the character that separates templates in a path.
  54. ** CHANGE it if for some reason your system cannot use a
  55. ** semicolon. (E.g., a semicolon may be a too common character in
  56. ** file/directory names.) Probably you do not need to change this.
  57. */
  58. #define LUA_PATHSEP ';'
  59. /*
  60. @@ LUA_PATH_MARK is ths string that marks the substitution points in a
  61. @* template.
  62. ** CHANGE it if for some reason your system cannot use an interogation
  63. ** mark. (E.g., an interogation mark may be a too common character in
  64. ** file/directory names.) Probably you do not need to change this.
  65. */
  66. #define LUA_PATH_MARK "?"
  67. /*
  68. @@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger.
  69. ** CHANGE that if ptrdiff_t is not adequate on your machine. (On most
  70. ** machines, ptrdiff_t gives a good choice between int or long.)
  71. */
  72. #define LUA_INTEGER ptrdiff_t
  73. /*
  74. @@ LUA_API is a mark for all core API functions.
  75. @@ LUALIB_API is a mark for all standard library functions.
  76. ** CHANGE them if you need to define those functions in some special way.
  77. ** For instance, if you want to create one Windows DLL with the core and
  78. ** the libraries, you may want to use the following definition (define
  79. ** LUA_BUILD_AS_DLL to get it).
  80. */
  81. #if defined(LUA_BUILD_AS_DLL)
  82. #if defined(LUA_CORE) || defined(LUA_LIB)
  83. #define LUA_API __declspec(__dllexport)
  84. #else
  85. #define LUA_API __declspec(__dllimport)
  86. #endif
  87. #else
  88. #define LUA_API extern
  89. #endif
  90. /* more often then not the libs go together with the core */
  91. #define LUALIB_API LUA_API
  92. /*
  93. @@ LUAI_FUNC is a mark for all extern functions that are not to be
  94. @* exported to outside modules.
  95. ** CHANGE it if you need to mark them in some special way. Gcc mark
  96. ** them as "hidden" to optimize their call when Lua is compiled as a
  97. ** shared library.
  98. */
  99. #if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302)
  100. #define LUAI_FUNC __attribute__((visibility("hidden")))
  101. #else
  102. #define LUAI_FUNC extern
  103. #endif
  104. /*
  105. @@ lua_assert describes the internal assertions in Lua.
  106. ** CHANGE that only if you need to debug Lua.
  107. */
  108. #define lua_assert(c) ((void)0)
  109. /*
  110. ** {==================================================================
  111. ** Stand-alone configuration
  112. ** ===================================================================
  113. */
  114. #if defined(lua_c) || defined(luaall_c)
  115. /*
  116. @@ lua_stdin_is_tty is a function to detect whether the standard input is
  117. @* a `tty' (that is, is interactive).
  118. ** CHANGE it if you have a better definition for non-POSIX/non-Windows
  119. ** systems.
  120. */
  121. #if !defined(__STRICT_ANSI__) && defined(_POSIX_C_SOURCE)
  122. #include <unistd.h>
  123. #define lua_stdin_is_tty() isatty(0)
  124. #elif !defined(__STRICT_ANSI__) && defined(_WIN32)
  125. #include <io.h>
  126. #include <stdio.h>
  127. #define lua_stdin_is_tty() _isatty(_fileno(stdin))
  128. #else
  129. #define lua_stdin_is_tty() 1 /* assume stdin is a tty */
  130. #endif
  131. /*
  132. @@ LUA_PROMPT is the default prompt used by stand-alone Lua.
  133. @@ LUA_PROMPT2 is the default continuation prompt used by stand-alone Lua.
  134. ** CHANGE them if you want different prompts. (You can also change the
  135. ** prompts dynamically, assigning to globals _PROMPT/_PROMPT2.)
  136. */
  137. #define LUA_PROMPT "> "
  138. #define LUA_PROMPT2 ">> "
  139. /*
  140. @@ LUA_PROGNAME is the default name for the stand-alone Lua program.
  141. ** CHANGE it if your stand-alone interpreter has a different name and
  142. ** your system is not able to detect that name automatically.
  143. */
  144. #define LUA_PROGNAME "lua"
  145. /*
  146. @@ LUA_MAXINPUT is the maximum length for an input line
  147. ** CHANGE it if you need longer lines.
  148. */
  149. #define LUA_MAXINPUT 512
  150. /*
  151. @@ lua_readline defines how to show a prompt and then read a line from
  152. @* the standard input.
  153. @@ lua_saveline defines how to "save" a read line.
  154. @@ lua_freeline defines how to free a line read by lua_readline.
  155. ** CHANGE them if you want to improve this functionality (e.g., using GNU
  156. ** readline and history facilities).
  157. */
  158. #if !defined(__STRICT_ANSI__) && defined(LUA_USE_READLINE)
  159. #include <stdio.h>
  160. #include <readline/readline.h>
  161. #include <readline/history.h>
  162. #define lua_readline(L,b,p) (((b)=readline(p)) != NULL)
  163. #define lua_saveline(L,idx) \
  164. if (lua_strlen(L,idx) > 0) /* non-empty line? */ \
  165. add_history(lua_tostring(L, idx)); /* add it to history */
  166. #define lua_freeline(L,b) free(b)
  167. #else
  168. #define lua_readline(L,b,p) \
  169. (fputs(p, stdout), fflush(stdout), /* show prompt */ \
  170. fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */
  171. #define lua_saveline(L,idx) ((void)0)
  172. #define lua_freeline(L,b) ((void)0)
  173. #endif
  174. #endif
  175. /* }================================================================== */
  176. /*
  177. @@ LUAI_GCPAUSE defines the default pause between garbage-collector cycles
  178. @* as a percentage.
  179. ** CHANGE it if you want the GC to run faster or slower (higher
  180. ** values mean larger pauses which mean slower collection.)
  181. */
  182. #define LUAI_GCPAUSE 200 /* 200% (wait memory to double before next GC) */
  183. /*
  184. @@ LUAI_GCMUL defines the speed of garbage collection relative to
  185. @* memory allocation as a percentage.
  186. ** CHANGE it if you want to change the granularity of the garbage
  187. ** collection. (Higher values mean coarser collections. 0 represents
  188. ** infinity, where each step performs a full collection.)
  189. */
  190. #define LUAI_GCMUL 200 /* GC runs `twice the speed' of memory allocation */
  191. /*
  192. @@ LUA_COMPAT_GETN controls compatibility with old getn behavior.
  193. ** CHANGE it to 1 if you want exact compatibility with the behavior of
  194. ** setn/getn in Lua 5.0.
  195. */
  196. #define LUA_COMPAT_GETN 0
  197. /*
  198. @@ LUA_COMPAT_PATH controls compatibility about LUA_PATH.
  199. ** CHANGE it to 1 if you want `require' to look for global LUA_PATH
  200. ** before checking package.path.
  201. */
  202. #define LUA_COMPAT_PATH 0
  203. /*
  204. @@ LUA_COMPAT_LOADLIB controls compatibility about global loadlib.
  205. ** CHANGE it to 1 if you want a global `loadlib' function (otherwise
  206. ** the function is only available as `package.loadlib').
  207. */
  208. #define LUA_COMPAT_LOADLIB 1
  209. /*
  210. @@ LUA_COMPAT_VARARG controls compatibility with old vararg feature.
  211. ** CHANGE it to 1 if you want vararg functions that do not use `...'
  212. ** to get an `arg' table with their extra arguments.
  213. */
  214. #define LUA_COMPAT_VARARG 1
  215. /*
  216. @@ luai_apicheck is the assert macro used by the Lua-C API.
  217. ** CHANGE luai_apicheck if you want Lua to perform some checks in the
  218. ** parameters it gets from API calls. This may slow down the interpreter
  219. ** a bit, but may be quite useful when debugging C code that interfaces
  220. ** with Lua. A useful redefinition is to use assert.h.
  221. */
  222. #if defined(LUA_USE_APICHECK)
  223. #include <assert.h>
  224. #define luai_apicheck(L,o) assert(o)
  225. #else
  226. /* (By default lua_assert is empty, so luai_apicheck is also empty.) */
  227. #define luai_apicheck(L,o) lua_assert(o)
  228. #endif
  229. /*
  230. @@ LUAI_BITSINT defines the number of bits in an int.
  231. ** CHANGE here if Lua cannot automatically detect the number of bits of
  232. ** your machine. Probably you do not need to change this.
  233. */
  234. /* avoid overflows in comparison */
  235. #if INT_MAX-20 < 32760
  236. #define LUAI_BITSINT 16
  237. #elif INT_MAX > 2147483640L
  238. /* int has at least 32 bits */
  239. #define LUAI_BITSINT 32
  240. #else
  241. #error "you must define LUA_BITSINT with number of bits in an integer"
  242. #endif
  243. /*
  244. @@ LUAI_UINT32 is an unsigned integer with at least 32 bits.
  245. @@ LUAI_INT32 is an signed integer with at least 32 bits.
  246. @@ LUAI_UMEM is an an unsigned integer big enough to count the total
  247. @* memory used by Lua.
  248. @@ LUAI_MEM is an a signed integer big enough to count the total memory
  249. @* used by Lua.
  250. ** CHANGE here if for some weird reason the default definitions are not
  251. ** good enough for your machine. (The `else' definition always works,
  252. ** but may waste space on machines with 64-bit longs.) Probably you do
  253. ** not need to change this.
  254. */
  255. #if LUAI_BITSINT >= 32
  256. #define LUAI_UINT32 unsigned int
  257. #define LUAI_INT32 int
  258. #define LUAI_MAXINT32 INT_MAX
  259. #define LUAI_UMEM size_t
  260. #define LUAI_MEM ptrdiff_t
  261. #else
  262. /* 16-bit ints */
  263. #define LUAI_UINT32 unsigned long
  264. #define LUAI_INT32 long
  265. #define LUAI_MAXINT32 LONG_MAX
  266. #define LUAI_UMEM unsigned long
  267. #define LUAI_MEM long
  268. #endif
  269. /*
  270. @@ LUAI_MAXCALLS limits the number of nested calls.
  271. ** CHANGE it if you need really deep recursive calls. This limit is
  272. ** arbitrary; its only purpose is to stop infinite recursion before
  273. ** exhausting memory.
  274. */
  275. #define LUAI_MAXCALLS 20000
  276. /*
  277. @@ LUAI_MAXCSTACK limits the number of slots that a C function can use.
  278. ** CHANGE it if you need lots of (Lua) stack space for your C
  279. ** functions. This limit is arbitrary; its only purpose is to stop C
  280. ** functions to consume unlimited stack space.
  281. */
  282. #define LUAI_MAXCSTACK 2048
  283. /*
  284. ** {==================================================================
  285. ** CHANGE (to smaller values) the following definitions if your system
  286. ** has a small C stack. (Or you may want to change them to larger
  287. ** values if your system has a large C stack and these limits are
  288. ** too rigid for you.) Some of these constants control the size of
  289. ** stack-allocated arrays used by the compiler or the interpreter, while
  290. ** others limit the maximum number of recursive calls that the compiler
  291. ** or the interpreter can perform. Values too large may cause a C stack
  292. ** overflow for some forms of deep constructs.
  293. ** ===================================================================
  294. */
  295. /*
  296. @@ LUAI_MAXCCALLS is the maximum depth for nested C calls (short) and
  297. @* syntactical nested non-terminals in a program.
  298. */
  299. #define LUAI_MAXCCALLS 200
  300. /*
  301. @@ LUAI_MAXVARS is the maximum number of local variables per function
  302. @* (must be smaller than 250).
  303. */
  304. #define LUAI_MAXVARS 200
  305. /*
  306. @@ LUAI_MAXUPVALUES is the maximum number of upvalues per function
  307. @* (must be smaller than 250).
  308. */
  309. #define LUAI_MAXUPVALUES 60
  310. /*
  311. @@ LUAI_MAXEXPWHILE is the maximum size of code for expressions
  312. @* controling a `while' loop.
  313. */
  314. #define LUAI_MAXEXPWHILE 100
  315. /*
  316. @@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.
  317. */
  318. #define LUAL_BUFFERSIZE BUFSIZ
  319. /* }================================================================== */
  320. /*
  321. @@ lua_number2int is a macro to convert lua_Number to int.
  322. ** CHANGE that if you know a faster way to convert a lua_Number to
  323. ** int (with any rounding method and without throwing errors) in your
  324. ** system. In Pentium machines, a naive typecast from double to int
  325. ** in C is extremely slow, so any alternative is worth trying.
  326. */
  327. /* On a GNU/Pentium, resort to assembler */
  328. #if !defined(__STRICT_ANSI__) && defined(__GNUC__) && defined(__i386)
  329. #define lua_number2int(i,d) __asm__ ("fistpl %0":"=m"(i):"t"(d):"st")
  330. /* On Windows/Pentium, resort to assembler */
  331. #elif !defined(__STRICT_ANSI__) && defined(_MSC_VER) && defined(_M_IX86)
  332. #define lua_number2int(i,d) __asm { \
  333. fld d \
  334. fistp i \
  335. }
  336. /* on Pentium machines compliant with C99, you can try lrint */
  337. #elif defined (__i386) && defined(__STDC_VERSION__) && \
  338. (__STDC_VERSION__ >= 199900L)
  339. #define lua_number2int(i,d) ((i)=lrint(d))
  340. /* this option always work, but may be slow */
  341. #else
  342. #define lua_number2int(i,d) ((i)=(int)(d))
  343. #endif
  344. /*
  345. @@ lua_number2integer is a macro to convert lua_Number to lua_Integer.
  346. ** CHANGE (see lua_number2int).
  347. */
  348. /* On a GNU or Windows/Pentium, resort to assembler */
  349. #if (defined(__GNUC__) && defined(__i386)) || \
  350. (defined(_MSC_VER) && defined(_M_IX86))
  351. #define lua_number2integer(i,n) lua_number2int((i), (n))
  352. /* this option always work, but may be slow */
  353. #else
  354. #define lua_number2integer(i,d) ((i)=(lua_Integer)(d))
  355. #endif
  356. /*
  357. ** {==================================================================
  358. ** CHANGE the following definitions only if you want to build Lua
  359. ** with a number type different from double. You may also need to
  360. ** change lua_number2int & lua_number2integer.
  361. ** ===================================================================
  362. */
  363. /*
  364. @@ LUA_NUMBER is the type of numbers in Lua.
  365. @@ LUAI_UACNUMBER is the result of an `usual argument conversion'
  366. @* over a number.
  367. */
  368. #define LUA_NUMBER double
  369. #define LUAI_UACNUMBER LUA_NUMBER
  370. /*
  371. @@ LUA_NUMBER_SCAN is the format for reading numbers.
  372. @@ LUA_NUMBER_FMT is the format for writing numbers.
  373. @@ lua_number2str converts a number to a string.
  374. @@ LUAI_MAXNUMBER2STR is maximum size of previous conversion.
  375. @@ lua_str2number converts a string to a number.
  376. */
  377. #define LUA_NUMBER_SCAN "%lf"
  378. #define LUA_NUMBER_FMT "%.14g"
  379. #define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n))
  380. #define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */
  381. #define lua_str2number(s,p) strtod((s), (p))
  382. /*
  383. @@ The luai_num* macros define the primitive operations over numbers.
  384. */
  385. #define luai_numadd(a,b) ((a)+(b))
  386. #define luai_numsub(a,b) ((a)-(b))
  387. #define luai_nummul(a,b) ((a)*(b))
  388. #define luai_numdiv(a,b) ((a)/(b))
  389. #define luai_nummod(a,b) ((a) - floor((a)/(b))*(b))
  390. #define luai_numpow(a,b) pow(a,b)
  391. #define luai_numunm(a) (-(a))
  392. #define luai_numeq(a,b) ((a)==(b))
  393. #define luai_numlt(a,b) ((a)<(b))
  394. #define luai_numle(a,b) ((a)<=(b))
  395. /* }================================================================== */
  396. /*
  397. @@ LUAI_USER_ALIGNMENT_T is a type that requires maximum alignment.
  398. ** CHANGE it if your system requires alignments larger than double. (For
  399. ** instance, if your system supports long double and those long doubles
  400. ** must be aligned in 16-byte boundaries, then you should add long
  401. ** double in the union.) Probably you do not need to change this.
  402. */
  403. #define LUAI_USER_ALIGNMENT_T union { double u; void *s; long l; }
  404. /*
  405. @@ LUAI_THROW/LUAI_TRY define how Lua does exception handling.
  406. ** CHANGE them if you prefer to use longjmp/setjmp even with C++ or
  407. ** if want/don't want to use _longjmp/_setjmp instead of regular
  408. ** longjmp/setjmp. By default, Lua handles errors with exceptions when
  409. ** compiling as C++ code, with _longjmp/_setjmp when compiling as C code
  410. ** in a Unix system, and with longjmp/setjmp otherwise.
  411. */
  412. #if defined(__cplusplus)
  413. /* C++ exceptions */
  414. #define LUAI_THROW(L,c) throw(c)
  415. #define LUAI_TRY(L,c,a) try { a } catch(...) \
  416. { if ((c)->status == 0) (c)->status = -1; }
  417. #define luai_jmpbuf int /* dummy variable */
  418. #elif !defined(__STRICT_ANSI__) && (defined(unix) || defined(__unix) || \
  419. defined(__unix__))
  420. /* in Unix, try _longjmp/_setjmp (more efficient) */
  421. #define LUAI_THROW(L,c) _longjmp((c)->b, 1)
  422. #define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a }
  423. #define luai_jmpbuf jmp_buf
  424. #else
  425. /* default handling with long jumps */
  426. #define LUAI_THROW(L,c) longjmp((c)->b, 1)
  427. #define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a }
  428. #define luai_jmpbuf jmp_buf
  429. #endif
  430. /*
  431. @@ LUA_MAXCAPTURES is the maximum number of captures that a pattern
  432. @* can do during pattern-matching.
  433. ** CHANGE it if you need more captures. This limit is arbitrary.
  434. */
  435. #define LUA_MAXCAPTURES 32
  436. /*
  437. @@ lua_tmpnam is the function that the OS library uses to create a
  438. @* temporary name.
  439. @@ LUA_TMPNAMBUFSIZE is the maximum size of a name created by lua_tmpnam.
  440. ** CHANGE them if you have an alternative to tmpnam (which is considered
  441. ** insecure) or if you want the original tmpnam anyway. By default, Lua
  442. ** uses tmpnam except when POSIX is available, where it uses mkstemp.
  443. */
  444. #if defined(loslib_c) || defined(luaall_c)
  445. #if !defined(__STRICT_ANSI__) && defined(_POSIX_C_SOURCE)
  446. #include <unistd.h>
  447. #define LUA_TMPNAMBUFSIZE 32
  448. #define lua_tmpnam(b,e) { \
  449. strcpy(b, "/tmp/lua_XXXXXX"); \
  450. e = mkstemp(b); \
  451. if (e != -1) close(e); \
  452. e = (e == -1); }
  453. #else
  454. #define LUA_TMPNAMBUFSIZE L_tmpnam
  455. #define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); }
  456. #endif
  457. #endif
  458. /*
  459. @@ LUA_DL_* define which dynamic-library system Lua should use.
  460. ** CHANGE here if Lua has problems choosing the appropriate
  461. ** dynamic-library system for your platform (either Windows' DLL, Mac's
  462. ** dyld, or Unix's dlopen). If your system is some kind of Unix, there
  463. ** is a good chance that it has dlopen, so LUA_DL_DLOPEN will work for
  464. ** it. To use dlopen you also need to adapt the makefile (probably
  465. ** adding -ldl to the linker options), so Lua does not select it
  466. ** automatically. (When you change the makefile to add -ldl, you must
  467. ** also add -DLUA_USE_DLOPEN.)
  468. ** If you do not want any kind of dynamic library, undefine all these
  469. ** options (or just remove these definitions).
  470. */
  471. #if !defined(__STRICT_ANSI__)
  472. #if defined(_WIN32)
  473. #define LUA_DL_DLL
  474. #elif defined(__APPLE__) && defined(__MACH__)
  475. #define LUA_DL_DYLD
  476. #elif defined(LUA_USE_DLOPEN)
  477. #define LUA_DL_DLOPEN
  478. #endif
  479. #endif
  480. /*
  481. @@ lua_lock/lua_unlock are macros for thread synchronization inside the
  482. @* Lua core. This is an attempt to simplify the implementation of a
  483. @* multithreaded version of Lua.
  484. ** CHANGE them only if you know what you are doing. all accesses to
  485. ** the global state and to global objects are synchronized. Because
  486. ** threads can read the stack of other threads (when running garbage
  487. ** collection), a thread must also synchronize any write-access to its
  488. ** own stack. Unsynchronized accesses are allowed only when reading its
  489. ** own stack, or when reading immutable fields from global objects (such
  490. ** as string values and udata values).
  491. */
  492. #define lua_lock(L) ((void) 0)
  493. #define lua_unlock(L) ((void) 0)
  494. /*
  495. @@ lua_threadyield allows a thread switch in appropriate places in the core.
  496. ** CHANGE it only if you know what you are doing. (See lua_lock.)
  497. */
  498. #define luai_threadyield(L) {lua_unlock(L); lua_lock(L);}
  499. /*
  500. @@ LUAI_EXTRASPACE allows you to add user-specific data in a lua_State
  501. @* (the data goes just *before* the lua_State pointer).
  502. ** CHANGE (define) this if you really need that. This value must be
  503. ** a multiple of the maximum alignment required for your machine.
  504. */
  505. #define LUAI_EXTRASPACE 0
  506. /*
  507. @@ luai_userstateopen allows user-specific initialization on new threads.
  508. ** CHANGE it if you defined LUAI_EXTRASPACE and need to initialize that
  509. ** data whenever a new lua_State is created.
  510. */
  511. #define luai_userstateopen(L) ((void)0)
  512. /* =================================================================== */
  513. /* Local configuration */
  514. #endif