diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-02-21 13:28:12 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-02-21 13:28:12 -0300 |
commit | c80c7a49fdbd5c6540bd49ef47925edd9eed8c99 (patch) | |
tree | 744b50b2390a27e6cc12f311747b2d868ca8dd05 /lobject.h | |
parent | 212095a601ee68e99065b553f7b6bc216056d82e (diff) | |
download | lua-c80c7a49fdbd5c6540bd49ef47925edd9eed8c99.tar.gz lua-c80c7a49fdbd5c6540bd49ef47925edd9eed8c99.tar.bz2 lua-c80c7a49fdbd5c6540bd49ef47925edd9eed8c99.zip |
details (comments)
Diffstat (limited to 'lobject.h')
-rw-r--r-- | lobject.h | 45 |
1 files changed, 26 insertions, 19 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lobject.h,v 2.133 2018/01/28 15:13:26 roberto Exp roberto $ | 2 | ** $Id: lobject.h,v 2.134 2018/02/20 16:52:50 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 | */ |
@@ -88,12 +88,6 @@ struct GCObject { | |||
88 | 88 | ||
89 | 89 | ||
90 | 90 | ||
91 | |||
92 | /* | ||
93 | ** Tagged Values. This is the basic representation of values in Lua, | ||
94 | ** an actual value plus a tag with its type. | ||
95 | */ | ||
96 | |||
97 | /* | 91 | /* |
98 | ** Union of all Lua values | 92 | ** Union of all Lua values |
99 | */ | 93 | */ |
@@ -107,8 +101,12 @@ typedef union Value { | |||
107 | } Value; | 101 | } Value; |
108 | 102 | ||
109 | 103 | ||
110 | #define TValuefields Value value_; lu_byte tt_ | 104 | /* |
105 | ** Tagged Values. This is the basic representation of values in Lua: | ||
106 | ** an actual value plus a tag with its type. | ||
107 | */ | ||
111 | 108 | ||
109 | #define TValuefields Value value_; lu_byte tt_ | ||
112 | 110 | ||
113 | typedef struct TValue { | 111 | typedef struct TValue { |
114 | TValuefields; | 112 | TValuefields; |
@@ -301,14 +299,6 @@ typedef struct TValue { | |||
301 | 299 | ||
302 | 300 | ||
303 | 301 | ||
304 | |||
305 | /* | ||
306 | ** {====================================================== | ||
307 | ** types and prototypes | ||
308 | ** ======================================================= | ||
309 | */ | ||
310 | |||
311 | |||
312 | typedef union StackValue { | 302 | typedef union StackValue { |
313 | TValue val; | 303 | TValue val; |
314 | } StackValue; | 304 | } StackValue; |
@@ -322,6 +312,12 @@ typedef StackValue *StkId; /* index to stack elements */ | |||
322 | 312 | ||
323 | 313 | ||
324 | /* | 314 | /* |
315 | ** {================================================================== | ||
316 | ** Strings | ||
317 | ** =================================================================== | ||
318 | */ | ||
319 | |||
320 | /* | ||
325 | ** Header for string value; string bytes follow the end of this structure | 321 | ** Header for string value; string bytes follow the end of this structure |
326 | ** (aligned according to 'UTString'; see next). | 322 | ** (aligned according to 'UTString'; see next). |
327 | */ | 323 | */ |
@@ -363,6 +359,8 @@ typedef union UTString { | |||
363 | /* get string length from 'TValue *o' */ | 359 | /* get string length from 'TValue *o' */ |
364 | #define vslen(o) tsslen(tsvalue(o)) | 360 | #define vslen(o) tsslen(tsvalue(o)) |
365 | 361 | ||
362 | /* }================================================================== */ | ||
363 | |||
366 | 364 | ||
367 | /* | 365 | /* |
368 | ** {================================================================== | 366 | ** {================================================================== |
@@ -404,7 +402,6 @@ typedef struct Udata { | |||
404 | /* }================================================================== */ | 402 | /* }================================================================== */ |
405 | 403 | ||
406 | 404 | ||
407 | |||
408 | /* | 405 | /* |
409 | ** {================================================================== | 406 | ** {================================================================== |
410 | ** Prototypes | 407 | ** Prototypes |
@@ -480,6 +477,11 @@ typedef struct Proto { | |||
480 | /* }================================================================== */ | 477 | /* }================================================================== */ |
481 | 478 | ||
482 | 479 | ||
480 | /* | ||
481 | ** {================================================================== | ||
482 | ** Closures | ||
483 | ** =================================================================== | ||
484 | */ | ||
483 | 485 | ||
484 | /* | 486 | /* |
485 | ** Upvalues for Lua closures | 487 | ** Upvalues for Lua closures |
@@ -529,14 +531,17 @@ typedef union Closure { | |||
529 | 531 | ||
530 | #define getproto(o) (clLvalue(o)->p) | 532 | #define getproto(o) (clLvalue(o)->p) |
531 | 533 | ||
534 | /* }================================================================== */ | ||
535 | |||
532 | 536 | ||
533 | /* | 537 | /* |
538 | ** {================================================================== | ||
534 | ** Tables | 539 | ** Tables |
540 | ** =================================================================== | ||
535 | */ | 541 | */ |
536 | 542 | ||
537 | |||
538 | /* | 543 | /* |
539 | ** Nodes for Hash tables. A pack of two TValue's (key-value pairs) | 544 | ** Nodes for Hash tables: A pack of two TValue's (key-value pairs) |
540 | ** plus a 'next' field to link colliding entries. The distribution | 545 | ** plus a 'next' field to link colliding entries. The distribution |
541 | ** of the key's fields ('key_tt' and 'key_val') not forming a proper | 546 | ** of the key's fields ('key_tt' and 'key_val') not forming a proper |
542 | ** 'TValue' allows for a smaller size for 'Node' both in 4-byte | 547 | ** 'TValue' allows for a smaller size for 'Node' both in 4-byte |
@@ -609,6 +614,8 @@ typedef struct Table { | |||
609 | */ | 614 | */ |
610 | #define setdeadkey(n) (keytt(n) = LUA_TTABLE, gckey(n) = NULL) | 615 | #define setdeadkey(n) (keytt(n) = LUA_TTABLE, gckey(n) = NULL) |
611 | 616 | ||
617 | /* }================================================================== */ | ||
618 | |||
612 | 619 | ||
613 | 620 | ||
614 | /* | 621 | /* |