diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-03-03 11:58:26 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-03-03 11:58:26 -0300 |
commit | 3c9d999424520c809e05bee11d81788b488434f6 (patch) | |
tree | 7556d9ea10bda42b226aec4dd956753467cc0864 /lobject.h | |
parent | f7840a3e0bc07813246b2bad6bf4579848187908 (diff) | |
download | lua-3c9d999424520c809e05bee11d81788b488434f6.tar.gz lua-3c9d999424520c809e05bee11d81788b488434f6.tar.bz2 lua-3c9d999424520c809e05bee11d81788b488434f6.zip |
many details (most by lhf).
Diffstat (limited to 'lobject.h')
-rw-r--r-- | lobject.h | 35 |
1 files changed, 15 insertions, 20 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lobject.h,v 1.48 2000/02/17 18:30:36 roberto Exp roberto $ | 2 | ** $Id: lobject.h,v 1.49 2000/02/21 18:33:26 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 | */ |
@@ -14,15 +14,13 @@ | |||
14 | 14 | ||
15 | 15 | ||
16 | #ifdef DEBUG | 16 | #ifdef DEBUG |
17 | #ifdef NDEBUG | ||
18 | #undef NDEBUG | 17 | #undef NDEBUG |
19 | #endif | ||
20 | #include <assert.h> | 18 | #include <assert.h> |
21 | #define LUA_INTERNALERROR(L,s) assert(0) | 19 | #define LUA_INTERNALERROR(L,s) assert(0) |
22 | #define LUA_ASSERT(L,c,s) assert(c) | 20 | #define LUA_ASSERT(L,c,s) assert(c) |
23 | #else | 21 | #else |
24 | #define LUA_INTERNALERROR(L,s) /* empty */ | 22 | #define LUA_INTERNALERROR(L,s) /* empty */ |
25 | #define LUA_ASSERT(L,c,s) /* empty */ | 23 | #define LUA_ASSERT(L,c,s) /* empty */ |
26 | #endif | 24 | #endif |
27 | 25 | ||
28 | 26 | ||
@@ -51,7 +49,7 @@ typedef unsigned long Instruction; | |||
51 | 49 | ||
52 | /* conversion of pointer to int (for hashing only) */ | 50 | /* conversion of pointer to int (for hashing only) */ |
53 | /* (the shift removes bits that are usually 0 because of alignment) */ | 51 | /* (the shift removes bits that are usually 0 because of alignment) */ |
54 | #define IntPoint(L, p) (((unsigned int)(p)) >> 3) | 52 | #define IntPoint(L, p) (((unsigned long)(p)) >> 3) |
55 | 53 | ||
56 | 54 | ||
57 | /* | 55 | /* |
@@ -68,21 +66,21 @@ typedef unsigned long Instruction; | |||
68 | ** grep "ORDER LUA_T" | 66 | ** grep "ORDER LUA_T" |
69 | */ | 67 | */ |
70 | typedef enum { | 68 | typedef enum { |
71 | LUA_T_USERDATA = 0, /* default tag for userdata */ | 69 | LUA_T_USERDATA = 0, /* default tag for userdata */ |
72 | LUA_T_NUMBER = -1, /* fixed tag for numbers */ | 70 | LUA_T_NUMBER = -1, /* fixed tag for numbers */ |
73 | LUA_T_STRING = -2, /* fixed tag for strings */ | 71 | LUA_T_STRING = -2, /* fixed tag for strings */ |
74 | LUA_T_ARRAY = -3, /* default tag for tables (or arrays) */ | 72 | LUA_T_ARRAY = -3, /* default tag for tables (or arrays) */ |
75 | LUA_T_LPROTO = -4, /* fixed tag for Lua functions */ | 73 | LUA_T_LPROTO = -4, /* fixed tag for Lua functions */ |
76 | LUA_T_CPROTO = -5, /* fixed tag for C functions */ | 74 | LUA_T_CPROTO = -5, /* fixed tag for C functions */ |
77 | LUA_T_NIL = -6, /* last "pre-defined" tag */ | 75 | LUA_T_NIL = -6, /* last "pre-defined" tag */ |
78 | 76 | ||
79 | LUA_T_LCLOSURE = -7, /* Lua closure */ | 77 | LUA_T_LCLOSURE = -7, /* Lua closure */ |
80 | LUA_T_CCLOSURE = -8, /* C closure */ | 78 | LUA_T_CCLOSURE = -8, /* C closure */ |
81 | 79 | ||
82 | LUA_T_LCLMARK = -9 ,/* mark for Lua closures */ | 80 | LUA_T_LCLMARK = -9 ,/* mark for Lua closures */ |
83 | LUA_T_CCLMARK = -10,/* mark for C closures */ | 81 | LUA_T_CCLMARK = -10,/* mark for C closures */ |
84 | LUA_T_LMARK = -11, /* mark for Lua prototypes */ | 82 | LUA_T_LMARK = -11,/* mark for Lua prototypes */ |
85 | LUA_T_CMARK = -12, /* mark for C prototypes */ | 83 | LUA_T_CMARK = -12,/* mark for C prototypes */ |
86 | 84 | ||
87 | LUA_T_LINE = -13 | 85 | LUA_T_LINE = -13 |
88 | } lua_Type; | 86 | } lua_Type; |
@@ -93,7 +91,7 @@ typedef enum { | |||
93 | #define LAST_REGULAR_TAG LUA_T_CCLOSURE /* after that, are all marks */ | 91 | #define LAST_REGULAR_TAG LUA_T_CCLOSURE /* after that, are all marks */ |
94 | 92 | ||
95 | /* | 93 | /* |
96 | ** chech whether `t' is a mark; ttypes are negative numbers, so the | 94 | ** check whether `t' is a mark; ttypes are negative numbers, so the |
97 | ** comparisons look reversed. (ORDER LUA_T) | 95 | ** comparisons look reversed. (ORDER LUA_T) |
98 | */ | 96 | */ |
99 | #define is_T_MARK(t) (LUA_T_CMARK <= (t) && (t) <= LUA_T_LCLMARK) | 97 | #define is_T_MARK(t) (LUA_T_CMARK <= (t) && (t) <= LUA_T_LCLMARK) |
@@ -221,6 +219,7 @@ typedef struct Hash { | |||
221 | 219 | ||
222 | 220 | ||
223 | extern const char *const luaO_typenames[]; | 221 | extern const char *const luaO_typenames[]; |
222 | extern const TObject luaO_nilobject; | ||
224 | 223 | ||
225 | #define luaO_typename(o) luaO_typenames[-ttype(o)] | 224 | #define luaO_typename(o) luaO_typenames[-ttype(o)] |
226 | 225 | ||
@@ -228,11 +227,7 @@ extern const char *const luaO_typenames[]; | |||
228 | 227 | ||
229 | unsigned long luaO_power2 (unsigned long n); | 228 | unsigned long luaO_power2 (unsigned long n); |
230 | 229 | ||
231 | extern const TObject luaO_nilobject; | 230 | #define luaO_equalObj(t1,t2) (ttype(t1) == ttype(t2) && luaO_equalval(t1,t2)) |
232 | |||
233 | |||
234 | #define luaO_equalObj(t1,t2) ((ttype(t1) != ttype(t2)) ? 0 \ | ||
235 | : luaO_equalval(t1,t2)) | ||
236 | int luaO_equalval (const TObject *t1, const TObject *t2); | 231 | int luaO_equalval (const TObject *t1, const TObject *t2); |
237 | int luaO_redimension (lua_State *L, int oldsize); | 232 | int luaO_redimension (lua_State *L, int oldsize); |
238 | int luaO_str2d (const char *s, real *result); | 233 | int luaO_str2d (const char *s, real *result); |