aboutsummaryrefslogtreecommitdiff
path: root/ltm.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-01-25 14:45:36 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-01-25 14:45:36 -0200
commita53d9b66ca6247818acaf41e28cdf123082a272b (patch)
tree8e909200d4d925fc7394e6adf83cc5941456c588 /ltm.h
parentc8559e3c8d12e052783e2952db1372c68cc16059 (diff)
downloadlua-a53d9b66ca6247818acaf41e28cdf123082a272b.tar.gz
lua-a53d9b66ca6247818acaf41e28cdf123082a272b.tar.bz2
lua-a53d9b66ca6247818acaf41e28cdf123082a272b.zip
first implementation for type names
Diffstat (limited to 'ltm.h')
-rw-r--r--ltm.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/ltm.h b/ltm.h
index 9c0f99d3..11d51ccf 100644
--- a/ltm.h
+++ b/ltm.h
@@ -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 {
53struct TM { 54struct 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
68void luaT_init (lua_State *L); 73void luaT_init (lua_State *L);
69void luaT_realtag (lua_State *L, int tag); 74int luaT_newtag (lua_State *L, const char *name, int basictype);
75const char *luaT_typename (global_State *G, const TObject *o);
70int luaT_tag (const TObject *o); 76int luaT_tag (const TObject *o);
71int luaT_validevent (int t, int e); /* used by compatibility module */ 77int luaT_validevent (int t, int e); /* used by compatibility module */
72 78