]> git.proxmox.com Git - ceph.git/blob - ceph/src/civetweb/src/third_party/lua-5.3.3/src/ltable.h
buildsys: switch source download to quincy
[ceph.git] / ceph / src / civetweb / src / third_party / lua-5.3.3 / src / ltable.h
1 /*
2 ** $Id: ltable.h,v 2.21 2015/11/03 15:47:30 roberto Exp $
3 ** Lua tables (hash)
4 ** See Copyright Notice in lua.h
5 */
6
7 #ifndef ltable_h
8 #define ltable_h
9
10 #include "lobject.h"
11
12
13 #define gnode(t,i) (&(t)->node[i])
14 #define gval(n) (&(n)->i_val)
15 #define gnext(n) ((n)->i_key.nk.next)
16
17
18 /* 'const' to avoid wrong writings that can mess up field 'next' */
19 #define gkey(n) cast(const TValue*, (&(n)->i_key.tvk))
20
21 /*
22 ** writable version of 'gkey'; allows updates to individual fields,
23 ** but not to the whole (which has incompatible type)
24 */
25 #define wgkey(n) (&(n)->i_key.nk)
26
27 #define invalidateTMcache(t) ((t)->flags = 0)
28
29
30 /* returns the key, given the value of a table entry */
31 #define keyfromval(v) \
32 (gkey(cast(Node *, cast(char *, (v)) - offsetof(Node, i_val))))
33
34
35 LUAI_FUNC const TValue *luaH_getint (Table *t, lua_Integer key);
36 LUAI_FUNC void luaH_setint (lua_State *L, Table *t, lua_Integer key,
37 TValue *value);
38 LUAI_FUNC const TValue *luaH_getshortstr (Table *t, TString *key);
39 LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key);
40 LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key);
41 LUAI_FUNC TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key);
42 LUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key);
43 LUAI_FUNC Table *luaH_new (lua_State *L);
44 LUAI_FUNC void luaH_resize (lua_State *L, Table *t, unsigned int nasize,
45 unsigned int nhsize);
46 LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, unsigned int nasize);
47 LUAI_FUNC void luaH_free (lua_State *L, Table *t);
48 LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key);
49 LUAI_FUNC int luaH_getn (Table *t);
50
51
52 #if defined(LUA_DEBUG)
53 LUAI_FUNC Node *luaH_mainposition (const Table *t, const TValue *key);
54 LUAI_FUNC int luaH_isdummy (Node *n);
55 #endif
56
57
58 #endif