diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-03-20 16:14:54 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-03-20 16:14:54 -0300 |
| commit | bb9605bbc954d53b7d5997c53fceafe4450a6917 (patch) | |
| tree | f62d6f64623221e2ba807aa080b84f2572640975 /lobject.h | |
| parent | 67592998809bf5816e2256409b384a712270c7b2 (diff) | |
| download | lua-bb9605bbc954d53b7d5997c53fceafe4450a6917.tar.gz lua-bb9605bbc954d53b7d5997c53fceafe4450a6917.tar.bz2 lua-bb9605bbc954d53b7d5997c53fceafe4450a6917.zip | |
tags can be positive values
Diffstat (limited to 'lobject.h')
| -rw-r--r-- | lobject.h | 46 |
1 files changed, 22 insertions, 24 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lobject.h,v 1.51 2000/03/10 18:37:44 roberto Exp roberto $ | 2 | ** $Id: lobject.h,v 1.52 2000/03/16 21:06:16 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 | */ |
| @@ -67,34 +67,32 @@ typedef unsigned long Instruction; | |||
| 67 | */ | 67 | */ |
| 68 | typedef enum { | 68 | typedef enum { |
| 69 | TAG_USERDATA = 0, /* default tag for userdata */ | 69 | TAG_USERDATA = 0, /* default tag for userdata */ |
| 70 | TAG_NUMBER = -1, /* fixed tag for numbers */ | 70 | TAG_NUMBER, /* fixed tag for numbers */ |
| 71 | TAG_STRING = -2, /* fixed tag for strings */ | 71 | TAG_STRING, /* fixed tag for strings */ |
| 72 | TAG_ARRAY = -3, /* default tag for tables (or arrays) */ | 72 | TAG_ARRAY, /* default tag for tables (or arrays) */ |
| 73 | TAG_LPROTO = -4, /* fixed tag for Lua functions */ | 73 | TAG_LPROTO, /* fixed tag for Lua functions */ |
| 74 | TAG_CPROTO = -5, /* fixed tag for C functions */ | 74 | TAG_CPROTO, /* fixed tag for C functions */ |
| 75 | TAG_NIL = -6, /* last "pre-defined" tag */ | 75 | TAG_NIL, /* last "pre-defined" tag */ |
| 76 | 76 | ||
| 77 | TAG_LCLOSURE = -7, /* Lua closure */ | 77 | TAG_LCLOSURE, /* Lua closure */ |
| 78 | TAG_CCLOSURE = -8, /* C closure */ | 78 | TAG_CCLOSURE, /* C closure */ |
| 79 | 79 | ||
| 80 | TAG_LCLMARK = -9 ,/* mark for Lua closures */ | 80 | TAG_LCLMARK, /* mark for Lua closures */ |
| 81 | TAG_CCLMARK = -10,/* mark for C closures */ | 81 | TAG_CCLMARK, /* mark for C closures */ |
| 82 | TAG_LMARK = -11,/* mark for Lua prototypes */ | 82 | TAG_LMARK, /* mark for Lua prototypes */ |
| 83 | TAG_CMARK = -12,/* mark for C prototypes */ | 83 | TAG_CMARK, /* mark for C prototypes */ |
| 84 | 84 | ||
| 85 | TAG_LINE = -13 | 85 | TAG_LINE |
| 86 | } lua_Type; | 86 | } lua_Type; |
| 87 | 87 | ||
| 88 | #define NUM_TAGS 7 /* tags for values visible from Lua */ | 88 | /* tags for values visible from Lua == first user-created tag */ |
| 89 | #define NUM_TAGS 7 | ||
| 89 | 90 | ||
| 90 | 91 | ||
| 91 | #define LAST_REGULAR_TAG TAG_CCLOSURE /* after that, are all marks */ | ||
| 92 | |||
| 93 | /* | 92 | /* |
| 94 | ** check whether `t' is a mark; ttypes are negative numbers, so the | 93 | ** check whether `t' is a mark |
| 95 | ** comparisons look reversed. (ORDER LUA_T) | ||
| 96 | */ | 94 | */ |
| 97 | #define is_T_MARK(t) (TAG_CMARK <= (t) && (t) <= TAG_LCLMARK) | 95 | #define is_T_MARK(t) (TAG_LCLMARK <= (t) && (t) <= TAG_CMARK) |
| 98 | 96 | ||
| 99 | 97 | ||
| 100 | typedef union { | 98 | typedef union { |
| @@ -221,7 +219,7 @@ typedef struct Hash { | |||
| 221 | extern const char *const luaO_typenames[]; | 219 | extern const char *const luaO_typenames[]; |
| 222 | extern const TObject luaO_nilobject; | 220 | extern const TObject luaO_nilobject; |
| 223 | 221 | ||
| 224 | #define luaO_typename(o) luaO_typenames[-ttype(o)] | 222 | #define luaO_typename(o) luaO_typenames[ttype(o)] |
| 225 | 223 | ||
| 226 | #define MINPOWER2 4 /* minimum size for "growing" vectors */ | 224 | #define MINPOWER2 4 /* minimum size for "growing" vectors */ |
| 227 | 225 | ||
