annotate lib/lua/lua-5.2.2/luaconf.h @ 1904:1a1c4040bee4

m
author Ritor1
date Mon, 21 Oct 2013 17:23:59 +0600
parents 41cc4dd3c122
children
rev   line source
1866
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
1 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
2 ** $Id: luaconf.h,v 1.176 2013/03/16 21:10:18 roberto Exp $
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
3 ** Configuration file for Lua
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
4 ** See Copyright Notice in lua.h
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
5 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
6
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
7
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
8 #ifndef lconfig_h
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
9 #define lconfig_h
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
10
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
11 #include <limits.h>
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
12 #include <stddef.h>
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
13
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
14
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
15 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
16 ** ==================================================================
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
17 ** Search for "@@" to find all configurable definitions.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
18 ** ===================================================================
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
19 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
20
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
21
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
22 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
23 @@ LUA_ANSI controls the use of non-ansi features.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
24 ** CHANGE it (define it) if you want Lua to avoid the use of any
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
25 ** non-ansi feature or library.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
26 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
27 #if !defined(LUA_ANSI) && defined(__STRICT_ANSI__)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
28 #define LUA_ANSI
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
29 #endif
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
30
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
31
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
32 #if !defined(LUA_ANSI) && defined(_WIN32) && !defined(_WIN32_WCE)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
33 #define LUA_WIN /* enable goodies for regular Windows platforms */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
34 #endif
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
35
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
36 #if defined(LUA_WIN)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
37 #define LUA_DL_DLL
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
38 #define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
39 #endif
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
40
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
41
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
42
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
43 #if defined(LUA_USE_LINUX)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
44 #define LUA_USE_POSIX
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
45 #define LUA_USE_DLOPEN /* needs an extra library: -ldl */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
46 #define LUA_USE_READLINE /* needs some extra libraries */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
47 #define LUA_USE_STRTODHEX /* assume 'strtod' handles hex formats */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
48 #define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
49 #define LUA_USE_LONGLONG /* assume support for long long */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
50 #endif
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
51
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
52 #if defined(LUA_USE_MACOSX)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
53 #define LUA_USE_POSIX
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
54 #define LUA_USE_DLOPEN /* does not need -ldl */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
55 #define LUA_USE_READLINE /* needs an extra library: -lreadline */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
56 #define LUA_USE_STRTODHEX /* assume 'strtod' handles hex formats */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
57 #define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
58 #define LUA_USE_LONGLONG /* assume support for long long */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
59 #endif
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
60
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
61
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
62
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
63 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
64 @@ LUA_USE_POSIX includes all functionality listed as X/Open System
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
65 @* Interfaces Extension (XSI).
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
66 ** CHANGE it (define it) if your system is XSI compatible.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
67 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
68 #if defined(LUA_USE_POSIX)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
69 #define LUA_USE_MKSTEMP
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
70 #define LUA_USE_ISATTY
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
71 #define LUA_USE_POPEN
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
72 #define LUA_USE_ULONGJMP
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
73 #define LUA_USE_GMTIME_R
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
74 #endif
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
75
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
76
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
77
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
78 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
79 @@ LUA_PATH_DEFAULT is the default path that Lua uses to look for
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
80 @* Lua libraries.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
81 @@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
82 @* C libraries.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
83 ** CHANGE them if your machine has a non-conventional directory
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
84 ** hierarchy or if you want to install your libraries in
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
85 ** non-conventional directories.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
86 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
87 #if defined(_WIN32) /* { */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
88 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
89 ** In Windows, any exclamation mark ('!') in the path is replaced by the
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
90 ** path of the directory of the executable file of the current process.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
91 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
92 #define LUA_LDIR "!\\lua\\"
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
93 #define LUA_CDIR "!\\"
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
94 #define LUA_PATH_DEFAULT \
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
95 LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
96 LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua;" ".\\?.lua"
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
97 #define LUA_CPATH_DEFAULT \
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
98 LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll;" ".\\?.dll"
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
99
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
100 #else /* }{ */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
101
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
102 #define LUA_VDIR LUA_VERSION_MAJOR "." LUA_VERSION_MINOR "/"
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
103 #define LUA_ROOT "/usr/local/"
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
104 #define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
105 #define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
106 #define LUA_PATH_DEFAULT \
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
107 LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
108 LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" "./?.lua"
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
109 #define LUA_CPATH_DEFAULT \
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
110 LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so"
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
111 #endif /* } */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
112
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
113
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
114 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
115 @@ LUA_DIRSEP is the directory separator (for submodules).
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
116 ** CHANGE it if your machine does not use "/" as the directory separator
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
117 ** and is not Windows. (On Windows Lua automatically uses "\".)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
118 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
119 #if defined(_WIN32)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
120 #define LUA_DIRSEP "\\"
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
121 #else
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
122 #define LUA_DIRSEP "/"
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
123 #endif
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
124
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
125
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
126 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
127 @@ LUA_ENV is the name of the variable that holds the current
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
128 @@ environment, used to access global names.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
129 ** CHANGE it if you do not like this name.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
130 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
131 #define LUA_ENV "_ENV"
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
132
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
133
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
134 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
135 @@ LUA_API is a mark for all core API functions.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
136 @@ LUALIB_API is a mark for all auxiliary library functions.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
137 @@ LUAMOD_API is a mark for all standard library opening functions.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
138 ** CHANGE them if you need to define those functions in some special way.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
139 ** For instance, if you want to create one Windows DLL with the core and
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
140 ** the libraries, you may want to use the following definition (define
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
141 ** LUA_BUILD_AS_DLL to get it).
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
142 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
143 #if defined(LUA_BUILD_AS_DLL) /* { */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
144
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
145 #if defined(LUA_CORE) || defined(LUA_LIB) /* { */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
146 #define LUA_API __declspec(dllexport)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
147 #else /* }{ */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
148 #define LUA_API __declspec(dllimport)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
149 #endif /* } */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
150
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
151 #else /* }{ */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
152
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
153 #define LUA_API extern
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
154
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
155 #endif /* } */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
156
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
157
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
158 /* more often than not the libs go together with the core */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
159 #define LUALIB_API LUA_API
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
160 #define LUAMOD_API LUALIB_API
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
161
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
162
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
163 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
164 @@ LUAI_FUNC is a mark for all extern functions that are not to be
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
165 @* exported to outside modules.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
166 @@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
167 @* that are not to be exported to outside modules (LUAI_DDEF for
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
168 @* definitions and LUAI_DDEC for declarations).
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
169 ** CHANGE them if you need to mark them in some special way. Elf/gcc
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
170 ** (versions 3.2 and later) mark them as "hidden" to optimize access
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
171 ** when Lua is compiled as a shared library. Not all elf targets support
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
172 ** this attribute. Unfortunately, gcc does not offer a way to check
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
173 ** whether the target offers that support, and those without support
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
174 ** give a warning about it. To avoid these warnings, change to the
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
175 ** default definition.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
176 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
177 #if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
178 defined(__ELF__) /* { */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
179 #define LUAI_FUNC __attribute__((visibility("hidden"))) extern
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
180 #define LUAI_DDEC LUAI_FUNC
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
181 #define LUAI_DDEF /* empty */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
182
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
183 #else /* }{ */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
184 #define LUAI_FUNC extern
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
185 #define LUAI_DDEC extern
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
186 #define LUAI_DDEF /* empty */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
187 #endif /* } */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
188
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
189
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
190
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
191 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
192 @@ LUA_QL describes how error messages quote program elements.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
193 ** CHANGE it if you want a different appearance.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
194 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
195 #define LUA_QL(x) "'" x "'"
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
196 #define LUA_QS LUA_QL("%s")
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
197
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
198
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
199 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
200 @@ LUA_IDSIZE gives the maximum size for the description of the source
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
201 @* of a function in debug information.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
202 ** CHANGE it if you want a different size.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
203 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
204 #define LUA_IDSIZE 60
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
205
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
206
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
207 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
208 @@ luai_writestring/luai_writeline define how 'print' prints its results.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
209 ** They are only used in libraries and the stand-alone program. (The #if
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
210 ** avoids including 'stdio.h' everywhere.)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
211 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
212 #if defined(LUA_LIB) || defined(lua_c)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
213 #include <stdio.h>
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
214 #define luai_writestring(s,l) fwrite((s), sizeof(char), (l), stdout)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
215 #define luai_writeline() (luai_writestring("\n", 1), fflush(stdout))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
216 #endif
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
217
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
218 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
219 @@ luai_writestringerror defines how to print error messages.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
220 ** (A format string with one argument is enough for Lua...)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
221 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
222 #define luai_writestringerror(s,p) \
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
223 (fprintf(stderr, (s), (p)), fflush(stderr))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
224
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
225
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
226 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
227 @@ LUAI_MAXSHORTLEN is the maximum length for short strings, that is,
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
228 ** strings that are internalized. (Cannot be smaller than reserved words
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
229 ** or tags for metamethods, as these strings must be internalized;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
230 ** #("function") = 8, #("__newindex") = 10.)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
231 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
232 #define LUAI_MAXSHORTLEN 40
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
233
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
234
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
235
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
236 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
237 ** {==================================================================
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
238 ** Compatibility with previous versions
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
239 ** ===================================================================
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
240 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
241
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
242 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
243 @@ LUA_COMPAT_ALL controls all compatibility options.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
244 ** You can define it to get all options, or change specific options
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
245 ** to fit your specific needs.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
246 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
247 #if defined(LUA_COMPAT_ALL) /* { */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
248
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
249 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
250 @@ LUA_COMPAT_UNPACK controls the presence of global 'unpack'.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
251 ** You can replace it with 'table.unpack'.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
252 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
253 #define LUA_COMPAT_UNPACK
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
254
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
255 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
256 @@ LUA_COMPAT_LOADERS controls the presence of table 'package.loaders'.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
257 ** You can replace it with 'package.searchers'.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
258 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
259 #define LUA_COMPAT_LOADERS
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
260
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
261 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
262 @@ macro 'lua_cpcall' emulates deprecated function lua_cpcall.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
263 ** You can call your C function directly (with light C functions).
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
264 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
265 #define lua_cpcall(L,f,u) \
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
266 (lua_pushcfunction(L, (f)), \
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
267 lua_pushlightuserdata(L,(u)), \
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
268 lua_pcall(L,1,0,0))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
269
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
270
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
271 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
272 @@ LUA_COMPAT_LOG10 defines the function 'log10' in the math library.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
273 ** You can rewrite 'log10(x)' as 'log(x, 10)'.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
274 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
275 #define LUA_COMPAT_LOG10
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
276
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
277 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
278 @@ LUA_COMPAT_LOADSTRING defines the function 'loadstring' in the base
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
279 ** library. You can rewrite 'loadstring(s)' as 'load(s)'.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
280 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
281 #define LUA_COMPAT_LOADSTRING
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
282
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
283 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
284 @@ LUA_COMPAT_MAXN defines the function 'maxn' in the table library.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
285 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
286 #define LUA_COMPAT_MAXN
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
287
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
288 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
289 @@ The following macros supply trivial compatibility for some
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
290 ** changes in the API. The macros themselves document how to
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
291 ** change your code to avoid using them.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
292 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
293 #define lua_strlen(L,i) lua_rawlen(L, (i))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
294
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
295 #define lua_objlen(L,i) lua_rawlen(L, (i))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
296
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
297 #define lua_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
298 #define lua_lessthan(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPLT)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
299
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
300 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
301 @@ LUA_COMPAT_MODULE controls compatibility with previous
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
302 ** module functions 'module' (Lua) and 'luaL_register' (C).
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
303 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
304 #define LUA_COMPAT_MODULE
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
305
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
306 #endif /* } */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
307
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
308 /* }================================================================== */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
309
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
310
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
311
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
312 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
313 @@ LUAI_BITSINT defines the number of bits in an int.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
314 ** CHANGE here if Lua cannot automatically detect the number of bits of
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
315 ** your machine. Probably you do not need to change this.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
316 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
317 /* avoid overflows in comparison */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
318 #if INT_MAX-20 < 32760 /* { */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
319 #define LUAI_BITSINT 16
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
320 #elif INT_MAX > 2147483640L /* }{ */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
321 /* int has at least 32 bits */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
322 #define LUAI_BITSINT 32
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
323 #else /* }{ */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
324 #error "you must define LUA_BITSINT with number of bits in an integer"
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
325 #endif /* } */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
326
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
327
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
328 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
329 @@ LUA_INT32 is an signed integer with exactly 32 bits.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
330 @@ LUAI_UMEM is an unsigned integer big enough to count the total
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
331 @* memory used by Lua.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
332 @@ LUAI_MEM is a signed integer big enough to count the total memory
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
333 @* used by Lua.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
334 ** CHANGE here if for some weird reason the default definitions are not
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
335 ** good enough for your machine. Probably you do not need to change
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
336 ** this.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
337 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
338 #if LUAI_BITSINT >= 32 /* { */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
339 #define LUA_INT32 int
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
340 #define LUAI_UMEM size_t
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
341 #define LUAI_MEM ptrdiff_t
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
342 #else /* }{ */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
343 /* 16-bit ints */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
344 #define LUA_INT32 long
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
345 #define LUAI_UMEM unsigned long
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
346 #define LUAI_MEM long
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
347 #endif /* } */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
348
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
349
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
350 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
351 @@ LUAI_MAXSTACK limits the size of the Lua stack.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
352 ** CHANGE it if you need a different limit. This limit is arbitrary;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
353 ** its only purpose is to stop Lua to consume unlimited stack
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
354 ** space (and to reserve some numbers for pseudo-indices).
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
355 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
356 #if LUAI_BITSINT >= 32
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
357 #define LUAI_MAXSTACK 1000000
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
358 #else
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
359 #define LUAI_MAXSTACK 15000
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
360 #endif
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
361
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
362 /* reserve some space for error handling */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
363 #define LUAI_FIRSTPSEUDOIDX (-LUAI_MAXSTACK - 1000)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
364
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
365
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
366
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
367
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
368 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
369 @@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
370 ** CHANGE it if it uses too much C-stack space.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
371 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
372 #define LUAL_BUFFERSIZE BUFSIZ
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
373
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
374
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
375
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
376
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
377 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
378 ** {==================================================================
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
379 @@ LUA_NUMBER is the type of numbers in Lua.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
380 ** CHANGE the following definitions only if you want to build Lua
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
381 ** with a number type different from double. You may also need to
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
382 ** change lua_number2int & lua_number2integer.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
383 ** ===================================================================
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
384 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
385
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
386 #define LUA_NUMBER_DOUBLE
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
387 #define LUA_NUMBER double
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
388
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
389 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
390 @@ LUAI_UACNUMBER is the result of an 'usual argument conversion'
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
391 @* over a number.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
392 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
393 #define LUAI_UACNUMBER double
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
394
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
395
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
396 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
397 @@ LUA_NUMBER_SCAN is the format for reading numbers.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
398 @@ LUA_NUMBER_FMT is the format for writing numbers.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
399 @@ lua_number2str converts a number to a string.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
400 @@ LUAI_MAXNUMBER2STR is maximum size of previous conversion.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
401 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
402 #define LUA_NUMBER_SCAN "%lf"
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
403 #define LUA_NUMBER_FMT "%.14g"
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
404 #define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
405 #define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
406
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
407
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
408 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
409 @@ l_mathop allows the addition of an 'l' or 'f' to all math operations
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
410 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
411 #define l_mathop(x) (x)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
412
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
413
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
414 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
415 @@ lua_str2number converts a decimal numeric string to a number.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
416 @@ lua_strx2number converts an hexadecimal numeric string to a number.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
417 ** In C99, 'strtod' does both conversions. C89, however, has no function
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
418 ** to convert floating hexadecimal strings to numbers. For these
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
419 ** systems, you can leave 'lua_strx2number' undefined and Lua will
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
420 ** provide its own implementation.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
421 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
422 #define lua_str2number(s,p) strtod((s), (p))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
423
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
424 #if defined(LUA_USE_STRTODHEX)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
425 #define lua_strx2number(s,p) strtod((s), (p))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
426 #endif
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
427
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
428
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
429 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
430 @@ The luai_num* macros define the primitive operations over numbers.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
431 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
432
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
433 /* the following operations need the math library */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
434 #if defined(lobject_c) || defined(lvm_c)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
435 #include <math.h>
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
436 #define luai_nummod(L,a,b) ((a) - l_mathop(floor)((a)/(b))*(b))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
437 #define luai_numpow(L,a,b) (l_mathop(pow)(a,b))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
438 #endif
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
439
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
440 /* these are quite standard operations */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
441 #if defined(LUA_CORE)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
442 #define luai_numadd(L,a,b) ((a)+(b))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
443 #define luai_numsub(L,a,b) ((a)-(b))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
444 #define luai_nummul(L,a,b) ((a)*(b))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
445 #define luai_numdiv(L,a,b) ((a)/(b))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
446 #define luai_numunm(L,a) (-(a))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
447 #define luai_numeq(a,b) ((a)==(b))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
448 #define luai_numlt(L,a,b) ((a)<(b))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
449 #define luai_numle(L,a,b) ((a)<=(b))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
450 #define luai_numisnan(L,a) (!luai_numeq((a), (a)))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
451 #endif
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
452
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
453
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
454
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
455 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
456 @@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
457 ** CHANGE that if ptrdiff_t is not adequate on your machine. (On most
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
458 ** machines, ptrdiff_t gives a good choice between int or long.)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
459 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
460 #define LUA_INTEGER ptrdiff_t
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
461
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
462 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
463 @@ LUA_UNSIGNED is the integral type used by lua_pushunsigned/lua_tounsigned.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
464 ** It must have at least 32 bits.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
465 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
466 #define LUA_UNSIGNED unsigned LUA_INT32
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
467
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
468
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
469
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
470 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
471 ** Some tricks with doubles
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
472 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
473
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
474 #if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) /* { */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
475 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
476 ** The next definitions activate some tricks to speed up the
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
477 ** conversion from doubles to integer types, mainly to LUA_UNSIGNED.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
478 **
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
479 @@ LUA_MSASMTRICK uses Microsoft assembler to avoid clashes with a
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
480 ** DirectX idiosyncrasy.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
481 **
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
482 @@ LUA_IEEE754TRICK uses a trick that should work on any machine
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
483 ** using IEEE754 with a 32-bit integer type.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
484 **
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
485 @@ LUA_IEEELL extends the trick to LUA_INTEGER; should only be
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
486 ** defined when LUA_INTEGER is a 32-bit integer.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
487 **
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
488 @@ LUA_IEEEENDIAN is the endianness of doubles in your machine
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
489 ** (0 for little endian, 1 for big endian); if not defined, Lua will
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
490 ** check it dynamically for LUA_IEEE754TRICK (but not for LUA_NANTRICK).
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
491 **
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
492 @@ LUA_NANTRICK controls the use of a trick to pack all types into
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
493 ** a single double value, using NaN values to represent non-number
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
494 ** values. The trick only works on 32-bit machines (ints and pointers
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
495 ** are 32-bit values) with numbers represented as IEEE 754-2008 doubles
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
496 ** with conventional endianess (12345678 or 87654321), in CPUs that do
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
497 ** not produce signaling NaN values (all NaNs are quiet).
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
498 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
499
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
500 /* Microsoft compiler on a Pentium (32 bit) ? */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
501 #if defined(LUA_WIN) && defined(_MSC_VER) && defined(_M_IX86) /* { */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
502
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
503 #define LUA_MSASMTRICK
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
504 #define LUA_IEEEENDIAN 0
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
505 #define LUA_NANTRICK
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
506
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
507
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
508 /* pentium 32 bits? */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
509 #elif defined(__i386__) || defined(__i386) || defined(__X86__) /* }{ */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
510
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
511 #define LUA_IEEE754TRICK
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
512 #define LUA_IEEELL
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
513 #define LUA_IEEEENDIAN 0
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
514 #define LUA_NANTRICK
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
515
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
516 /* pentium 64 bits? */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
517 #elif defined(__x86_64) /* }{ */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
518
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
519 #define LUA_IEEE754TRICK
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
520 #define LUA_IEEEENDIAN 0
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
521
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
522 #elif defined(__POWERPC__) || defined(__ppc__) /* }{ */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
523
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
524 #define LUA_IEEE754TRICK
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
525 #define LUA_IEEEENDIAN 1
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
526
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
527 #else /* }{ */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
528
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
529 /* assume IEEE754 and a 32-bit integer type */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
530 #define LUA_IEEE754TRICK
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
531
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
532 #endif /* } */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
533
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
534 #endif /* } */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
535
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
536 /* }================================================================== */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
537
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
538
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
539
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
540
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
541 /* =================================================================== */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
542
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
543 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
544 ** Local configuration. You can use this space to add your redefinitions
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
545 ** without modifying the main part of the file.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
546 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
547
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
548
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
549
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
550 #endif
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
551