From 53f9499f7f7bf1fb41a37382ffef8a6796a528c1 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Sun, 18 Apr 2010 10:22:48 -0300 Subject: [PATCH] "light C function" is a better name than "C-function pointer" --- lapi.c | 10 +++++----- ldo.c | 4 ++-- lobject.c | 4 ++-- lobject.h | 12 ++++++------ ltable.c | 4 ++-- lvm.c | 4 ++-- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lapi.c b/lapi.c index 805eedef..b56f8c85 100644 --- a/lapi.c +++ b/lapi.c @@ -1,5 +1,5 @@ /* -** $Id: lapi.c,v 2.120 2010/04/05 14:21:38 roberto Exp roberto $ +** $Id: lapi.c,v 2.121 2010/04/13 20:48:12 roberto Exp roberto $ ** Lua API ** See Copyright Notice in lua.h */ @@ -56,7 +56,7 @@ static TValue *index2addr (lua_State *L, int idx) { else { /* upvalues */ idx = LUA_REGISTRYINDEX - idx; api_check(L, idx <= UCHAR_MAX + 1, "upvalue index too large"); - if (ttiscfp(ci->func)) /* C-function pointer? */ + if (ttislcf(ci->func)) /* light C function? */ return cast(TValue *, luaO_nilobject); /* it has no upvalues */ else { Closure *func = clvalue(ci->func); @@ -241,7 +241,7 @@ LUA_API const char *lua_typename (lua_State *L, int t) { LUA_API int lua_iscfunction (lua_State *L, int idx) { StkId o = index2addr(L, idx); - return (ttiscfp(o) || (ttisclosure(o) && clvalue(o)->c.isC)); + return (ttislcf(o) || (ttisclosure(o) && clvalue(o)->c.isC)); } @@ -367,7 +367,7 @@ LUA_API size_t lua_rawlen (lua_State *L, int idx) { LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) { StkId o = index2addr(L, idx); - if (ttiscfp(o)) return fvalue(o); + if (ttislcf(o)) return fvalue(o); else if (ttisclosure(o) && clvalue(o)->c.isC) return clvalue(o)->c.f; else return NULL; /* not a C function */ @@ -395,7 +395,7 @@ LUA_API const void *lua_topointer (lua_State *L, int idx) { switch (ttype(o)) { case LUA_TTABLE: return hvalue(o); case LUA_TFUNCTION: return clvalue(o); - case LUA_TCFP: return cast(void *, cast(size_t, fvalue(o))); + case LUA_TLCF: return cast(void *, cast(size_t, fvalue(o))); case LUA_TTHREAD: return thvalue(o); case LUA_TUSERDATA: case LUA_TLIGHTUSERDATA: diff --git a/ldo.c b/ldo.c index ef7dda8a..73d65371 100644 --- a/ldo.c +++ b/ldo.c @@ -1,5 +1,5 @@ /* -** $Id: ldo.c,v 2.84 2010/04/13 20:48:12 roberto Exp roberto $ +** $Id: ldo.c,v 2.85 2010/04/18 12:41:35 roberto Exp roberto $ ** Stack and Call structure of Lua ** See Copyright Notice in lua.h */ @@ -300,7 +300,7 @@ int luaD_precall (lua_State *L, StkId func, int nresults) { func = tryfuncTM(L, func); /* check the `function' tag method */ funcr = savestack(L, func); L->ci->nresults = nresults; - if (ttiscfp(func)) { /* C function pointer? */ + if (ttislcf(func)) { /* light C function? */ f = fvalue(func); /* get it */ goto isCfunc; /* go to call it */ } diff --git a/lobject.c b/lobject.c index e2208789..5cc4c58a 100644 --- a/lobject.c +++ b/lobject.c @@ -1,5 +1,5 @@ /* -** $Id: lobject.c,v 2.38 2010/04/13 20:48:12 roberto Exp roberto $ +** $Id: lobject.c,v 2.39 2010/04/15 19:44:43 roberto Exp roberto $ ** Some generic functions over Lua objects ** See Copyright Notice in lua.h */ @@ -83,7 +83,7 @@ int luaO_rawequalObj (const TValue *t1, const TValue *t2) { return pvalue(t1) == pvalue(t2); case LUA_TSTRING: return rawtsvalue(t1) == rawtsvalue(t2); - case LUA_TCFP: + case LUA_TLCF: return fvalue(t1) == fvalue(t2); default: lua_assert(iscollectable(t1)); diff --git a/lobject.h b/lobject.h index f093b3cb..22f4354c 100644 --- a/lobject.h +++ b/lobject.h @@ -1,5 +1,5 @@ /* -** $Id: lobject.h,v 2.37 2010/04/12 16:07:06 roberto Exp roberto $ +** $Id: lobject.h,v 2.38 2010/04/14 15:13:48 roberto Exp roberto $ ** Type definitions for Lua objects ** See Copyright Notice in lua.h */ @@ -25,10 +25,10 @@ /* -** Variant tag for C-function pointers (negative to be considered +** Variant tag for light C functions (negative to be considered ** non collectable by 'iscollectable') */ -#define LUA_TCFP (~0x0F | LUA_TFUNCTION) +#define LUA_TLCF (~0x0F | LUA_TFUNCTION) /* ** Union of all collectable objects @@ -99,7 +99,7 @@ typedef struct lua_TValue { #define ttistable(o) (ttype(o) == LUA_TTABLE) #define ttisfunction(o) (ttypenv(o) == LUA_TFUNCTION) #define ttisclosure(o) (ttype(o) == LUA_TFUNCTION) -#define ttiscfp(o) (ttype(o) == LUA_TCFP) +#define ttislcf(o) (ttype(o) == LUA_TLCF) #define ttisboolean(o) (ttype(o) == LUA_TBOOLEAN) #define ttisuserdata(o) (ttype(o) == LUA_TUSERDATA) #define ttisthread(o) (ttype(o) == LUA_TTHREAD) @@ -115,7 +115,7 @@ typedef struct lua_TValue { #define rawuvalue(o) check_exp(ttisuserdata(o), &(o)->value_.gc->u) #define uvalue(o) (&rawuvalue(o)->uv) #define clvalue(o) check_exp(ttisclosure(o), &(o)->value_.gc->cl) -#define fvalue(o) check_exp(ttiscfp(o), (o)->value_.f) +#define fvalue(o) check_exp(ttislcf(o), (o)->value_.f) #define hvalue(o) check_exp(ttistable(o), &(o)->value_.gc->h) #define bvalue(o) check_exp(ttisboolean(o), (o)->value_.b) #define thvalue(o) check_exp(ttisthread(o), &(o)->value_.gc->th) @@ -140,7 +140,7 @@ typedef struct lua_TValue { { TValue *i_o=(obj); i_o->value_.n=(x); i_o->tt_=LUA_TNUMBER; } #define setfvalue(obj,x) \ - { TValue *i_o=(obj); i_o->value_.f=(x); i_o->tt_=LUA_TCFP; } + { TValue *i_o=(obj); i_o->value_.f=(x); i_o->tt_=LUA_TLCF; } #define changenvalue(obj,x) \ ( lua_assert((obj)->tt_==LUA_TNUMBER), (obj)->value_.n=(x) ) diff --git a/ltable.c b/ltable.c index 7eb1f4a9..3e8b2060 100644 --- a/ltable.c +++ b/ltable.c @@ -1,5 +1,5 @@ /* -** $Id: ltable.c,v 2.48 2010/04/05 16:26:37 roberto Exp roberto $ +** $Id: ltable.c,v 2.49 2010/04/13 20:48:12 roberto Exp roberto $ ** Lua tables (hash) ** See Copyright Notice in lua.h */ @@ -109,7 +109,7 @@ static Node *mainposition (const Table *t, const TValue *key) { return hashboolean(t, bvalue(key)); case LUA_TLIGHTUSERDATA: return hashpointer(t, pvalue(key)); - case LUA_TCFP: + case LUA_TLCF: return hashpointer(t, fvalue(key)); default: return hashpointer(t, gcvalue(key)); diff --git a/lvm.c b/lvm.c index aef1b376..6aa85b87 100644 --- a/lvm.c +++ b/lvm.c @@ -1,5 +1,5 @@ /* -** $Id: lvm.c,v 2.112 2010/04/15 19:43:43 roberto Exp roberto $ +** $Id: lvm.c,v 2.113 2010/04/18 13:15:11 roberto Exp roberto $ ** Lua virtual machine ** See Copyright Notice in lua.h */ @@ -246,7 +246,7 @@ int luaV_equalval_ (lua_State *L, const TValue *t1, const TValue *t2) { case LUA_TNUMBER: return luai_numeq(nvalue(t1), nvalue(t2)); case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */ case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2); - case LUA_TCFP: return fvalue(t1) == fvalue(t2); + case LUA_TLCF: return fvalue(t1) == fvalue(t2); case LUA_TSTRING: return eqstr(rawtsvalue(t1), rawtsvalue(t2)); case LUA_TUSERDATA: { if (uvalue(t1) == uvalue(t2)) return 1;