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