aboutsummaryrefslogtreecommitdiff
path: root/lobject.h
diff options
context:
space:
mode:
Diffstat (limited to 'lobject.h')
-rw-r--r--lobject.h37
1 files changed, 22 insertions, 15 deletions
diff --git a/lobject.h b/lobject.h
index 7488e2fe..86bc3601 100644
--- a/lobject.h
+++ b/lobject.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lobject.h,v 1.159 2003/03/18 12:50:04 roberto Exp roberto $ 2** $Id: lobject.h,v 1.160 2003/04/28 19:26: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*/
@@ -92,44 +92,49 @@ typedef struct lua_TObject {
92#define l_isfalse(o) (ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0)) 92#define l_isfalse(o) (ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0))
93 93
94/* Macros to set values */ 94/* Macros to set values */
95#define setnilvalue(obj) ((obj)->tt=LUA_TNIL)
96
95#define setnvalue(obj,x) \ 97#define setnvalue(obj,x) \
96 { TObject *i_o=(obj); i_o->tt=LUA_TNUMBER; i_o->value.n=(x); } 98 { TObject *i_o=(obj); i_o->value.n=(x); i_o->tt=LUA_TNUMBER; }
97 99
98#define chgnvalue(obj,x) \ 100#define chgnvalue(obj,x) \
99 check_exp(ttype(obj)==LUA_TNUMBER, (obj)->value.n=(x)) 101 check_exp(ttype(obj)==LUA_TNUMBER, (obj)->value.n=(x))
100 102
101#define setpvalue(obj,x) \ 103#define setpvalue(obj,x) \
102 { TObject *i_o=(obj); i_o->tt=LUA_TLIGHTUSERDATA; i_o->value.p=(x); } 104 { TObject *i_o=(obj); i_o->value.p=(x); i_o->tt=LUA_TLIGHTUSERDATA; }
103 105
104#define setbvalue(obj,x) \ 106#define setbvalue(obj,x) \
105 { TObject *i_o=(obj); i_o->tt=LUA_TBOOLEAN; i_o->value.b=(x); } 107 { TObject *i_o=(obj); i_o->value.b=(x); i_o->tt=LUA_TBOOLEAN; }
106 108
107#define setsvalue(obj,x) \ 109#define setsvalue(obj,x) \
108 { TObject *i_o=(obj); i_o->tt=LUA_TSTRING; \ 110 { TObject *i_o=(obj); \
109 i_o->value.gc=cast(GCObject *, (x)); \ 111 i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TSTRING; \
110 lua_assert(i_o->value.gc->gch.tt == LUA_TSTRING); } 112 lua_assert(i_o->value.gc->gch.tt == LUA_TSTRING); }
111 113
112#define setuvalue(obj,x) \ 114#define setuvalue(obj,x) \
113 { TObject *i_o=(obj); i_o->tt=LUA_TUSERDATA; \ 115 { TObject *i_o=(obj); \
114 i_o->value.gc=cast(GCObject *, (x)); \ 116 i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TUSERDATA; \
115 lua_assert(i_o->value.gc->gch.tt == LUA_TUSERDATA); } 117 lua_assert(i_o->value.gc->gch.tt == LUA_TUSERDATA); }
116 118
117#define setthvalue(obj,x) \ 119#define setthvalue(obj,x) \
118 { TObject *i_o=(obj); i_o->tt=LUA_TTHREAD; \ 120 { TObject *i_o=(obj); \
119 i_o->value.gc=cast(GCObject *, (x)); \ 121 i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TTHREAD; \
120 lua_assert(i_o->value.gc->gch.tt == LUA_TTHREAD); } 122 lua_assert(i_o->value.gc->gch.tt == LUA_TTHREAD); }
121 123
122#define setclvalue(obj,x) \ 124#define setclvalue(obj,x) \
123 { TObject *i_o=(obj); i_o->tt=LUA_TFUNCTION; \ 125 { TObject *i_o=(obj); \
124 i_o->value.gc=cast(GCObject *, (x)); \ 126 i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TFUNCTION; \
125 lua_assert(i_o->value.gc->gch.tt == LUA_TFUNCTION); } 127 lua_assert(i_o->value.gc->gch.tt == LUA_TFUNCTION); }
126 128
127#define sethvalue(obj,x) \ 129#define sethvalue(obj,x) \
128 { TObject *i_o=(obj); i_o->tt=LUA_TTABLE; \ 130 { TObject *i_o=(obj); \
129 i_o->value.gc=cast(GCObject *, (x)); \ 131 i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TTABLE; \
130 lua_assert(i_o->value.gc->gch.tt == LUA_TTABLE); } 132 lua_assert(i_o->value.gc->gch.tt == LUA_TTABLE); }
131 133
132#define setnilvalue(obj) ((obj)->tt=LUA_TNIL) 134#define setptvalue(obj,x) \
135 { TObject *i_o=(obj); \
136 i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TPROTO; \
137 lua_assert(i_o->value.gc->gch.tt == LUA_TPROTO); }
133 138
134 139
135 140
@@ -155,6 +160,8 @@ typedef struct lua_TObject {
155/* to stack (not from same stack) */ 160/* to stack (not from same stack) */
156#define setobj2s setobj 161#define setobj2s setobj
157#define setsvalue2s setsvalue 162#define setsvalue2s setsvalue
163#define sethvalue2s sethvalue
164#define setptvalue2s setptvalue
158/* from table to same table */ 165/* from table to same table */
159#define setobjt2t setobj 166#define setobjt2t setobj
160/* to table */ 167/* to table */