aboutsummaryrefslogtreecommitdiff
path: root/lobject.h
diff options
context:
space:
mode:
Diffstat (limited to 'lobject.h')
-rw-r--r--lobject.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/lobject.h b/lobject.h
index a5ace499..568aef3f 100644
--- a/lobject.h
+++ b/lobject.h
@@ -52,6 +52,12 @@
52#define LUA_TCCL (LUA_TFUNCTION | (2 << 4)) /* C closure */ 52#define LUA_TCCL (LUA_TFUNCTION | (2 << 4)) /* C closure */
53 53
54 54
55/*
56** LUA_TSTRING variants */
57#define LUA_TSHRSTR (LUA_TSTRING | (0 << 4)) /* short strings */
58#define LUA_TLNGSTR (LUA_TSTRING | (1 << 4)) /* long strings */
59
60
55/* Bit mark for collectable types */ 61/* Bit mark for collectable types */
56#define BIT_ISCOLLECTABLE (1 << 6) 62#define BIT_ISCOLLECTABLE (1 << 6)
57 63
@@ -129,7 +135,9 @@ typedef struct lua_TValue TValue;
129#define ttisnil(o) checktag((o), LUA_TNIL) 135#define ttisnil(o) checktag((o), LUA_TNIL)
130#define ttisboolean(o) checktag((o), LUA_TBOOLEAN) 136#define ttisboolean(o) checktag((o), LUA_TBOOLEAN)
131#define ttislightuserdata(o) checktag((o), LUA_TLIGHTUSERDATA) 137#define ttislightuserdata(o) checktag((o), LUA_TLIGHTUSERDATA)
132#define ttisstring(o) checktag((o), ctb(LUA_TSTRING)) 138#define ttisstring(o) checktype((o), LUA_TSTRING)
139#define ttisshrstring(o) checktag((o), ctb(LUA_TSHRSTR))
140#define ttislngstring(o) checktag((o), ctb(LUA_TLNGSTR))
133#define ttistable(o) checktag((o), ctb(LUA_TTABLE)) 141#define ttistable(o) checktag((o), ctb(LUA_TTABLE))
134#define ttisfunction(o) checktype(o, LUA_TFUNCTION) 142#define ttisfunction(o) checktype(o, LUA_TFUNCTION)
135#define ttisclosure(o) ((rttype(o) & 0x1F) == LUA_TFUNCTION) 143#define ttisclosure(o) ((rttype(o) & 0x1F) == LUA_TFUNCTION)
@@ -199,7 +207,8 @@ typedef struct lua_TValue TValue;
199 207
200#define setsvalue(L,obj,x) \ 208#define setsvalue(L,obj,x) \
201 { TValue *io=(obj); \ 209 { TValue *io=(obj); \
202 val_(io).gc=cast(GCObject *, (x)); settt_(io, ctb(LUA_TSTRING)); \ 210 TString *x_ = (x); \
211 val_(io).gc=cast(GCObject *, x_); settt_(io, ctb(x_->tsv.tt)); \
203 checkliveness(G(L),io); } 212 checkliveness(G(L),io); }
204 213
205#define setuvalue(L,obj,x) \ 214#define setuvalue(L,obj,x) \
@@ -409,7 +418,7 @@ typedef union TString {
409 L_Umaxalign dummy; /* ensures maximum alignment for strings */ 418 L_Umaxalign dummy; /* ensures maximum alignment for strings */
410 struct { 419 struct {
411 CommonHeader; 420 CommonHeader;
412 lu_byte extra; /* reserved words for strings */ 421 lu_byte extra; /* reserved words for short strings; "has hash" for longs */
413 unsigned int hash; 422 unsigned int hash;
414 size_t len; /* number of characters in string */ 423 size_t len; /* number of characters in string */
415 } tsv; 424 } tsv;