aboutsummaryrefslogtreecommitdiff
path: root/lobject.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-03-20 16:14:54 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-03-20 16:14:54 -0300
commitbb9605bbc954d53b7d5997c53fceafe4450a6917 (patch)
treef62d6f64623221e2ba807aa080b84f2572640975 /lobject.h
parent67592998809bf5816e2256409b384a712270c7b2 (diff)
downloadlua-bb9605bbc954d53b7d5997c53fceafe4450a6917.tar.gz
lua-bb9605bbc954d53b7d5997c53fceafe4450a6917.tar.bz2
lua-bb9605bbc954d53b7d5997c53fceafe4450a6917.zip
tags can be positive values
Diffstat (limited to 'lobject.h')
-rw-r--r--lobject.h46
1 files changed, 22 insertions, 24 deletions
diff --git a/lobject.h b/lobject.h
index ad35d0d4..558af2de 100644
--- a/lobject.h
+++ b/lobject.h
@@ -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*/
68typedef enum { 68typedef 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
100typedef union { 98typedef union {
@@ -221,7 +219,7 @@ typedef struct Hash {
221extern const char *const luaO_typenames[]; 219extern const char *const luaO_typenames[];
222extern const TObject luaO_nilobject; 220extern 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