diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-04-03 10:35:34 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-04-03 10:35:34 -0300 |
commit | 0d88545b82b82671904474499b5d312141170ab6 (patch) | |
tree | 5a924d4d492dd987a5480a15cd1d12947089db85 | |
parent | f84c5a5fc68f83b3adad37919e0096ea3c7f4129 (diff) | |
download | lua-0d88545b82b82671904474499b5d312141170ab6.tar.gz lua-0d88545b82b82671904474499b5d312141170ab6.tar.bz2 lua-0d88545b82b82671904474499b5d312141170ab6.zip |
warnings from several compilers (mainly typecasts when lua_Number is float)
-rw-r--r-- | lapi.c | 6 | ||||
-rw-r--r-- | lauxlib.c | 8 | ||||
-rw-r--r-- | lauxlib.h | 6 | ||||
-rw-r--r-- | lbaselib.c | 8 | ||||
-rw-r--r-- | lcode.c | 4 | ||||
-rw-r--r-- | ldblib.c | 9 | ||||
-rw-r--r-- | ldo.c | 8 | ||||
-rw-r--r-- | lgc.c | 5 | ||||
-rw-r--r-- | lobject.c | 6 | ||||
-rw-r--r-- | lparser.c | 4 | ||||
-rw-r--r-- | lstate.c | 4 | ||||
-rw-r--r-- | lstrlib.c | 22 | ||||
-rw-r--r-- | ltable.c | 6 | ||||
-rw-r--r-- | ltablib.c | 6 | ||||
-rw-r--r-- | ltests.c | 90 | ||||
-rw-r--r-- | ltm.c | 4 | ||||
-rw-r--r-- | lvm.c | 4 |
17 files changed, 100 insertions, 100 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 1.232 2003/02/27 12:33:07 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 1.233 2003/03/14 18:59:21 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 | */ |
@@ -681,7 +681,7 @@ LUA_API int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc) { | |||
681 | func = (errfunc == 0) ? 0 : savestack(L, luaA_index(L, errfunc)); | 681 | func = (errfunc == 0) ? 0 : savestack(L, luaA_index(L, errfunc)); |
682 | c.func = L->top - (nargs+1); /* function to be called */ | 682 | c.func = L->top - (nargs+1); /* function to be called */ |
683 | c.nresults = nresults; | 683 | c.nresults = nresults; |
684 | status = luaD_pcall(L, &f_call, &c, savestack(L, c.func), func); | 684 | status = luaD_pcall(L, f_call, &c, savestack(L, c.func), func); |
685 | lua_unlock(L); | 685 | lua_unlock(L); |
686 | return status; | 686 | return status; |
687 | } | 687 | } |
@@ -715,7 +715,7 @@ LUA_API int lua_cpcall (lua_State *L, lua_CFunction func, void *ud) { | |||
715 | lua_lock(L); | 715 | lua_lock(L); |
716 | c.func = func; | 716 | c.func = func; |
717 | c.ud = ud; | 717 | c.ud = ud; |
718 | status = luaD_pcall(L, &f_Ccall, &c, savestack(L, L->top), 0); | 718 | status = luaD_pcall(L, f_Ccall, &c, savestack(L, L->top), 0); |
719 | lua_unlock(L); | 719 | lua_unlock(L); |
720 | return status; | 720 | return status; |
721 | } | 721 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.c,v 1.97 2003/03/18 18:48:31 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.98 2003/04/01 17:52:31 roberto Exp roberto $ |
3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -278,13 +278,13 @@ void luaL_setn (lua_State *L, int t, int n) { | |||
278 | lua_rawget(L, t); | 278 | lua_rawget(L, t); |
279 | if (checkint(L, 1) >= 0) { /* is there a numeric field `n'? */ | 279 | if (checkint(L, 1) >= 0) { /* is there a numeric field `n'? */ |
280 | lua_pushliteral(L, "n"); /* use it */ | 280 | lua_pushliteral(L, "n"); /* use it */ |
281 | lua_pushnumber(L, n); | 281 | lua_pushnumber(L, (lua_Number)n); |
282 | lua_rawset(L, t); | 282 | lua_rawset(L, t); |
283 | } | 283 | } |
284 | else { /* use `sizes' */ | 284 | else { /* use `sizes' */ |
285 | getsizes(L); | 285 | getsizes(L); |
286 | lua_pushvalue(L, t); | 286 | lua_pushvalue(L, t); |
287 | lua_pushnumber(L, n); | 287 | lua_pushnumber(L, (lua_Number)n); |
288 | lua_rawset(L, -3); /* sizes[t] = n */ | 288 | lua_rawset(L, -3); /* sizes[t] = n */ |
289 | lua_pop(L, 1); /* remove `sizes' */ | 289 | lua_pop(L, 1); /* remove `sizes' */ |
290 | } | 290 | } |
@@ -438,7 +438,7 @@ LUALIB_API void luaL_unref (lua_State *L, int t, int ref) { | |||
438 | if (ref >= 0) { | 438 | if (ref >= 0) { |
439 | lua_rawgeti(L, t, FREELIST_REF); | 439 | lua_rawgeti(L, t, FREELIST_REF); |
440 | lua_rawseti(L, t, ref); /* t[ref] = t[FREELIST_REF] */ | 440 | lua_rawseti(L, t, ref); /* t[ref] = t[FREELIST_REF] */ |
441 | lua_pushnumber(L, ref); | 441 | lua_pushnumber(L, (lua_Number)ref); |
442 | lua_rawseti(L, t, FREELIST_REF); /* t[FREELIST_REF] = ref */ | 442 | lua_rawseti(L, t, FREELIST_REF); /* t[FREELIST_REF] = ref */ |
443 | } | 443 | } |
444 | } | 444 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.h,v 1.58 2003/02/11 15:32:31 roberto Exp roberto $ | 2 | ** $Id: lauxlib.h,v 1.59 2003/03/18 12:25:32 roberto Exp roberto $ |
3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -76,8 +76,8 @@ LUALIB_API int luaL_loadbuffer (lua_State *L, const char *buff, size_t sz, | |||
76 | #define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL)) | 76 | #define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL)) |
77 | #define luaL_checkint(L,n) ((int)luaL_checknumber(L, n)) | 77 | #define luaL_checkint(L,n) ((int)luaL_checknumber(L, n)) |
78 | #define luaL_checklong(L,n) ((long)luaL_checknumber(L, n)) | 78 | #define luaL_checklong(L,n) ((long)luaL_checknumber(L, n)) |
79 | #define luaL_optint(L,n,d) ((int)luaL_optnumber(L, n,d)) | 79 | #define luaL_optint(L,n,d) ((int)luaL_optnumber(L, n,(lua_Number)(d))) |
80 | #define luaL_optlong(L,n,d) ((long)luaL_optnumber(L, n,d)) | 80 | #define luaL_optlong(L,n,d) ((long)luaL_optnumber(L, n,(lua_Number)(d))) |
81 | 81 | ||
82 | 82 | ||
83 | /* | 83 | /* |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lbaselib.c,v 1.128 2003/03/11 18:17:43 roberto Exp roberto $ | 2 | ** $Id: lbaselib.c,v 1.129 2003/03/19 21:14:34 roberto Exp roberto $ |
3 | ** Basic library | 3 | ** Basic library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -66,7 +66,7 @@ static int luaB_tonumber (lua_State *L) { | |||
66 | if (s1 != s2) { /* at least one valid digit? */ | 66 | if (s1 != s2) { /* at least one valid digit? */ |
67 | while (isspace((unsigned char)(*s2))) s2++; /* skip trailing spaces */ | 67 | while (isspace((unsigned char)(*s2))) s2++; /* skip trailing spaces */ |
68 | if (*s2 == '\0') { /* no invalid trailing characters? */ | 68 | if (*s2 == '\0') { /* no invalid trailing characters? */ |
69 | lua_pushnumber(L, n); | 69 | lua_pushnumber(L, (lua_Number)n); |
70 | return 1; | 70 | return 1; |
71 | } | 71 | } |
72 | } | 72 | } |
@@ -187,8 +187,8 @@ static int luaB_rawset (lua_State *L) { | |||
187 | 187 | ||
188 | 188 | ||
189 | static int luaB_gcinfo (lua_State *L) { | 189 | static int luaB_gcinfo (lua_State *L) { |
190 | lua_pushnumber(L, lua_getgccount(L)); | 190 | lua_pushnumber(L, (lua_Number)lua_getgccount(L)); |
191 | lua_pushnumber(L, lua_getgcthreshold(L)); | 191 | lua_pushnumber(L, (lua_Number)lua_getgcthreshold(L)); |
192 | return 2; | 192 | return 2; |
193 | } | 193 | } |
194 | 194 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lcode.c,v 1.115 2002/12/11 12:34:22 roberto Exp roberto $ | 2 | ** $Id: lcode.c,v 1.116 2003/02/27 12:33:07 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 | */ |
@@ -217,7 +217,7 @@ static int addk (FuncState *fs, TObject *k, TObject *v) { | |||
217 | luaM_growvector(fs->L, f->k, fs->nk, f->sizek, TObject, | 217 | luaM_growvector(fs->L, f->k, fs->nk, f->sizek, TObject, |
218 | MAXARG_Bx, "constant table overflow"); | 218 | MAXARG_Bx, "constant table overflow"); |
219 | setobj2n(&f->k[fs->nk], v); | 219 | setobj2n(&f->k[fs->nk], v); |
220 | setnvalue(luaH_set(fs->L, fs->h, k), fs->nk); | 220 | setnvalue(luaH_set(fs->L, fs->h, k), cast(lua_Number, fs->nk)); |
221 | return fs->nk++; | 221 | return fs->nk++; |
222 | } | 222 | } |
223 | } | 223 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldblib.c,v 1.78 2003/02/27 11:52:30 roberto Exp roberto $ | 2 | ** $Id: ldblib.c,v 1.79 2003/03/11 12:24:34 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 | */ |
@@ -27,7 +27,7 @@ static void settabss (lua_State *L, const char *i, const char *v) { | |||
27 | 27 | ||
28 | static void settabsi (lua_State *L, const char *i, int v) { | 28 | static void settabsi (lua_State *L, const char *i, int v) { |
29 | lua_pushstring(L, i); | 29 | lua_pushstring(L, i); |
30 | lua_pushnumber(L, v); | 30 | lua_pushnumber(L, (lua_Number)v); |
31 | lua_rawset(L, -3); | 31 | lua_rawset(L, -3); |
32 | } | 32 | } |
33 | 33 | ||
@@ -143,7 +143,8 @@ static void hookf (lua_State *L, lua_Debug *ar) { | |||
143 | lua_rawget(L, LUA_REGISTRYINDEX); | 143 | lua_rawget(L, LUA_REGISTRYINDEX); |
144 | if (lua_isfunction(L, -1)) { | 144 | if (lua_isfunction(L, -1)) { |
145 | lua_pushstring(L, hooknames[(int)ar->event]); | 145 | lua_pushstring(L, hooknames[(int)ar->event]); |
146 | if (ar->currentline >= 0) lua_pushnumber(L, ar->currentline); | 146 | if (ar->currentline >= 0) |
147 | lua_pushnumber(L, (lua_Number)ar->currentline); | ||
147 | else lua_pushnil(L); | 148 | else lua_pushnil(L); |
148 | lua_assert(lua_getinfo(L, "lS", ar)); | 149 | lua_assert(lua_getinfo(L, "lS", ar)); |
149 | lua_call(L, 2, 0); | 150 | lua_call(L, 2, 0); |
@@ -202,7 +203,7 @@ static int gethook (lua_State *L) { | |||
202 | lua_rawget(L, LUA_REGISTRYINDEX); /* get hook */ | 203 | lua_rawget(L, LUA_REGISTRYINDEX); /* get hook */ |
203 | } | 204 | } |
204 | lua_pushstring(L, unmakemask(mask, buff)); | 205 | lua_pushstring(L, unmakemask(mask, buff)); |
205 | lua_pushnumber(L, lua_gethookcount(L)); | 206 | lua_pushnumber(L, (lua_Number)lua_gethookcount(L)); |
206 | return 3; | 207 | return 3; |
207 | } | 208 | } |
208 | 209 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 1.215 2003/02/28 15:42:08 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 1.216 2003/02/28 19:45:15 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 | */ |
@@ -196,7 +196,7 @@ static void adjust_varargs (lua_State *L, int nfixargs, StkId base) { | |||
196 | setobj2n(luaH_setnum(L, htab, i+1), L->top - actual + i); | 196 | setobj2n(luaH_setnum(L, htab, i+1), L->top - actual + i); |
197 | /* store counter in field `n' */ | 197 | /* store counter in field `n' */ |
198 | setsvalue(&nname, luaS_newliteral(L, "n")); | 198 | setsvalue(&nname, luaS_newliteral(L, "n")); |
199 | setnvalue(luaH_set(L, htab, &nname), actual); | 199 | setnvalue(luaH_set(L, htab, &nname), cast(lua_Number, actual)); |
200 | L->top -= actual; /* remove extra elements from the stack */ | 200 | L->top -= actual; /* remove extra elements from the stack */ |
201 | sethvalue(L->top, htab); | 201 | sethvalue(L->top, htab); |
202 | incr_top(L); | 202 | incr_top(L); |
@@ -251,10 +251,8 @@ StkId luaD_precall (lua_State *L, StkId func) { | |||
251 | L->base = L->ci->base = restorestack(L, funcr) + 1; | 251 | L->base = L->ci->base = restorestack(L, funcr) + 1; |
252 | ci->top = L->top + LUA_MINSTACK; | 252 | ci->top = L->top + LUA_MINSTACK; |
253 | ci->state = CI_C; /* a C function */ | 253 | ci->state = CI_C; /* a C function */ |
254 | if (L->hookmask & LUA_MASKCALL) { | 254 | if (L->hookmask & LUA_MASKCALL) |
255 | luaD_callhook(L, LUA_HOOKCALL, -1); | 255 | luaD_callhook(L, LUA_HOOKCALL, -1); |
256 | ci = L->ci; /* previous call may reallocate `ci' */ | ||
257 | } | ||
258 | lua_unlock(L); | 256 | lua_unlock(L); |
259 | #ifdef LUA_COMPATUPVALUES | 257 | #ifdef LUA_COMPATUPVALUES |
260 | lua_pushupvalues(L); | 258 | lua_pushupvalues(L); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.c,v 1.169 2003/02/11 10:46:24 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 1.170 2003/03/18 12:50:04 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 | */ |
@@ -158,7 +158,8 @@ static void traversetable (GCState *st, Table *h) { | |||
158 | if (weakkey || weakvalue) { /* is really weak? */ | 158 | if (weakkey || weakvalue) { /* is really weak? */ |
159 | GCObject **weaklist; | 159 | GCObject **weaklist; |
160 | h->marked &= ~(KEYWEAK | VALUEWEAK); /* clear bits */ | 160 | h->marked &= ~(KEYWEAK | VALUEWEAK); /* clear bits */ |
161 | h->marked |= (weakkey << KEYWEAKBIT) | (weakvalue << VALUEWEAKBIT); | 161 | h->marked |= cast(lu_byte, (weakkey << KEYWEAKBIT) | |
162 | (weakvalue << VALUEWEAKBIT)); | ||
162 | weaklist = (weakkey && weakvalue) ? &st->wkv : | 163 | weaklist = (weakkey && weakvalue) ? &st->wkv : |
163 | (weakkey) ? &st->wk : | 164 | (weakkey) ? &st->wk : |
164 | &st->wv; | 165 | &st->wv; |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lobject.c,v 1.95 2003/01/27 13:00:43 roberto Exp roberto $ | 2 | ** $Id: lobject.c,v 1.96 2003/02/18 16:02:56 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 | */ |
@@ -128,11 +128,11 @@ const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) { | |||
128 | break; | 128 | break; |
129 | } | 129 | } |
130 | case 'd': | 130 | case 'd': |
131 | setnvalue(L->top, va_arg(argp, int)); | 131 | setnvalue(L->top, cast(lua_Number, va_arg(argp, int))); |
132 | incr_top(L); | 132 | incr_top(L); |
133 | break; | 133 | break; |
134 | case 'f': | 134 | case 'f': |
135 | setnvalue(L->top, va_arg(argp, l_uacNumber)); | 135 | setnvalue(L->top, cast(lua_Number, va_arg(argp, l_uacNumber))); |
136 | incr_top(L); | 136 | incr_top(L); |
137 | break; | 137 | break; |
138 | case '%': | 138 | case '%': |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lparser.c,v 1.206 2003/02/18 16:02:56 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 1.207 2003/02/28 17:19:47 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 | */ |
@@ -961,7 +961,7 @@ static void cond (LexState *ls, expdesc *v) { | |||
961 | static void whilestat (LexState *ls, int line) { | 961 | static void whilestat (LexState *ls, int line) { |
962 | /* whilestat -> WHILE cond DO block END */ | 962 | /* whilestat -> WHILE cond DO block END */ |
963 | Instruction codeexp[MAXEXPWHILE + EXTRAEXP]; | 963 | Instruction codeexp[MAXEXPWHILE + EXTRAEXP]; |
964 | int lineexp = 0; | 964 | int lineexp; |
965 | int i; | 965 | int i; |
966 | int sizeexp; | 966 | int sizeexp; |
967 | FuncState *fs = ls->fs; | 967 | FuncState *fs = ls->fs; |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.c,v 1.121 2003/02/28 19:45:15 roberto Exp roberto $ | 2 | ** $Id: lstate.c,v 1.122 2003/03/18 12:50:04 roberto Exp roberto $ |
3 | ** Global State | 3 | ** Global State |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -100,7 +100,7 @@ static void f_luaopen (lua_State *L, void *ud) { | |||
100 | setnilvalue(defaultmeta(L)); | 100 | setnilvalue(defaultmeta(L)); |
101 | setnilvalue(registry(L)); | 101 | setnilvalue(registry(L)); |
102 | luaZ_initbuffer(L, &g->buff); | 102 | luaZ_initbuffer(L, &g->buff); |
103 | g->panic = &default_panic; | 103 | g->panic = default_panic; |
104 | g->rootgc = NULL; | 104 | g->rootgc = NULL; |
105 | g->rootudata = NULL; | 105 | g->rootudata = NULL; |
106 | g->tmudata = NULL; | 106 | g->tmudata = NULL; |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstrlib.c,v 1.96 2003/03/14 18:59:53 roberto Exp roberto $ | 2 | ** $Id: lstrlib.c,v 1.97 2003/03/19 21:16:12 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 | */ |
@@ -31,7 +31,7 @@ typedef long sint32; /* a signed version for size_t */ | |||
31 | static int str_len (lua_State *L) { | 31 | static int str_len (lua_State *L) { |
32 | size_t l; | 32 | size_t l; |
33 | luaL_checklstring(L, 1, &l); | 33 | luaL_checklstring(L, 1, &l); |
34 | lua_pushnumber(L, l); | 34 | lua_pushnumber(L, (lua_Number)l); |
35 | return 1; | 35 | return 1; |
36 | } | 36 | } |
37 | 37 | ||
@@ -48,7 +48,7 @@ static int str_sub (lua_State *L) { | |||
48 | sint32 start = posrelat(luaL_checklong(L, 2), l); | 48 | sint32 start = posrelat(luaL_checklong(L, 2), l); |
49 | sint32 end = posrelat(luaL_optlong(L, 3, -1), l); | 49 | sint32 end = posrelat(luaL_optlong(L, 3, -1), l); |
50 | if (start < 1) start = 1; | 50 | if (start < 1) start = 1; |
51 | if (end > (sint32)l) end = l; | 51 | if (end > (sint32)l) end = (sint32)l; |
52 | if (start <= end) | 52 | if (start <= end) |
53 | lua_pushlstring(L, s+start-1, end-start+1); | 53 | lua_pushlstring(L, s+start-1, end-start+1); |
54 | else lua_pushliteral(L, ""); | 54 | else lua_pushliteral(L, ""); |
@@ -452,7 +452,7 @@ static void push_onecapture (MatchState *ms, int i) { | |||
452 | int l = ms->capture[i].len; | 452 | int l = ms->capture[i].len; |
453 | if (l == CAP_UNFINISHED) luaL_error(ms->L, "unfinished capture"); | 453 | if (l == CAP_UNFINISHED) luaL_error(ms->L, "unfinished capture"); |
454 | if (l == CAP_POSITION) | 454 | if (l == CAP_POSITION) |
455 | lua_pushnumber(ms->L, ms->capture[i].init - ms->src_init + 1); | 455 | lua_pushnumber(ms->L, (lua_Number)(ms->capture[i].init - ms->src_init + 1)); |
456 | else | 456 | else |
457 | lua_pushlstring(ms->L, ms->capture[i].init, l); | 457 | lua_pushlstring(ms->L, ms->capture[i].init, l); |
458 | } | 458 | } |
@@ -479,14 +479,14 @@ static int str_find (lua_State *L) { | |||
479 | const char *p = luaL_checklstring(L, 2, &l2); | 479 | const char *p = luaL_checklstring(L, 2, &l2); |
480 | sint32 init = posrelat(luaL_optlong(L, 3, 1), l1) - 1; | 480 | sint32 init = posrelat(luaL_optlong(L, 3, 1), l1) - 1; |
481 | if (init < 0) init = 0; | 481 | if (init < 0) init = 0; |
482 | else if ((size_t)(init) > l1) init = l1; | 482 | else if ((size_t)(init) > l1) init = (sint32)l1; |
483 | if (lua_toboolean(L, 4) || /* explicit request? */ | 483 | if (lua_toboolean(L, 4) || /* explicit request? */ |
484 | strpbrk(p, SPECIALS) == NULL) { /* or no special characters? */ | 484 | strpbrk(p, SPECIALS) == NULL) { /* or no special characters? */ |
485 | /* do a plain search */ | 485 | /* do a plain search */ |
486 | const char *s2 = lmemfind(s+init, l1-init, p, l2); | 486 | const char *s2 = lmemfind(s+init, l1-init, p, l2); |
487 | if (s2) { | 487 | if (s2) { |
488 | lua_pushnumber(L, s2-s+1); | 488 | lua_pushnumber(L, (lua_Number)(s2-s+1)); |
489 | lua_pushnumber(L, s2-s+l2); | 489 | lua_pushnumber(L, (lua_Number)(s2-s+l2)); |
490 | return 2; | 490 | return 2; |
491 | } | 491 | } |
492 | } | 492 | } |
@@ -501,8 +501,8 @@ static int str_find (lua_State *L) { | |||
501 | const char *res; | 501 | const char *res; |
502 | ms.level = 0; | 502 | ms.level = 0; |
503 | if ((res=match(&ms, s1, p)) != NULL) { | 503 | if ((res=match(&ms, s1, p)) != NULL) { |
504 | lua_pushnumber(L, s1-s+1); /* start */ | 504 | lua_pushnumber(L, (lua_Number)(s1-s+1)); /* start */ |
505 | lua_pushnumber(L, res-s); /* end */ | 505 | lua_pushnumber(L, (lua_Number)(res-s)); /* end */ |
506 | return push_captures(&ms, NULL, 0) + 2; | 506 | return push_captures(&ms, NULL, 0) + 2; |
507 | } | 507 | } |
508 | } while (s1++<ms.src_end && !anchor); | 508 | } while (s1++<ms.src_end && !anchor); |
@@ -529,7 +529,7 @@ static int gfind_aux (lua_State *L) { | |||
529 | if ((e = match(&ms, src, p)) != NULL) { | 529 | if ((e = match(&ms, src, p)) != NULL) { |
530 | int newstart = e-s; | 530 | int newstart = e-s; |
531 | if (e == src) newstart++; /* empty match? go at least one position */ | 531 | if (e == src) newstart++; /* empty match? go at least one position */ |
532 | lua_pushnumber(L, newstart); | 532 | lua_pushnumber(L, (lua_Number)newstart); |
533 | lua_replace(L, lua_upvalueindex(3)); | 533 | lua_replace(L, lua_upvalueindex(3)); |
534 | return push_captures(&ms, src, e); | 534 | return push_captures(&ms, src, e); |
535 | } | 535 | } |
@@ -616,7 +616,7 @@ static int str_gsub (lua_State *L) { | |||
616 | } | 616 | } |
617 | luaL_addlstring(&b, src, ms.src_end-src); | 617 | luaL_addlstring(&b, src, ms.src_end-src); |
618 | luaL_pushresult(&b); | 618 | luaL_pushresult(&b); |
619 | lua_pushnumber(L, n); /* number of substitutions */ | 619 | lua_pushnumber(L, (lua_Number)n); /* number of substitutions */ |
620 | return 2; | 620 | return 2; |
621 | } | 621 | } |
622 | 622 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltable.c,v 1.130 2003/03/20 20:26:33 roberto Exp roberto $ | 2 | ** $Id: ltable.c,v 1.131 2003/03/24 14:18:42 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 | */ |
@@ -154,7 +154,7 @@ int luaH_next (lua_State *L, Table *t, StkId key) { | |||
154 | int i = luaH_index(L, t, key); /* find original element */ | 154 | int i = luaH_index(L, t, key); /* find original element */ |
155 | for (i++; i < t->sizearray; i++) { /* try first array part */ | 155 | for (i++; i < t->sizearray; i++) { /* try first array part */ |
156 | if (!ttisnil(&t->array[i])) { /* a non-nil value? */ | 156 | if (!ttisnil(&t->array[i])) { /* a non-nil value? */ |
157 | setnvalue(key, i+1); | 157 | setnvalue(key, cast(lua_Number, i+1)); |
158 | setobj2s(key+1, &t->array[i]); | 158 | setobj2s(key+1, &t->array[i]); |
159 | return 1; | 159 | return 1; |
160 | } | 160 | } |
@@ -502,7 +502,7 @@ TObject *luaH_setnum (lua_State *L, Table *t, int key) { | |||
502 | return cast(TObject *, p); | 502 | return cast(TObject *, p); |
503 | else { | 503 | else { |
504 | TObject k; | 504 | TObject k; |
505 | setnvalue(&k, key); | 505 | setnvalue(&k, cast(lua_Number, key)); |
506 | return newkey(L, t, &k); | 506 | return newkey(L, t, &k); |
507 | } | 507 | } |
508 | } | 508 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltablib.c,v 1.19 2003/01/27 13:46:16 roberto Exp roberto $ | 2 | ** $Id: ltablib.c,v 1.20 2003/03/11 12:24:34 roberto Exp roberto $ |
3 | ** Library for Table Manipulation | 3 | ** Library for Table Manipulation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -24,7 +24,7 @@ static int luaB_foreachi (lua_State *L) { | |||
24 | luaL_checktype(L, 2, LUA_TFUNCTION); | 24 | luaL_checktype(L, 2, LUA_TFUNCTION); |
25 | for (i=1; i<=n; i++) { | 25 | for (i=1; i<=n; i++) { |
26 | lua_pushvalue(L, 2); /* function */ | 26 | lua_pushvalue(L, 2); /* function */ |
27 | lua_pushnumber(L, i); /* 1st argument */ | 27 | lua_pushnumber(L, (lua_Number)i); /* 1st argument */ |
28 | lua_rawgeti(L, 1, i); /* 2nd argument */ | 28 | lua_rawgeti(L, 1, i); /* 2nd argument */ |
29 | lua_call(L, 2, 1); | 29 | lua_call(L, 2, 1); |
30 | if (!lua_isnil(L, -1)) | 30 | if (!lua_isnil(L, -1)) |
@@ -54,7 +54,7 @@ static int luaB_foreach (lua_State *L) { | |||
54 | 54 | ||
55 | 55 | ||
56 | static int luaB_getn (lua_State *L) { | 56 | static int luaB_getn (lua_State *L) { |
57 | lua_pushnumber(L, aux_getn(L, 1)); | 57 | lua_pushnumber(L, (lua_Number)aux_getn(L, 1)); |
58 | return 1; | 58 | return 1; |
59 | } | 59 | } |
60 | 60 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 1.155 2003/03/11 12:24:34 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 1.156 2003/03/19 21:14:53 roberto Exp roberto $ |
3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -36,6 +36,9 @@ | |||
36 | #ifdef LUA_DEBUG | 36 | #ifdef LUA_DEBUG |
37 | 37 | ||
38 | 38 | ||
39 | #define lua_pushintegral(L,i) lua_pushnumber(L, cast(lua_Number, (i))) | ||
40 | |||
41 | |||
39 | static lua_State *lua_state = NULL; | 42 | static lua_State *lua_state = NULL; |
40 | 43 | ||
41 | int islocked = 0; | 44 | int islocked = 0; |
@@ -46,7 +49,7 @@ int islocked = 0; | |||
46 | 49 | ||
47 | static void setnameval (lua_State *L, const char *name, int val) { | 50 | static void setnameval (lua_State *L, const char *name, int val) { |
48 | lua_pushstring(L, name); | 51 | lua_pushstring(L, name); |
49 | lua_pushnumber(L, val); | 52 | lua_pushintegral(L, val); |
50 | lua_settable(L, -3); | 53 | lua_settable(L, -3); |
51 | } | 54 | } |
52 | 55 | ||
@@ -196,7 +199,7 @@ static int listcode (lua_State *L) { | |||
196 | setnameval(L, "numparams", p->numparams); | 199 | setnameval(L, "numparams", p->numparams); |
197 | for (pc=0; pc<p->sizecode; pc++) { | 200 | for (pc=0; pc<p->sizecode; pc++) { |
198 | char buff[100]; | 201 | char buff[100]; |
199 | lua_pushnumber(L, pc+1); | 202 | lua_pushintegral(L, pc+1); |
200 | lua_pushstring(L, buildop(p, pc, buff)); | 203 | lua_pushstring(L, buildop(p, pc, buff)); |
201 | lua_settable(L, -3); | 204 | lua_settable(L, -3); |
202 | } | 205 | } |
@@ -212,7 +215,7 @@ static int listk (lua_State *L) { | |||
212 | p = clvalue(func_at(L, 1))->l.p; | 215 | p = clvalue(func_at(L, 1))->l.p; |
213 | lua_newtable(L); | 216 | lua_newtable(L); |
214 | for (i=0; i<p->sizek; i++) { | 217 | for (i=0; i<p->sizek; i++) { |
215 | lua_pushnumber(L, i+1); | 218 | lua_pushintegral(L, i+1); |
216 | luaA_pushobject(L, p->k+i); | 219 | luaA_pushobject(L, p->k+i); |
217 | lua_settable(L, -3); | 220 | lua_settable(L, -3); |
218 | } | 221 | } |
@@ -252,9 +255,9 @@ static int get_limits (lua_State *L) { | |||
252 | 255 | ||
253 | static int mem_query (lua_State *L) { | 256 | static int mem_query (lua_State *L) { |
254 | if (lua_isnone(L, 1)) { | 257 | if (lua_isnone(L, 1)) { |
255 | lua_pushnumber(L, memdebug_total); | 258 | lua_pushintegral(L, memdebug_total); |
256 | lua_pushnumber(L, memdebug_numblocks); | 259 | lua_pushintegral(L, memdebug_numblocks); |
257 | lua_pushnumber(L, memdebug_maxmem); | 260 | lua_pushintegral(L, memdebug_maxmem); |
258 | return 3; | 261 | return 3; |
259 | } | 262 | } |
260 | else { | 263 | else { |
@@ -267,14 +270,14 @@ static int mem_query (lua_State *L) { | |||
267 | static int hash_query (lua_State *L) { | 270 | static int hash_query (lua_State *L) { |
268 | if (lua_isnone(L, 2)) { | 271 | if (lua_isnone(L, 2)) { |
269 | luaL_argcheck(L, lua_type(L, 1) == LUA_TSTRING, 1, "string expected"); | 272 | luaL_argcheck(L, lua_type(L, 1) == LUA_TSTRING, 1, "string expected"); |
270 | lua_pushnumber(L, tsvalue(func_at(L, 1))->tsv.hash); | 273 | lua_pushintegral(L, tsvalue(func_at(L, 1))->tsv.hash); |
271 | } | 274 | } |
272 | else { | 275 | else { |
273 | TObject *o = func_at(L, 1); | 276 | TObject *o = func_at(L, 1); |
274 | Table *t; | 277 | Table *t; |
275 | luaL_checktype(L, 2, LUA_TTABLE); | 278 | luaL_checktype(L, 2, LUA_TTABLE); |
276 | t = hvalue(func_at(L, 2)); | 279 | t = hvalue(func_at(L, 2)); |
277 | lua_pushnumber(L, luaH_mainposition(t, o) - t->node); | 280 | lua_pushintegral(L, luaH_mainposition(t, o) - t->node); |
278 | } | 281 | } |
279 | return 1; | 282 | return 1; |
280 | } | 283 | } |
@@ -282,11 +285,11 @@ static int hash_query (lua_State *L) { | |||
282 | 285 | ||
283 | static int stacklevel (lua_State *L) { | 286 | static int stacklevel (lua_State *L) { |
284 | unsigned long a = 0; | 287 | unsigned long a = 0; |
285 | lua_pushnumber(L, (int)(L->top - L->stack)); | 288 | lua_pushintegral(L, (int)(L->top - L->stack)); |
286 | lua_pushnumber(L, (int)(L->stack_last - L->stack)); | 289 | lua_pushintegral(L, (int)(L->stack_last - L->stack)); |
287 | lua_pushnumber(L, (int)(L->ci - L->base_ci)); | 290 | lua_pushintegral(L, (int)(L->ci - L->base_ci)); |
288 | lua_pushnumber(L, (int)(L->end_ci - L->base_ci)); | 291 | lua_pushintegral(L, (int)(L->end_ci - L->base_ci)); |
289 | lua_pushnumber(L, (unsigned long)&a); | 292 | lua_pushintegral(L, (unsigned long)&a); |
290 | return 5; | 293 | return 5; |
291 | } | 294 | } |
292 | 295 | ||
@@ -297,12 +300,12 @@ static int table_query (lua_State *L) { | |||
297 | luaL_checktype(L, 1, LUA_TTABLE); | 300 | luaL_checktype(L, 1, LUA_TTABLE); |
298 | t = hvalue(func_at(L, 1)); | 301 | t = hvalue(func_at(L, 1)); |
299 | if (i == -1) { | 302 | if (i == -1) { |
300 | lua_pushnumber(L, t->sizearray); | 303 | lua_pushintegral(L, t->sizearray); |
301 | lua_pushnumber(L, sizenode(t)); | 304 | lua_pushintegral(L, sizenode(t)); |
302 | lua_pushnumber(L, t->firstfree - t->node); | 305 | lua_pushintegral(L, t->firstfree - t->node); |
303 | } | 306 | } |
304 | else if (i < t->sizearray) { | 307 | else if (i < t->sizearray) { |
305 | lua_pushnumber(L, i); | 308 | lua_pushintegral(L, i); |
306 | luaA_pushobject(L, &t->array[i]); | 309 | luaA_pushobject(L, &t->array[i]); |
307 | lua_pushnil(L); | 310 | lua_pushnil(L); |
308 | } | 311 | } |
@@ -316,7 +319,7 @@ static int table_query (lua_State *L) { | |||
316 | lua_pushstring(L, "<undef>"); | 319 | lua_pushstring(L, "<undef>"); |
317 | luaA_pushobject(L, gval(gnode(t, i))); | 320 | luaA_pushobject(L, gval(gnode(t, i))); |
318 | if (t->node[i].next) | 321 | if (t->node[i].next) |
319 | lua_pushnumber(L, t->node[i].next - t->node); | 322 | lua_pushintegral(L, t->node[i].next - t->node); |
320 | else | 323 | else |
321 | lua_pushnil(L); | 324 | lua_pushnil(L); |
322 | } | 325 | } |
@@ -328,8 +331,8 @@ static int string_query (lua_State *L) { | |||
328 | stringtable *tb = &G(L)->strt; | 331 | stringtable *tb = &G(L)->strt; |
329 | int s = luaL_optint(L, 2, 0) - 1; | 332 | int s = luaL_optint(L, 2, 0) - 1; |
330 | if (s==-1) { | 333 | if (s==-1) { |
331 | lua_pushnumber(L ,tb->nuse); | 334 | lua_pushintegral(L ,tb->nuse); |
332 | lua_pushnumber(L ,tb->size); | 335 | lua_pushintegral(L ,tb->size); |
333 | return 2; | 336 | return 2; |
334 | } | 337 | } |
335 | else if (s < tb->size) { | 338 | else if (s < tb->size) { |
@@ -351,7 +354,7 @@ static int tref (lua_State *L) { | |||
351 | int lock = luaL_optint(L, 2, 1); | 354 | int lock = luaL_optint(L, 2, 1); |
352 | luaL_checkany(L, 1); | 355 | luaL_checkany(L, 1); |
353 | lua_pushvalue(L, 1); | 356 | lua_pushvalue(L, 1); |
354 | lua_pushnumber(L, lua_ref(L, lock)); | 357 | lua_pushintegral(L, lua_ref(L, lock)); |
355 | assert(lua_gettop(L) == level+1); /* +1 for result */ | 358 | assert(lua_gettop(L) == level+1); /* +1 for result */ |
356 | return 1; | 359 | return 1; |
357 | } | 360 | } |
@@ -417,7 +420,7 @@ static int pushuserdata (lua_State *L) { | |||
417 | 420 | ||
418 | 421 | ||
419 | static int udataval (lua_State *L) { | 422 | static int udataval (lua_State *L) { |
420 | lua_pushnumber(L, cast(int, lua_touserdata(L, 1))); | 423 | lua_pushintegral(L, cast(int, lua_touserdata(L, 1))); |
421 | return 1; | 424 | return 1; |
422 | } | 425 | } |
423 | 426 | ||
@@ -429,7 +432,7 @@ static int doonnewstack (lua_State *L) { | |||
429 | int status = luaL_loadbuffer(L1, s, l, s); | 432 | int status = luaL_loadbuffer(L1, s, l, s); |
430 | if (status == 0) | 433 | if (status == 0) |
431 | status = lua_pcall(L1, 0, 0, 0); | 434 | status = lua_pcall(L1, 0, 0, 0); |
432 | lua_pushnumber(L, status); | 435 | lua_pushintegral(L, status); |
433 | return 1; | 436 | return 1; |
434 | } | 437 | } |
435 | 438 | ||
@@ -450,7 +453,7 @@ static int newstate (lua_State *L) { | |||
450 | lua_State *L1 = lua_open(); | 453 | lua_State *L1 = lua_open(); |
451 | if (L1) { | 454 | if (L1) { |
452 | lua_userstateopen(L1); /* init lock */ | 455 | lua_userstateopen(L1); /* init lock */ |
453 | lua_pushnumber(L, (unsigned long)L1); | 456 | lua_pushintegral(L, (unsigned long)L1); |
454 | } | 457 | } |
455 | else | 458 | else |
456 | lua_pushnil(L); | 459 | lua_pushnil(L); |
@@ -493,7 +496,7 @@ static int doremote (lua_State *L) { | |||
493 | status = lua_pcall(L1, 0, LUA_MULTRET, 0); | 496 | status = lua_pcall(L1, 0, LUA_MULTRET, 0); |
494 | if (status != 0) { | 497 | if (status != 0) { |
495 | lua_pushnil(L); | 498 | lua_pushnil(L); |
496 | lua_pushnumber(L, status); | 499 | lua_pushintegral(L, status); |
497 | lua_pushstring(L, lua_tostring(L1, -1)); | 500 | lua_pushstring(L, lua_tostring(L1, -1)); |
498 | return 3; | 501 | return 3; |
499 | } | 502 | } |
@@ -508,14 +511,14 @@ static int doremote (lua_State *L) { | |||
508 | 511 | ||
509 | 512 | ||
510 | static int log2_aux (lua_State *L) { | 513 | static int log2_aux (lua_State *L) { |
511 | lua_pushnumber(L, luaO_log2(luaL_checkint(L, 1))); | 514 | lua_pushintegral(L, luaO_log2(luaL_checkint(L, 1))); |
512 | return 1; | 515 | return 1; |
513 | } | 516 | } |
514 | 517 | ||
515 | static int int2fb_aux (lua_State *L) { | 518 | static int int2fb_aux (lua_State *L) { |
516 | int b = luaO_int2fb(luaL_checkint(L, 1)); | 519 | int b = luaO_int2fb(luaL_checkint(L, 1)); |
517 | lua_pushnumber(L, b); | 520 | lua_pushintegral(L, b); |
518 | lua_pushnumber(L, fb2int(b)); | 521 | lua_pushintegral(L, fb2int(b)); |
519 | return 2; | 522 | return 2; |
520 | } | 523 | } |
521 | 524 | ||
@@ -585,31 +588,31 @@ static int testC (lua_State *L) { | |||
585 | const char *inst = getname; | 588 | const char *inst = getname; |
586 | if EQ("") return 0; | 589 | if EQ("") return 0; |
587 | else if EQ("isnumber") { | 590 | else if EQ("isnumber") { |
588 | lua_pushnumber(L, lua_isnumber(L, getnum)); | 591 | lua_pushintegral(L, lua_isnumber(L, getnum)); |
589 | } | 592 | } |
590 | else if EQ("isstring") { | 593 | else if EQ("isstring") { |
591 | lua_pushnumber(L, lua_isstring(L, getnum)); | 594 | lua_pushintegral(L, lua_isstring(L, getnum)); |
592 | } | 595 | } |
593 | else if EQ("istable") { | 596 | else if EQ("istable") { |
594 | lua_pushnumber(L, lua_istable(L, getnum)); | 597 | lua_pushintegral(L, lua_istable(L, getnum)); |
595 | } | 598 | } |
596 | else if EQ("iscfunction") { | 599 | else if EQ("iscfunction") { |
597 | lua_pushnumber(L, lua_iscfunction(L, getnum)); | 600 | lua_pushintegral(L, lua_iscfunction(L, getnum)); |
598 | } | 601 | } |
599 | else if EQ("isfunction") { | 602 | else if EQ("isfunction") { |
600 | lua_pushnumber(L, lua_isfunction(L, getnum)); | 603 | lua_pushintegral(L, lua_isfunction(L, getnum)); |
601 | } | 604 | } |
602 | else if EQ("isuserdata") { | 605 | else if EQ("isuserdata") { |
603 | lua_pushnumber(L, lua_isuserdata(L, getnum)); | 606 | lua_pushintegral(L, lua_isuserdata(L, getnum)); |
604 | } | 607 | } |
605 | else if EQ("isudataval") { | 608 | else if EQ("isudataval") { |
606 | lua_pushnumber(L, lua_islightuserdata(L, getnum)); | 609 | lua_pushintegral(L, lua_islightuserdata(L, getnum)); |
607 | } | 610 | } |
608 | else if EQ("isnil") { | 611 | else if EQ("isnil") { |
609 | lua_pushnumber(L, lua_isnil(L, getnum)); | 612 | lua_pushintegral(L, lua_isnil(L, getnum)); |
610 | } | 613 | } |
611 | else if EQ("isnull") { | 614 | else if EQ("isnull") { |
612 | lua_pushnumber(L, lua_isnone(L, getnum)); | 615 | lua_pushintegral(L, lua_isnone(L, getnum)); |
613 | } | 616 | } |
614 | else if EQ("tonumber") { | 617 | else if EQ("tonumber") { |
615 | lua_pushnumber(L, lua_tonumber(L, getnum)); | 618 | lua_pushnumber(L, lua_tonumber(L, getnum)); |
@@ -618,11 +621,8 @@ static int testC (lua_State *L) { | |||
618 | const char *s = lua_tostring(L, getnum); | 621 | const char *s = lua_tostring(L, getnum); |
619 | lua_pushstring(L, s); | 622 | lua_pushstring(L, s); |
620 | } | 623 | } |
621 | else if EQ("tonumber") { | ||
622 | lua_pushnumber(L, lua_tonumber(L, getnum)); | ||
623 | } | ||
624 | else if EQ("strlen") { | 624 | else if EQ("strlen") { |
625 | lua_pushnumber(L, lua_strlen(L, getnum)); | 625 | lua_pushintegral(L, lua_strlen(L, getnum)); |
626 | } | 626 | } |
627 | else if EQ("tocfunction") { | 627 | else if EQ("tocfunction") { |
628 | lua_pushcfunction(L, lua_tocfunction(L, getnum)); | 628 | lua_pushcfunction(L, lua_tocfunction(L, getnum)); |
@@ -631,7 +631,7 @@ static int testC (lua_State *L) { | |||
631 | return getnum; | 631 | return getnum; |
632 | } | 632 | } |
633 | else if EQ("gettop") { | 633 | else if EQ("gettop") { |
634 | lua_pushnumber(L, lua_gettop(L)); | 634 | lua_pushintegral(L, lua_gettop(L)); |
635 | } | 635 | } |
636 | else if EQ("settop") { | 636 | else if EQ("settop") { |
637 | lua_settop(L, getnum); | 637 | lua_settop(L, getnum); |
@@ -640,7 +640,7 @@ static int testC (lua_State *L) { | |||
640 | lua_pop(L, getnum); | 640 | lua_pop(L, getnum); |
641 | } | 641 | } |
642 | else if EQ("pushnum") { | 642 | else if EQ("pushnum") { |
643 | lua_pushnumber(L, getnum); | 643 | lua_pushintegral(L, getnum); |
644 | } | 644 | } |
645 | else if EQ("pushnil") { | 645 | else if EQ("pushnil") { |
646 | lua_pushnil(L); | 646 | lua_pushnil(L); |
@@ -649,7 +649,7 @@ static int testC (lua_State *L) { | |||
649 | lua_pushboolean(L, getnum); | 649 | lua_pushboolean(L, getnum); |
650 | } | 650 | } |
651 | else if EQ("tobool") { | 651 | else if EQ("tobool") { |
652 | lua_pushnumber(L, lua_toboolean(L, getnum)); | 652 | lua_pushintegral(L, lua_toboolean(L, getnum)); |
653 | } | 653 | } |
654 | else if EQ("pushvalue") { | 654 | else if EQ("pushvalue") { |
655 | lua_pushvalue(L, getnum); | 655 | lua_pushvalue(L, getnum); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltm.c,v 1.104 2002/11/14 11:51:50 roberto Exp roberto $ | 2 | ** $Id: ltm.c,v 1.105 2002/12/04 17:38:31 roberto Exp roberto $ |
3 | ** Tag methods | 3 | ** Tag methods |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -49,7 +49,7 @@ const TObject *luaT_gettm (Table *events, TMS event, TString *ename) { | |||
49 | const TObject *tm = luaH_getstr(events, ename); | 49 | const TObject *tm = luaH_getstr(events, ename); |
50 | lua_assert(event <= TM_EQ); | 50 | lua_assert(event <= TM_EQ); |
51 | if (ttisnil(tm)) { /* no tag method? */ | 51 | if (ttisnil(tm)) { /* no tag method? */ |
52 | events->flags |= (1u<<event); /* cache this fact */ | 52 | events->flags |= cast(lu_byte, 1u<<event); /* cache this fact */ |
53 | return NULL; | 53 | return NULL; |
54 | } | 54 | } |
55 | else return tm; | 55 | else return tm; |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 1.282 2003/03/11 12:30:37 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 1.283 2003/03/31 13:00:25 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 | */ |
@@ -286,7 +286,7 @@ static int luaV_lessequal (lua_State *L, const TObject *l, const TObject *r) { | |||
286 | 286 | ||
287 | 287 | ||
288 | int luaV_equalval (lua_State *L, const TObject *t1, const TObject *t2) { | 288 | int luaV_equalval (lua_State *L, const TObject *t1, const TObject *t2) { |
289 | const TObject *tm = NULL; | 289 | const TObject *tm; |
290 | lua_assert(ttype(t1) == ttype(t2)); | 290 | lua_assert(ttype(t1) == ttype(t2)); |
291 | switch (ttype(t1)) { | 291 | switch (ttype(t1)) { |
292 | case LUA_TNIL: return 1; | 292 | case LUA_TNIL: return 1; |