diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-04-18 10:22:48 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-04-18 10:22:48 -0300 |
| commit | 53f9499f7f7bf1fb41a37382ffef8a6796a528c1 (patch) | |
| tree | 68aea55eb493117598b0f3d709eedcd1c425e90e | |
| parent | 575befc394adc9714978a51e1b48ebb610bd3147 (diff) | |
| download | lua-53f9499f7f7bf1fb41a37382ffef8a6796a528c1.tar.gz lua-53f9499f7f7bf1fb41a37382ffef8a6796a528c1.tar.bz2 lua-53f9499f7f7bf1fb41a37382ffef8a6796a528c1.zip | |
"light C function" is a better name than "C-function pointer"
| -rw-r--r-- | lapi.c | 10 | ||||
| -rw-r--r-- | ldo.c | 4 | ||||
| -rw-r--r-- | lobject.c | 4 | ||||
| -rw-r--r-- | lobject.h | 12 | ||||
| -rw-r--r-- | ltable.c | 4 | ||||
| -rw-r--r-- | lvm.c | 4 |
6 files changed, 19 insertions, 19 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lapi.c,v 2.120 2010/04/05 14:21:38 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.121 2010/04/13 20:48:12 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 | */ |
| @@ -56,7 +56,7 @@ static TValue *index2addr (lua_State *L, int idx) { | |||
| 56 | else { /* upvalues */ | 56 | else { /* upvalues */ |
| 57 | idx = LUA_REGISTRYINDEX - idx; | 57 | idx = LUA_REGISTRYINDEX - idx; |
| 58 | api_check(L, idx <= UCHAR_MAX + 1, "upvalue index too large"); | 58 | api_check(L, idx <= UCHAR_MAX + 1, "upvalue index too large"); |
| 59 | if (ttiscfp(ci->func)) /* C-function pointer? */ | 59 | if (ttislcf(ci->func)) /* light C function? */ |
| 60 | return cast(TValue *, luaO_nilobject); /* it has no upvalues */ | 60 | return cast(TValue *, luaO_nilobject); /* it has no upvalues */ |
| 61 | else { | 61 | else { |
| 62 | Closure *func = clvalue(ci->func); | 62 | Closure *func = clvalue(ci->func); |
| @@ -241,7 +241,7 @@ LUA_API const char *lua_typename (lua_State *L, int t) { | |||
| 241 | 241 | ||
| 242 | LUA_API int lua_iscfunction (lua_State *L, int idx) { | 242 | LUA_API int lua_iscfunction (lua_State *L, int idx) { |
| 243 | StkId o = index2addr(L, idx); | 243 | StkId o = index2addr(L, idx); |
| 244 | return (ttiscfp(o) || (ttisclosure(o) && clvalue(o)->c.isC)); | 244 | return (ttislcf(o) || (ttisclosure(o) && clvalue(o)->c.isC)); |
| 245 | } | 245 | } |
| 246 | 246 | ||
| 247 | 247 | ||
| @@ -367,7 +367,7 @@ LUA_API size_t lua_rawlen (lua_State *L, int idx) { | |||
| 367 | 367 | ||
| 368 | LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) { | 368 | LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) { |
| 369 | StkId o = index2addr(L, idx); | 369 | StkId o = index2addr(L, idx); |
| 370 | if (ttiscfp(o)) return fvalue(o); | 370 | if (ttislcf(o)) return fvalue(o); |
| 371 | else if (ttisclosure(o) && clvalue(o)->c.isC) | 371 | else if (ttisclosure(o) && clvalue(o)->c.isC) |
| 372 | return clvalue(o)->c.f; | 372 | return clvalue(o)->c.f; |
| 373 | else return NULL; /* not a C function */ | 373 | else return NULL; /* not a C function */ |
| @@ -395,7 +395,7 @@ LUA_API const void *lua_topointer (lua_State *L, int idx) { | |||
| 395 | switch (ttype(o)) { | 395 | switch (ttype(o)) { |
| 396 | case LUA_TTABLE: return hvalue(o); | 396 | case LUA_TTABLE: return hvalue(o); |
| 397 | case LUA_TFUNCTION: return clvalue(o); | 397 | case LUA_TFUNCTION: return clvalue(o); |
| 398 | case LUA_TCFP: return cast(void *, cast(size_t, fvalue(o))); | 398 | case LUA_TLCF: return cast(void *, cast(size_t, fvalue(o))); |
| 399 | case LUA_TTHREAD: return thvalue(o); | 399 | case LUA_TTHREAD: return thvalue(o); |
| 400 | case LUA_TUSERDATA: | 400 | case LUA_TUSERDATA: |
| 401 | case LUA_TLIGHTUSERDATA: | 401 | case LUA_TLIGHTUSERDATA: |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldo.c,v 2.84 2010/04/13 20:48:12 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 2.85 2010/04/18 12:41:35 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 | */ |
| @@ -300,7 +300,7 @@ int luaD_precall (lua_State *L, StkId func, int nresults) { | |||
| 300 | func = tryfuncTM(L, func); /* check the `function' tag method */ | 300 | func = tryfuncTM(L, func); /* check the `function' tag method */ |
| 301 | funcr = savestack(L, func); | 301 | funcr = savestack(L, func); |
| 302 | L->ci->nresults = nresults; | 302 | L->ci->nresults = nresults; |
| 303 | if (ttiscfp(func)) { /* C function pointer? */ | 303 | if (ttislcf(func)) { /* light C function? */ |
| 304 | f = fvalue(func); /* get it */ | 304 | f = fvalue(func); /* get it */ |
| 305 | goto isCfunc; /* go to call it */ | 305 | goto isCfunc; /* go to call it */ |
| 306 | } | 306 | } |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lobject.c,v 2.38 2010/04/13 20:48:12 roberto Exp roberto $ | 2 | ** $Id: lobject.c,v 2.39 2010/04/15 19:44:43 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 | */ |
| @@ -83,7 +83,7 @@ int luaO_rawequalObj (const TValue *t1, const TValue *t2) { | |||
| 83 | return pvalue(t1) == pvalue(t2); | 83 | return pvalue(t1) == pvalue(t2); |
| 84 | case LUA_TSTRING: | 84 | case LUA_TSTRING: |
| 85 | return rawtsvalue(t1) == rawtsvalue(t2); | 85 | return rawtsvalue(t1) == rawtsvalue(t2); |
| 86 | case LUA_TCFP: | 86 | case LUA_TLCF: |
| 87 | return fvalue(t1) == fvalue(t2); | 87 | return fvalue(t1) == fvalue(t2); |
| 88 | default: | 88 | default: |
| 89 | lua_assert(iscollectable(t1)); | 89 | lua_assert(iscollectable(t1)); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lobject.h,v 2.37 2010/04/12 16:07:06 roberto Exp roberto $ | 2 | ** $Id: lobject.h,v 2.38 2010/04/14 15:13:48 roberto Exp roberto $ |
| 3 | ** Type definitions for Lua objects | 3 | ** Type definitions for Lua objects |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -25,10 +25,10 @@ | |||
| 25 | 25 | ||
| 26 | 26 | ||
| 27 | /* | 27 | /* |
| 28 | ** Variant tag for C-function pointers (negative to be considered | 28 | ** Variant tag for light C functions (negative to be considered |
| 29 | ** non collectable by 'iscollectable') | 29 | ** non collectable by 'iscollectable') |
| 30 | */ | 30 | */ |
| 31 | #define LUA_TCFP (~0x0F | LUA_TFUNCTION) | 31 | #define LUA_TLCF (~0x0F | LUA_TFUNCTION) |
| 32 | 32 | ||
| 33 | /* | 33 | /* |
| 34 | ** Union of all collectable objects | 34 | ** Union of all collectable objects |
| @@ -99,7 +99,7 @@ typedef struct lua_TValue { | |||
| 99 | #define ttistable(o) (ttype(o) == LUA_TTABLE) | 99 | #define ttistable(o) (ttype(o) == LUA_TTABLE) |
| 100 | #define ttisfunction(o) (ttypenv(o) == LUA_TFUNCTION) | 100 | #define ttisfunction(o) (ttypenv(o) == LUA_TFUNCTION) |
| 101 | #define ttisclosure(o) (ttype(o) == LUA_TFUNCTION) | 101 | #define ttisclosure(o) (ttype(o) == LUA_TFUNCTION) |
| 102 | #define ttiscfp(o) (ttype(o) == LUA_TCFP) | 102 | #define ttislcf(o) (ttype(o) == LUA_TLCF) |
| 103 | #define ttisboolean(o) (ttype(o) == LUA_TBOOLEAN) | 103 | #define ttisboolean(o) (ttype(o) == LUA_TBOOLEAN) |
| 104 | #define ttisuserdata(o) (ttype(o) == LUA_TUSERDATA) | 104 | #define ttisuserdata(o) (ttype(o) == LUA_TUSERDATA) |
| 105 | #define ttisthread(o) (ttype(o) == LUA_TTHREAD) | 105 | #define ttisthread(o) (ttype(o) == LUA_TTHREAD) |
| @@ -115,7 +115,7 @@ typedef struct lua_TValue { | |||
| 115 | #define rawuvalue(o) check_exp(ttisuserdata(o), &(o)->value_.gc->u) | 115 | #define rawuvalue(o) check_exp(ttisuserdata(o), &(o)->value_.gc->u) |
| 116 | #define uvalue(o) (&rawuvalue(o)->uv) | 116 | #define uvalue(o) (&rawuvalue(o)->uv) |
| 117 | #define clvalue(o) check_exp(ttisclosure(o), &(o)->value_.gc->cl) | 117 | #define clvalue(o) check_exp(ttisclosure(o), &(o)->value_.gc->cl) |
| 118 | #define fvalue(o) check_exp(ttiscfp(o), (o)->value_.f) | 118 | #define fvalue(o) check_exp(ttislcf(o), (o)->value_.f) |
| 119 | #define hvalue(o) check_exp(ttistable(o), &(o)->value_.gc->h) | 119 | #define hvalue(o) check_exp(ttistable(o), &(o)->value_.gc->h) |
| 120 | #define bvalue(o) check_exp(ttisboolean(o), (o)->value_.b) | 120 | #define bvalue(o) check_exp(ttisboolean(o), (o)->value_.b) |
| 121 | #define thvalue(o) check_exp(ttisthread(o), &(o)->value_.gc->th) | 121 | #define thvalue(o) check_exp(ttisthread(o), &(o)->value_.gc->th) |
| @@ -140,7 +140,7 @@ typedef struct lua_TValue { | |||
| 140 | { TValue *i_o=(obj); i_o->value_.n=(x); i_o->tt_=LUA_TNUMBER; } | 140 | { TValue *i_o=(obj); i_o->value_.n=(x); i_o->tt_=LUA_TNUMBER; } |
| 141 | 141 | ||
| 142 | #define setfvalue(obj,x) \ | 142 | #define setfvalue(obj,x) \ |
| 143 | { TValue *i_o=(obj); i_o->value_.f=(x); i_o->tt_=LUA_TCFP; } | 143 | { TValue *i_o=(obj); i_o->value_.f=(x); i_o->tt_=LUA_TLCF; } |
| 144 | 144 | ||
| 145 | #define changenvalue(obj,x) \ | 145 | #define changenvalue(obj,x) \ |
| 146 | ( lua_assert((obj)->tt_==LUA_TNUMBER), (obj)->value_.n=(x) ) | 146 | ( lua_assert((obj)->tt_==LUA_TNUMBER), (obj)->value_.n=(x) ) |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltable.c,v 2.48 2010/04/05 16:26:37 roberto Exp roberto $ | 2 | ** $Id: ltable.c,v 2.49 2010/04/13 20:48:12 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 | */ |
| @@ -109,7 +109,7 @@ static Node *mainposition (const Table *t, const TValue *key) { | |||
| 109 | return hashboolean(t, bvalue(key)); | 109 | return hashboolean(t, bvalue(key)); |
| 110 | case LUA_TLIGHTUSERDATA: | 110 | case LUA_TLIGHTUSERDATA: |
| 111 | return hashpointer(t, pvalue(key)); | 111 | return hashpointer(t, pvalue(key)); |
| 112 | case LUA_TCFP: | 112 | case LUA_TLCF: |
| 113 | return hashpointer(t, fvalue(key)); | 113 | return hashpointer(t, fvalue(key)); |
| 114 | default: | 114 | default: |
| 115 | return hashpointer(t, gcvalue(key)); | 115 | return hashpointer(t, gcvalue(key)); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lvm.c,v 2.112 2010/04/15 19:43:43 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.113 2010/04/18 13:15:11 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 | */ |
| @@ -246,7 +246,7 @@ int luaV_equalval_ (lua_State *L, const TValue *t1, const TValue *t2) { | |||
| 246 | case LUA_TNUMBER: return luai_numeq(nvalue(t1), nvalue(t2)); | 246 | case LUA_TNUMBER: return luai_numeq(nvalue(t1), nvalue(t2)); |
| 247 | case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */ | 247 | case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */ |
| 248 | case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2); | 248 | case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2); |
| 249 | case LUA_TCFP: return fvalue(t1) == fvalue(t2); | 249 | case LUA_TLCF: return fvalue(t1) == fvalue(t2); |
| 250 | case LUA_TSTRING: return eqstr(rawtsvalue(t1), rawtsvalue(t2)); | 250 | case LUA_TSTRING: return eqstr(rawtsvalue(t1), rawtsvalue(t2)); |
| 251 | case LUA_TUSERDATA: { | 251 | case LUA_TUSERDATA: { |
| 252 | if (uvalue(t1) == uvalue(t2)) return 1; | 252 | if (uvalue(t1) == uvalue(t2)) return 1; |
