aboutsummaryrefslogtreecommitdiff
path: root/lobject.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lobject.h22
1 files changed, 18 insertions, 4 deletions
diff --git a/lobject.h b/lobject.h
index 342197c4..c6c43647 100644
--- a/lobject.h
+++ b/lobject.h
@@ -394,7 +394,7 @@ typedef struct TString {
394 size_t lnglen; /* length for long strings */ 394 size_t lnglen; /* length for long strings */
395 struct TString *hnext; /* linked list for hash table */ 395 struct TString *hnext; /* linked list for hash table */
396 } u; 396 } u;
397 char contents[1]; 397 char contents[1]; /* string body starts here */
398} TString; 398} TString;
399 399
400 400
@@ -403,15 +403,22 @@ typedef struct TString {
403** Get the actual string (array of bytes) from a 'TString'. (Generic 403** Get the actual string (array of bytes) from a 'TString'. (Generic
404** version and specialized versions for long and short strings.) 404** version and specialized versions for long and short strings.)
405*/ 405*/
406#define getstr(ts) ((ts)->contents)
407#define getlngstr(ts) check_exp((ts)->shrlen == 0xFF, (ts)->contents) 406#define getlngstr(ts) check_exp((ts)->shrlen == 0xFF, (ts)->contents)
408#define getshrstr(ts) check_exp((ts)->shrlen != 0xFF, (ts)->contents) 407#define getshrstr(ts) check_exp((ts)->shrlen != 0xFF, (ts)->contents)
408#define getstr(ts) ((ts)->contents)
409 409
410 410
411/* get string length from 'TString *s' */ 411/* get string length from 'TString *s' */
412#define tsslen(s) \ 412#define tsslen(s) \
413 ((s)->shrlen != 0xFF ? (s)->shrlen : (s)->u.lnglen) 413 ((s)->shrlen != 0xFF ? (s)->shrlen : (s)->u.lnglen)
414 414
415/*
416** Get string and length */
417#define getlstr(ts, len) \
418 ((ts)->shrlen != 0xFF \
419 ? (cast_void(len = (ts)->shrlen), (ts)->contents) \
420 : (cast_void(len = (ts)->u.lnglen), (ts)->contents))
421
415/* }================================================================== */ 422/* }================================================================== */
416 423
417 424
@@ -546,13 +553,21 @@ typedef struct AbsLineInfo {
546 int line; 553 int line;
547} AbsLineInfo; 554} AbsLineInfo;
548 555
556
557/*
558** Flags in Prototypes
559*/
560#define PF_ISVARARG 1
561#define PF_FIXED 2 /* prototype has parts in fixed memory */
562
563
549/* 564/*
550** Function Prototypes 565** Function Prototypes
551*/ 566*/
552typedef struct Proto { 567typedef struct Proto {
553 CommonHeader; 568 CommonHeader;
554 lu_byte numparams; /* number of fixed (named) parameters */ 569 lu_byte numparams; /* number of fixed (named) parameters */
555 lu_byte is_vararg; 570 lu_byte flag;
556 lu_byte maxstacksize; /* number of registers needed by this function */ 571 lu_byte maxstacksize; /* number of registers needed by this function */
557 int sizeupvalues; /* size of 'upvalues' */ 572 int sizeupvalues; /* size of 'upvalues' */
558 int sizek; /* size of 'k' */ 573 int sizek; /* size of 'k' */
@@ -746,7 +761,6 @@ typedef struct Table {
746 unsigned int alimit; /* "limit" of 'array' array */ 761 unsigned int alimit; /* "limit" of 'array' array */
747 ArrayCell *array; /* array part */ 762 ArrayCell *array; /* array part */
748 Node *node; 763 Node *node;
749 Node *lastfree; /* any free position is before this position */
750 struct Table *metatable; 764 struct Table *metatable;
751 GCObject *gclist; 765 GCObject *gclist;
752} Table; 766} Table;