diff --git a/lapi.c b/lapi.c index d4d06777..b1a95b79 100644 --- a/lapi.c +++ b/lapi.c @@ -1,5 +1,5 @@ /* -** $Id: lapi.c,v 1.232 2003/02/27 12:33:07 roberto Exp roberto $ +** $Id: lapi.c,v 1.233 2003/03/14 18:59:21 roberto Exp roberto $ ** Lua API ** See Copyright Notice in lua.h */ @@ -681,7 +681,7 @@ LUA_API int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc) { func = (errfunc == 0) ? 0 : savestack(L, luaA_index(L, errfunc)); c.func = L->top - (nargs+1); /* function to be called */ c.nresults = nresults; - status = luaD_pcall(L, &f_call, &c, savestack(L, c.func), func); + status = luaD_pcall(L, f_call, &c, savestack(L, c.func), func); lua_unlock(L); return status; } @@ -715,7 +715,7 @@ LUA_API int lua_cpcall (lua_State *L, lua_CFunction func, void *ud) { lua_lock(L); c.func = func; c.ud = ud; - status = luaD_pcall(L, &f_Ccall, &c, savestack(L, L->top), 0); + status = luaD_pcall(L, f_Ccall, &c, savestack(L, L->top), 0); lua_unlock(L); return status; } diff --git a/lauxlib.c b/lauxlib.c index 9cfeeb71..6f802534 100644 --- a/lauxlib.c +++ b/lauxlib.c @@ -1,5 +1,5 @@ /* -** $Id: lauxlib.c,v 1.97 2003/03/18 18:48:31 roberto Exp roberto $ +** $Id: lauxlib.c,v 1.98 2003/04/01 17:52:31 roberto Exp roberto $ ** Auxiliary functions for building Lua libraries ** See Copyright Notice in lua.h */ @@ -278,13 +278,13 @@ void luaL_setn (lua_State *L, int t, int n) { lua_rawget(L, t); if (checkint(L, 1) >= 0) { /* is there a numeric field `n'? */ lua_pushliteral(L, "n"); /* use it */ - lua_pushnumber(L, n); + lua_pushnumber(L, (lua_Number)n); lua_rawset(L, t); } else { /* use `sizes' */ getsizes(L); lua_pushvalue(L, t); - lua_pushnumber(L, n); + lua_pushnumber(L, (lua_Number)n); lua_rawset(L, -3); /* sizes[t] = n */ lua_pop(L, 1); /* remove `sizes' */ } @@ -438,7 +438,7 @@ LUALIB_API void luaL_unref (lua_State *L, int t, int ref) { if (ref >= 0) { lua_rawgeti(L, t, FREELIST_REF); lua_rawseti(L, t, ref); /* t[ref] = t[FREELIST_REF] */ - lua_pushnumber(L, ref); + lua_pushnumber(L, (lua_Number)ref); lua_rawseti(L, t, FREELIST_REF); /* t[FREELIST_REF] = ref */ } } diff --git a/lauxlib.h b/lauxlib.h index 5969cbf8..25f3c441 100644 --- a/lauxlib.h +++ b/lauxlib.h @@ -1,5 +1,5 @@ /* -** $Id: lauxlib.h,v 1.58 2003/02/11 15:32:31 roberto Exp roberto $ +** $Id: lauxlib.h,v 1.59 2003/03/18 12:25:32 roberto Exp roberto $ ** Auxiliary functions for building Lua libraries ** See Copyright Notice in lua.h */ @@ -76,8 +76,8 @@ LUALIB_API int luaL_loadbuffer (lua_State *L, const char *buff, size_t sz, #define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL)) #define luaL_checkint(L,n) ((int)luaL_checknumber(L, n)) #define luaL_checklong(L,n) ((long)luaL_checknumber(L, n)) -#define luaL_optint(L,n,d) ((int)luaL_optnumber(L, n,d)) -#define luaL_optlong(L,n,d) ((long)luaL_optnumber(L, n,d)) +#define luaL_optint(L,n,d) ((int)luaL_optnumber(L, n,(lua_Number)(d))) +#define luaL_optlong(L,n,d) ((long)luaL_optnumber(L, n,(lua_Number)(d))) /* diff --git a/lbaselib.c b/lbaselib.c index 1c02921a..7d559585 100644 --- a/lbaselib.c +++ b/lbaselib.c @@ -1,5 +1,5 @@ /* -** $Id: lbaselib.c,v 1.128 2003/03/11 18:17:43 roberto Exp roberto $ +** $Id: lbaselib.c,v 1.129 2003/03/19 21:14:34 roberto Exp roberto $ ** Basic library ** See Copyright Notice in lua.h */ @@ -66,7 +66,7 @@ static int luaB_tonumber (lua_State *L) { if (s1 != s2) { /* at least one valid digit? */ while (isspace((unsigned char)(*s2))) s2++; /* skip trailing spaces */ if (*s2 == '\0') { /* no invalid trailing characters? */ - lua_pushnumber(L, n); + lua_pushnumber(L, (lua_Number)n); return 1; } } @@ -187,8 +187,8 @@ static int luaB_rawset (lua_State *L) { static int luaB_gcinfo (lua_State *L) { - lua_pushnumber(L, lua_getgccount(L)); - lua_pushnumber(L, lua_getgcthreshold(L)); + lua_pushnumber(L, (lua_Number)lua_getgccount(L)); + lua_pushnumber(L, (lua_Number)lua_getgcthreshold(L)); return 2; } diff --git a/lcode.c b/lcode.c index ed1e0bff..96b01e37 100644 --- a/lcode.c +++ b/lcode.c @@ -1,5 +1,5 @@ /* -** $Id: lcode.c,v 1.115 2002/12/11 12:34:22 roberto Exp roberto $ +** $Id: lcode.c,v 1.116 2003/02/27 12:33:07 roberto Exp roberto $ ** Code generator for Lua ** See Copyright Notice in lua.h */ @@ -217,7 +217,7 @@ static int addk (FuncState *fs, TObject *k, TObject *v) { luaM_growvector(fs->L, f->k, fs->nk, f->sizek, TObject, MAXARG_Bx, "constant table overflow"); setobj2n(&f->k[fs->nk], v); - setnvalue(luaH_set(fs->L, fs->h, k), fs->nk); + setnvalue(luaH_set(fs->L, fs->h, k), cast(lua_Number, fs->nk)); return fs->nk++; } } diff --git a/ldblib.c b/ldblib.c index e5c48ca8..a4d2d66b 100644 --- a/ldblib.c +++ b/ldblib.c @@ -1,5 +1,5 @@ /* -** $Id: ldblib.c,v 1.78 2003/02/27 11:52:30 roberto Exp roberto $ +** $Id: ldblib.c,v 1.79 2003/03/11 12:24:34 roberto Exp roberto $ ** Interface from Lua to its debug API ** See Copyright Notice in lua.h */ @@ -27,7 +27,7 @@ static void settabss (lua_State *L, const char *i, const char *v) { static void settabsi (lua_State *L, const char *i, int v) { lua_pushstring(L, i); - lua_pushnumber(L, v); + lua_pushnumber(L, (lua_Number)v); lua_rawset(L, -3); } @@ -143,7 +143,8 @@ static void hookf (lua_State *L, lua_Debug *ar) { lua_rawget(L, LUA_REGISTRYINDEX); if (lua_isfunction(L, -1)) { lua_pushstring(L, hooknames[(int)ar->event]); - if (ar->currentline >= 0) lua_pushnumber(L, ar->currentline); + if (ar->currentline >= 0) + lua_pushnumber(L, (lua_Number)ar->currentline); else lua_pushnil(L); lua_assert(lua_getinfo(L, "lS", ar)); lua_call(L, 2, 0); @@ -202,7 +203,7 @@ static int gethook (lua_State *L) { lua_rawget(L, LUA_REGISTRYINDEX); /* get hook */ } lua_pushstring(L, unmakemask(mask, buff)); - lua_pushnumber(L, lua_gethookcount(L)); + lua_pushnumber(L, (lua_Number)lua_gethookcount(L)); return 3; } diff --git a/ldo.c b/ldo.c index 985ab6e3..6dbfe833 100644 --- a/ldo.c +++ b/ldo.c @@ -1,5 +1,5 @@ /* -** $Id: ldo.c,v 1.215 2003/02/28 15:42:08 roberto Exp roberto $ +** $Id: ldo.c,v 1.216 2003/02/28 19:45:15 roberto Exp roberto $ ** Stack and Call structure of Lua ** See Copyright Notice in lua.h */ @@ -196,7 +196,7 @@ static void adjust_varargs (lua_State *L, int nfixargs, StkId base) { setobj2n(luaH_setnum(L, htab, i+1), L->top - actual + i); /* store counter in field `n' */ setsvalue(&nname, luaS_newliteral(L, "n")); - setnvalue(luaH_set(L, htab, &nname), actual); + setnvalue(luaH_set(L, htab, &nname), cast(lua_Number, actual)); L->top -= actual; /* remove extra elements from the stack */ sethvalue(L->top, htab); incr_top(L); @@ -251,10 +251,8 @@ StkId luaD_precall (lua_State *L, StkId func) { L->base = L->ci->base = restorestack(L, funcr) + 1; ci->top = L->top + LUA_MINSTACK; ci->state = CI_C; /* a C function */ - if (L->hookmask & LUA_MASKCALL) { + if (L->hookmask & LUA_MASKCALL) luaD_callhook(L, LUA_HOOKCALL, -1); - ci = L->ci; /* previous call may reallocate `ci' */ - } lua_unlock(L); #ifdef LUA_COMPATUPVALUES lua_pushupvalues(L); diff --git a/lgc.c b/lgc.c index 71cacd1d..fe9bed2d 100644 --- a/lgc.c +++ b/lgc.c @@ -1,5 +1,5 @@ /* -** $Id: lgc.c,v 1.169 2003/02/11 10:46:24 roberto Exp roberto $ +** $Id: lgc.c,v 1.170 2003/03/18 12:50:04 roberto Exp roberto $ ** Garbage Collector ** See Copyright Notice in lua.h */ @@ -158,7 +158,8 @@ static void traversetable (GCState *st, Table *h) { if (weakkey || weakvalue) { /* is really weak? */ GCObject **weaklist; h->marked &= ~(KEYWEAK | VALUEWEAK); /* clear bits */ - h->marked |= (weakkey << KEYWEAKBIT) | (weakvalue << VALUEWEAKBIT); + h->marked |= cast(lu_byte, (weakkey << KEYWEAKBIT) | + (weakvalue << VALUEWEAKBIT)); weaklist = (weakkey && weakvalue) ? &st->wkv : (weakkey) ? &st->wk : &st->wv; diff --git a/lobject.c b/lobject.c index 5c5c1383..7106478a 100644 --- a/lobject.c +++ b/lobject.c @@ -1,5 +1,5 @@ /* -** $Id: lobject.c,v 1.95 2003/01/27 13:00:43 roberto Exp roberto $ +** $Id: lobject.c,v 1.96 2003/02/18 16:02:56 roberto Exp roberto $ ** Some generic functions over Lua objects ** See Copyright Notice in lua.h */ @@ -128,11 +128,11 @@ const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) { break; } case 'd': - setnvalue(L->top, va_arg(argp, int)); + setnvalue(L->top, cast(lua_Number, va_arg(argp, int))); incr_top(L); break; case 'f': - setnvalue(L->top, va_arg(argp, l_uacNumber)); + setnvalue(L->top, cast(lua_Number, va_arg(argp, l_uacNumber))); incr_top(L); break; case '%': diff --git a/lparser.c b/lparser.c index 722c5bb8..0ebb1ee3 100644 --- a/lparser.c +++ b/lparser.c @@ -1,5 +1,5 @@ /* -** $Id: lparser.c,v 1.206 2003/02/18 16:02:56 roberto Exp roberto $ +** $Id: lparser.c,v 1.207 2003/02/28 17:19:47 roberto Exp roberto $ ** Lua Parser ** See Copyright Notice in lua.h */ @@ -961,7 +961,7 @@ static void cond (LexState *ls, expdesc *v) { static void whilestat (LexState *ls, int line) { /* whilestat -> WHILE cond DO block END */ Instruction codeexp[MAXEXPWHILE + EXTRAEXP]; - int lineexp = 0; + int lineexp; int i; int sizeexp; FuncState *fs = ls->fs; diff --git a/lstate.c b/lstate.c index 63bbb497..008955e4 100644 --- a/lstate.c +++ b/lstate.c @@ -1,5 +1,5 @@ /* -** $Id: lstate.c,v 1.121 2003/02/28 19:45:15 roberto Exp roberto $ +** $Id: lstate.c,v 1.122 2003/03/18 12:50:04 roberto Exp roberto $ ** Global State ** See Copyright Notice in lua.h */ @@ -100,7 +100,7 @@ static void f_luaopen (lua_State *L, void *ud) { setnilvalue(defaultmeta(L)); setnilvalue(registry(L)); luaZ_initbuffer(L, &g->buff); - g->panic = &default_panic; + g->panic = default_panic; g->rootgc = NULL; g->rootudata = NULL; g->tmudata = NULL; diff --git a/lstrlib.c b/lstrlib.c index e1aee1fd..e4be9f58 100644 --- a/lstrlib.c +++ b/lstrlib.c @@ -1,5 +1,5 @@ /* -** $Id: lstrlib.c,v 1.96 2003/03/14 18:59:53 roberto Exp roberto $ +** $Id: lstrlib.c,v 1.97 2003/03/19 21:16:12 roberto Exp roberto $ ** Standard library for string operations and pattern-matching ** See Copyright Notice in lua.h */ @@ -31,7 +31,7 @@ typedef long sint32; /* a signed version for size_t */ static int str_len (lua_State *L) { size_t l; luaL_checklstring(L, 1, &l); - lua_pushnumber(L, l); + lua_pushnumber(L, (lua_Number)l); return 1; } @@ -48,7 +48,7 @@ static int str_sub (lua_State *L) { sint32 start = posrelat(luaL_checklong(L, 2), l); sint32 end = posrelat(luaL_optlong(L, 3, -1), l); if (start < 1) start = 1; - if (end > (sint32)l) end = l; + if (end > (sint32)l) end = (sint32)l; if (start <= end) lua_pushlstring(L, s+start-1, end-start+1); else lua_pushliteral(L, ""); @@ -452,7 +452,7 @@ static void push_onecapture (MatchState *ms, int i) { int l = ms->capture[i].len; if (l == CAP_UNFINISHED) luaL_error(ms->L, "unfinished capture"); if (l == CAP_POSITION) - lua_pushnumber(ms->L, ms->capture[i].init - ms->src_init + 1); + lua_pushnumber(ms->L, (lua_Number)(ms->capture[i].init - ms->src_init + 1)); else lua_pushlstring(ms->L, ms->capture[i].init, l); } @@ -479,14 +479,14 @@ static int str_find (lua_State *L) { const char *p = luaL_checklstring(L, 2, &l2); sint32 init = posrelat(luaL_optlong(L, 3, 1), l1) - 1; if (init < 0) init = 0; - else if ((size_t)(init) > l1) init = l1; + else if ((size_t)(init) > l1) init = (sint32)l1; if (lua_toboolean(L, 4) || /* explicit request? */ strpbrk(p, SPECIALS) == NULL) { /* or no special characters? */ /* do a plain search */ const char *s2 = lmemfind(s+init, l1-init, p, l2); if (s2) { - lua_pushnumber(L, s2-s+1); - lua_pushnumber(L, s2-s+l2); + lua_pushnumber(L, (lua_Number)(s2-s+1)); + lua_pushnumber(L, (lua_Number)(s2-s+l2)); return 2; } } @@ -501,8 +501,8 @@ static int str_find (lua_State *L) { const char *res; ms.level = 0; if ((res=match(&ms, s1, p)) != NULL) { - lua_pushnumber(L, s1-s+1); /* start */ - lua_pushnumber(L, res-s); /* end */ + lua_pushnumber(L, (lua_Number)(s1-s+1)); /* start */ + lua_pushnumber(L, (lua_Number)(res-s)); /* end */ return push_captures(&ms, NULL, 0) + 2; } } while (s1++sizearray; i++) { /* try first array part */ if (!ttisnil(&t->array[i])) { /* a non-nil value? */ - setnvalue(key, i+1); + setnvalue(key, cast(lua_Number, i+1)); setobj2s(key+1, &t->array[i]); return 1; } @@ -502,7 +502,7 @@ TObject *luaH_setnum (lua_State *L, Table *t, int key) { return cast(TObject *, p); else { TObject k; - setnvalue(&k, key); + setnvalue(&k, cast(lua_Number, key)); return newkey(L, t, &k); } } diff --git a/ltablib.c b/ltablib.c index 49475145..39447e29 100644 --- a/ltablib.c +++ b/ltablib.c @@ -1,5 +1,5 @@ /* -** $Id: ltablib.c,v 1.19 2003/01/27 13:46:16 roberto Exp roberto $ +** $Id: ltablib.c,v 1.20 2003/03/11 12:24:34 roberto Exp roberto $ ** Library for Table Manipulation ** See Copyright Notice in lua.h */ @@ -24,7 +24,7 @@ static int luaB_foreachi (lua_State *L) { luaL_checktype(L, 2, LUA_TFUNCTION); for (i=1; i<=n; i++) { lua_pushvalue(L, 2); /* function */ - lua_pushnumber(L, i); /* 1st argument */ + lua_pushnumber(L, (lua_Number)i); /* 1st argument */ lua_rawgeti(L, 1, i); /* 2nd argument */ lua_call(L, 2, 1); if (!lua_isnil(L, -1)) @@ -54,7 +54,7 @@ static int luaB_foreach (lua_State *L) { static int luaB_getn (lua_State *L) { - lua_pushnumber(L, aux_getn(L, 1)); + lua_pushnumber(L, (lua_Number)aux_getn(L, 1)); return 1; } diff --git a/ltests.c b/ltests.c index da880c65..3f2b724b 100644 --- a/ltests.c +++ b/ltests.c @@ -1,5 +1,5 @@ /* -** $Id: ltests.c,v 1.155 2003/03/11 12:24:34 roberto Exp roberto $ +** $Id: ltests.c,v 1.156 2003/03/19 21:14:53 roberto Exp roberto $ ** Internal Module for Debugging of the Lua Implementation ** See Copyright Notice in lua.h */ @@ -36,6 +36,9 @@ #ifdef LUA_DEBUG +#define lua_pushintegral(L,i) lua_pushnumber(L, cast(lua_Number, (i))) + + static lua_State *lua_state = NULL; int islocked = 0; @@ -46,7 +49,7 @@ int islocked = 0; static void setnameval (lua_State *L, const char *name, int val) { lua_pushstring(L, name); - lua_pushnumber(L, val); + lua_pushintegral(L, val); lua_settable(L, -3); } @@ -196,7 +199,7 @@ static int listcode (lua_State *L) { setnameval(L, "numparams", p->numparams); for (pc=0; pcsizecode; pc++) { char buff[100]; - lua_pushnumber(L, pc+1); + lua_pushintegral(L, pc+1); lua_pushstring(L, buildop(p, pc, buff)); lua_settable(L, -3); } @@ -212,7 +215,7 @@ static int listk (lua_State *L) { p = clvalue(func_at(L, 1))->l.p; lua_newtable(L); for (i=0; isizek; i++) { - lua_pushnumber(L, i+1); + lua_pushintegral(L, i+1); luaA_pushobject(L, p->k+i); lua_settable(L, -3); } @@ -252,9 +255,9 @@ static int get_limits (lua_State *L) { static int mem_query (lua_State *L) { if (lua_isnone(L, 1)) { - lua_pushnumber(L, memdebug_total); - lua_pushnumber(L, memdebug_numblocks); - lua_pushnumber(L, memdebug_maxmem); + lua_pushintegral(L, memdebug_total); + lua_pushintegral(L, memdebug_numblocks); + lua_pushintegral(L, memdebug_maxmem); return 3; } else { @@ -267,14 +270,14 @@ static int mem_query (lua_State *L) { static int hash_query (lua_State *L) { if (lua_isnone(L, 2)) { luaL_argcheck(L, lua_type(L, 1) == LUA_TSTRING, 1, "string expected"); - lua_pushnumber(L, tsvalue(func_at(L, 1))->tsv.hash); + lua_pushintegral(L, tsvalue(func_at(L, 1))->tsv.hash); } else { TObject *o = func_at(L, 1); Table *t; luaL_checktype(L, 2, LUA_TTABLE); t = hvalue(func_at(L, 2)); - lua_pushnumber(L, luaH_mainposition(t, o) - t->node); + lua_pushintegral(L, luaH_mainposition(t, o) - t->node); } return 1; } @@ -282,11 +285,11 @@ static int hash_query (lua_State *L) { static int stacklevel (lua_State *L) { unsigned long a = 0; - lua_pushnumber(L, (int)(L->top - L->stack)); - lua_pushnumber(L, (int)(L->stack_last - L->stack)); - lua_pushnumber(L, (int)(L->ci - L->base_ci)); - lua_pushnumber(L, (int)(L->end_ci - L->base_ci)); - lua_pushnumber(L, (unsigned long)&a); + lua_pushintegral(L, (int)(L->top - L->stack)); + lua_pushintegral(L, (int)(L->stack_last - L->stack)); + lua_pushintegral(L, (int)(L->ci - L->base_ci)); + lua_pushintegral(L, (int)(L->end_ci - L->base_ci)); + lua_pushintegral(L, (unsigned long)&a); return 5; } @@ -297,12 +300,12 @@ static int table_query (lua_State *L) { luaL_checktype(L, 1, LUA_TTABLE); t = hvalue(func_at(L, 1)); if (i == -1) { - lua_pushnumber(L, t->sizearray); - lua_pushnumber(L, sizenode(t)); - lua_pushnumber(L, t->firstfree - t->node); + lua_pushintegral(L, t->sizearray); + lua_pushintegral(L, sizenode(t)); + lua_pushintegral(L, t->firstfree - t->node); } else if (i < t->sizearray) { - lua_pushnumber(L, i); + lua_pushintegral(L, i); luaA_pushobject(L, &t->array[i]); lua_pushnil(L); } @@ -316,7 +319,7 @@ static int table_query (lua_State *L) { lua_pushstring(L, ""); luaA_pushobject(L, gval(gnode(t, i))); if (t->node[i].next) - lua_pushnumber(L, t->node[i].next - t->node); + lua_pushintegral(L, t->node[i].next - t->node); else lua_pushnil(L); } @@ -328,8 +331,8 @@ static int string_query (lua_State *L) { stringtable *tb = &G(L)->strt; int s = luaL_optint(L, 2, 0) - 1; if (s==-1) { - lua_pushnumber(L ,tb->nuse); - lua_pushnumber(L ,tb->size); + lua_pushintegral(L ,tb->nuse); + lua_pushintegral(L ,tb->size); return 2; } else if (s < tb->size) { @@ -351,7 +354,7 @@ static int tref (lua_State *L) { int lock = luaL_optint(L, 2, 1); luaL_checkany(L, 1); lua_pushvalue(L, 1); - lua_pushnumber(L, lua_ref(L, lock)); + lua_pushintegral(L, lua_ref(L, lock)); assert(lua_gettop(L) == level+1); /* +1 for result */ return 1; } @@ -417,7 +420,7 @@ static int pushuserdata (lua_State *L) { static int udataval (lua_State *L) { - lua_pushnumber(L, cast(int, lua_touserdata(L, 1))); + lua_pushintegral(L, cast(int, lua_touserdata(L, 1))); return 1; } @@ -429,7 +432,7 @@ static int doonnewstack (lua_State *L) { int status = luaL_loadbuffer(L1, s, l, s); if (status == 0) status = lua_pcall(L1, 0, 0, 0); - lua_pushnumber(L, status); + lua_pushintegral(L, status); return 1; } @@ -450,7 +453,7 @@ static int newstate (lua_State *L) { lua_State *L1 = lua_open(); if (L1) { lua_userstateopen(L1); /* init lock */ - lua_pushnumber(L, (unsigned long)L1); + lua_pushintegral(L, (unsigned long)L1); } else lua_pushnil(L); @@ -493,7 +496,7 @@ static int doremote (lua_State *L) { status = lua_pcall(L1, 0, LUA_MULTRET, 0); if (status != 0) { lua_pushnil(L); - lua_pushnumber(L, status); + lua_pushintegral(L, status); lua_pushstring(L, lua_tostring(L1, -1)); return 3; } @@ -508,14 +511,14 @@ static int doremote (lua_State *L) { static int log2_aux (lua_State *L) { - lua_pushnumber(L, luaO_log2(luaL_checkint(L, 1))); + lua_pushintegral(L, luaO_log2(luaL_checkint(L, 1))); return 1; } static int int2fb_aux (lua_State *L) { int b = luaO_int2fb(luaL_checkint(L, 1)); - lua_pushnumber(L, b); - lua_pushnumber(L, fb2int(b)); + lua_pushintegral(L, b); + lua_pushintegral(L, fb2int(b)); return 2; } @@ -585,31 +588,31 @@ static int testC (lua_State *L) { const char *inst = getname; if EQ("") return 0; else if EQ("isnumber") { - lua_pushnumber(L, lua_isnumber(L, getnum)); + lua_pushintegral(L, lua_isnumber(L, getnum)); } else if EQ("isstring") { - lua_pushnumber(L, lua_isstring(L, getnum)); + lua_pushintegral(L, lua_isstring(L, getnum)); } else if EQ("istable") { - lua_pushnumber(L, lua_istable(L, getnum)); + lua_pushintegral(L, lua_istable(L, getnum)); } else if EQ("iscfunction") { - lua_pushnumber(L, lua_iscfunction(L, getnum)); + lua_pushintegral(L, lua_iscfunction(L, getnum)); } else if EQ("isfunction") { - lua_pushnumber(L, lua_isfunction(L, getnum)); + lua_pushintegral(L, lua_isfunction(L, getnum)); } else if EQ("isuserdata") { - lua_pushnumber(L, lua_isuserdata(L, getnum)); + lua_pushintegral(L, lua_isuserdata(L, getnum)); } else if EQ("isudataval") { - lua_pushnumber(L, lua_islightuserdata(L, getnum)); + lua_pushintegral(L, lua_islightuserdata(L, getnum)); } else if EQ("isnil") { - lua_pushnumber(L, lua_isnil(L, getnum)); + lua_pushintegral(L, lua_isnil(L, getnum)); } else if EQ("isnull") { - lua_pushnumber(L, lua_isnone(L, getnum)); + lua_pushintegral(L, lua_isnone(L, getnum)); } else if EQ("tonumber") { lua_pushnumber(L, lua_tonumber(L, getnum)); @@ -618,11 +621,8 @@ static int testC (lua_State *L) { const char *s = lua_tostring(L, getnum); lua_pushstring(L, s); } - else if EQ("tonumber") { - lua_pushnumber(L, lua_tonumber(L, getnum)); - } else if EQ("strlen") { - lua_pushnumber(L, lua_strlen(L, getnum)); + lua_pushintegral(L, lua_strlen(L, getnum)); } else if EQ("tocfunction") { lua_pushcfunction(L, lua_tocfunction(L, getnum)); @@ -631,7 +631,7 @@ static int testC (lua_State *L) { return getnum; } else if EQ("gettop") { - lua_pushnumber(L, lua_gettop(L)); + lua_pushintegral(L, lua_gettop(L)); } else if EQ("settop") { lua_settop(L, getnum); @@ -640,7 +640,7 @@ static int testC (lua_State *L) { lua_pop(L, getnum); } else if EQ("pushnum") { - lua_pushnumber(L, getnum); + lua_pushintegral(L, getnum); } else if EQ("pushnil") { lua_pushnil(L); @@ -649,7 +649,7 @@ static int testC (lua_State *L) { lua_pushboolean(L, getnum); } else if EQ("tobool") { - lua_pushnumber(L, lua_toboolean(L, getnum)); + lua_pushintegral(L, lua_toboolean(L, getnum)); } else if EQ("pushvalue") { lua_pushvalue(L, getnum); diff --git a/ltm.c b/ltm.c index 8a4c8e74..5687e28b 100644 --- a/ltm.c +++ b/ltm.c @@ -1,5 +1,5 @@ /* -** $Id: ltm.c,v 1.104 2002/11/14 11:51:50 roberto Exp roberto $ +** $Id: ltm.c,v 1.105 2002/12/04 17:38:31 roberto Exp roberto $ ** Tag methods ** See Copyright Notice in lua.h */ @@ -49,7 +49,7 @@ const TObject *luaT_gettm (Table *events, TMS event, TString *ename) { const TObject *tm = luaH_getstr(events, ename); lua_assert(event <= TM_EQ); if (ttisnil(tm)) { /* no tag method? */ - events->flags |= (1u<flags |= cast(lu_byte, 1u<