diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-01-25 14:45:36 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-01-25 14:45:36 -0200 |
commit | a53d9b66ca6247818acaf41e28cdf123082a272b (patch) | |
tree | 8e909200d4d925fc7394e6adf83cc5941456c588 /ltm.h | |
parent | c8559e3c8d12e052783e2952db1372c68cc16059 (diff) | |
download | lua-a53d9b66ca6247818acaf41e28cdf123082a272b.tar.gz lua-a53d9b66ca6247818acaf41e28cdf123082a272b.tar.bz2 lua-a53d9b66ca6247818acaf41e28cdf123082a272b.zip |
first implementation for type names
Diffstat (limited to 'ltm.h')
-rw-r--r-- | ltm.h | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltm.h,v 1.20 2001/01/19 13:20:30 roberto Exp roberto $ | 2 | ** $Id: ltm.h,v 1.21 2001/01/24 16:20:54 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 | */ |
@@ -38,6 +38,7 @@ typedef enum { | |||
38 | 38 | ||
39 | /* | 39 | /* |
40 | ** masks for allowable tag methods | 40 | ** masks for allowable tag methods |
41 | ** (see `luaT_validevents') | ||
41 | */ | 42 | */ |
42 | #define HAS_TM_GETGLOBAL(L,t) (1<<(t) & ((1<<LUA_TUSERDATA) | \ | 43 | #define HAS_TM_GETGLOBAL(L,t) (1<<(t) & ((1<<LUA_TUSERDATA) | \ |
43 | (1<<LUA_TTABLE) | \ | 44 | (1<<LUA_TTABLE) | \ |
@@ -53,12 +54,16 @@ typedef enum { | |||
53 | struct TM { | 54 | struct TM { |
54 | Closure *method[TM_N]; | 55 | Closure *method[TM_N]; |
55 | TString *collected; /* list of garbage-collected udata with this tag */ | 56 | TString *collected; /* list of garbage-collected udata with this tag */ |
57 | TString *name; /* type name */ | ||
58 | int basictype; | ||
56 | }; | 59 | }; |
57 | 60 | ||
58 | 61 | ||
59 | #define luaT_gettm(G,tag,event) (G->TMtable[tag].method[event]) | 62 | #define luaT_gettm(G,tag,event) (G->TMtable[tag].method[event]) |
60 | #define luaT_gettmbyObj(G,o,e) (luaT_gettm((G),luaT_tag(o),(e))) | 63 | #define luaT_gettmbyObj(G,o,e) (luaT_gettm((G),luaT_tag(o),(e))) |
61 | 64 | ||
65 | #define basictypename(G, t) (G->TMtable[t].name->str) | ||
66 | |||
62 | 67 | ||
63 | #define validtag(G,t) (NUM_TAGS <= (t) && (t) < G->ntag) | 68 | #define validtag(G,t) (NUM_TAGS <= (t) && (t) < G->ntag) |
64 | 69 | ||
@@ -66,7 +71,8 @@ extern const char *const luaT_eventname[]; | |||
66 | 71 | ||
67 | 72 | ||
68 | void luaT_init (lua_State *L); | 73 | void luaT_init (lua_State *L); |
69 | void luaT_realtag (lua_State *L, int tag); | 74 | int luaT_newtag (lua_State *L, const char *name, int basictype); |
75 | const char *luaT_typename (global_State *G, const TObject *o); | ||
70 | int luaT_tag (const TObject *o); | 76 | int luaT_tag (const TObject *o); |
71 | int luaT_validevent (int t, int e); /* used by compatibility module */ | 77 | int luaT_validevent (int t, int e); /* used by compatibility module */ |
72 | 78 | ||