diff options
Diffstat (limited to 'luaconf.h')
-rw-r--r-- | luaconf.h | 239 |
1 files changed, 1 insertions, 238 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: luaconf.h,v 1.120 2009/12/10 19:00:33 roberto Exp roberto $ | 2 | ** $Id: luaconf.h,v 1.121 2009/12/14 15:27:30 roberto Exp roberto $ |
3 | ** Configuration file for Lua | 3 | ** Configuration file for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -65,17 +65,6 @@ | |||
65 | #endif | 65 | #endif |
66 | 66 | ||
67 | 67 | ||
68 | /* | ||
69 | @@ LUA_PATH and LUA_CPATH are the names of the environment variables that | ||
70 | @* Lua check to set its paths. | ||
71 | @@ LUA_INIT is the name of the environment variable that Lua | ||
72 | @* checks for initialization code. | ||
73 | ** CHANGE them if you want different names. | ||
74 | */ | ||
75 | #define LUA_PATH "LUA_PATH" | ||
76 | #define LUA_CPATH "LUA_CPATH" | ||
77 | #define LUA_INIT "LUA_INIT" | ||
78 | |||
79 | 68 | ||
80 | /* | 69 | /* |
81 | @@ LUA_PATH_DEFAULT is the default path that Lua uses to look for | 70 | @@ LUA_PATH_DEFAULT is the default path that Lua uses to look for |
@@ -124,24 +113,6 @@ | |||
124 | 113 | ||
125 | 114 | ||
126 | /* | 115 | /* |
127 | @@ LUA_PATHSEP is the character that separates templates in a path. | ||
128 | @@ LUA_PATH_MARK is the string that marks the substitution points in a | ||
129 | @* template. | ||
130 | @@ LUA_EXECDIR in a Windows path is replaced by the executable's | ||
131 | @* directory. | ||
132 | @@ LUA_IGMARK is a mark to ignore all before it when building the | ||
133 | @* luaopen_ function name. | ||
134 | ** CHANGE them if for some reason your system cannot use those | ||
135 | ** characters. (E.g., if one of those characters is a common character | ||
136 | ** in file/directory names.) Probably you do not need to change them. | ||
137 | */ | ||
138 | #define LUA_PATHSEP ";" | ||
139 | #define LUA_PATH_MARK "?" | ||
140 | #define LUA_EXECDIR "!" | ||
141 | #define LUA_IGMARK "-" | ||
142 | |||
143 | |||
144 | /* | ||
145 | @@ LUA_API is a mark for all core API functions. | 116 | @@ LUA_API is a mark for all core API functions. |
146 | @@ LUALIB_API is a mark for all auxiliary library functions. | 117 | @@ LUALIB_API is a mark for all auxiliary library functions. |
147 | @@ LUAMOD_API is a mark for all standard library opening functions. | 118 | @@ LUAMOD_API is a mark for all standard library opening functions. |
@@ -225,106 +196,6 @@ | |||
225 | #define luai_writestring(s,l) fwrite((s), sizeof(char), (l), stdout) | 196 | #define luai_writestring(s,l) fwrite((s), sizeof(char), (l), stdout) |
226 | 197 | ||
227 | 198 | ||
228 | /* | ||
229 | ** {================================================================== | ||
230 | ** Stand-alone configuration | ||
231 | ** =================================================================== | ||
232 | */ | ||
233 | |||
234 | #if defined(lua_c) || defined(luaall_c) | ||
235 | |||
236 | /* | ||
237 | @@ lua_stdin_is_tty detects whether the standard input is a 'tty' (that | ||
238 | @* is, whether we're running lua interactively). | ||
239 | ** CHANGE it if you have a better definition for non-POSIX/non-Windows | ||
240 | ** systems. | ||
241 | */ | ||
242 | #if defined(LUA_USE_ISATTY) | ||
243 | #include <unistd.h> | ||
244 | #define lua_stdin_is_tty() isatty(0) | ||
245 | #elif defined(LUA_WIN) | ||
246 | #include <io.h> | ||
247 | #include <stdio.h> | ||
248 | #define lua_stdin_is_tty() _isatty(_fileno(stdin)) | ||
249 | #else | ||
250 | #define lua_stdin_is_tty() 1 /* assume stdin is a tty */ | ||
251 | #endif | ||
252 | |||
253 | |||
254 | /* | ||
255 | @@ LUA_PROMPT is the default prompt used by stand-alone Lua. | ||
256 | @@ LUA_PROMPT2 is the default continuation prompt used by stand-alone Lua. | ||
257 | ** CHANGE them if you want different prompts. (You can also change the | ||
258 | ** prompts dynamically, assigning to globals _PROMPT/_PROMPT2.) | ||
259 | */ | ||
260 | #define LUA_PROMPT "> " | ||
261 | #define LUA_PROMPT2 ">> " | ||
262 | |||
263 | |||
264 | /* | ||
265 | @@ LUA_PROGNAME is the default name for the stand-alone Lua program. | ||
266 | ** CHANGE it if your stand-alone interpreter has a different name and | ||
267 | ** your system is not able to detect that name automatically. | ||
268 | */ | ||
269 | #define LUA_PROGNAME "lua" | ||
270 | |||
271 | |||
272 | /* | ||
273 | @@ LUA_MAXINPUT is the maximum length for an input line in the | ||
274 | @* stand-alone interpreter. | ||
275 | ** CHANGE it if you need longer lines. | ||
276 | */ | ||
277 | #define LUA_MAXINPUT 512 | ||
278 | |||
279 | |||
280 | /* | ||
281 | @@ lua_readline defines how to show a prompt and then read a line from | ||
282 | @* the standard input. | ||
283 | @@ lua_saveline defines how to "save" a read line in a "history". | ||
284 | @@ lua_freeline defines how to free a line read by lua_readline. | ||
285 | ** CHANGE them if you want to improve/adapt this functionality. | ||
286 | */ | ||
287 | #if defined(LUA_USE_READLINE) | ||
288 | #include <stdio.h> | ||
289 | #include <readline/readline.h> | ||
290 | #include <readline/history.h> | ||
291 | #define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL) | ||
292 | #define lua_saveline(L,idx) \ | ||
293 | if (lua_objlen(L,idx) > 0) /* non-empty line? */ \ | ||
294 | add_history(lua_tostring(L, idx)); /* add it to history */ | ||
295 | #define lua_freeline(L,b) ((void)L, free(b)) | ||
296 | #else | ||
297 | #define lua_readline(L,b,p) \ | ||
298 | ((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \ | ||
299 | fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */ | ||
300 | #define lua_saveline(L,idx) { (void)L; (void)idx; } | ||
301 | #define lua_freeline(L,b) { (void)L; (void)b; } | ||
302 | #endif | ||
303 | |||
304 | #endif | ||
305 | |||
306 | /* }================================================================== */ | ||
307 | |||
308 | |||
309 | /* | ||
310 | @@ LUAI_GCPAUSE defines the default pause between garbage-collector cycles | ||
311 | @* as a percentage. | ||
312 | ** CHANGE it if you want the GC to run faster or slower (higher values | ||
313 | ** mean larger pauses which mean slower collection.) You can also change | ||
314 | ** this value dynamically. | ||
315 | */ | ||
316 | #define LUAI_GCPAUSE 162 /* 162% (wait memory to double before next GC) */ | ||
317 | |||
318 | |||
319 | /* | ||
320 | @@ LUAI_GCMUL defines the default speed of garbage collection relative to | ||
321 | @* memory allocation as a percentage. | ||
322 | ** CHANGE it if you want to change the granularity of the garbage | ||
323 | ** collection. (Higher values mean coarser collections. 0 represents | ||
324 | ** infinity, where each step performs a full collection.) You can also | ||
325 | ** change this value dynamically. | ||
326 | */ | ||
327 | #define LUAI_GCMUL 200 /* GC runs 'twice the speed' of memory allocation */ | ||
328 | 199 | ||
329 | 200 | ||
330 | 201 | ||
@@ -373,22 +244,6 @@ | |||
373 | 244 | ||
374 | 245 | ||
375 | 246 | ||
376 | |||
377 | /* | ||
378 | @@ luai_apicheck is the assert macro used by the Lua-C API. | ||
379 | ** CHANGE luai_apicheck if you want Lua to perform some checks in the | ||
380 | ** parameters it gets from API calls. This may slow down the interpreter | ||
381 | ** a bit, but may be quite useful when debugging C code that interfaces | ||
382 | ** with Lua. A useful redefinition is to use assert.h. | ||
383 | */ | ||
384 | #if defined(LUA_USE_APICHECK) | ||
385 | #include <assert.h> | ||
386 | #define luai_apicheck(L,o) { (void)L; assert(o); } | ||
387 | #else | ||
388 | #define luai_apicheck(L,o) { (void)L; } | ||
389 | #endif | ||
390 | |||
391 | |||
392 | /* | 247 | /* |
393 | @@ LUAI_BITSINT defines the number of bits in an int. | 248 | @@ LUAI_BITSINT defines the number of bits in an int. |
394 | ** CHANGE here if Lua cannot automatically detect the number of bits of | 249 | ** CHANGE here if Lua cannot automatically detect the number of bits of |
@@ -459,14 +314,6 @@ | |||
459 | 314 | ||
460 | 315 | ||
461 | /* | 316 | /* |
462 | @@ LUAI_MAXCCALLS is the maximum depth for nested C calls and | ||
463 | @* syntactical nested non-terminals in a program. (Value must | ||
464 | @* fit in an unsigned short int.) | ||
465 | */ | ||
466 | #define LUAI_MAXCCALLS 200 | ||
467 | |||
468 | |||
469 | /* | ||
470 | @@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. | 317 | @@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. |
471 | */ | 318 | */ |
472 | #define LUAL_BUFFERSIZE BUFSIZ | 319 | #define LUAL_BUFFERSIZE BUFSIZ |
@@ -616,81 +463,6 @@ union luai_Cast { double l_d; long l_l; }; | |||
616 | 463 | ||
617 | 464 | ||
618 | /* | 465 | /* |
619 | @@ LUAI_USER_ALIGNMENT_T is a type that requires maximum alignment. | ||
620 | ** CHANGE it if your system requires alignments larger than double. (For | ||
621 | ** instance, if your system supports long doubles and they must be | ||
622 | ** aligned in 16-byte boundaries, then you should add long double in the | ||
623 | ** union.) Probably you do not need to change this. | ||
624 | */ | ||
625 | #define LUAI_USER_ALIGNMENT_T union { double u; void *s; long l; } | ||
626 | |||
627 | |||
628 | /* | ||
629 | @@ LUAI_THROW/LUAI_TRY define how Lua does exception handling. | ||
630 | ** CHANGE them if you prefer to use longjmp/setjmp even with C++ | ||
631 | ** or if want/don't to use _longjmp/_setjmp instead of regular | ||
632 | ** longjmp/setjmp. By default, Lua handles errors with exceptions when | ||
633 | ** compiling as C++ code, with _longjmp/_setjmp when asked to use them, | ||
634 | ** and with longjmp/setjmp otherwise. | ||
635 | */ | ||
636 | #if defined(__cplusplus) | ||
637 | /* C++ exceptions */ | ||
638 | #define LUAI_THROW(L,c) throw(c) | ||
639 | #define LUAI_TRY(L,c,a) try { a } catch(...) \ | ||
640 | { if ((c)->status == 0) (c)->status = -1; } | ||
641 | #define luai_jmpbuf int /* dummy variable */ | ||
642 | |||
643 | #elif defined(LUA_USE_ULONGJMP) | ||
644 | /* in Unix, try _longjmp/_setjmp (more efficient) */ | ||
645 | #define LUAI_THROW(L,c) _longjmp((c)->b, 1) | ||
646 | #define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a } | ||
647 | #define luai_jmpbuf jmp_buf | ||
648 | |||
649 | #else | ||
650 | /* default handling with long jumps */ | ||
651 | #define LUAI_THROW(L,c) longjmp((c)->b, 1) | ||
652 | #define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a } | ||
653 | #define luai_jmpbuf jmp_buf | ||
654 | |||
655 | #endif | ||
656 | |||
657 | |||
658 | /* | ||
659 | @@ LUA_MAXCAPTURES is the maximum number of captures that a pattern | ||
660 | @* can do during pattern-matching. | ||
661 | ** CHANGE it if you need more captures. This limit is arbitrary. | ||
662 | */ | ||
663 | #define LUA_MAXCAPTURES 32 | ||
664 | |||
665 | |||
666 | /* | ||
667 | @@ lua_tmpnam is the function that the OS library uses to create a | ||
668 | @* temporary name. | ||
669 | @@ LUA_TMPNAMBUFSIZE is the maximum size of a name created by lua_tmpnam. | ||
670 | ** CHANGE them if you have an alternative to tmpnam (which is considered | ||
671 | ** insecure) or if you want the original tmpnam anyway. By default, Lua | ||
672 | ** uses tmpnam except when POSIX is available, where it uses mkstemp. | ||
673 | */ | ||
674 | #if defined(loslib_c) || defined(luaall_c) | ||
675 | |||
676 | #if defined(LUA_USE_MKSTEMP) | ||
677 | #include <unistd.h> | ||
678 | #define LUA_TMPNAMBUFSIZE 32 | ||
679 | #define lua_tmpnam(b,e) { \ | ||
680 | strcpy(b, "/tmp/lua_XXXXXX"); \ | ||
681 | e = mkstemp(b); \ | ||
682 | if (e != -1) close(e); \ | ||
683 | e = (e == -1); } | ||
684 | |||
685 | #else | ||
686 | #define LUA_TMPNAMBUFSIZE L_tmpnam | ||
687 | #define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); } | ||
688 | #endif | ||
689 | |||
690 | #endif | ||
691 | |||
692 | |||
693 | /* | ||
694 | @@ LUA_STRFTIMEOPTIONS is the list of valid conversion specifiers | 466 | @@ LUA_STRFTIMEOPTIONS is the list of valid conversion specifiers |
695 | @* for the 'strftime' function; | 467 | @* for the 'strftime' function; |
696 | ** CHANGE it if you want to use non-ansi options specific to your system. | 468 | ** CHANGE it if you want to use non-ansi options specific to your system. |
@@ -753,15 +525,6 @@ union luai_Cast { double l_d; long l_l; }; | |||
753 | 525 | ||
754 | 526 | ||
755 | /* | 527 | /* |
756 | @@ LUAI_EXTRASPACE allows you to add user-specific data in a lua_State. | ||
757 | @* (This data goes just *before* the lua_State pointer.) | ||
758 | ** CHANGE (define) this if you really need that. If defined, this value | ||
759 | ** cannot be zero. | ||
760 | */ | ||
761 | /* #define LUAI_EXTRASPACE ?? */ | ||
762 | |||
763 | |||
764 | /* | ||
765 | @@ luai_userstate* allow user-specific actions on threads. | 528 | @@ luai_userstate* allow user-specific actions on threads. |
766 | ** CHANGE them if you defined LUAI_EXTRASPACE and need to do something | 529 | ** CHANGE them if you defined LUAI_EXTRASPACE and need to do something |
767 | ** extra when a thread is created/deleted/resumed/yielded. | 530 | ** extra when a thread is created/deleted/resumed/yielded. |