diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-03-10 15:37:44 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-03-10 15:37:44 -0300 |
commit | 73aa465a8ed8dee6c6a27a6f8b2f51227b70789d (patch) | |
tree | 496a63ffffe0312f1d0b9882d97944fa38ed7801 /ltm.c | |
parent | 3d0577f4b98908be3f2d697ab75c5fbbd3f6999b (diff) | |
download | lua-73aa465a8ed8dee6c6a27a6f8b2f51227b70789d.tar.gz lua-73aa465a8ed8dee6c6a27a6f8b2f51227b70789d.tar.bz2 lua-73aa465a8ed8dee6c6a27a6f8b2f51227b70789d.zip |
some name changes
Diffstat (limited to 'ltm.c')
-rw-r--r-- | ltm.c | 40 |
1 files changed, 20 insertions, 20 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltm.c,v 1.32 2000/02/22 18:12:46 roberto Exp roberto $ | 2 | ** $Id: ltm.c,v 1.33 2000/03/03 14:58:26 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 | */ |
@@ -32,33 +32,33 @@ static int luaI_checkevent (lua_State *L, const char *name, const char *const li | |||
32 | 32 | ||
33 | 33 | ||
34 | 34 | ||
35 | /* events in LUA_T_NIL are all allowed, since this is used as a | 35 | /* events in TAG_NIL are all allowed, since this is used as a |
36 | * 'placeholder' for "default" fallbacks | 36 | * 'placeholder' for "default" fallbacks |
37 | */ | 37 | */ |
38 | /* ORDER LUA_T, ORDER IM */ | 38 | /* ORDER LUA_T, ORDER IM */ |
39 | static const char luaT_validevents[NUM_TAGS][IM_N] = { | 39 | static const char luaT_validevents[NUM_TAGS][IM_N] = { |
40 | {1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1}, /* LUA_T_USERDATA */ | 40 | {1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1}, /* TAG_USERDATA */ |
41 | {1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}, /* LUA_T_NUMBER */ | 41 | {1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}, /* TAG_NUMBER */ |
42 | {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, /* LUA_T_STRING */ | 42 | {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, /* TAG_STRING */ |
43 | {0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1}, /* LUA_T_ARRAY */ | 43 | {0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1}, /* TAG_ARRAY */ |
44 | {1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0}, /* LUA_T_LPROTO */ | 44 | {1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0}, /* TAG_LPROTO */ |
45 | {1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0}, /* LUA_T_CPROTO */ | 45 | {1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0}, /* TAG_CPROTO */ |
46 | {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} /* LUA_T_NIL */ | 46 | {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} /* TAG_NIL */ |
47 | }; | 47 | }; |
48 | 48 | ||
49 | int luaT_validevent (int t, int e) { /* ORDER LUA_T */ | 49 | int luaT_validevent (int t, int e) { /* ORDER LUA_T */ |
50 | #ifdef LUA_COMPAT_GC | 50 | #ifdef LUA_COMPAT_GC |
51 | if (t == LUA_T_ARRAY && e == IM_GC) | 51 | if (t == TAG_ARRAY && e == IM_GC) |
52 | return 1; /* old versions allowed gc tag method for tables */ | 52 | return 1; /* old versions allowed gc tag method for tables */ |
53 | #endif | 53 | #endif |
54 | return (t < LUA_T_NIL) ? 1 : luaT_validevents[-t][e]; | 54 | return (t < TAG_NIL) ? 1 : luaT_validevents[-t][e]; |
55 | } | 55 | } |
56 | 56 | ||
57 | 57 | ||
58 | static void init_entry (lua_State *L, int tag) { | 58 | static void init_entry (lua_State *L, int tag) { |
59 | int i; | 59 | int i; |
60 | for (i=0; i<IM_N; i++) | 60 | for (i=0; i<IM_N; i++) |
61 | ttype(luaT_getim(L, tag, i)) = LUA_T_NIL; | 61 | ttype(luaT_getim(L, tag, i)) = TAG_NIL; |
62 | } | 62 | } |
63 | 63 | ||
64 | 64 | ||
@@ -85,7 +85,7 @@ static void checktag (lua_State *L, int tag) { | |||
85 | } | 85 | } |
86 | 86 | ||
87 | void luaT_realtag (lua_State *L, int tag) { | 87 | void luaT_realtag (lua_State *L, int tag) { |
88 | if (!(L->last_tag <= tag && tag < LUA_T_NIL)) | 88 | if (!(L->last_tag <= tag && tag < TAG_NIL)) |
89 | luaL_verror(L, "tag %d was not created by `newtag'", tag); | 89 | luaL_verror(L, "tag %d was not created by `newtag'", tag); |
90 | } | 90 | } |
91 | 91 | ||
@@ -104,17 +104,17 @@ int lua_copytagmethods (lua_State *L, int tagto, int tagfrom) { | |||
104 | 104 | ||
105 | int luaT_effectivetag (const TObject *o) { | 105 | int luaT_effectivetag (const TObject *o) { |
106 | static const int realtag[] = { /* ORDER LUA_T */ | 106 | static const int realtag[] = { /* ORDER LUA_T */ |
107 | LUA_T_USERDATA, LUA_T_NUMBER, LUA_T_STRING, LUA_T_ARRAY, | 107 | TAG_USERDATA, TAG_NUMBER, TAG_STRING, TAG_ARRAY, |
108 | LUA_T_LPROTO, LUA_T_CPROTO, LUA_T_NIL, | 108 | TAG_LPROTO, TAG_CPROTO, TAG_NIL, |
109 | LUA_T_LPROTO, LUA_T_CPROTO, /* LUA_T_LCLOSURE, LUA_T_CCLOSURE */ | 109 | TAG_LPROTO, TAG_CPROTO, /* TAG_LCLOSURE, TAG_CCLOSURE */ |
110 | }; | 110 | }; |
111 | int t; | 111 | int t; |
112 | switch (t = ttype(o)) { | 112 | switch (t = ttype(o)) { |
113 | case LUA_T_USERDATA: { | 113 | case TAG_USERDATA: { |
114 | int tag = o->value.ts->u.d.tag; | 114 | int tag = o->value.ts->u.d.tag; |
115 | return (tag >= 0) ? LUA_T_USERDATA : tag; /* deprecated test */ | 115 | return (tag >= 0) ? TAG_USERDATA : tag; /* deprecated test */ |
116 | } | 116 | } |
117 | case LUA_T_ARRAY: return o->value.a->htag; | 117 | case TAG_ARRAY: return o->value.a->htag; |
118 | default: return realtag[-t]; | 118 | default: return realtag[-t]; |
119 | } | 119 | } |
120 | } | 120 | } |
@@ -149,7 +149,7 @@ void luaT_settagmethod (lua_State *L, int t, const char *event, TObject *func) { | |||
149 | if (!luaT_validevent(t, e)) | 149 | if (!luaT_validevent(t, e)) |
150 | luaL_verror(L, "cannot change `%.20s' tag method for type `%.20s'%.20s", | 150 | luaL_verror(L, "cannot change `%.20s' tag method for type `%.20s'%.20s", |
151 | luaT_eventname[e], luaO_typenames[-t], | 151 | luaT_eventname[e], luaO_typenames[-t], |
152 | (t == LUA_T_ARRAY || t == LUA_T_USERDATA) ? " with default tag" | 152 | (t == TAG_ARRAY || t == TAG_USERDATA) ? " with default tag" |
153 | : ""); | 153 | : ""); |
154 | temp = *func; | 154 | temp = *func; |
155 | *func = *luaT_getim(L, t,e); | 155 | *func = *luaT_getim(L, t,e); |