diff options
-rw-r--r-- | lapi.c | 4 | ||||
-rw-r--r-- | lcode.c | 4 | ||||
-rw-r--r-- | ldblib.c | 54 | ||||
-rw-r--r-- | ldo.c | 24 | ||||
-rw-r--r-- | lgc.c | 4 | ||||
-rw-r--r-- | llimits.h | 14 | ||||
-rw-r--r-- | loadlib.c | 9 | ||||
-rw-r--r-- | lobject.c | 4 | ||||
-rw-r--r-- | lopcodes.h | 6 | ||||
-rw-r--r-- | loslib.c | 4 | ||||
-rw-r--r-- | lparser.c | 12 | ||||
-rw-r--r-- | lparser.h | 6 | ||||
-rw-r--r-- | lstrlib.c | 6 | ||||
-rw-r--r-- | ltable.c | 14 | ||||
-rw-r--r-- | luaconf.h | 283 | ||||
-rw-r--r-- | lvm.c | 42 |
16 files changed, 237 insertions, 253 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 2.28 2005/02/23 17:30:22 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.29 2005/03/08 18:09:16 roberto Exp roberto $ |
3 | ** Lua API | 3 | ** Lua API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -95,7 +95,7 @@ void luaA_pushobject (lua_State *L, const TValue *o) { | |||
95 | LUA_API int lua_checkstack (lua_State *L, int size) { | 95 | LUA_API int lua_checkstack (lua_State *L, int size) { |
96 | int res; | 96 | int res; |
97 | lua_lock(L); | 97 | lua_lock(L); |
98 | if ((L->top - L->base + size) > MAXCSTACK) | 98 | if ((L->top - L->base + size) > LUAC_MAXCSTACK) |
99 | res = 0; /* stack overflow */ | 99 | res = 0; /* stack overflow */ |
100 | else { | 100 | else { |
101 | luaD_checkstack(L, size); | 101 | luaD_checkstack(L, size); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lcode.c,v 2.8 2004/12/03 20:35:33 roberto Exp roberto $ | 2 | ** $Id: lcode.c,v 2.9 2005/01/10 18:17:39 roberto Exp roberto $ |
3 | ** Code generator for Lua | 3 | ** Code generator for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -606,7 +606,7 @@ void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e) { | |||
606 | if (op == OPR_MINUS) { | 606 | if (op == OPR_MINUS) { |
607 | luaK_exp2val(fs, e); | 607 | luaK_exp2val(fs, e); |
608 | if (e->k == VK && ttisnumber(&fs->f->k[e->info])) | 608 | if (e->k == VK && ttisnumber(&fs->f->k[e->info])) |
609 | e->info = luaK_numberK(fs, num_unm(nvalue(&fs->f->k[e->info]))); | 609 | e->info = luaK_numberK(fs, luac_numunm(nvalue(&fs->f->k[e->info]))); |
610 | else { | 610 | else { |
611 | luaK_exp2anyreg(fs, e); | 611 | luaK_exp2anyreg(fs, e); |
612 | freeexp(fs, e); | 612 | freeexp(fs, e); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldblib.c,v 1.92 2005/01/18 17:23:25 roberto Exp roberto $ | 2 | ** $Id: ldblib.c,v 1.93 2005/02/18 12:40:02 roberto Exp roberto $ |
3 | ** Interface from Lua to its debug API | 3 | ** Interface from Lua to its debug API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -19,7 +19,7 @@ | |||
19 | 19 | ||
20 | 20 | ||
21 | 21 | ||
22 | static int getmetatable (lua_State *L) { | 22 | static int db_getmetatable (lua_State *L) { |
23 | luaL_checkany(L, 1); | 23 | luaL_checkany(L, 1); |
24 | if (!lua_getmetatable(L, 1)) { | 24 | if (!lua_getmetatable(L, 1)) { |
25 | lua_pushnil(L); /* no metatable */ | 25 | lua_pushnil(L); /* no metatable */ |
@@ -28,7 +28,7 @@ static int getmetatable (lua_State *L) { | |||
28 | } | 28 | } |
29 | 29 | ||
30 | 30 | ||
31 | static int setmetatable (lua_State *L) { | 31 | static int db_setmetatable (lua_State *L) { |
32 | int t = lua_type(L, 2); | 32 | int t = lua_type(L, 2); |
33 | luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2, | 33 | luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2, |
34 | "nil or table expected"); | 34 | "nil or table expected"); |
@@ -38,13 +38,13 @@ static int setmetatable (lua_State *L) { | |||
38 | } | 38 | } |
39 | 39 | ||
40 | 40 | ||
41 | static int getfenv (lua_State *L) { | 41 | static int db_getfenv (lua_State *L) { |
42 | lua_getfenv(L, 1); | 42 | lua_getfenv(L, 1); |
43 | return 1; | 43 | return 1; |
44 | } | 44 | } |
45 | 45 | ||
46 | 46 | ||
47 | static int setfenv (lua_State *L) { | 47 | static int db_setfenv (lua_State *L) { |
48 | luaL_checktype(L, 2, LUA_TTABLE); | 48 | luaL_checktype(L, 2, LUA_TTABLE); |
49 | lua_settop(L, 2); | 49 | lua_settop(L, 2); |
50 | if (lua_setfenv(L, 1) == 0) | 50 | if (lua_setfenv(L, 1) == 0) |
@@ -77,7 +77,7 @@ static lua_State *getthread (lua_State *L, int *arg) { | |||
77 | } | 77 | } |
78 | 78 | ||
79 | 79 | ||
80 | static int getinfo (lua_State *L) { | 80 | static int db_getinfo (lua_State *L) { |
81 | lua_Debug ar; | 81 | lua_Debug ar; |
82 | int arg; | 82 | int arg; |
83 | lua_State *L1 = getthread(L, &arg); | 83 | lua_State *L1 = getthread(L, &arg); |
@@ -130,7 +130,7 @@ static int getinfo (lua_State *L) { | |||
130 | } | 130 | } |
131 | 131 | ||
132 | 132 | ||
133 | static int getlocal (lua_State *L) { | 133 | static int db_getlocal (lua_State *L) { |
134 | int arg; | 134 | int arg; |
135 | lua_State *L1 = getthread(L, &arg); | 135 | lua_State *L1 = getthread(L, &arg); |
136 | lua_Debug ar; | 136 | lua_Debug ar; |
@@ -151,7 +151,7 @@ static int getlocal (lua_State *L) { | |||
151 | } | 151 | } |
152 | 152 | ||
153 | 153 | ||
154 | static int setlocal (lua_State *L) { | 154 | static int db_setlocal (lua_State *L) { |
155 | int arg; | 155 | int arg; |
156 | lua_State *L1 = getthread(L, &arg); | 156 | lua_State *L1 = getthread(L, &arg); |
157 | lua_Debug ar; | 157 | lua_Debug ar; |
@@ -178,12 +178,12 @@ static int auxupvalue (lua_State *L, int get) { | |||
178 | } | 178 | } |
179 | 179 | ||
180 | 180 | ||
181 | static int getupvalue (lua_State *L) { | 181 | static int db_getupvalue (lua_State *L) { |
182 | return auxupvalue(L, 1); | 182 | return auxupvalue(L, 1); |
183 | } | 183 | } |
184 | 184 | ||
185 | 185 | ||
186 | static int setupvalue (lua_State *L) { | 186 | static int db_setupvalue (lua_State *L) { |
187 | luaL_checkany(L, 3); | 187 | luaL_checkany(L, 3); |
188 | return auxupvalue(L, 0); | 188 | return auxupvalue(L, 0); |
189 | } | 189 | } |
@@ -244,7 +244,7 @@ static void gethooktable (lua_State *L) { | |||
244 | } | 244 | } |
245 | 245 | ||
246 | 246 | ||
247 | static int sethook (lua_State *L) { | 247 | static int db_sethook (lua_State *L) { |
248 | int arg; | 248 | int arg; |
249 | lua_State *L1 = getthread(L, &arg); | 249 | lua_State *L1 = getthread(L, &arg); |
250 | if (lua_isnoneornil(L, arg+1)) { | 250 | if (lua_isnoneornil(L, arg+1)) { |
@@ -267,7 +267,7 @@ static int sethook (lua_State *L) { | |||
267 | } | 267 | } |
268 | 268 | ||
269 | 269 | ||
270 | static int gethook (lua_State *L) { | 270 | static int db_gethook (lua_State *L) { |
271 | int arg; | 271 | int arg; |
272 | lua_State *L1 = getthread(L, &arg); | 272 | lua_State *L1 = getthread(L, &arg); |
273 | char buff[5]; | 273 | char buff[5]; |
@@ -288,7 +288,7 @@ static int gethook (lua_State *L) { | |||
288 | } | 288 | } |
289 | 289 | ||
290 | 290 | ||
291 | static int debug (lua_State *L) { | 291 | static int db_debug (lua_State *L) { |
292 | for (;;) { | 292 | for (;;) { |
293 | char buffer[250]; | 293 | char buffer[250]; |
294 | fputs("lua_debug> ", stderr); | 294 | fputs("lua_debug> ", stderr); |
@@ -308,7 +308,7 @@ static int debug (lua_State *L) { | |||
308 | #define LEVELS1 12 /* size of the first part of the stack */ | 308 | #define LEVELS1 12 /* size of the first part of the stack */ |
309 | #define LEVELS2 10 /* size of the second part of the stack */ | 309 | #define LEVELS2 10 /* size of the second part of the stack */ |
310 | 310 | ||
311 | static int errorfb (lua_State *L) { | 311 | static int db_errorfb (lua_State *L) { |
312 | int level; | 312 | int level; |
313 | int firstpart = 1; /* still before eventual `...' */ | 313 | int firstpart = 1; /* still before eventual `...' */ |
314 | int arg; | 314 | int arg; |
@@ -362,19 +362,19 @@ static int errorfb (lua_State *L) { | |||
362 | 362 | ||
363 | 363 | ||
364 | static const luaL_reg dblib[] = { | 364 | static const luaL_reg dblib[] = { |
365 | {"getmetatable", getmetatable}, | 365 | {"getmetatable", db_getmetatable}, |
366 | {"setmetatable", setmetatable}, | 366 | {"setmetatable", db_setmetatable}, |
367 | {"getfenv", getfenv}, | 367 | {"getfenv", db_getfenv}, |
368 | {"setfenv", setfenv}, | 368 | {"setfenv", db_setfenv}, |
369 | {"getlocal", getlocal}, | 369 | {"getlocal", db_getlocal}, |
370 | {"getinfo", getinfo}, | 370 | {"getinfo", db_getinfo}, |
371 | {"gethook", gethook}, | 371 | {"gethook", db_gethook}, |
372 | {"getupvalue", getupvalue}, | 372 | {"getupvalue", db_getupvalue}, |
373 | {"sethook", sethook}, | 373 | {"sethook", db_sethook}, |
374 | {"setlocal", setlocal}, | 374 | {"setlocal", db_setlocal}, |
375 | {"setupvalue", setupvalue}, | 375 | {"setupvalue", db_setupvalue}, |
376 | {"debug", debug}, | 376 | {"debug", db_debug}, |
377 | {"traceback", errorfb}, | 377 | {"traceback", db_errorfb}, |
378 | {NULL, NULL} | 378 | {NULL, NULL} |
379 | }; | 379 | }; |
380 | 380 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 2.14 2005/02/18 12:40:02 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 2.15 2005/03/08 18:09:16 roberto Exp roberto $ |
3 | ** Stack and Call structure of Lua | 3 | ** Stack and Call structure of Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -43,7 +43,7 @@ | |||
43 | /* chain list of long jump buffers */ | 43 | /* chain list of long jump buffers */ |
44 | struct lua_longjmp { | 44 | struct lua_longjmp { |
45 | struct lua_longjmp *previous; | 45 | struct lua_longjmp *previous; |
46 | l_jmpbuf b; | 46 | luac_jmpbuf b; |
47 | volatile int status; /* error code */ | 47 | volatile int status; /* error code */ |
48 | }; | 48 | }; |
49 | 49 | ||
@@ -71,7 +71,7 @@ static void seterrorobj (lua_State *L, int errcode, StkId oldtop) { | |||
71 | void luaD_throw (lua_State *L, int errcode) { | 71 | void luaD_throw (lua_State *L, int errcode) { |
72 | if (L->errorJmp) { | 72 | if (L->errorJmp) { |
73 | L->errorJmp->status = errcode; | 73 | L->errorJmp->status = errcode; |
74 | L_THROW(L, L->errorJmp); | 74 | LUAC_THROW(L, L->errorJmp); |
75 | } | 75 | } |
76 | else { | 76 | else { |
77 | if (G(L)->panic) G(L)->panic(L); | 77 | if (G(L)->panic) G(L)->panic(L); |
@@ -85,7 +85,7 @@ int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) { | |||
85 | lj.status = 0; | 85 | lj.status = 0; |
86 | lj.previous = L->errorJmp; /* chain new error handler */ | 86 | lj.previous = L->errorJmp; /* chain new error handler */ |
87 | L->errorJmp = &lj; | 87 | L->errorJmp = &lj; |
88 | L_TRY(L, &lj, | 88 | LUAC_TRY(L, &lj, |
89 | (*f)(L, ud); | 89 | (*f)(L, ud); |
90 | ); | 90 | ); |
91 | L->errorJmp = lj.previous; /* restore old error handler */ | 91 | L->errorJmp = lj.previous; /* restore old error handler */ |
@@ -95,10 +95,10 @@ int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) { | |||
95 | 95 | ||
96 | static void restore_stack_limit (lua_State *L) { | 96 | static void restore_stack_limit (lua_State *L) { |
97 | lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK - 1); | 97 | lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK - 1); |
98 | if (L->size_ci > LUA_MAXCALLS) { /* there was an overflow? */ | 98 | if (L->size_ci > LUAC_MAXCALLS) { /* there was an overflow? */ |
99 | int inuse = (L->ci - L->base_ci); | 99 | int inuse = (L->ci - L->base_ci); |
100 | if (inuse + 1 < LUA_MAXCALLS) /* can `undo' overflow? */ | 100 | if (inuse + 1 < LUAC_MAXCALLS) /* can `undo' overflow? */ |
101 | luaD_reallocCI(L, LUA_MAXCALLS); | 101 | luaD_reallocCI(L, LUAC_MAXCALLS); |
102 | } | 102 | } |
103 | } | 103 | } |
104 | 104 | ||
@@ -149,11 +149,11 @@ void luaD_growstack (lua_State *L, int n) { | |||
149 | 149 | ||
150 | 150 | ||
151 | static CallInfo *growCI (lua_State *L) { | 151 | static CallInfo *growCI (lua_State *L) { |
152 | if (L->size_ci > LUA_MAXCALLS) /* overflow while handling overflow? */ | 152 | if (L->size_ci > LUAC_MAXCALLS) /* overflow while handling overflow? */ |
153 | luaD_throw(L, LUA_ERRERR); | 153 | luaD_throw(L, LUA_ERRERR); |
154 | else { | 154 | else { |
155 | luaD_reallocCI(L, 2*L->size_ci); | 155 | luaD_reallocCI(L, 2*L->size_ci); |
156 | if (L->size_ci > LUA_MAXCALLS) | 156 | if (L->size_ci > LUAC_MAXCALLS) |
157 | luaG_runerror(L, "stack overflow"); | 157 | luaG_runerror(L, "stack overflow"); |
158 | } | 158 | } |
159 | return ++L->ci; | 159 | return ++L->ci; |
@@ -340,10 +340,10 @@ void luaD_poscall (lua_State *L, int wanted, StkId firstResult) { | |||
340 | ** function position. | 340 | ** function position. |
341 | */ | 341 | */ |
342 | void luaD_call (lua_State *L, StkId func, int nResults) { | 342 | void luaD_call (lua_State *L, StkId func, int nResults) { |
343 | if (++L->nCcalls >= LUA_MAXCCALLS) { | 343 | if (++L->nCcalls >= LUAC_MAXCCALLS) { |
344 | if (L->nCcalls == LUA_MAXCCALLS) | 344 | if (L->nCcalls == LUAC_MAXCCALLS) |
345 | luaG_runerror(L, "C stack overflow"); | 345 | luaG_runerror(L, "C stack overflow"); |
346 | else if (L->nCcalls >= (LUA_MAXCCALLS + (LUA_MAXCCALLS>>3))) | 346 | else if (L->nCcalls >= (LUAC_MAXCCALLS + (LUAC_MAXCCALLS>>3))) |
347 | luaD_throw(L, LUA_ERRERR); /* error while handing stack error */ | 347 | luaD_throw(L, LUA_ERRERR); /* error while handing stack error */ |
348 | } | 348 | } |
349 | if (luaD_precall(L, func, nResults) == PCRLUA) { /* is a Lua function? */ | 349 | if (luaD_precall(L, func, nResults) == PCRLUA) { /* is a Lua function? */ |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.c,v 2.26 2005/02/18 12:40:02 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 2.27 2005/02/23 17:30:22 roberto Exp roberto $ |
3 | ** Garbage Collector | 3 | ** Garbage Collector |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -242,7 +242,7 @@ static void traverseclosure (global_State *g, Closure *cl) { | |||
242 | static void checkstacksizes (lua_State *L, StkId max) { | 242 | static void checkstacksizes (lua_State *L, StkId max) { |
243 | int ci_used = L->ci - L->base_ci; /* number of `ci' in use */ | 243 | int ci_used = L->ci - L->base_ci; /* number of `ci' in use */ |
244 | int s_used = max - L->stack; /* part of stack in use */ | 244 | int s_used = max - L->stack; /* part of stack in use */ |
245 | if (L->size_ci > LUA_MAXCALLS) /* handling overflow? */ | 245 | if (L->size_ci > LUAC_MAXCALLS) /* handling overflow? */ |
246 | return; /* do not touch the stacks */ | 246 | return; /* do not touch the stacks */ |
247 | if (4*ci_used < L->size_ci && 2*BASIC_CI_SIZE < L->size_ci) | 247 | if (4*ci_used < L->size_ci && 2*BASIC_CI_SIZE < L->size_ci) |
248 | luaD_reallocCI(L, L->size_ci/2); /* still big enough... */ | 248 | luaD_reallocCI(L, L->size_ci/2); /* still big enough... */ |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: llimits.h,v 1.62 2004/12/13 12:15:11 roberto Exp roberto $ | 2 | ** $Id: llimits.h,v 1.63 2005/01/14 14:19:42 roberto Exp roberto $ |
3 | ** Limits, basic types, and some other `installation-dependent' definitions | 3 | ** Limits, basic types, and some other `installation-dependent' definitions |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -15,12 +15,14 @@ | |||
15 | #include "lua.h" | 15 | #include "lua.h" |
16 | 16 | ||
17 | 17 | ||
18 | #define api_check luac_apicheck | ||
18 | 19 | ||
19 | typedef LUA_UINT32 lu_int32; | ||
20 | 20 | ||
21 | typedef LU_MEM lu_mem; | 21 | typedef LUAC_UINT32 lu_int32; |
22 | 22 | ||
23 | typedef L_MEM l_mem; | 23 | typedef LUAC_UMEM lu_mem; |
24 | |||
25 | typedef LUAC_MEM l_mem; | ||
24 | 26 | ||
25 | 27 | ||
26 | 28 | ||
@@ -45,11 +47,11 @@ typedef unsigned char lu_byte; | |||
45 | 47 | ||
46 | 48 | ||
47 | /* type to ensure maximum alignment */ | 49 | /* type to ensure maximum alignment */ |
48 | typedef LUSER_ALIGNMENT_T L_Umaxalign; | 50 | typedef LUAC_USER_ALIGNMENT_T L_Umaxalign; |
49 | 51 | ||
50 | 52 | ||
51 | /* result of a `usual argument conversion' over lua_Number */ | 53 | /* result of a `usual argument conversion' over lua_Number */ |
52 | typedef LUA_UACNUMBER l_uacNumber; | 54 | typedef LUAC_UACNUMBER l_uacNumber; |
53 | 55 | ||
54 | 56 | ||
55 | #define check_exp(c,e) (lua_assert(c), (e)) | 57 | #define check_exp(c,e) (lua_assert(c), (e)) |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: loadlib.c,v 1.18 2005/02/28 15:58:48 roberto Exp roberto $ | 2 | ** $Id: loadlib.c,v 1.19 2005/03/07 18:07:34 roberto Exp roberto $ |
3 | ** Dynamic library loader for Lua | 3 | ** Dynamic library loader for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | * | 5 | * |
@@ -33,7 +33,7 @@ static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym); | |||
33 | 33 | ||
34 | 34 | ||
35 | 35 | ||
36 | #if defined(USE_DLOPEN) | 36 | #if defined(LUA_USEDLOPEN) |
37 | /* | 37 | /* |
38 | ** {======================================================================== | 38 | ** {======================================================================== |
39 | ** This is an implementation of loadlib based on the dlfcn interface. | 39 | ** This is an implementation of loadlib based on the dlfcn interface. |
@@ -67,7 +67,7 @@ static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { | |||
67 | 67 | ||
68 | 68 | ||
69 | 69 | ||
70 | #elif defined(USE_DLL) | 70 | #elif defined(LUA_USEDLL) |
71 | /* | 71 | /* |
72 | ** {====================================================================== | 72 | ** {====================================================================== |
73 | ** This is an implementation of loadlib for Windows using native functions. | 73 | ** This is an implementation of loadlib for Windows using native functions. |
@@ -109,7 +109,7 @@ static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { | |||
109 | 109 | ||
110 | 110 | ||
111 | 111 | ||
112 | #elif defined(USE_DYLD) | 112 | #elif defined(LUA_USEDYLD) |
113 | /* | 113 | /* |
114 | ** {====================================================================== | 114 | ** {====================================================================== |
115 | ** Native Mac OS X / Darwin Implementation | 115 | ** Native Mac OS X / Darwin Implementation |
@@ -119,6 +119,7 @@ static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { | |||
119 | #include <mach-o/dyld.h> | 119 | #include <mach-o/dyld.h> |
120 | 120 | ||
121 | 121 | ||
122 | /* Mac appends a `_' before C function names */ | ||
122 | #undef POF | 123 | #undef POF |
123 | #define POF "_" LUA_POF | 124 | #define POF "_" LUA_POF |
124 | 125 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lobject.c,v 2.8 2005/01/10 18:17:39 roberto Exp roberto $ | 2 | ** $Id: lobject.c,v 2.9 2005/03/08 18:09:16 roberto Exp roberto $ |
3 | ** Some generic functions over Lua objects | 3 | ** Some generic functions over Lua objects |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -74,7 +74,7 @@ int luaO_rawequalObj (const TValue *t1, const TValue *t2) { | |||
74 | case LUA_TNIL: | 74 | case LUA_TNIL: |
75 | return 1; | 75 | return 1; |
76 | case LUA_TNUMBER: | 76 | case LUA_TNUMBER: |
77 | return num_eq(nvalue(t1), nvalue(t2)); | 77 | return luac_numeq(nvalue(t1), nvalue(t2)); |
78 | case LUA_TBOOLEAN: | 78 | case LUA_TBOOLEAN: |
79 | return bvalue(t1) == bvalue(t2); /* boolean true must be 1 !! */ | 79 | return bvalue(t1) == bvalue(t2); /* boolean true must be 1 !! */ |
80 | case LUA_TLIGHTUSERDATA: | 80 | case LUA_TLIGHTUSERDATA: |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lopcodes.h,v 1.114 2004/12/02 12:59:10 roberto Exp roberto $ | 2 | ** $Id: lopcodes.h,v 1.115 2005/03/08 18:00:16 roberto Exp roberto $ |
3 | ** Opcodes for Lua virtual machine | 3 | ** Opcodes for Lua virtual machine |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -51,9 +51,9 @@ enum OpMode {iABC, iABx, iAsBx}; /* basic instruction format */ | |||
51 | /* | 51 | /* |
52 | ** limits for opcode arguments. | 52 | ** limits for opcode arguments. |
53 | ** we use (signed) int to manipulate most arguments, | 53 | ** we use (signed) int to manipulate most arguments, |
54 | ** so they must fit in LUA_BITSINT-1 bits (-1 for sign) | 54 | ** so they must fit in LUAC_BITSINT-1 bits (-1 for sign) |
55 | */ | 55 | */ |
56 | #if SIZE_Bx < LUA_BITSINT-1 | 56 | #if SIZE_Bx < LUAC_BITSINT-1 |
57 | #define MAXARG_Bx ((1<<SIZE_Bx)-1) | 57 | #define MAXARG_Bx ((1<<SIZE_Bx)-1) |
58 | #define MAXARG_sBx (MAXARG_Bx>>1) /* `sBx' is signed */ | 58 | #define MAXARG_sBx (MAXARG_Bx>>1) /* `sBx' is signed */ |
59 | #else | 59 | #else |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: loslib.c,v 1.3 2004/10/08 18:57:16 roberto Exp roberto $ | 2 | ** $Id: loslib.c,v 1.4 2005/01/10 19:16:29 roberto Exp roberto $ |
3 | ** Standard Operating System library | 3 | ** Standard Operating System library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -57,7 +57,7 @@ static int io_rename (lua_State *L) { | |||
57 | 57 | ||
58 | 58 | ||
59 | static int io_tmpname (lua_State *L) { | 59 | static int io_tmpname (lua_State *L) { |
60 | #if !USE_TMPNAME | 60 | #if !LUA_USETMPNAME |
61 | luaL_error(L, "`tmpname' not supported"); | 61 | luaL_error(L, "`tmpname' not supported"); |
62 | return 0; | 62 | return 0; |
63 | #else | 63 | #else |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lparser.c,v 2.15 2005/03/08 18:00:16 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 2.16 2005/03/08 18:16:45 roberto Exp roberto $ |
3 | ** Lua Parser | 3 | ** Lua Parser |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -33,7 +33,7 @@ | |||
33 | 33 | ||
34 | #define luaY_checklimit(fs,v,l,m) if ((v)>(l)) errorlimit(fs,l,m) | 34 | #define luaY_checklimit(fs,v,l,m) if ((v)>(l)) errorlimit(fs,l,m) |
35 | 35 | ||
36 | #define enterlevel(ls) if (++(ls)->nestlevel > LUA_MAXPARSERLEVEL) \ | 36 | #define enterlevel(ls) if (++(ls)->nestlevel > LUAC_MAXPARSERLEVEL) \ |
37 | luaX_lexerror(ls, "chunk has too many syntax levels", 0) | 37 | luaX_lexerror(ls, "chunk has too many syntax levels", 0) |
38 | #define leavelevel(ls) ((ls)->nestlevel--) | 38 | #define leavelevel(ls) ((ls)->nestlevel--) |
39 | 39 | ||
@@ -181,7 +181,7 @@ static int registerlocalvar (LexState *ls, TString *varname) { | |||
181 | 181 | ||
182 | static void new_localvar (LexState *ls, TString *name, int n) { | 182 | static void new_localvar (LexState *ls, TString *name, int n) { |
183 | FuncState *fs = ls->fs; | 183 | FuncState *fs = ls->fs; |
184 | luaY_checklimit(fs, fs->nactvar+n+1, MAXVARS, "local variables"); | 184 | luaY_checklimit(fs, fs->nactvar+n+1, LUAC_MAXVARS, "local variables"); |
185 | fs->actvar[fs->nactvar+n] = cast(unsigned short, registerlocalvar(ls, name)); | 185 | fs->actvar[fs->nactvar+n] = cast(unsigned short, registerlocalvar(ls, name)); |
186 | } | 186 | } |
187 | 187 | ||
@@ -213,7 +213,7 @@ static int indexupvalue (FuncState *fs, TString *name, expdesc *v) { | |||
213 | } | 213 | } |
214 | } | 214 | } |
215 | /* new one */ | 215 | /* new one */ |
216 | luaY_checklimit(fs, f->nups + 1, MAXUPVALUES, "upvalues"); | 216 | luaY_checklimit(fs, f->nups + 1, LUAC_MAXUPVALUES, "upvalues"); |
217 | luaM_growvector(fs->L, f->upvalues, f->nups, f->sizeupvalues, | 217 | luaM_growvector(fs->L, f->upvalues, f->nups, f->sizeupvalues, |
218 | TString *, MAX_INT, ""); | 218 | TString *, MAX_INT, ""); |
219 | while (oldsize < f->sizeupvalues) f->upvalues[oldsize++] = NULL; | 219 | while (oldsize < f->sizeupvalues) f->upvalues[oldsize++] = NULL; |
@@ -993,7 +993,7 @@ static int cond (LexState *ls) { | |||
993 | 993 | ||
994 | static void whilestat (LexState *ls, int line) { | 994 | static void whilestat (LexState *ls, int line) { |
995 | /* whilestat -> WHILE cond DO block END */ | 995 | /* whilestat -> WHILE cond DO block END */ |
996 | Instruction codeexp[MAXEXPWHILE + EXTRAEXP]; | 996 | Instruction codeexp[LUAC_MAXEXPWHILE + EXTRAEXP]; |
997 | int lineexp; | 997 | int lineexp; |
998 | int i; | 998 | int i; |
999 | int sizeexp; | 999 | int sizeexp; |
@@ -1011,7 +1011,7 @@ static void whilestat (LexState *ls, int line) { | |||
1011 | luaK_concat(fs, &v.f, fs->jpc); | 1011 | luaK_concat(fs, &v.f, fs->jpc); |
1012 | fs->jpc = NO_JUMP; | 1012 | fs->jpc = NO_JUMP; |
1013 | sizeexp = fs->pc - expinit; /* size of expression code */ | 1013 | sizeexp = fs->pc - expinit; /* size of expression code */ |
1014 | if (sizeexp > MAXEXPWHILE) | 1014 | if (sizeexp > LUAC_MAXEXPWHILE) |
1015 | luaX_syntaxerror(ls, "`while' condition too complex"); | 1015 | luaX_syntaxerror(ls, "`while' condition too complex"); |
1016 | for (i = 0; i < sizeexp; i++) /* save `exp' code */ | 1016 | for (i = 0; i < sizeexp; i++) /* save `exp' code */ |
1017 | codeexp[i] = fs->f->code[expinit + i]; | 1017 | codeexp[i] = fs->f->code[expinit + i]; |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lparser.h,v 1.51 2004/05/31 18:51:50 roberto Exp roberto $ | 2 | ** $Id: lparser.h,v 1.52 2005/03/07 16:58:27 roberto Exp roberto $ |
3 | ** Lua Parser | 3 | ** Lua Parser |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -67,8 +67,8 @@ typedef struct FuncState { | |||
67 | int np; /* number of elements in `p' */ | 67 | int np; /* number of elements in `p' */ |
68 | short nlocvars; /* number of elements in `locvars' */ | 68 | short nlocvars; /* number of elements in `locvars' */ |
69 | lu_byte nactvar; /* number of active local variables */ | 69 | lu_byte nactvar; /* number of active local variables */ |
70 | upvaldesc upvalues[MAXUPVALUES]; /* upvalues */ | 70 | upvaldesc upvalues[LUAC_MAXUPVALUES]; /* upvalues */ |
71 | unsigned short actvar[MAXVARS]; /* declared-variable stack */ | 71 | unsigned short actvar[LUAC_MAXVARS]; /* declared-variable stack */ |
72 | } FuncState; | 72 | } FuncState; |
73 | 73 | ||
74 | 74 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstrlib.c,v 1.108 2004/11/19 16:58:43 roberto Exp roberto $ | 2 | ** $Id: lstrlib.c,v 1.109 2004/12/01 15:46:06 roberto Exp roberto $ |
3 | ** Standard library for string operations and pattern-matching | 3 | ** Standard library for string operations and pattern-matching |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -172,7 +172,7 @@ typedef struct MatchState { | |||
172 | struct { | 172 | struct { |
173 | const char *init; | 173 | const char *init; |
174 | ptrdiff_t len; | 174 | ptrdiff_t len; |
175 | } capture[MAX_CAPTURES]; | 175 | } capture[LUA_MAXCAPTURES]; |
176 | } MatchState; | 176 | } MatchState; |
177 | 177 | ||
178 | 178 | ||
@@ -327,7 +327,7 @@ static const char *start_capture (MatchState *ms, const char *s, | |||
327 | const char *p, int what) { | 327 | const char *p, int what) { |
328 | const char *res; | 328 | const char *res; |
329 | int level = ms->level; | 329 | int level = ms->level; |
330 | if (level >= MAX_CAPTURES) luaL_error(ms->L, "too many captures"); | 330 | if (level >= LUA_MAXCAPTURES) luaL_error(ms->L, "too many captures"); |
331 | ms->capture[level].init = s; | 331 | ms->capture[level].init = s; |
332 | ms->capture[level].len = what; | 332 | ms->capture[level].len = what; |
333 | ms->level = level+1; | 333 | ms->level = level+1; |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltable.c,v 2.15 2005/01/10 18:17:39 roberto Exp roberto $ | 2 | ** $Id: ltable.c,v 2.16 2005/03/08 18:09:16 roberto Exp roberto $ |
3 | ** Lua tables (hash) | 3 | ** Lua tables (hash) |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -38,10 +38,10 @@ | |||
38 | /* | 38 | /* |
39 | ** max size of array part is 2^MAXBITS | 39 | ** max size of array part is 2^MAXBITS |
40 | */ | 40 | */ |
41 | #if LUA_BITSINT > 26 | 41 | #if LUAC_BITSINT > 26 |
42 | #define MAXBITS 26 | 42 | #define MAXBITS 26 |
43 | #else | 43 | #else |
44 | #define MAXBITS (LUA_BITSINT-2) | 44 | #define MAXBITS (LUAC_BITSINT-2) |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | #define MAXASIZE (1 << MAXBITS) | 47 | #define MAXASIZE (1 << MAXBITS) |
@@ -120,7 +120,7 @@ static int arrayindex (const TValue *key) { | |||
120 | lua_Number n = nvalue(key); | 120 | lua_Number n = nvalue(key); |
121 | int k; | 121 | int k; |
122 | lua_number2int(k, n); | 122 | lua_number2int(k, n); |
123 | if (num_eq(cast(lua_Number, k), nvalue(key))) | 123 | if (luac_numeq(cast(lua_Number, k), nvalue(key))) |
124 | return k; | 124 | return k; |
125 | } | 125 | } |
126 | return -1; /* `key' did not match some condition */ | 126 | return -1; /* `key' did not match some condition */ |
@@ -437,7 +437,7 @@ const TValue *luaH_getnum (Table *t, int key) { | |||
437 | lua_Number nk = cast(lua_Number, key); | 437 | lua_Number nk = cast(lua_Number, key); |
438 | Node *n = hashnum(t, nk); | 438 | Node *n = hashnum(t, nk); |
439 | do { /* check whether `key' is somewhere in the chain */ | 439 | do { /* check whether `key' is somewhere in the chain */ |
440 | if (ttisnumber(gkey(n)) && num_eq(nvalue(gkey(n)), nk)) | 440 | if (ttisnumber(gkey(n)) && luac_numeq(nvalue(gkey(n)), nk)) |
441 | return gval(n); /* that's it */ | 441 | return gval(n); /* that's it */ |
442 | else n = gnext(n); | 442 | else n = gnext(n); |
443 | } while (n); | 443 | } while (n); |
@@ -470,7 +470,7 @@ const TValue *luaH_get (Table *t, const TValue *key) { | |||
470 | case LUA_TNUMBER: { | 470 | case LUA_TNUMBER: { |
471 | int k; | 471 | int k; |
472 | lua_number2int(k, (nvalue(key))); | 472 | lua_number2int(k, (nvalue(key))); |
473 | if (num_eq(cast(lua_Number, k), nvalue(key))) /* is an integer index? */ | 473 | if (luac_numeq(cast(lua_Number, k), nvalue(key))) /* index is integer? */ |
474 | return luaH_getnum(t, k); /* use specialized version */ | 474 | return luaH_getnum(t, k); /* use specialized version */ |
475 | /* else go through */ | 475 | /* else go through */ |
476 | } | 476 | } |
@@ -494,7 +494,7 @@ TValue *luaH_set (lua_State *L, Table *t, const TValue *key) { | |||
494 | return cast(TValue *, p); | 494 | return cast(TValue *, p); |
495 | else { | 495 | else { |
496 | if (ttisnil(key)) luaG_runerror(L, "table index is nil"); | 496 | if (ttisnil(key)) luaG_runerror(L, "table index is nil"); |
497 | else if (ttisnumber(key) && !num_eq(nvalue(key), nvalue(key))) | 497 | else if (ttisnumber(key) && !luac_numeq(nvalue(key), nvalue(key))) |
498 | luaG_runerror(L, "table index is NaN"); | 498 | luaG_runerror(L, "table index is NaN"); |
499 | return newkey(L, t, key); | 499 | return newkey(L, t, key); |
500 | } | 500 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: luaconf.h,v 1.32 2005/03/08 18:00:16 roberto Exp roberto $ | 2 | ** $Id: luaconf.h,v 1.33 2005/03/08 18:09:16 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 | */ |
@@ -30,7 +30,7 @@ | |||
30 | ** ======================================================= | 30 | ** ======================================================= |
31 | */ | 31 | */ |
32 | 32 | ||
33 | /* default path */ | 33 | /* CONFIG: default path */ |
34 | #if defined(_WIN32) | 34 | #if defined(_WIN32) |
35 | #define LUA_ROOT "C:\\Program Files\\Lua51" | 35 | #define LUA_ROOT "C:\\Program Files\\Lua51" |
36 | #define LUA_LDIR LUA_ROOT "\\lua" | 36 | #define LUA_LDIR LUA_ROOT "\\lua" |
@@ -51,33 +51,58 @@ | |||
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | 53 | ||
54 | /* CONFIG: directory separator (for submodules) */ | ||
55 | #if defined(_WIN32) | ||
56 | #define LUA_DIRSEP "\\" | ||
57 | #else | ||
58 | #define LUA_DIRSEP "/" | ||
59 | #endif | ||
60 | |||
61 | |||
62 | /* CONFIG: environment variables that hold the search path for packages */ | ||
63 | #define LUA_PATH "LUA_PATH" | ||
64 | #define LUA_CPATH "LUA_CPATH" | ||
65 | |||
66 | /* CONFIG: prefix for open functions in C libraries */ | ||
67 | #define LUA_POF "luaopen_" | ||
68 | |||
69 | /* CONFIG: separator for open functions in C libraries */ | ||
70 | #define LUA_OFSEP "_" | ||
71 | |||
72 | /* CONFIG: separator of templates in a path */ | ||
73 | #define LUA_PATHSEP ';' | ||
54 | 74 | ||
55 | /* type of numbers in Lua */ | 75 | /* CONFIG: wild char in each template */ |
76 | #define LUA_PATH_MARK "?" | ||
77 | |||
78 | |||
79 | |||
80 | /* CONFIG: type of numbers in Lua */ | ||
56 | #define LUA_NUMBER double | 81 | #define LUA_NUMBER double |
57 | 82 | ||
58 | /* formats for Lua numbers */ | 83 | /* CONFIG: formats for Lua numbers */ |
59 | #define LUA_NUMBER_SCAN "%lf" | 84 | #define LUA_NUMBER_SCAN "%lf" |
60 | #define LUA_NUMBER_FMT "%.14g" | 85 | #define LUA_NUMBER_FMT "%.14g" |
61 | 86 | ||
62 | 87 | ||
63 | /* | 88 | /* |
64 | ** type for integer functions | 89 | ** CONFIG: type for integer functions |
65 | ** on most machines, `ptrdiff_t' gives a reasonable size for integers | 90 | ** on most machines, `ptrdiff_t' gives a reasonable size for integers |
66 | */ | 91 | */ |
67 | #define LUA_INTEGER ptrdiff_t | 92 | #define LUA_INTEGER ptrdiff_t |
68 | 93 | ||
69 | 94 | ||
70 | /* mark for all API functions */ | 95 | /* CONFIG: mark for all API functions */ |
71 | #define LUA_API extern | 96 | #define LUA_API extern |
72 | 97 | ||
73 | /* mark for auxlib functions */ | 98 | /* CONFIG: mark for auxlib functions */ |
74 | #define LUALIB_API extern | 99 | #define LUALIB_API extern |
75 | 100 | ||
76 | /* buffer size used by lauxlib buffer system */ | 101 | /* CONFIG: buffer size used by lauxlib buffer system */ |
77 | #define LUAL_BUFFERSIZE BUFSIZ | 102 | #define LUAL_BUFFERSIZE BUFSIZ |
78 | 103 | ||
79 | 104 | ||
80 | /* assertions in Lua (mainly for internal debugging) */ | 105 | /* CONFIG: assertions in Lua (mainly for internal debugging) */ |
81 | #define lua_assert(c) ((void)0) | 106 | #define lua_assert(c) ((void)0) |
82 | 107 | ||
83 | /* }====================================================== */ | 108 | /* }====================================================== */ |
@@ -92,7 +117,7 @@ | |||
92 | 117 | ||
93 | #ifdef lua_c | 118 | #ifdef lua_c |
94 | 119 | ||
95 | /* definition of `isatty' */ | 120 | /* CONFIG: definition of `isatty' */ |
96 | #ifdef _POSIX_C_SOURCE | 121 | #ifdef _POSIX_C_SOURCE |
97 | #include <unistd.h> | 122 | #include <unistd.h> |
98 | #define stdin_is_tty() isatty(0) | 123 | #define stdin_is_tty() isatty(0) |
@@ -113,7 +138,7 @@ | |||
113 | 138 | ||
114 | 139 | ||
115 | /* | 140 | /* |
116 | ** this macro can be used by some `history' system to save lines | 141 | ** CONFIG: this macro can be used by some `history' system to save lines |
117 | ** read in manual input | 142 | ** read in manual input |
118 | */ | 143 | */ |
119 | #define lua_saveline(L,line) /* empty */ | 144 | #define lua_saveline(L,line) /* empty */ |
@@ -126,86 +151,80 @@ | |||
126 | 151 | ||
127 | 152 | ||
128 | 153 | ||
129 | /* | 154 | /* CONFIG: LUA-C API assertions */ |
130 | ** {====================================================== | 155 | #define luac_apicheck(L,o) lua_assert(o) |
131 | ** Core configuration | ||
132 | ** ======================================================= | ||
133 | */ | ||
134 | |||
135 | #ifdef LUA_CORE | ||
136 | |||
137 | /* LUA-C API assertions */ | ||
138 | #define api_check(L,o) lua_assert(o) | ||
139 | 156 | ||
140 | 157 | ||
141 | /* number of bits in an `int' */ | 158 | /* number of bits in an `int' */ |
142 | /* avoid overflows in comparison */ | 159 | /* avoid overflows in comparison */ |
143 | #if INT_MAX-20 < 32760 | 160 | #if INT_MAX-20 < 32760 |
144 | #define LUA_BITSINT 16 | 161 | #define LUAC_BITSINT 16 |
145 | #elif INT_MAX > 2147483640L | 162 | #elif INT_MAX > 2147483640L |
146 | /* `int' has at least 32 bits */ | 163 | /* `int' has at least 32 bits */ |
147 | #define LUA_BITSINT 32 | 164 | #define LUAC_BITSINT 32 |
148 | #else | 165 | #else |
149 | #error "you must define LUA_BITSINT with number of bits in an integer" | 166 | #error "you must define LUA_BITSINT with number of bits in an integer" |
150 | #endif | 167 | #endif |
151 | 168 | ||
152 | 169 | ||
153 | /* | 170 | /* |
154 | ** L_UINT32: unsigned integer with at least 32 bits | 171 | ** CONFIG: |
155 | ** L_INT32: signed integer with at least 32 bits | 172 | ** LUAC_UINT32: unsigned integer with at least 32 bits |
156 | ** LU_MEM: an unsigned integer big enough to count the total memory used by Lua | 173 | ** LUAC_INT32: signed integer with at least 32 bits |
157 | ** L_MEM: a signed integer big enough to count the total memory used by Lua | 174 | ** LUAC_UMEM: an unsigned integer big enough to count the total memory |
175 | ** used by Lua | ||
176 | ** LUAC_MEM: a signed integer big enough to count the total memory used by Lua | ||
158 | */ | 177 | */ |
159 | #if LUA_BITSINT >= 32 | 178 | #if LUAC_BITSINT >= 32 |
160 | #define LUA_UINT32 unsigned int | 179 | #define LUAC_UINT32 unsigned int |
161 | #define LUA_INT32 int | 180 | #define LUAC_INT32 int |
162 | #define LUA_MAXINT32 INT_MAX | 181 | #define LUAC_MAXINT32 INT_MAX |
163 | #define LU_MEM size_t | 182 | #define LUAC_UMEM size_t |
164 | #define L_MEM ptrdiff_t | 183 | #define LUAC_MEM ptrdiff_t |
165 | #else | 184 | #else |
166 | /* 16-bit ints */ | 185 | /* 16-bit ints */ |
167 | #define LUA_UINT32 unsigned long | 186 | #define LUAC_UINT32 unsigned long |
168 | #define LUA_INT32 long | 187 | #define LUAC_INT32 long |
169 | #define LUA_MAXINT32 LONG_MAX | 188 | #define LUAC_MAXINT32 LONG_MAX |
170 | #define LU_MEM LUA_UINT32 | 189 | #define LUAC_UMEM LUAC_UINT32 |
171 | #define L_MEM ptrdiff_t | 190 | #define LUAC_MEM ptrdiff_t |
172 | #endif | 191 | #endif |
173 | 192 | ||
174 | 193 | ||
175 | /* maximum depth for calls (unsigned short) */ | 194 | /* CONFIG: maximum depth for calls (unsigned short) */ |
176 | #define LUA_MAXCALLS 10000 | 195 | #define LUAC_MAXCALLS 10000 |
177 | 196 | ||
178 | /* | 197 | /* |
179 | ** maximum depth for C calls (unsigned short): Not too big, or may | 198 | ** CONFIG: maximum depth for C calls (unsigned short): Not too big, or may |
180 | ** overflow the C stack... | 199 | ** overflow the C stack... |
181 | */ | 200 | */ |
182 | #define LUA_MAXCCALLS 200 | 201 | #define LUAC_MAXCCALLS 200 |
183 | 202 | ||
184 | 203 | ||
185 | /* maximum size for the virtual stack of a C function */ | 204 | /* CONFIG: maximum size for the virtual stack of a C function */ |
186 | #define MAXCSTACK 2048 | 205 | #define LUAC_MAXCSTACK 2048 |
187 | 206 | ||
188 | 207 | ||
189 | /* | 208 | /* |
190 | ** maximum number of syntactical nested non-terminals: Not too big, | 209 | ** CONFIG: maximum number of syntactical nested non-terminals: Not too big, |
191 | ** or may overflow the C stack... | 210 | ** or may overflow the C stack... |
192 | */ | 211 | */ |
193 | #define LUA_MAXPARSERLEVEL 200 | 212 | #define LUAC_MAXPARSERLEVEL 200 |
194 | 213 | ||
195 | 214 | ||
196 | /* maximum number of variables declared in a function */ | 215 | /* CONFIG: maximum number of variables declared in a function */ |
197 | #define MAXVARS 200 /* <MAXSTACK */ | 216 | #define LUAC_MAXVARS 200 /* <MAXSTACK */ |
198 | 217 | ||
199 | 218 | ||
200 | /* maximum number of upvalues per function */ | 219 | /* CONFIG: maximum number of upvalues per function */ |
201 | #define MAXUPVALUES 60 /* <MAXSTACK */ | 220 | #define LUAC_MAXUPVALUES 60 /* <MAXSTACK */ |
202 | 221 | ||
203 | 222 | ||
204 | /* maximum size of expressions for optimizing `while' code */ | 223 | /* CONFIG: maximum size of expressions for optimizing `while' code */ |
205 | #define MAXEXPWHILE 100 | 224 | #define LUAC_MAXEXPWHILE 100 |
206 | 225 | ||
207 | 226 | ||
208 | /* function to convert a lua_Number to int (with any rounding method) */ | 227 | /* CONFIG: function to convert a lua_Number to int (with any rounding method) */ |
209 | #if defined(__GNUC__) && defined(__i386) | 228 | #if defined(__GNUC__) && defined(__i386) |
210 | #define lua_number2int(i,d) __asm__ ("fistpl %0":"=m"(i):"t"(d):"st") | 229 | #define lua_number2int(i,d) __asm__ ("fistpl %0":"=m"(i):"t"(d):"st") |
211 | 230 | ||
@@ -231,171 +250,133 @@ __inline int l_lrint (double flt) | |||
231 | #endif | 250 | #endif |
232 | 251 | ||
233 | 252 | ||
234 | /* function to convert a lua_Number to lua_Integer (with any rounding method) */ | 253 | /* CONFIG: function to convert a lua_Number to lua_Integer (with any rounding method) */ |
235 | #define lua_number2integer(i,n) lua_number2int((i), (n)) | 254 | #define lua_number2integer(i,n) lua_number2int((i), (n)) |
236 | 255 | ||
237 | 256 | ||
238 | /* function to convert a lua_Number to a string */ | 257 | /* CONFIG: function to convert a lua_Number to a string */ |
239 | #define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n)) | 258 | #define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n)) |
240 | /* maximum size of previous conversion */ | 259 | /* maximum size of previous conversion */ |
241 | #define MAX_NUMBER2STR 32 /* 16 digits, sign, point and \0 (+ some extra) */ | 260 | #define LUAC_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */ |
242 | 261 | ||
243 | /* function to convert a string to a lua_Number */ | 262 | /* CONFIG: function to convert a string to a lua_Number */ |
244 | #define lua_str2number(s,p) strtod((s), (p)) | 263 | #define lua_str2number(s,p) strtod((s), (p)) |
245 | 264 | ||
246 | 265 | ||
247 | 266 | ||
248 | /* result of a `usual argument conversion' over lua_Number */ | 267 | /* CONFIG: result of a `usual argument conversion' over lua_Number */ |
249 | #define LUA_UACNUMBER double | 268 | #define LUAC_UACNUMBER double |
250 | 269 | ||
251 | 270 | ||
252 | /* primitive operators for numbers */ | 271 | /* CONFIG: primitive operators for numbers */ |
253 | #define num_add(a,b) ((a)+(b)) | 272 | #define luac_numadd(a,b) ((a)+(b)) |
254 | #define num_sub(a,b) ((a)-(b)) | 273 | #define luac_numsub(a,b) ((a)-(b)) |
255 | #define num_mul(a,b) ((a)*(b)) | 274 | #define luac_nummul(a,b) ((a)*(b)) |
256 | #define num_div(a,b) ((a)/(b)) | 275 | #define luac_numdiv(a,b) ((a)/(b)) |
257 | #define num_unm(a) (-(a)) | 276 | #define luac_numunm(a) (-(a)) |
258 | #define num_eq(a,b) ((a)==(b)) | 277 | #define luac_numeq(a,b) ((a)==(b)) |
259 | #define num_lt(a,b) ((a)<(b)) | 278 | #define luac_numlt(a,b) ((a)<(b)) |
260 | #define num_le(a,b) ((a)<=(b)) | 279 | #define luac_numle(a,b) ((a)<=(b)) |
261 | #define num_mod(a,b) ((a) - floor((a)/(b))*(b)) | 280 | #define luac_nummod(a,b) ((a) - floor((a)/(b))*(b)) |
262 | #define num_pow(a,b) pow(a,b) | 281 | #define luac_numpow(a,b) pow(a,b) |
263 | 282 | ||
264 | 283 | ||
265 | 284 | ||
266 | /* type to ensure maximum alignment */ | 285 | /* CONFIG: type to ensure maximum alignment */ |
267 | #define LUSER_ALIGNMENT_T union { double u; void *s; long l; } | 286 | #define LUAC_USER_ALIGNMENT_T union { double u; void *s; long l; } |
268 | 287 | ||
269 | 288 | ||
270 | /* | 289 | /* |
271 | ** exception handling: by default, Lua handles errors with longjmp/setjmp | 290 | ** CONFIG: exception handling: by default, Lua handles errors with |
272 | ** when compiling as C code and with exceptions when compiling as C++ code. | 291 | ** longjmp/setjmp when compiling as C code and with exceptions |
273 | ** Change that if you prefer to use longjmp/setjmp even with C++. | 292 | ** when compiling as C++ code. Change that if you prefer to use |
293 | ** longjmp/setjmp even with C++. | ||
274 | */ | 294 | */ |
275 | #ifndef __cplusplus | 295 | #ifndef __cplusplus |
276 | /* default handling with long jumps */ | 296 | /* default handling with long jumps */ |
277 | #define L_THROW(L,c) longjmp((c)->b, 1) | 297 | #define LUAC_THROW(L,c) longjmp((c)->b, 1) |
278 | #define L_TRY(L,c,a) if (setjmp((c)->b) == 0) { a } | 298 | #define LUAC_TRY(L,c,a) if (setjmp((c)->b) == 0) { a } |
279 | #define l_jmpbuf jmp_buf | 299 | #define luac_jmpbuf jmp_buf |
280 | 300 | ||
281 | #else | 301 | #else |
282 | /* C++ exceptions */ | 302 | /* C++ exceptions */ |
283 | #define L_THROW(L,c) throw(c) | 303 | #define LUAC_THROW(L,c) throw(c) |
284 | #define L_TRY(L,c,a) try { a } catch(...) \ | 304 | #define LUAC_TRY(L,c,a) try { a } catch(...) \ |
285 | { if ((c)->status == 0) (c)->status = -1; } | 305 | { if ((c)->status == 0) (c)->status = -1; } |
286 | #define l_jmpbuf int /* dummy variable */ | 306 | #define luac_jmpbuf int /* dummy variable */ |
287 | #endif | 307 | #endif |
288 | 308 | ||
289 | 309 | ||
290 | 310 | ||
291 | /* | 311 | /* |
292 | ** macros for thread synchronization inside Lua core machine: This is | 312 | ** CONFIG: macros for thread synchronization inside Lua core |
293 | ** an attempt to simplify the implementation of a multithreaded version | 313 | ** machine: This is an attempt to simplify the implementation of a |
294 | ** of Lua. Do not change that unless you know what you are doing. all | 314 | ** multithreaded version of Lua. Do not change that unless you know |
295 | ** accesses to the global state and to global objects are synchronized. | 315 | ** what you are doing. all accesses to the global state and to global |
296 | ** Because threads can read the stack of other threads (when running | 316 | ** objects are synchronized. Because threads can read the stack of |
297 | ** garbage collection), a thread must also synchronize any write-access | 317 | ** other threads (when running garbage collection), a thread must also |
298 | ** to its own stack. Unsynchronized accesses are allowed only when | 318 | ** synchronize any write-access to its own stack. Unsynchronized |
299 | ** reading its own stack, or when reading immutable fields from global | 319 | ** accesses are allowed only when reading its own stack, or when reading |
300 | ** objects (such as string values and udata values). | 320 | ** immutable fields from global objects (such as string values and udata |
321 | ** values). | ||
301 | */ | 322 | */ |
302 | #define lua_lock(L) ((void) 0) | 323 | #define lua_lock(L) ((void) 0) |
303 | #define lua_unlock(L) ((void) 0) | 324 | #define lua_unlock(L) ((void) 0) |
304 | 325 | ||
305 | 326 | ||
306 | /* | 327 | /* |
307 | ** this macro allows a thread switch in appropriate places in the Lua | 328 | ** CONFIG: this macro allows a thread switch in appropriate places in |
308 | ** core | 329 | ** the Lua core |
309 | */ | 330 | */ |
310 | #define lua_threadyield(L) {lua_unlock(L); lua_lock(L);} | 331 | #define lua_threadyield(L) {lua_unlock(L); lua_lock(L);} |
311 | 332 | ||
312 | 333 | ||
313 | 334 | ||
314 | /* allows user-specific initialization on new threads */ | 335 | /* CONFIG: allows user-specific initialization on new threads */ |
315 | #define lua_userstateopen(L) ((void)0) | 336 | #define lua_userstateopen(L) ((void)0) |
316 | 337 | ||
317 | 338 | ||
318 | #endif | ||
319 | |||
320 | /* }====================================================== */ | ||
321 | |||
322 | |||
323 | 339 | ||
324 | /* | ||
325 | ** {====================================================== | ||
326 | ** Library configuration | ||
327 | ** ======================================================= | ||
328 | */ | ||
329 | 340 | ||
330 | #ifdef LUA_LIB | ||
331 | 341 | ||
332 | 342 | /* CONFIG: maximum number of captures in pattern-matching (arbitrary limit) */ | |
333 | /* environment variables that hold the search path for packages */ | 343 | #define LUA_MAXCAPTURES 32 |
334 | #define LUA_PATH "LUA_PATH" | ||
335 | #define LUA_CPATH "LUA_CPATH" | ||
336 | |||
337 | /* prefix for open functions in C libraries */ | ||
338 | #define LUA_POF "luaopen_" | ||
339 | |||
340 | /* separator for open functions in C libraries */ | ||
341 | #define LUA_OFSEP "_" | ||
342 | |||
343 | /* directory separator (for submodules) */ | ||
344 | #if defined(_WIN32) | ||
345 | #define LUA_DIRSEP "\\" | ||
346 | #else | ||
347 | #define LUA_DIRSEP "/" | ||
348 | #endif | ||
349 | |||
350 | /* separator of templates in a path */ | ||
351 | #define LUA_PATHSEP ';' | ||
352 | |||
353 | /* wild char in each template */ | ||
354 | #define LUA_PATH_MARK "?" | ||
355 | |||
356 | |||
357 | /* maximum number of captures in pattern-matching (arbitrary limit) */ | ||
358 | #define MAX_CAPTURES 32 | ||
359 | 344 | ||
360 | 345 | ||
361 | /* | 346 | /* |
362 | ** by default, gcc does not get `os.tmpname', because it generates a warning | 347 | ** CONFIG: by default, gcc does not get `os.tmpname', because it |
363 | ** when using `tmpname'. Change that if you really want (or do not want) | 348 | ** generates a warning when using `tmpname'. Change that if you really |
364 | ** `os.tmpname' available. | 349 | ** want (or do not want) `os.tmpname' available. |
365 | */ | 350 | */ |
366 | #ifdef __GNUC__ | 351 | #ifdef __GNUC__ |
367 | #define USE_TMPNAME 0 | 352 | #define LUA_USETMPNAME 0 |
368 | #else | 353 | #else |
369 | #define USE_TMPNAME 1 | 354 | #define LUA_USETMPNAME 1 |
370 | #endif | 355 | #endif |
371 | 356 | ||
372 | 357 | ||
373 | /* | 358 | /* |
374 | ** Configuration for loadlib: Lua tries to guess the dynamic-library | 359 | ** CONFIG: Configuration for loadlib: Lua tries to guess the |
375 | ** system that your platform uses (either Windows' DLL, Mac's dyld, or | 360 | ** dynamic-library system that your platform uses (either Windows' DLL, |
376 | ** dlopen). If your system is some kind of Unix, there is a good chance | 361 | ** Mac's dyld, or dlopen). If your system is some kind of Unix, there is |
377 | ** that USE_DLOPEN will work for it. You may need to adapt also the | 362 | ** a good chance that LUA_USEDLOPEN will work for it. You may need to adapt |
378 | ** makefile. | 363 | ** also the makefile. |
379 | */ | 364 | */ |
380 | #if defined(_WIN32) | 365 | #if defined(_WIN32) |
381 | #define USE_DLL | 366 | #define LUA_USEDLL |
382 | #elif defined(__APPLE__) && defined(__MACH__) | 367 | #elif defined(__APPLE__) && defined(__MACH__) |
383 | #define USE_DYLD | 368 | #define LUA_USEDYLD |
384 | #elif defined(__linux) || defined(sun) || defined(sgi) || defined(BSD) | 369 | #elif defined(__linux) || defined(sun) || defined(sgi) || defined(BSD) |
385 | #define USE_DLOPEN | 370 | #define LUA_USEDLOPEN |
386 | #endif | 371 | #endif |
387 | 372 | ||
388 | 373 | ||
389 | #endif | ||
390 | |||
391 | /* }====================================================== */ | ||
392 | |||
393 | |||
394 | 374 | ||
375 | /* ======================================================= */ | ||
395 | 376 | ||
396 | /* Local configuration */ | 377 | /* Local configuration */ |
397 | 378 | ||
398 | #undef USE_TMPNAME | 379 | #undef LUA_USETMPNAME |
399 | #define USE_TMPNAME 1 | 380 | #define LUA_USETMPNAME 1 |
400 | 381 | ||
401 | #endif | 382 | #endif |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 2.29 2005/03/08 18:00:16 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.30 2005/03/08 18:09:16 roberto Exp roberto $ |
3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -49,7 +49,7 @@ int luaV_tostring (lua_State *L, StkId obj) { | |||
49 | if (!ttisnumber(obj)) | 49 | if (!ttisnumber(obj)) |
50 | return 0; | 50 | return 0; |
51 | else { | 51 | else { |
52 | char s[MAX_NUMBER2STR]; | 52 | char s[LUAC_MAXNUMBER2STR]; |
53 | lua_number2str(s, nvalue(obj)); | 53 | lua_number2str(s, nvalue(obj)); |
54 | setsvalue2s(L, obj, luaS_new(L, s)); | 54 | setsvalue2s(L, obj, luaS_new(L, s)); |
55 | return 1; | 55 | return 1; |
@@ -243,7 +243,7 @@ int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) { | |||
243 | if (ttype(l) != ttype(r)) | 243 | if (ttype(l) != ttype(r)) |
244 | return luaG_ordererror(L, l, r); | 244 | return luaG_ordererror(L, l, r); |
245 | else if (ttisnumber(l)) | 245 | else if (ttisnumber(l)) |
246 | return num_lt(nvalue(l), nvalue(r)); | 246 | return luac_numlt(nvalue(l), nvalue(r)); |
247 | else if (ttisstring(l)) | 247 | else if (ttisstring(l)) |
248 | return l_strcmp(rawtsvalue(l), rawtsvalue(r)) < 0; | 248 | return l_strcmp(rawtsvalue(l), rawtsvalue(r)) < 0; |
249 | else if ((res = call_orderTM(L, l, r, TM_LT)) != -1) | 249 | else if ((res = call_orderTM(L, l, r, TM_LT)) != -1) |
@@ -257,7 +257,7 @@ static int lessequal (lua_State *L, const TValue *l, const TValue *r) { | |||
257 | if (ttype(l) != ttype(r)) | 257 | if (ttype(l) != ttype(r)) |
258 | return luaG_ordererror(L, l, r); | 258 | return luaG_ordererror(L, l, r); |
259 | else if (ttisnumber(l)) | 259 | else if (ttisnumber(l)) |
260 | return num_le(nvalue(l), nvalue(r)); | 260 | return luac_numle(nvalue(l), nvalue(r)); |
261 | else if (ttisstring(l)) | 261 | else if (ttisstring(l)) |
262 | return l_strcmp(rawtsvalue(l), rawtsvalue(r)) <= 0; | 262 | return l_strcmp(rawtsvalue(l), rawtsvalue(r)) <= 0; |
263 | else if ((res = call_orderTM(L, l, r, TM_LE)) != -1) /* first try `le' */ | 263 | else if ((res = call_orderTM(L, l, r, TM_LE)) != -1) /* first try `le' */ |
@@ -273,7 +273,7 @@ int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2) { | |||
273 | lua_assert(ttype(t1) == ttype(t2)); | 273 | lua_assert(ttype(t1) == ttype(t2)); |
274 | switch (ttype(t1)) { | 274 | switch (ttype(t1)) { |
275 | case LUA_TNIL: return 1; | 275 | case LUA_TNIL: return 1; |
276 | case LUA_TNUMBER: return num_eq(nvalue(t1), nvalue(t2)); | 276 | case LUA_TNUMBER: return luac_numeq(nvalue(t1), nvalue(t2)); |
277 | case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */ | 277 | case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */ |
278 | case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2); | 278 | case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2); |
279 | case LUA_TUSERDATA: { | 279 | case LUA_TUSERDATA: { |
@@ -338,12 +338,12 @@ static StkId Arith (lua_State *L, StkId ra, const TValue *rb, | |||
338 | (c = luaV_tonumber(rc, &tempc)) != NULL) { | 338 | (c = luaV_tonumber(rc, &tempc)) != NULL) { |
339 | lua_Number nb = nvalue(b), nc = nvalue(c); | 339 | lua_Number nb = nvalue(b), nc = nvalue(c); |
340 | switch (op) { | 340 | switch (op) { |
341 | case TM_ADD: setnvalue(ra, num_add(nb, nc)); break; | 341 | case TM_ADD: setnvalue(ra, luac_numadd(nb, nc)); break; |
342 | case TM_SUB: setnvalue(ra, num_sub(nb, nc)); break; | 342 | case TM_SUB: setnvalue(ra, luac_numsub(nb, nc)); break; |
343 | case TM_MUL: setnvalue(ra, num_mul(nb, nc)); break; | 343 | case TM_MUL: setnvalue(ra, luac_nummul(nb, nc)); break; |
344 | case TM_DIV: setnvalue(ra, num_div(nb, nc)); break; | 344 | case TM_DIV: setnvalue(ra, luac_numdiv(nb, nc)); break; |
345 | case TM_MOD: setnvalue(ra, num_mod(nb, nc)); break; | 345 | case TM_MOD: setnvalue(ra, luac_nummod(nb, nc)); break; |
346 | case TM_POW: setnvalue(ra, num_pow(nb, nc)); break; | 346 | case TM_POW: setnvalue(ra, luac_numpow(nb, nc)); break; |
347 | default: lua_assert(0); break; | 347 | default: lua_assert(0); break; |
348 | } | 348 | } |
349 | } | 349 | } |
@@ -480,7 +480,7 @@ StkId luaV_execute (lua_State *L, int nexeccalls) { | |||
480 | TValue *rc = RKC(i); | 480 | TValue *rc = RKC(i); |
481 | if (ttisnumber(rb) && ttisnumber(rc)) { | 481 | if (ttisnumber(rb) && ttisnumber(rc)) { |
482 | lua_Number nb = nvalue(rb), nc = nvalue(rc); | 482 | lua_Number nb = nvalue(rb), nc = nvalue(rc); |
483 | setnvalue(ra, num_add(nb, nc)); | 483 | setnvalue(ra, luac_numadd(nb, nc)); |
484 | } | 484 | } |
485 | else | 485 | else |
486 | base = Arith(L, ra, rb, rc, TM_ADD, pc); /***/ | 486 | base = Arith(L, ra, rb, rc, TM_ADD, pc); /***/ |
@@ -491,7 +491,7 @@ StkId luaV_execute (lua_State *L, int nexeccalls) { | |||
491 | TValue *rc = RKC(i); | 491 | TValue *rc = RKC(i); |
492 | if (ttisnumber(rb) && ttisnumber(rc)) { | 492 | if (ttisnumber(rb) && ttisnumber(rc)) { |
493 | lua_Number nb = nvalue(rb), nc = nvalue(rc); | 493 | lua_Number nb = nvalue(rb), nc = nvalue(rc); |
494 | setnvalue(ra, num_sub(nb, nc)); | 494 | setnvalue(ra, luac_numsub(nb, nc)); |
495 | } | 495 | } |
496 | else | 496 | else |
497 | base = Arith(L, ra, rb, rc, TM_SUB, pc); /***/ | 497 | base = Arith(L, ra, rb, rc, TM_SUB, pc); /***/ |
@@ -502,7 +502,7 @@ StkId luaV_execute (lua_State *L, int nexeccalls) { | |||
502 | TValue *rc = RKC(i); | 502 | TValue *rc = RKC(i); |
503 | if (ttisnumber(rb) && ttisnumber(rc)) { | 503 | if (ttisnumber(rb) && ttisnumber(rc)) { |
504 | lua_Number nb = nvalue(rb), nc = nvalue(rc); | 504 | lua_Number nb = nvalue(rb), nc = nvalue(rc); |
505 | setnvalue(ra, num_mul(nb, nc)); | 505 | setnvalue(ra, luac_nummul(nb, nc)); |
506 | } | 506 | } |
507 | else | 507 | else |
508 | base = Arith(L, ra, rb, rc, TM_MUL, pc); /***/ | 508 | base = Arith(L, ra, rb, rc, TM_MUL, pc); /***/ |
@@ -513,7 +513,7 @@ StkId luaV_execute (lua_State *L, int nexeccalls) { | |||
513 | TValue *rc = RKC(i); | 513 | TValue *rc = RKC(i); |
514 | if (ttisnumber(rb) && ttisnumber(rc)) { | 514 | if (ttisnumber(rb) && ttisnumber(rc)) { |
515 | lua_Number nb = nvalue(rb), nc = nvalue(rc); | 515 | lua_Number nb = nvalue(rb), nc = nvalue(rc); |
516 | setnvalue(ra, num_div(nb, nc)); | 516 | setnvalue(ra, luac_numdiv(nb, nc)); |
517 | } | 517 | } |
518 | else | 518 | else |
519 | base = Arith(L, ra, rb, rc, TM_DIV, pc); /***/ | 519 | base = Arith(L, ra, rb, rc, TM_DIV, pc); /***/ |
@@ -524,7 +524,7 @@ StkId luaV_execute (lua_State *L, int nexeccalls) { | |||
524 | TValue *rc = RKC(i); | 524 | TValue *rc = RKC(i); |
525 | if (ttisnumber(rb) && ttisnumber(rc)) { | 525 | if (ttisnumber(rb) && ttisnumber(rc)) { |
526 | lua_Number nb = nvalue(rb), nc = nvalue(rc); | 526 | lua_Number nb = nvalue(rb), nc = nvalue(rc); |
527 | setnvalue(ra, num_mod(nb, nc)); | 527 | setnvalue(ra, luac_nummod(nb, nc)); |
528 | } | 528 | } |
529 | else | 529 | else |
530 | base = Arith(L, ra, rb, rc, TM_MOD, pc); /***/ | 530 | base = Arith(L, ra, rb, rc, TM_MOD, pc); /***/ |
@@ -535,7 +535,7 @@ StkId luaV_execute (lua_State *L, int nexeccalls) { | |||
535 | TValue *rc = RKC(i); | 535 | TValue *rc = RKC(i); |
536 | if (ttisnumber(rb) && ttisnumber(rc)) { | 536 | if (ttisnumber(rb) && ttisnumber(rc)) { |
537 | lua_Number nb = nvalue(rb), nc = nvalue(rc); | 537 | lua_Number nb = nvalue(rb), nc = nvalue(rc); |
538 | setnvalue(ra, num_pow(nb, nc)); | 538 | setnvalue(ra, luac_numpow(nb, nc)); |
539 | } | 539 | } |
540 | else | 540 | else |
541 | base = Arith(L, ra, rb, rc, TM_POW, pc); /***/ | 541 | base = Arith(L, ra, rb, rc, TM_POW, pc); /***/ |
@@ -546,7 +546,7 @@ StkId luaV_execute (lua_State *L, int nexeccalls) { | |||
546 | TValue temp; | 546 | TValue temp; |
547 | if (tonumber(rb, &temp)) { | 547 | if (tonumber(rb, &temp)) { |
548 | lua_Number nb = nvalue(rb); | 548 | lua_Number nb = nvalue(rb); |
549 | setnvalue(ra, num_unm(nb)); | 549 | setnvalue(ra, luac_numunm(nb)); |
550 | } | 550 | } |
551 | else { | 551 | else { |
552 | setnilvalue(&temp); | 552 | setnilvalue(&temp); |
@@ -682,9 +682,9 @@ StkId luaV_execute (lua_State *L, int nexeccalls) { | |||
682 | } | 682 | } |
683 | case OP_FORLOOP: { | 683 | case OP_FORLOOP: { |
684 | lua_Number step = nvalue(ra+2); | 684 | lua_Number step = nvalue(ra+2); |
685 | lua_Number idx = num_add(nvalue(ra), step); /* increment index */ | 685 | lua_Number idx = luac_numadd(nvalue(ra), step); /* increment index */ |
686 | lua_Number limit = nvalue(ra+1); | 686 | lua_Number limit = nvalue(ra+1); |
687 | if (step > 0 ? num_le(idx, limit) : num_le(limit, idx)) { | 687 | if (step > 0 ? luac_numle(idx, limit) : luac_numle(limit, idx)) { |
688 | dojump(L, pc, GETARG_sBx(i)); /* jump back */ | 688 | dojump(L, pc, GETARG_sBx(i)); /* jump back */ |
689 | setnvalue(ra, idx); /* update internal index... */ | 689 | setnvalue(ra, idx); /* update internal index... */ |
690 | setnvalue(ra+3, idx); /* ...and external index */ | 690 | setnvalue(ra+3, idx); /* ...and external index */ |
@@ -702,7 +702,7 @@ StkId luaV_execute (lua_State *L, int nexeccalls) { | |||
702 | luaG_runerror(L, "`for' limit must be a number"); | 702 | luaG_runerror(L, "`for' limit must be a number"); |
703 | else if (!tonumber(pstep, ra+2)) | 703 | else if (!tonumber(pstep, ra+2)) |
704 | luaG_runerror(L, "`for' step must be a number"); | 704 | luaG_runerror(L, "`for' step must be a number"); |
705 | setnvalue(ra, num_sub(nvalue(ra), nvalue(pstep))); | 705 | setnvalue(ra, luac_numsub(nvalue(ra), nvalue(pstep))); |
706 | dojump(L, pc, GETARG_sBx(i)); | 706 | dojump(L, pc, GETARG_sBx(i)); |
707 | continue; | 707 | continue; |
708 | } | 708 | } |