xref: /freebsd-src/sys/contrib/openzfs/module/lua/ltable.h (revision eda14cbc264d6969b02f2b1994cef11148e914f1)
1*eda14cbcSMatt Macy /* BEGIN CSTYLED */
2*eda14cbcSMatt Macy /*
3*eda14cbcSMatt Macy ** $Id: ltable.h,v 2.16.1.2 2013/08/30 15:49:41 roberto Exp $
4*eda14cbcSMatt Macy ** Lua tables (hash)
5*eda14cbcSMatt Macy ** See Copyright Notice in lua.h
6*eda14cbcSMatt Macy */
7*eda14cbcSMatt Macy 
8*eda14cbcSMatt Macy #ifndef ltable_h
9*eda14cbcSMatt Macy #define ltable_h
10*eda14cbcSMatt Macy 
11*eda14cbcSMatt Macy #include "lobject.h"
12*eda14cbcSMatt Macy 
13*eda14cbcSMatt Macy 
14*eda14cbcSMatt Macy #define gnode(t,i)	((Node *)&(t)->node[i])
15*eda14cbcSMatt Macy #define gkey(n)		(&(n)->i_key.tvk)
16*eda14cbcSMatt Macy #define gval(n)		(&(n)->i_val)
17*eda14cbcSMatt Macy #define gnext(n)	((n)->i_key.nk.next)
18*eda14cbcSMatt Macy 
19*eda14cbcSMatt Macy #define invalidateTMcache(t)	((t)->flags = 0)
20*eda14cbcSMatt Macy 
21*eda14cbcSMatt Macy /* returns the key, given the value of a table entry */
22*eda14cbcSMatt Macy #define keyfromval(v) \
23*eda14cbcSMatt Macy   (gkey(cast(Node *, cast(char *, (v)) - offsetof(Node, i_val))))
24*eda14cbcSMatt Macy 
25*eda14cbcSMatt Macy 
26*eda14cbcSMatt Macy LUAI_FUNC const TValue *luaH_getint (Table *t, int key);
27*eda14cbcSMatt Macy LUAI_FUNC void luaH_setint (lua_State *L, Table *t, int key, TValue *value);
28*eda14cbcSMatt Macy LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key);
29*eda14cbcSMatt Macy LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key);
30*eda14cbcSMatt Macy LUAI_FUNC TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key);
31*eda14cbcSMatt Macy LUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key);
32*eda14cbcSMatt Macy LUAI_FUNC Table *luaH_new (lua_State *L);
33*eda14cbcSMatt Macy LUAI_FUNC void luaH_resize (lua_State *L, Table *t, int nasize, int nhsize);
34*eda14cbcSMatt Macy LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, int nasize);
35*eda14cbcSMatt Macy LUAI_FUNC void luaH_free (lua_State *L, Table *t);
36*eda14cbcSMatt Macy LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key);
37*eda14cbcSMatt Macy LUAI_FUNC int luaH_getn (Table *t);
38*eda14cbcSMatt Macy 
39*eda14cbcSMatt Macy 
40*eda14cbcSMatt Macy #if defined(LUA_DEBUG)
41*eda14cbcSMatt Macy LUAI_FUNC Node *luaH_mainposition (const Table *t, const TValue *key);
42*eda14cbcSMatt Macy LUAI_FUNC int luaH_isdummy (Node *n);
43*eda14cbcSMatt Macy #endif
44*eda14cbcSMatt Macy 
45*eda14cbcSMatt Macy 
46*eda14cbcSMatt Macy #endif
47*eda14cbcSMatt Macy /* END CSTYLED */
48