lua5.4
lobject.h
浏览该文件的文档.
1 /*
2 ** $Id: lobject.h $
3 ** Type definitions for Lua objects
4 ** See Copyright Notice in lua.h
5 */
6 
7 
8 #ifndef lobject_h
9 #define lobject_h
10 
11 
12 #include <stdarg.h>
13 
14 
15 #include "llimits.h"
16 #include "lua.h"
17 
18 
19 /*
20 ** Extra types for collectable non-values
21 */
22 #define LUA_TUPVAL LUA_NUMTYPES /* upvalues */
23 #define LUA_TPROTO (LUA_NUMTYPES+1) /* function prototypes */
24 #define LUA_TDEADKEY (LUA_NUMTYPES+2) /* removed keys in tables */
25 
26 
27 
28 /*
29 ** number of all possible types (including LUA_TNONE but excluding DEADKEY)
30 */
31 #define LUA_TOTALTYPES (LUA_TPROTO + 2)
32 
33 
34 /*
35 ** tags for Tagged Values have the following use of bits:
36 ** bits 0-3: actual tag (a LUA_T* constant)
37 ** bits 4-5: variant bits
38 ** bit 6: whether value is collectable
39 */
40 
41 /* add variant bits to a type */
42 #define makevariant(t,v) ((t) | ((v) << 4))
43 
44 
45 
46 /*
47 ** Union of all Lua values
48 */
49 typedef union Value {
50  struct GCObject *gc; /* collectable objects */
51  void *p; /* light userdata */
52  lua_CFunction f; /* light C functions */
53  lua_Integer i; /* integer numbers */
54  lua_Number n; /* float numbers */
56 
57 
58 /*
59 ** Tagged Values. This is the basic representation of values in Lua:
60 ** an actual value plus a tag with its type.
61 */
62 
63 #define TValuefields Value value_; lu_byte tt_
64 
65 typedef struct TValue {
68 
69 
70 #define val_(o) ((o)->value_)
71 #define valraw(o) (&val_(o))
72 
73 
74 /* raw type tag of a TValue */
75 #define rawtt(o) ((o)->tt_)
76 
77 /* tag with no variants (bits 0-3) */
78 #define novariant(t) ((t) & 0x0F)
79 
80 /* type tag of a TValue (bits 0-3 for tags + variant bits 4-5) */
81 #define withvariant(t) ((t) & 0x3F)
82 #define ttypetag(o) withvariant(rawtt(o))
83 
84 /* type of a TValue */
85 #define ttype(o) (novariant(rawtt(o)))
86 
87 
88 /* Macros to test type */
89 #define checktag(o,t) (rawtt(o) == (t))
90 #define checktype(o,t) (ttype(o) == (t))
91 
92 
93 /* Macros for internal tests */
94 
95 /* collectable object has the same tag as the original value */
96 #define righttt(obj) (ttypetag(obj) == gcvalue(obj)->tt)
97 
98 /*
99 ** Any value being manipulated by the program either is non
100 ** collectable, or the collectable object has the right tag
101 ** and it is not dead. The option 'L == NULL' allows other
102 ** macros using this one to be used where L is not available.
103 */
104 #define checkliveness(L,obj) \
105  ((void)L, lua_longassert(!iscollectable(obj) || \
106  (righttt(obj) && (L == NULL || !isdead(G(L),gcvalue(obj))))))
107 
108 
109 /* Macros to set values */
110 
111 /* set a value's tag */
112 #define settt_(o,t) ((o)->tt_=(t))
113 
114 
115 /* main macro to copy values (from 'obj1' to 'obj2') */
116 #define setobj(L,obj1,obj2) \
117  { TValue *io1=(obj1); const TValue *io2=(obj2); \
118  io1->value_ = io2->value_; settt_(io1, io2->tt_); \
119  checkliveness(L,io1); lua_assert(!isnonstrictnil(io1)); }
120 
121 /*
122 ** Different types of assignments, according to source and destination.
123 ** (They are mostly equal now, but may be different in the future.)
124 */
125 
126 /* from stack to stack */
127 #define setobjs2s(L,o1,o2) setobj(L,s2v(o1),s2v(o2))
128 /* to stack (not from same stack) */
129 #define setobj2s(L,o1,o2) setobj(L,s2v(o1),o2)
130 /* from table to same table */
131 #define setobjt2t setobj
132 /* to new object */
133 #define setobj2n setobj
134 /* to table */
135 #define setobj2t setobj
136 
137 
138 /*
139 ** Entries in the Lua stack
140 */
141 typedef union StackValue {
144 
145 
146 /* index to stack elements */
147 typedef StackValue *StkId;
148 
149 /* convert a 'StackValue' to a 'TValue' */
150 #define s2v(o) (&(o)->val)
151 
152 
153 
154 /*
155 ** {==================================================================
156 ** Nil
157 ** ===================================================================
158 */
159 
160 /* Standard nil */
161 #define LUA_VNIL makevariant(LUA_TNIL, 0)
162 
163 /* Empty slot (which might be different from a slot containing nil) */
164 #define LUA_VEMPTY makevariant(LUA_TNIL, 1)
165 
166 /* Value returned for a key not found in a table (absent key) */
167 #define LUA_VABSTKEY makevariant(LUA_TNIL, 2)
168 
169 
170 /* macro to test for (any kind of) nil */
171 #define ttisnil(v) checktype((v), LUA_TNIL)
172 
173 
174 /* macro to test for a standard nil */
175 #define ttisstrictnil(o) checktag((o), LUA_VNIL)
176 
177 
178 #define setnilvalue(obj) settt_(obj, LUA_VNIL)
179 
180 
181 #define isabstkey(v) checktag((v), LUA_VABSTKEY)
182 
183 
184 /*
185 ** macro to detect non-standard nils (used only in assertions)
186 */
187 #define isnonstrictnil(v) (ttisnil(v) && !ttisstrictnil(v))
188 
189 
190 /*
191 ** By default, entries with any kind of nil are considered empty.
192 ** (In any definition, values associated with absent keys must also
193 ** be accepted as empty.)
194 */
195 #define isempty(v) ttisnil(v)
196 
197 
198 /* macro defining a value corresponding to an absent key */
199 #define ABSTKEYCONSTANT {NULL}, LUA_VABSTKEY
200 
201 
202 /* mark an entry as empty */
203 #define setempty(v) settt_(v, LUA_VEMPTY)
204 
205 
206 
207 /* }================================================================== */
208 
209 
210 /*
211 ** {==================================================================
212 ** Booleans
213 ** ===================================================================
214 */
215 
216 
217 #define LUA_VFALSE makevariant(LUA_TBOOLEAN, 0)
218 #define LUA_VTRUE makevariant(LUA_TBOOLEAN, 1)
219 
220 #define ttisboolean(o) checktype((o), LUA_TBOOLEAN)
221 #define ttisfalse(o) checktag((o), LUA_VFALSE)
222 #define ttistrue(o) checktag((o), LUA_VTRUE)
223 
224 
225 #define l_isfalse(o) (ttisfalse(o) || ttisnil(o))
226 
227 
228 #define setbfvalue(obj) settt_(obj, LUA_VFALSE)
229 #define setbtvalue(obj) settt_(obj, LUA_VTRUE)
230 
231 /* }================================================================== */
232 
233 
234 /*
235 ** {==================================================================
236 ** Threads
237 ** ===================================================================
238 */
239 
240 #define LUA_VTHREAD makevariant(LUA_TTHREAD, 0)
241 
242 #define ttisthread(o) checktag((o), ctb(LUA_VTHREAD))
243 
244 #define thvalue(o) check_exp(ttisthread(o), gco2th(val_(o).gc))
245 
246 #define setthvalue(L,obj,x) \
247  { TValue *io = (obj); lua_State *x_ = (x); \
248  val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_VTHREAD)); \
249  checkliveness(L,io); }
250 
251 #define setthvalue2s(L,o,t) setthvalue(L,s2v(o),t)
252 
253 /* }================================================================== */
254 
255 
256 /*
257 ** {==================================================================
258 ** Collectable Objects
259 ** ===================================================================
260 */
261 
262 /*
263 ** Common Header for all collectable objects (in macro form, to be
264 ** included in other objects)
265 */
266 #define CommonHeader struct GCObject *next; lu_byte tt; lu_byte marked
267 
268 
269 /* Common type for all collectable objects */
270 typedef struct GCObject {
273 
274 
275 /* Bit mark for collectable types */
276 #define BIT_ISCOLLECTABLE (1 << 6)
277 
278 #define iscollectable(o) (rawtt(o) & BIT_ISCOLLECTABLE)
279 
280 /* mark a tag as collectable */
281 #define ctb(t) ((t) | BIT_ISCOLLECTABLE)
282 
283 #define gcvalue(o) check_exp(iscollectable(o), val_(o).gc)
284 
285 #define gcvalueraw(v) ((v).gc)
286 
287 #define setgcovalue(L,obj,x) \
288  { TValue *io = (obj); GCObject *i_g=(x); \
289  val_(io).gc = i_g; settt_(io, ctb(i_g->tt)); }
290 
291 /* }================================================================== */
292 
293 
294 /*
295 ** {==================================================================
296 ** Numbers
297 ** ===================================================================
298 */
299 
300 /* Variant tags for numbers */
301 #define LUA_VNUMINT makevariant(LUA_TNUMBER, 0) /* integer numbers */
302 #define LUA_VNUMFLT makevariant(LUA_TNUMBER, 1) /* float numbers */
303 
304 #define ttisnumber(o) checktype((o), LUA_TNUMBER)
305 #define ttisfloat(o) checktag((o), LUA_VNUMFLT)
306 #define ttisinteger(o) checktag((o), LUA_VNUMINT)
307 
308 #define nvalue(o) check_exp(ttisnumber(o), \
309  (ttisinteger(o) ? cast_num(ivalue(o)) : fltvalue(o)))
310 #define fltvalue(o) check_exp(ttisfloat(o), val_(o).n)
311 #define ivalue(o) check_exp(ttisinteger(o), val_(o).i)
312 
313 #define fltvalueraw(v) ((v).n)
314 #define ivalueraw(v) ((v).i)
315 
316 #define setfltvalue(obj,x) \
317  { TValue *io=(obj); val_(io).n=(x); settt_(io, LUA_VNUMFLT); }
318 
319 #define chgfltvalue(obj,x) \
320  { TValue *io=(obj); lua_assert(ttisfloat(io)); val_(io).n=(x); }
321 
322 #define setivalue(obj,x) \
323  { TValue *io=(obj); val_(io).i=(x); settt_(io, LUA_VNUMINT); }
324 
325 #define chgivalue(obj,x) \
326  { TValue *io=(obj); lua_assert(ttisinteger(io)); val_(io).i=(x); }
327 
328 /* }================================================================== */
329 
330 
331 /*
332 ** {==================================================================
333 ** Strings
334 ** ===================================================================
335 */
336 
337 /* Variant tags for strings */
338 #define LUA_VSHRSTR makevariant(LUA_TSTRING, 0) /* short strings */
339 #define LUA_VLNGSTR makevariant(LUA_TSTRING, 1) /* long strings */
340 
341 #define ttisstring(o) checktype((o), LUA_TSTRING)
342 #define ttisshrstring(o) checktag((o), ctb(LUA_VSHRSTR))
343 #define ttislngstring(o) checktag((o), ctb(LUA_VLNGSTR))
344 
345 #define tsvalueraw(v) (gco2ts((v).gc))
346 
347 #define tsvalue(o) check_exp(ttisstring(o), gco2ts(val_(o).gc))
348 
349 #define setsvalue(L,obj,x) \
350  { TValue *io = (obj); TString *x_ = (x); \
351  val_(io).gc = obj2gco(x_); settt_(io, ctb(x_->tt)); \
352  checkliveness(L,io); }
353 
354 /* set a string to the stack */
355 #define setsvalue2s(L,o,s) setsvalue(L,s2v(o),s)
356 
357 /* set a string to a new object */
358 #define setsvalue2n setsvalue
359 
360 
361 /*
362 ** Header for a string value.
363 */
364 typedef struct TString {
366  lu_byte extra; /* reserved words for short strings; "has hash" for longs */
367  lu_byte shrlen; /* length for short strings */
368  unsigned int hash;
369  union {
370  size_t lnglen; /* length for long strings */
371  struct TString *hnext; /* linked list for hash table */
372  } u;
373  char contents[1];
375 
376 
377 
378 /*
379 ** Get the actual string (array of bytes) from a 'TString'.
380 */
381 #define getstr(ts) ((ts)->contents)
382 
383 
384 /* get the actual string (array of bytes) from a Lua value */
385 #define svalue(o) getstr(tsvalue(o))
386 
387 /* get string length from 'TString *s' */
388 #define tsslen(s) ((s)->tt == LUA_VSHRSTR ? (s)->shrlen : (s)->u.lnglen)
389 
390 /* get string length from 'TValue *o' */
391 #define vslen(o) tsslen(tsvalue(o))
392 
393 /* }================================================================== */
394 
395 
396 /*
397 ** {==================================================================
398 ** Userdata
399 ** ===================================================================
400 */
401 
402 
403 /*
404 ** Light userdata should be a variant of userdata, but for compatibility
405 ** reasons they are also different types.
406 */
407 #define LUA_VLIGHTUSERDATA makevariant(LUA_TLIGHTUSERDATA, 0)
408 
409 #define LUA_VUSERDATA makevariant(LUA_TUSERDATA, 0)
410 
411 #define ttislightuserdata(o) checktag((o), LUA_VLIGHTUSERDATA)
412 #define ttisfulluserdata(o) checktag((o), ctb(LUA_VUSERDATA))
413 
414 #define pvalue(o) check_exp(ttislightuserdata(o), val_(o).p)
415 #define uvalue(o) check_exp(ttisfulluserdata(o), gco2u(val_(o).gc))
416 
417 #define pvalueraw(v) ((v).p)
418 
419 #define setpvalue(obj,x) \
420  { TValue *io=(obj); val_(io).p=(x); settt_(io, LUA_VLIGHTUSERDATA); }
421 
422 #define setuvalue(L,obj,x) \
423  { TValue *io = (obj); Udata *x_ = (x); \
424  val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_VUSERDATA)); \
425  checkliveness(L,io); }
426 
427 
428 /* Ensures that addresses after this type are always fully aligned. */
429 typedef union UValue {
431  LUAI_MAXALIGN; /* ensures maximum alignment for udata bytes */
433 
434 
435 /*
436 ** Header for userdata with user values;
437 ** memory area follows the end of this structure.
438 */
439 typedef struct Udata {
441  unsigned short nuvalue; /* number of user values */
442  size_t len; /* number of bytes */
443  struct Table *metatable;
445  UValue uv[1]; /* user values */
447 
448 
449 /*
450 ** Header for userdata with no user values. These userdata do not need
451 ** to be gray during GC, and therefore do not need a 'gclist' field.
452 ** To simplify, the code always use 'Udata' for both kinds of userdata,
453 ** making sure it never accesses 'gclist' on userdata with no user values.
454 ** This structure here is used only to compute the correct size for
455 ** this representation. (The 'bindata' field in its end ensures correct
456 ** alignment for binary data following this header.)
457 */
458 typedef struct Udata0 {
460  unsigned short nuvalue; /* number of user values */
461  size_t len; /* number of bytes */
462  struct Table *metatable;
465 
466 
467 /* compute the offset of the memory area of a userdata */
468 #define udatamemoffset(nuv) \
469  ((nuv) == 0 ? offsetof(Udata0, bindata) \
470  : offsetof(Udata, uv) + (sizeof(UValue) * (nuv)))
471 
472 /* get the address of the memory block inside 'Udata' */
473 #define getudatamem(u) (cast_charp(u) + udatamemoffset((u)->nuvalue))
474 
475 /* compute the size of a userdata */
476 #define sizeudata(nuv,nb) (udatamemoffset(nuv) + (nb))
477 
478 /* }================================================================== */
479 
480 
481 /*
482 ** {==================================================================
483 ** Prototypes
484 ** ===================================================================
485 */
486 
487 #define LUA_VPROTO makevariant(LUA_TPROTO, 0)
488 
489 
490 /*
491 ** Description of an upvalue for function prototypes
492 */
493 typedef struct Upvaldesc {
494  TString *name; /* upvalue name (for debug information) */
495  lu_byte instack; /* whether it is in stack (register) */
496  lu_byte idx; /* index of upvalue (in stack or in outer function's list) */
497  lu_byte kind; /* kind of corresponding variable */
499 
500 
501 /*
502 ** Description of a local variable for function prototypes
503 ** (used for debug information)
504 */
505 typedef struct LocVar {
507  int startpc; /* first point where variable is active */
508  int endpc; /* first point where variable is dead */
510 
511 
512 /*
513 ** Associates the absolute line source for a given instruction ('pc').
514 ** The array 'lineinfo' gives, for each instruction, the difference in
515 ** lines from the previous instruction. When that difference does not
516 ** fit into a byte, Lua saves the absolute line for that instruction.
517 ** (Lua also saves the absolute line periodically, to speed up the
518 ** computation of a line number: we can use binary search in the
519 ** absolute-line array, but we must traverse the 'lineinfo' array
520 ** linearly to compute a line.)
521 */
522 typedef struct AbsLineInfo {
523  int pc;
524  int line;
526 
527 /*
528 ** Function Prototypes
529 */
530 typedef struct Proto {
532  lu_byte numparams; /* number of fixed (named) parameters */
534  lu_byte maxstacksize; /* number of registers needed by this function */
535  int sizeupvalues; /* size of 'upvalues' */
536  int sizek; /* size of 'k' */
537  int sizecode;
539  int sizep; /* size of 'p' */
541  int sizeabslineinfo; /* size of 'abslineinfo' */
542  int linedefined; /* debug information */
543  int lastlinedefined; /* debug information */
544  TValue *k; /* constants used by the function */
545  Instruction *code; /* opcodes */
546  struct Proto **p; /* functions defined inside the function */
547  Upvaldesc *upvalues; /* upvalue information */
548  ls_byte *lineinfo; /* information about source lines (debug information) */
550  LocVar *locvars; /* information about local variables (debug information) */
551  TString *source; /* used for debug information */
554 
555 /* }================================================================== */
556 
557 
558 /*
559 ** {==================================================================
560 ** Functions
561 ** ===================================================================
562 */
563 
564 #define LUA_VUPVAL makevariant(LUA_TUPVAL, 0)
565 
566 
567 /* Variant tags for functions */
568 #define LUA_VLCL makevariant(LUA_TFUNCTION, 0) /* Lua closure */
569 #define LUA_VLCF makevariant(LUA_TFUNCTION, 1) /* light C function */
570 #define LUA_VCCL makevariant(LUA_TFUNCTION, 2) /* C closure */
571 
572 #define ttisfunction(o) checktype(o, LUA_TFUNCTION)
573 #define ttisclosure(o) ((rawtt(o) & 0x1F) == LUA_VLCL)
574 #define ttisLclosure(o) checktag((o), ctb(LUA_VLCL))
575 #define ttislcf(o) checktag((o), LUA_VLCF)
576 #define ttisCclosure(o) checktag((o), ctb(LUA_VCCL))
577 
578 #define isLfunction(o) ttisLclosure(o)
579 
580 #define clvalue(o) check_exp(ttisclosure(o), gco2cl(val_(o).gc))
581 #define clLvalue(o) check_exp(ttisLclosure(o), gco2lcl(val_(o).gc))
582 #define fvalue(o) check_exp(ttislcf(o), val_(o).f)
583 #define clCvalue(o) check_exp(ttisCclosure(o), gco2ccl(val_(o).gc))
584 
585 #define fvalueraw(v) ((v).f)
586 
587 #define setclLvalue(L,obj,x) \
588  { TValue *io = (obj); LClosure *x_ = (x); \
589  val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_VLCL)); \
590  checkliveness(L,io); }
591 
592 #define setclLvalue2s(L,o,cl) setclLvalue(L,s2v(o),cl)
593 
594 #define setfvalue(obj,x) \
595  { TValue *io=(obj); val_(io).f=(x); settt_(io, LUA_VLCF); }
596 
597 #define setclCvalue(L,obj,x) \
598  { TValue *io = (obj); CClosure *x_ = (x); \
599  val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_VCCL)); \
600  checkliveness(L,io); }
601 
602 
603 /*
604 ** Upvalues for Lua closures
605 */
606 typedef struct UpVal {
608  lu_byte tbc; /* true if it represents a to-be-closed variable */
609  TValue *v; /* points to stack or to its own value */
610  union {
611  struct { /* (when open) */
612  struct UpVal *next; /* linked list */
613  struct UpVal **previous;
614  } open;
615  TValue value; /* the value (when closed) */
616  } u;
618 
619 
620 
621 #define ClosureHeader \
622  CommonHeader; lu_byte nupvalues; GCObject *gclist
623 
624 typedef struct CClosure {
627  TValue upvalue[1]; /* list of upvalues */
629 
630 
631 typedef struct LClosure {
633  struct Proto *p;
634  UpVal *upvals[1]; /* list of upvalues */
636 
637 
638 typedef union Closure {
642 
643 
644 #define getproto(o) (clLvalue(o)->p)
645 
646 /* }================================================================== */
647 
648 
649 /*
650 ** {==================================================================
651 ** Tables
652 ** ===================================================================
653 */
654 
655 #define LUA_VTABLE makevariant(LUA_TTABLE, 0)
656 
657 #define ttistable(o) checktag((o), ctb(LUA_VTABLE))
658 
659 #define hvalue(o) check_exp(ttistable(o), gco2t(val_(o).gc))
660 
661 #define sethvalue(L,obj,x) \
662  { TValue *io = (obj); Table *x_ = (x); \
663  val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_VTABLE)); \
664  checkliveness(L,io); }
665 
666 #define sethvalue2s(L,o,h) sethvalue(L,s2v(o),h)
667 
668 
669 /*
670 ** Nodes for Hash tables: A pack of two TValue's (key-value pairs)
671 ** plus a 'next' field to link colliding entries. The distribution
672 ** of the key's fields ('key_tt' and 'key_val') not forming a proper
673 ** 'TValue' allows for a smaller size for 'Node' both in 4-byte
674 ** and 8-byte alignments.
675 */
676 typedef union Node {
677  struct NodeKey {
678  TValuefields; /* fields for value */
679  lu_byte key_tt; /* key type */
680  int next; /* for chaining */
681  Value key_val; /* key value */
682  } u;
683  TValue i_val; /* direct access to node's value as a proper 'TValue' */
685 
686 
687 /* copy a value into a key */
688 #define setnodekey(L,node,obj) \
689  { Node *n_=(node); const TValue *io_=(obj); \
690  n_->u.key_val = io_->value_; n_->u.key_tt = io_->tt_; \
691  checkliveness(L,io_); }
692 
693 
694 /* copy a value from a key */
695 #define getnodekey(L,obj,node) \
696  { TValue *io_=(obj); const Node *n_=(node); \
697  io_->value_ = n_->u.key_val; io_->tt_ = n_->u.key_tt; \
698  checkliveness(L,io_); }
699 
700 
701 /*
702 ** About 'alimit': if 'isrealasize(t)' is true, then 'alimit' is the
703 ** real size of 'array'. Otherwise, the real size of 'array' is the
704 ** smallest power of two not smaller than 'alimit' (or zero iff 'alimit'
705 ** is zero); 'alimit' is then used as a hint for #t.
706 */
707 
708 #define BITRAS (1 << 7)
709 #define isrealasize(t) (!((t)->flags & BITRAS))
710 #define setrealasize(t) ((t)->flags &= cast_byte(~BITRAS))
711 #define setnorealasize(t) ((t)->flags |= BITRAS)
712 
713 
714 typedef struct Table {
716  lu_byte flags; /* 1<<p means tagmethod(p) is not present */
717  lu_byte lsizenode; /* log2 of size of 'node' array */
718  unsigned int alimit; /* "limit" of 'array' array */
719  TValue *array; /* array part */
721  Node *lastfree; /* any free position is before this position */
722  struct Table *metatable;
725 
726 
727 /*
728 ** Macros to manipulate keys inserted in nodes
729 */
730 #define keytt(node) ((node)->u.key_tt)
731 #define keyval(node) ((node)->u.key_val)
732 
733 #define keyisnil(node) (keytt(node) == LUA_TNIL)
734 #define keyisinteger(node) (keytt(node) == LUA_VNUMINT)
735 #define keyival(node) (keyval(node).i)
736 #define keyisshrstr(node) (keytt(node) == ctb(LUA_VSHRSTR))
737 #define keystrval(node) (gco2ts(keyval(node).gc))
738 
739 #define setnilkey(node) (keytt(node) = LUA_TNIL)
740 
741 #define keyiscollectable(n) (keytt(n) & BIT_ISCOLLECTABLE)
742 
743 #define gckey(n) (keyval(n).gc)
744 #define gckeyN(n) (keyiscollectable(n) ? gckey(n) : NULL)
745 
746 
747 /*
748 ** Dead keys in tables have the tag DEADKEY but keep their original
749 ** gcvalue. This distinguishes them from regular keys but allows them to
750 ** be found when searched in a special way. ('next' needs that to find
751 ** keys removed from a table during a traversal.)
752 */
753 #define setdeadkey(node) (keytt(node) = LUA_TDEADKEY)
754 #define keyisdead(node) (keytt(node) == LUA_TDEADKEY)
755 
756 /* }================================================================== */
757 
758 
759 
760 /*
761 ** 'module' operation for hashing (size is always a power of 2)
762 */
763 #define lmod(s,size) \
764  (check_exp((size&(size-1))==0, (cast_int((s) & ((size)-1)))))
765 
766 
767 #define twoto(x) (1<<(x))
768 #define sizenode(t) (twoto((t)->lsizenode))
769 
770 
771 /* size of buffer for 'luaO_utf8esc' function */
772 #define UTF8BUFFSZ 8
773 
774 LUAI_FUNC int luaO_utf8esc (char *buff, unsigned long x);
775 LUAI_FUNC int luaO_ceillog2 (unsigned int x);
776 LUAI_FUNC int luaO_rawarith (lua_State *L, int op, const TValue *p1,
777  const TValue *p2, TValue *res);
778 LUAI_FUNC void luaO_arith (lua_State *L, int op, const TValue *p1,
779  const TValue *p2, StkId res);
780 LUAI_FUNC size_t luaO_str2num (const char *s, TValue *o);
781 LUAI_FUNC int luaO_hexavalue (int c);
782 LUAI_FUNC void luaO_tostring (lua_State *L, TValue *obj);
783 LUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt,
784  va_list argp);
785 LUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...);
786 LUAI_FUNC void luaO_chunkid (char *out, const char *source, size_t srclen);
787 
788 
789 #endif
790 
searcher_Lua
static int searcher_Lua(lua_State *L)
Definition: loadlib.c:543
luaV_mod
lua_Integer luaV_mod(lua_State *L, lua_Integer m, lua_Integer n)
Definition: lvm.c:733
LUA_IDSIZE
#define LUA_IDSIZE
Definition: luaconf.h:728
luaL_optstring
#define luaL_optstring(L, n, d)
Definition: lauxlib.h:139
LUA_CSUBSEP
#define LUA_CSUBSEP
Definition: loadlib.c:43
UpVal::CommonHeader
CommonHeader
Definition: lobject.h:607
LClosure
struct LClosure LClosure
s2v
#define s2v(o)
Definition: lobject.h:150
luai_numsub
#define luai_numsub(L, a, b)
Definition: llimits.h:336
lua_pushliteral
#define lua_pushliteral(L, s)
Definition: lua.h:381
luaO_rawarith
int luaO_rawarith(lua_State *L, int op, const TValue *p1, const TValue *p2, TValue *res)
Definition: lobject.c:89
Proto::upvalues
Upvaldesc * upvalues
Definition: lobject.h:547
lua_rotate
LUA_API void lua_rotate(lua_State *L, int idx, int n)
Definition: lapi.c:217
luai_numunm
#define luai_numunm(L, a)
Definition: llimits.h:338
Upvaldesc::kind
lu_byte kind
Definition: lobject.h:497
Table::flags
lu_byte flags
Definition: lobject.h:716
LUA_OPUNM
#define LUA_OPUNM
Definition: lua.h:217
TString
struct TString TString
TString::u
union TString::@1 u
lua_assert
#define lua_assert(c)
Definition: lauxlib.h:169
lua_number2str
#define lua_number2str(s, sz, n)
Definition: luaconf.h:401
GCObject::CommonHeader
CommonHeader
Definition: lobject.h:271
intarith
static lua_Integer intarith(lua_State *L, int op, lua_Integer v1, lua_Integer v2)
Definition: lobject.c:53
pushstr
static void pushstr(BuffFS *buff, const char *str, size_t l)
Definition: lobject.c:405
LUA_PRELOAD_TABLE
#define LUA_PRELOAD_TABLE
Definition: lauxlib.h:34
ls_byte
signed char ls_byte
Definition: llimits.h:37
Udata0
Definition: lobject.h:458
lua_Unsigned
LUA_UNSIGNED lua_Unsigned
Definition: lua.h:97
LUAI_FUNC
#define LUAI_FUNC
Definition: luaconf.h:307
findloader
static void findloader(lua_State *L, const char *name)
Definition: loadlib.c:622
l_str2dloc
static const char * l_str2dloc(const char *s, lua_Number *result, int mode)
Definition: lobject.c:228
luaL_addstring
LUALIB_API void luaL_addstring(luaL_Buffer *B, const char *s)
Definition: lauxlib.c:579
cast
#define cast(t, exp)
Definition: llimits.h:123
lua_pushglobaltable
#define lua_pushglobaltable(L)
Definition: lua.h:383
Proto::code
Instruction * code
Definition: lobject.h:545
L_MAXLENNUM
#define L_MAXLENNUM
Definition: lobject.c:220
LUA_CPATH_DEFAULT
#define LUA_CPATH_DEFAULT
Definition: luaconf.h:227
Value::p
void * p
Definition: lobject.h:51
UpVal::u
union UpVal::@3 u
LUA_LOADED_TABLE
#define LUA_LOADED_TABLE
Definition: lauxlib.h:30
AbsLineInfo::pc
int pc
Definition: lobject.h:523
lstate.h
pk_funcs
static const luaL_Reg pk_funcs[]
Definition: loadlib.c:688
isneg
static int isneg(const char **s)
Definition: lobject.c:141
ll_require
static int ll_require(lua_State *L)
Definition: loadlib.c:654
lua_tostring
#define lua_tostring(L, i)
Definition: lua.h:386
Node::NodeKey::key_tt
lu_byte key_tt
Definition: lobject.h:679
Closure
union Closure Closure
addstr
#define addstr(a, b, l)
Definition: lobject.c:555
Proto::sizeabslineinfo
int sizeabslineinfo
Definition: lobject.h:541
LUA_OK
#define LUA_OK
Definition: lua.h:49
LUA_OPDIV
#define LUA_OPDIV
Definition: lua.h:210
LClosure::ClosureHeader
ClosureHeader
Definition: lobject.h:632
POS
#define POS
Definition: lobject.c:553
GCObject
struct GCObject GCObject
luaS_newlstr
TString * luaS_newlstr(lua_State *L, const char *str, size_t l)
Definition: lstring.c:221
lua_pushstring
LUA_API const char * lua_pushstring(lua_State *L, const char *s)
Definition: lapi.c:514
luaL_checkstring
#define luaL_checkstring(L, n)
Definition: lauxlib.h:138
tostringbuff
static int tostringbuff(TValue *obj, char *buff)
Definition: lobject.c:355
Value::i
lua_Integer i
Definition: lobject.h:53
TString::CommonHeader
CommonHeader
Definition: lobject.h:365
UpVal::next
struct UpVal * next
Definition: lobject.h:612
lisdigit
#define lisdigit(c)
Definition: lctype.h:59
lua_getfield
LUA_API int lua_getfield(lua_State *L, int idx, const char *k)
Definition: lapi.c:665
exp1
static void exp1(LexState *ls)
Definition: lparser.c:1505
luaL_gsub
LUALIB_API const char * luaL_gsub(lua_State *L, const char *s, const char *p, const char *r)
Definition: lauxlib.c:990
setsvalue
#define setsvalue(L, obj, x)
Definition: lobject.h:349
StackValue::val
TValue val
Definition: lobject.h:142
BuffFS
Definition: lobject.c:393
luaL_buffinit
LUALIB_API void luaL_buffinit(lua_State *L, luaL_Buffer *B)
Definition: lauxlib.c:620
LUA_TTABLE
#define LUA_TTABLE
Definition: lua.h:70
pusherrornotfound
static void pusherrornotfound(lua_State *L, const char *path)
Definition: loadlib.c:469
Table::CommonHeader
CommonHeader
Definition: lobject.h:715
luaO_hexavalue
LUAI_FUNC int luaO_hexavalue(int c)
Definition: lobject.c:135
LocVar::varname
TString * varname
Definition: lobject.h:506
lisspace
#define lisspace(c)
Definition: lctype.h:60
Proto::lastlinedefined
int lastlinedefined
Definition: lobject.h:543
LUA_OPBAND
#define LUA_OPBAND
Definition: lua.h:212
Value::f
lua_CFunction f
Definition: lobject.h:52
LUA_OPSUB
#define LUA_OPSUB
Definition: lua.h:206
gctm
static int gctm(lua_State *L)
Definition: loadlib.c:361
lua_strx2number
#define lua_strx2number(s, p)
Definition: luaconf.h:598
LUA_OPMUL
#define LUA_OPMUL
Definition: lua.h:207
ll_funcs
static const luaL_Reg ll_funcs[]
Definition: loadlib.c:701
lua_remove
#define lua_remove(L, idx)
Definition: lua.h:391
luaG_runerror
l_noret luaG_runerror(lua_State *L, const char *fmt,...)
Definition: ldebug.c:767
lua_pop
#define lua_pop(L, n)
Definition: lua.h:364
Proto::p
struct Proto ** p
Definition: lobject.h:546
luaV_shiftl
lua_Integer luaV_shiftl(lua_Integer x, lua_Integer y)
Definition: lvm.c:766
Udata0::LUAI_MAXALIGN
LUAI_MAXALIGN
Definition: lobject.h:463
Udata0::nuvalue
unsigned short nuvalue
Definition: lobject.h:460
LUA_OPADD
#define LUA_OPADD
Definition: lua.h:205
BUFVFS
#define BUFVFS
Definition: lobject.c:390
clearbuff
static void clearbuff(BuffFS *buff)
Definition: lobject.c:418
lua_pushlstring
LUA_API const char * lua_pushlstring(lua_State *L, const char *s, size_t len)
Definition: lapi.c:502
ttisinteger
#define ttisinteger(o)
Definition: lobject.h:306
Proto::is_vararg
lu_byte is_vararg
Definition: lobject.h:533
Udata::uv
UValue uv[1]
Definition: lobject.h:445
Udata::nuvalue
unsigned short nuvalue
Definition: lobject.h:441
luaL_addlstring
LUALIB_API void luaL_addlstring(luaL_Buffer *B, const char *s, size_t l)
Definition: lauxlib.c:570
Node::NodeKey::next
int next
Definition: lobject.h:680
lua_Number
LUA_NUMBER lua_Number
Definition: lua.h:90
TMS
TMS
Definition: ltm.h:18
llimits.h
LUA_OPBXOR
#define LUA_OPBXOR
Definition: lua.h:214
lua_isstring
LUA_API int lua_isstring(lua_State *L, int idx)
Definition: lapi.c:292
Upvaldesc::name
TString * name
Definition: lobject.h:494
addtoclib
static void addtoclib(lua_State *L, const char *path, void *plib)
Definition: loadlib.c:347
luaL_loadfile
#define luaL_loadfile(L, f)
Definition: lauxlib.h:94
luaopen_package
LUAMOD_API int luaopen_package(lua_State *L)
Definition: loadlib.c:736
LUA_VERSUFFIX
#define LUA_VERSUFFIX
Definition: lualib.h:15
luaL_buffsub
#define luaL_buffsub(B, s)
Definition: lauxlib.h:204
Proto::sizecode
int sizecode
Definition: lobject.h:537
cast_char
#define cast_char(i)
Definition: llimits.h:132
checkclib
static void * checkclib(lua_State *L, const char *path)
Definition: loadlib.c:333
TString::extra
lu_byte extra
Definition: lobject.h:366
lua_setmetatable
LUA_API int lua_setmetatable(lua_State *L, int objindex)
Definition: lapi.c:909
CClosure::ClosureHeader
ClosureHeader
Definition: lobject.h:625
error
static l_noret error(LoadState *S, const char *why)
Definition: lundump.c:40
StackValue
Definition: lobject.h:141
Node::i_val
TValue i_val
Definition: lobject.h:683
l_str2d
static const char * l_str2d(const char *s, lua_Number *result)
Definition: lobject.c:251
Udata0
struct Udata0 Udata0
Proto::sizep
int sizep
Definition: lobject.h:539
Proto
struct Proto Proto
StackValue
union StackValue StackValue
luaL_pushresult
LUALIB_API void luaL_pushresult(luaL_Buffer *B)
Definition: lauxlib.c:584
UValue::uv
TValue uv
Definition: lobject.h:430
BuffFS::L
lua_State * L
Definition: lobject.c:394
ltolower
#define ltolower(c)
Definition: lctype.h:71
Proto::source
TString * source
Definition: lobject.h:551
Udata0::CommonHeader
CommonHeader
Definition: lobject.h:459
UTF8BUFFSZ
#define UTF8BUFFSZ
Definition: lobject.h:772
MAXLASTD
#define MAXLASTD
Definition: lobject.c:274
tointegerns
#define tointegerns(o, i)
Definition: lvm.h:67
lua_isfunction
#define lua_isfunction(L, n)
Definition: lua.h:372
Table::lastfree
Node * lastfree
Definition: lobject.h:721
numarith
static lua_Number numarith(lua_State *L, int op, lua_Number v1, lua_Number v2)
Definition: lobject.c:73
UValue::LUAI_MAXALIGN
LUAI_MAXALIGN
Definition: lobject.h:431
LocVar::startpc
int startpc
Definition: lobject.h:507
Proto::numparams
lu_byte numparams
Definition: lobject.h:532
luai_numidiv
#define luai_numidiv(L, a, b)
Definition: llimits.h:302
UValue
union UValue UValue
Proto::linedefined
int linedefined
Definition: lobject.h:542
BuffFS::space
char space[BUFVFS]
Definition: lobject.c:397
lua.h
LL
#define LL(x)
Definition: llimits.h:70
UpVal::tbc
lu_byte tbc
Definition: lobject.h:608
UpVal
Definition: lobject.h:606
fltvalue
#define fltvalue(o)
Definition: lobject.h:310
noenv
static int noenv(lua_State *L)
Definition: loadlib.c:283
Udata::len
size_t len
Definition: lobject.h:442
ivalue
#define ivalue(o)
Definition: lobject.h:311
lisxdigit
#define lisxdigit(c)
Definition: lctype.h:62
lua_insert
#define lua_insert(L, idx)
Definition: lua.h:389
TString::hash
unsigned int hash
Definition: lobject.h:368
LUA_OPIDIV
#define LUA_OPIDIV
Definition: lua.h:211
Proto::abslineinfo
AbsLineInfo * abslineinfo
Definition: lobject.h:549
CClosure
struct CClosure CClosure
PRE
#define PRE
Definition: lobject.c:552
Value::gc
struct GCObject * gc
Definition: lobject.h:50
ERRLIB
#define ERRLIB
Definition: loadlib.c:374
Udata::gclist
GCObject * gclist
Definition: lobject.h:444
TString::hnext
struct TString * hnext
Definition: lobject.h:371
luai_numpow
#define luai_numpow(L, a, b)
Definition: llimits.h:329
Value::n
lua_Number n
Definition: lobject.h:54
lua_setfield
LUA_API void lua_setfield(lua_State *L, int idx, const char *k)
Definition: lapi.c:847
l_str2int
static const char * l_str2int(const char *s, lua_Integer *result)
Definition: lobject.c:276
lua_pushcclosure
LUA_API void lua_pushcclosure(lua_State *L, lua_CFunction fn, int n)
Definition: lapi.c:555
CClosure
Definition: lobject.h:624
l_uacInt
LUAI_UACINT l_uacInt
Definition: llimits.h:84
AbsLineInfo::line
int line
Definition: lobject.h:524
luaO_ceillog2
int luaO_ceillog2(unsigned int x)
Definition: lobject.c:35
luaO_str2num
LUAI_FUNC size_t luaO_str2num(const char *s, TValue *o)
Definition: lobject.c:308
lvm.h
luaV_modf
lua_Number luaV_modf(lua_State *L, lua_Number m, lua_Number n)
Definition: lvm.c:751
luaL_Reg
Definition: lauxlib.h:37
luaO_chunkid
LUAI_FUNC void luaO_chunkid(char *out, const char *source, size_t srclen)
Definition: lobject.c:557
Node::NodeKey
Definition: lobject.h:677
LIB_FAIL
#define LIB_FAIL
Definition: loadlib.c:232
TString
Definition: lobject.h:364
ll_searchpath
static int ll_searchpath(lua_State *L)
Definition: loadlib.c:506
UValue
Definition: lobject.h:429
LUA_OPMOD
#define LUA_OPMOD
Definition: lua.h:208
lprefix.h
luaO_tostring
LUAI_FUNC void luaO_tostring(lua_State *L, TValue *obj)
Definition: lobject.c:374
luaO_pushvfstring
LUAI_FUNC const char * luaO_pushvfstring(lua_State *L, const char *fmt, va_list argp)
Definition: lobject.c:470
createclibstable
static void createclibstable(lua_State *L)
Definition: loadlib.c:727
lua_rawgeti
LUA_API int lua_rawgeti(lua_State *L, int idx, lua_Integer n)
Definition: lapi.c:720
setsvalue2s
#define setsvalue2s(L, o, s)
Definition: lobject.h:355
ldebug.h
Proto::sizek
int sizek
Definition: lobject.h:536
lu_byte
unsigned char lu_byte
Definition: llimits.h:36
MAXNUMBER2STR
#define MAXNUMBER2STR
Definition: lobject.c:349
TString::lnglen
size_t lnglen
Definition: lobject.h:370
luaO_chunkid
void luaO_chunkid(char *out, const char *source, size_t srclen)
Definition: lobject.c:557
CClosure::f
lua_CFunction f
Definition: lobject.h:626
checkload
static int checkload(lua_State *L, int stat, const char *filename)
Definition: loadlib.c:532
RETS
#define RETS
Definition: lobject.c:551
TM_ADD
@ TM_ADD
Definition: ltm.h:25
lua_pushfstring
LUA_API const char * lua_pushfstring(lua_State *L, const char *fmt,...)
Definition: lapi.c:542
Proto::lineinfo
ls_byte * lineinfo
Definition: lobject.h:548
CClosure::upvalue
TValue upvalue[1]
Definition: lobject.h:627
Proto::gclist
GCObject * gclist
Definition: lobject.h:552
LUA_DIRSEP
#define LUA_DIRSEP
Definition: luaconf.h:244
loadfunc
static int loadfunc(lua_State *L, const char *filename, const char *modname)
Definition: loadlib.c:560
TString::contents
char contents[1]
Definition: lobject.h:373
BuffFS::pushed
int pushed
Definition: lobject.c:395
Table
Definition: lobject.h:714
Udata
Definition: lobject.h:439
LUA_REGISTRYINDEX
#define LUA_REGISTRYINDEX
Definition: lua.h:44
setprogdir
#define setprogdir(L)
Definition: loadlib.c:67
lua_touserdata
LUA_API void * lua_touserdata(lua_State *L, int idx)
Definition: lapi.c:432
LUA_PATH_VAR
#define LUA_PATH_VAR
Definition: loadlib.c:271
l_castU2S
#define l_castU2S(i)
Definition: llimits.h:148
luaL_Buffer
Definition: lauxlib.h:182
LUA_PATH_SEP
#define LUA_PATH_SEP
Definition: luaconf.h:173
luaO_hexavalue
int luaO_hexavalue(int c)
Definition: lobject.c:135
cast_charp
#define cast_charp(i)
Definition: llimits.h:133
luaL_addchar
#define luaL_addchar(B, c)
Definition: lauxlib.h:198
lobject.h
Table::metatable
struct Table * metatable
Definition: lobject.h:722
luai_numdiv
#define luai_numdiv(L, a, b)
Definition: llimits.h:307
Node::NodeKey::key_val
Value key_val
Definition: lobject.h:681
UpVal
struct UpVal UpVal
lua_State
Definition: lstate.h:273
Table::gclist
GCObject * gclist
Definition: lobject.h:723
lua_Integer
LUA_INTEGER lua_Integer
Definition: lua.h:94
cast_uchar
#define cast_uchar(i)
Definition: llimits.h:131
lua_isnil
#define lua_isnil(L, n)
Definition: lua.h:375
lua_settop
LUA_API void lua_settop(lua_State *L, int idx)
Definition: lapi.c:173
LClosure::p
struct Proto * p
Definition: lobject.h:633
setpath
static void setpath(lua_State *L, const char *fieldname, const char *envname, const char *dft)
Definition: loadlib.c:295
Udata0::bindata
union Udata0::@2 bindata
LUA_CPATH_VAR
#define LUA_CPATH_VAR
Definition: loadlib.c:275
lauxlib.h
lualib.h
lua_pushboolean
LUA_API void lua_pushboolean(lua_State *L, int b)
Definition: lapi.c:581
lua_pushvalue
LUA_API void lua_pushvalue(lua_State *L, int idx)
Definition: lapi.c:246
TValue
Definition: lobject.h:65
Upvaldesc
struct Upvaldesc Upvaldesc
AbsLineInfo
Definition: lobject.h:522
Node::NodeKey::TValuefields
TValuefields
Definition: lobject.h:678
DLMSG
#define DLMSG
Definition: loadlib.c:235
luaL_len
LUALIB_API lua_Integer luaL_len(lua_State *L, int idx)
Definition: lauxlib.c:861
LUA_POF
#define LUA_POF
Definition: loadlib.c:52
UpVal::value
TValue value
Definition: lobject.h:615
MAXBY10
#define MAXBY10
Definition: lobject.c:273
luai_numadd
#define luai_numadd(L, a, b)
Definition: llimits.h:335
UpVal::v
TValue * v
Definition: lobject.h:609
Table::array
TValue * array
Definition: lobject.h:719
Proto::k
TValue * k
Definition: lobject.h:544
lua_pointer2str
#define lua_pointer2str(buff, sz, p)
Definition: luaconf.h:606
Table::alimit
unsigned int alimit
Definition: lobject.h:718
intop
#define intop(op, v1, v2)
Definition: lvm.h:71
l_castS2U
#define l_castS2U(i)
Definition: llimits.h:139
lua_pushcfunction
#define lua_pushcfunction(L, f)
Definition: lua.h:370
LClosure
Definition: lobject.h:631
Proto::sizelineinfo
int sizelineinfo
Definition: lobject.h:538
Proto::maxstacksize
lu_byte maxstacksize
Definition: lobject.h:534
Upvaldesc::instack
lu_byte instack
Definition: lobject.h:495
luai_nummul
#define luai_nummul(L, a, b)
Definition: llimits.h:337
ERRFUNC
#define ERRFUNC
Definition: loadlib.c:375
Closure::c
CClosure c
Definition: lobject.h:639
luaO_pushfstring
const char * luaO_pushfstring(lua_State *L, const char *fmt,...)
Definition: lobject.c:539
lua_call
#define lua_call(L, n, r)
Definition: lua.h:283
Proto::sizeupvalues
int sizeupvalues
Definition: lobject.h:535
tonumberns
#define tonumberns(o, n)
Definition: lvm.h:56
lua_getlocaledecpoint
#define lua_getlocaledecpoint()
Definition: luaconf.h:659
Instruction
l_uint32 Instruction
Definition: llimits.h:194
LUA_TNIL
#define LUA_TNIL
Definition: lua.h:65
luaO_pushvfstring
const char * luaO_pushvfstring(lua_State *L, const char *fmt, va_list argp)
Definition: lobject.c:470
luaO_str2num
size_t luaO_str2num(const char *s, TValue *o)
Definition: lobject.c:308
Udata0::metatable
struct Table * metatable
Definition: lobject.h:462
luaL_bufflen
#define luaL_bufflen(bf)
Definition: lauxlib.h:194
LUAMOD_API
#define LUAMOD_API
Definition: luaconf.h:286
StkId
StackValue * StkId
Definition: lobject.h:147
luaV_concat
void luaV_concat(lua_State *L, int total)
Definition: lvm.c:633
luaO_pushfstring
LUAI_FUNC const char * luaO_pushfstring(lua_State *L, const char *fmt,...)
Definition: lobject.c:539
setivalue
#define setivalue(obj, x)
Definition: lobject.h:322
LUA_OFSEP
#define LUA_OFSEP
Definition: loadlib.c:55
lua_integer2str
#define lua_integer2str(s, sz, n)
Definition: luaconf.h:498
luaO_tostring
void luaO_tostring(lua_State *L, TValue *obj)
Definition: lobject.c:374
addsize
#define addsize(b, sz)
Definition: lobject.c:436
lua_rawseti
LUA_API void lua_rawseti(lua_State *L, int idx, lua_Integer n)
Definition: lapi.c:897
luaL_setfuncs
LUALIB_API void luaL_setfuncs(lua_State *L, const luaL_Reg *l, int nup)
Definition: lauxlib.c:916
lsys_sym
static lua_CFunction lsys_sym(lua_State *L, void *lib, const char *sym)
Definition: loadlib.c:250
luaO_rawarith
LUAI_FUNC int luaO_rawarith(lua_State *L, int op, const TValue *p1, const TValue *p2, TValue *res)
Definition: lobject.c:89
searcher_Croot
static int searcher_Croot(lua_State *L)
Definition: loadlib.c:586
LocVar
struct LocVar LocVar
Proto
Definition: lobject.h:530
lsys_load
static void * lsys_load(lua_State *L, const char *path, int seeglb)
Definition: loadlib.c:243
lsys_unloadlib
static void lsys_unloadlib(void *lib)
Definition: loadlib.c:238
Value
Definition: lobject.h:49
ll_loadlib
static int ll_loadlib(lua_State *L)
Definition: loadlib.c:409
Udata::CommonHeader
CommonHeader
Definition: lobject.h:440
readable
static int readable(const char *filename)
Definition: loadlib.c:432
CLIBS
static const char *const CLIBS
Definition: loadlib.c:62
l_mathop
#define l_mathop(op)
Definition: luaconf.h:463
luaL_newlib
#define luaL_newlib(L, l)
Definition: lauxlib.h:129
luaL_error
LUALIB_API int luaL_error(lua_State *L, const char *fmt,...)
Definition: lauxlib.c:234
Value
union Value Value
Node::u
struct Node::NodeKey u
l_uacNumber
LUAI_UACNUMBER l_uacNumber
Definition: llimits.h:83
Table
struct Table Table
BuffFS::blen
int blen
Definition: lobject.c:396
findfile
static const char * findfile(lua_State *L, const char *name, const char *pname, const char *dirsep)
Definition: loadlib.c:520
UpVal::open
struct UpVal::@3::@4 open
lstring.h
AbsLineInfo
struct AbsLineInfo AbsLineInfo
luaO_arith
void luaO_arith(lua_State *L, int op, const TValue *p1, const TValue *p2, StkId res)
Definition: lobject.c:126
luaO_arith
LUAI_FUNC void luaO_arith(lua_State *L, int op, const TValue *p1, const TValue *p2, StkId res)
Definition: lobject.c:126
Upvaldesc
Definition: lobject.h:493
ttisnumber
#define ttisnumber(o)
Definition: lobject.h:304
Upvaldesc::idx
lu_byte idx
Definition: lobject.h:496
luaL_buffaddr
#define luaL_buffaddr(bf)
Definition: lauxlib.h:195
getbuff
static char * getbuff(BuffFS *buff, int sz)
Definition: lobject.c:428
createsearcherstable
static void createsearcherstable(lua_State *L)
Definition: loadlib.c:707
luaL_getsubtable
LUALIB_API int luaL_getsubtable(lua_State *L, int idx, const char *fname)
Definition: lauxlib.c:937
lua_CFunction
int(* lua_CFunction)(lua_State *L)
Definition: lua.h:106
searcher_preload
static int searcher_preload(lua_State *L)
Definition: loadlib.c:608
voidf
void(* voidf)(void)
Definition: loadlib.c:74
LUA_OPPOW
#define LUA_OPPOW
Definition: lua.h:209
Node
Definition: lobject.h:676
getnextfilename
static const char * getnextfilename(char **path, char *end)
Definition: loadlib.c:445
lmem.h
TString::shrlen
lu_byte shrlen
Definition: lobject.h:367
lua_State::top
StkId top
Definition: lstate.h:278
Udata::metatable
struct Table * metatable
Definition: lobject.h:443
Udata
struct Udata Udata
LocVar
Definition: lobject.h:505
setfltvalue
#define setfltvalue(obj, x)
Definition: lobject.h:316
searcher_C
static int searcher_C(lua_State *L)
Definition: loadlib.c:578
lua_toboolean
LUA_API int lua_toboolean(lua_State *L, int idx)
Definition: lapi.c:375
GCObject
Definition: lobject.h:270
LUA_OPSHR
#define LUA_OPSHR
Definition: lua.h:216
luaV_idiv
lua_Integer luaV_idiv(lua_State *L, lua_Integer m, lua_Integer n)
Definition: lvm.c:713
luaO_utf8esc
int luaO_utf8esc(char *buff, unsigned long x)
Definition: lobject.c:323
LUA_OPBOR
#define LUA_OPBOR
Definition: lua.h:213
LUA_PATH_MARK
#define LUA_PATH_MARK
Definition: luaconf.h:174
luaO_ceillog2
LUAI_FUNC int luaO_ceillog2(unsigned int x)
Definition: lobject.c:35
Proto::CommonHeader
CommonHeader
Definition: lobject.h:531
UpVal::previous
struct UpVal ** previous
Definition: lobject.h:613
Table::lsizenode
lu_byte lsizenode
Definition: lobject.h:717
luaT_trybinTM
void luaT_trybinTM(lua_State *L, const TValue *p1, const TValue *p2, StkId res, TMS event)
Definition: ltm.c:148
lua_str2number
#define lua_str2number(s, p)
Definition: luaconf.h:465
lua_upvalueindex
#define lua_upvalueindex(i)
Definition: lua.h:45
lookforfunc
static int lookforfunc(lua_State *L, const char *path, const char *sym)
Definition: loadlib.c:388
luaL_addvalue
LUALIB_API void luaL_addvalue(luaL_Buffer *B)
Definition: lauxlib.c:609
LUA_PATH_DEFAULT
#define LUA_PATH_DEFAULT
Definition: luaconf.h:220
LUA_LSUBSEP
#define LUA_LSUBSEP
Definition: loadlib.c:47
Proto::locvars
LocVar * locvars
Definition: lobject.h:550
LUA_OPSHL
#define LUA_OPSHL
Definition: lua.h:215
luaL_addgsub
LUALIB_API void luaL_addgsub(luaL_Buffer *b, const char *s, const char *p, const char *r)
Definition: lauxlib.c:977
TValue::TValuefields
TValuefields
Definition: lobject.h:66
lctype.h
addstr2buff
static void addstr2buff(BuffFS *buff, const char *str, size_t slen)
Definition: lobject.c:443
BuffFS
struct BuffFS BuffFS
svalue
#define svalue(o)
Definition: lobject.h:385
lua_createtable
LUA_API void lua_createtable(lua_State *L, int narray, int nrec)
Definition: lapi.c:738
LocVar::endpc
int endpc
Definition: lobject.h:508
luaO_utf8esc
LUAI_FUNC int luaO_utf8esc(char *buff, unsigned long x)
Definition: lobject.c:323
Proto::sizelocvars
int sizelocvars
Definition: lobject.h:540
LUA_EXEC_DIR
#define LUA_EXEC_DIR
Definition: luaconf.h:175
Node
union Node Node
LUA_OPBNOT
#define LUA_OPBNOT
Definition: lua.h:218
lua_pushlightuserdata
LUA_API void lua_pushlightuserdata(lua_State *L, void *p)
Definition: lapi.c:592
LUA_IGMARK
#define LUA_IGMARK
Definition: loadlib.c:32
luaL_pushfail
#define luaL_pushfail(L)
Definition: lauxlib.h:157
Closure
Definition: lobject.h:638
lua_copy
LUA_API void lua_copy(lua_State *L, int fromidx, int toidx)
Definition: lapi.c:231
Table::node
Node * node
Definition: lobject.h:720
LClosure::upvals
UpVal * upvals[1]
Definition: lobject.h:634
TValue
struct TValue TValue
Udata0::len
size_t len
Definition: lobject.h:461
searchpath
static const char * searchpath(lua_State *L, const char *name, const char *path, const char *sep, const char *dirsep)
Definition: loadlib.c:479
Closure::l
LClosure l
Definition: lobject.h:640
cast_num
#define cast_num(i)
Definition: llimits.h:127
ldo.h
addnum2buff
static void addnum2buff(BuffFS *buff, TValue *num)
Definition: lobject.c:459
cast_int
#define cast_int(i)
Definition: llimits.h:128