diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-12-23 16:19:57 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-12-23 16:19:57 -0200 |
commit | b1b0c219f5255a0cd0921ebc0a77a81f99b72532 (patch) | |
tree | 7cb4d9cbbdb1309b94794eb75694b02f2b08f75a /lobject.h | |
parent | be3212de781786c0a68365dee1d3510407b5c325 (diff) | |
download | lua-b1b0c219f5255a0cd0921ebc0a77a81f99b72532.tar.gz lua-b1b0c219f5255a0cd0921ebc0a77a81f99b72532.tar.bz2 lua-b1b0c219f5255a0cd0921ebc0a77a81f99b72532.zip |
new ttypes to distinguish between C closures and Lua closures.
Diffstat (limited to 'lobject.h')
-rw-r--r-- | lobject.h | 28 |
1 files changed, 18 insertions, 10 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lobject.h,v 1.39 1999/12/02 16:24:45 roberto Exp roberto $ | 2 | ** $Id: lobject.h,v 1.40 1999/12/14 18:33:29 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 | */ |
@@ -69,25 +69,33 @@ typedef enum { | |||
69 | LUA_T_NUMBER = -1, /* fixed tag for numbers */ | 69 | LUA_T_NUMBER = -1, /* fixed tag for numbers */ |
70 | LUA_T_STRING = -2, /* fixed tag for strings */ | 70 | LUA_T_STRING = -2, /* fixed tag for strings */ |
71 | LUA_T_ARRAY = -3, /* tag default for tables (or arrays) */ | 71 | LUA_T_ARRAY = -3, /* tag default for tables (or arrays) */ |
72 | LUA_T_PROTO = -4, /* fixed tag for functions */ | 72 | LUA_T_LPROTO = -4, /* fixed tag for Lua functions */ |
73 | LUA_T_CPROTO = -5, /* fixed tag for Cfunctions */ | 73 | LUA_T_CPROTO = -5, /* fixed tag for C functions */ |
74 | LUA_T_NIL = -6, /* last "pre-defined" tag */ | 74 | LUA_T_NIL = -6, /* last "pre-defined" tag */ |
75 | LUA_T_CLOSURE = -7, | 75 | LUA_T_LCLOSURE = -7, /* Lua closure */ |
76 | LUA_T_CLMARK = -8, /* mark for closures */ | 76 | LUA_T_CCLOSURE = -8, /* C closure */ |
77 | LUA_T_PMARK = -9, /* mark for Lua prototypes */ | 77 | LUA_T_LCLMARK = -9 ,/* mark for Lua closures */ |
78 | LUA_T_CMARK = -10, /* mark for C prototypes */ | 78 | LUA_T_CCLMARK = -10,/* mark for C closures */ |
79 | LUA_T_LINE = -11 | 79 | LUA_T_LMARK = -11, /* mark for Lua prototypes */ |
80 | LUA_T_CMARK = -12, /* mark for C prototypes */ | ||
81 | LUA_T_LINE = -13 | ||
80 | } lua_Type; | 82 | } lua_Type; |
81 | 83 | ||
82 | #define NUM_TAGS 7 | 84 | #define NUM_TAGS 7 |
83 | 85 | ||
86 | /* | ||
87 | ** chech whether t is a mark; ttypes are negative numbers, so the | ||
88 | ** comparisons look reversed. (ORDER LUA_T) | ||
89 | */ | ||
90 | #define is_T_MARK(t) (LUA_T_CMARK <= (t) && (t) <= LUA_T_LCLMARK) | ||
91 | |||
84 | 92 | ||
85 | typedef union { | 93 | typedef union { |
86 | lua_CFunction f; /* LUA_T_CPROTO, LUA_T_CMARK */ | 94 | lua_CFunction f; /* LUA_T_CPROTO, LUA_T_CMARK */ |
87 | real n; /* LUA_T_NUMBER */ | 95 | real n; /* LUA_T_NUMBER */ |
88 | struct TaggedString *ts; /* LUA_T_STRING, LUA_T_USERDATA */ | 96 | struct TaggedString *ts; /* LUA_T_STRING, LUA_T_USERDATA */ |
89 | struct TProtoFunc *tf; /* LUA_T_PROTO, LUA_T_PMARK */ | 97 | struct TProtoFunc *tf; /* LUA_T_LPROTO, LUA_T_LMARK */ |
90 | struct Closure *cl; /* LUA_T_CLOSURE, LUA_T_CLMARK */ | 98 | struct Closure *cl; /* LUA_T_[CL]CLOSURE, LUA_T_[CL]CLMARK */ |
91 | struct Hash *a; /* LUA_T_ARRAY */ | 99 | struct Hash *a; /* LUA_T_ARRAY */ |
92 | int i; /* LUA_T_LINE */ | 100 | int i; /* LUA_T_LINE */ |
93 | } Value; | 101 | } Value; |