#include <string.h>
#include "lua.h"
#include "ldebug.h"
#include "ldo.h"
#include "lgc.h"
#include "lmem.h"
#include "lobject.h"
#include "lstate.h"
#include "ltable.h"
Go to the source code of this file.
Defines | |
#define | ltable_c |
#define | MAXBITS (BITS_INT-2) |
#define | toobig(x) ((((x)-1) >> MAXBITS) != 0) |
#define | lua_number2int(i, n) ((i)=(int)(n)) |
#define | hashpow2(t, n) (gnode(t, lmod((n), sizenode(t)))) |
#define | hashstr(t, str) hashpow2(t, (str)->tsv.hash) |
#define | hashboolean(t, p) hashpow2(t, p) |
#define | hashmod(t, n) (gnode(t, ((n) % ((sizenode(t)-1)|1)))) |
#define | hashpointer(t, p) hashmod(t, IntPoint(p)) |
#define | numints cast(int, sizeof(lua_Number)/sizeof(int)) |
Functions | |
static Node * | hashnum (const Table *t, lua_Number n) |
Node * | luaH_mainposition (const Table *t, const TObject *key) |
static int | arrayindex (const TObject *key) |
static int | luaH_index (lua_State *L, Table *t, StkId key) |
int | luaH_next (lua_State *L, Table *t, StkId key) |
static void | computesizes (int nums[], int ntotal, int *narray, int *nhash) |
static void | numuse (const Table *t, int *narray, int *nhash) |
static void | setarrayvector (lua_State *L, Table *t, int size) |
static void | setnodevector (lua_State *L, Table *t, int lsize) |
static void | resize (lua_State *L, Table *t, int nasize, int nhsize) |
static void | rehash (lua_State *L, Table *t) |
Table * | luaH_new (lua_State *L, int narray, int lnhash) |
void | luaH_free (lua_State *L, Table *t) |
static TObject * | newkey (lua_State *L, Table *t, const TObject *key) |
static const TObject * | luaH_getany (Table *t, const TObject *key) |
const TObject * | luaH_getnum (Table *t, int key) |
const TObject * | luaH_getstr (Table *t, TString *key) |
const TObject * | luaH_get (Table *t, const TObject *key) |
TObject * | luaH_set (lua_State *L, Table *t, const TObject *key) |
TObject * | luaH_setnum (lua_State *L, Table *t, int key) |
#define hashboolean | ( | t, | |||
p | ) | hashpow2(t, p) |
#define hashmod | ( | t, | |||
n | ) | (gnode(t, ((n) % ((sizenode(t)-1)|1)))) |
#define hashpointer | ( | t, | |||
p | ) | hashmod(t, IntPoint(p)) |
#define hashpow2 | ( | t, | |||
n | ) | (gnode(t, lmod((n), sizenode(t)))) |
#define hashstr | ( | t, | |||
str | ) | hashpow2(t, (str)->tsv.hash) |
#define lua_number2int | ( | i, | |||
n | ) | ((i)=(int)(n)) |
#define MAXBITS (BITS_INT-2) |
#define numints cast(int, sizeof(lua_Number)/sizeof(int)) |
#define toobig | ( | x | ) | ((((x)-1) >> MAXBITS) != 0) |
static int arrayindex | ( | const TObject * | key | ) | [static] |
Definition at line 121 of file ltable.c.
References cast, lua_number2int, nvalue, toobig, and ttisnumber.
Referenced by luaH_index().
static void computesizes | ( | int | nums[], | |
int | ntotal, | |||
int * | narray, | |||
int * | nhash | |||
) | [static] |
Definition at line 83 of file ltable.c.
References cast, hashmod, lua_assert, and numints.
Referenced by luaH_getnum(), and luaH_mainposition().
Definition at line 361 of file ltable.c.
References Table::array, Table::lsizenode, luaM_freearray, luaM_freelem, Table::node, Table::sizearray, and sizenode.
Referenced by freeobj().
Definition at line 495 of file ltable.c.
References cast, lua_number2int, luaH_getany(), luaH_getnum(), luaH_getstr(), nvalue, tsvalue, and ttype.
Referenced by addk(), lua_rawget(), luaH_index(), luaH_set(), luaV_gettable(), and newkey().
Definition at line 444 of file ltable.c.
References gkey, gval, luaH_mainposition(), luaO_nilobject, luaO_rawequalObj(), and ttisnil.
Referenced by luaH_get().
Definition at line 462 of file ltable.c.
References Table::array, cast, gkey, gval, hashnum(), luaO_nilobject, nvalue, and ttisnumber.
Referenced by lua_rawgeti(), luaH_get(), and luaH_setnum().
Definition at line 481 of file ltable.c.
References gkey, gval, hashstr, luaO_nilobject, tsvalue, and ttisstring.
Referenced by Arith(), luaH_get(), luaT_gettm(), and luaT_gettmbyobj().
Definition at line 139 of file ltable.c.
References arrayindex(), cast, gnode, gval, luaG_runerror(), luaH_get(), luaO_nilobject, Table::sizearray, and ttisnil.
Referenced by luaH_next().
Definition at line 101 of file ltable.c.
References bvalue, gcvalue, hashboolean, hashnum(), hashpointer, hashstr, nvalue, pvalue, tsvalue, and ttype.
Referenced by luaH_getany(), and newkey().
Definition at line 345 of file ltable.c.
References Table::array, cast, defaultmeta, Table::flags, hvalue, Table::lsizenode, luaC_link(), luaM_new, Table::metatable, Table::node, setarrayvector(), setnodevector(), Table::sizearray, and valtogco.
Referenced by adjust_varargs(), f_luaopen(), lua_newtable(), and open_func().
Definition at line 159 of file ltable.c.
References Table::array, cast, luaH_index(), setnvalue, setobj2s, Table::sizearray, and ttisnil.
Referenced by lua_next().
Definition at line 510 of file ltable.c.
References cast, Table::flags, luaG_runerror(), luaH_get(), luaO_nilobject, newkey(), nvalue, ttisnil, and ttisnumber.
Referenced by addk(), adjust_varargs(), lua_rawset(), luaV_settable(), and resize().
Definition at line 526 of file ltable.c.
References cast, luaH_getnum(), luaO_nilobject, newkey(), and setnvalue.
Referenced by adjust_varargs(), lua_rawseti(), and resize().
Definition at line 397 of file ltable.c.
References cast, Table::firstfree, gkey, gval, lua_assert, luaH_get(), luaH_mainposition(), Node::next, Table::node, rehash(), setbvalue, setnilvalue, setobj2t, ttisboolean, and ttisnil.
Referenced by luaH_set(), and luaH_setnum().
static void numuse | ( | const Table * | t, | |
int * | narray, | |||
int * | nhash | |||
) | [static] |
Definition at line 209 of file ltable.c.
References Table::array, MAXBITS, Table::sizearray, ttisnil, and twoto.
Referenced by rehash().
Definition at line 286 of file ltable.c.
References Table::array, G, gkey, gval, Table::lsizenode, lua_assert, luaH_set(), luaH_setnum(), luaM_freearray, luaM_reallocvector, Table::node, setarrayvector(), setnilvalue, setnodevector(), setobjt2t, Table::sizearray, ttisnil, and twoto.
Referenced by rehash().
Definition at line 249 of file ltable.c.
References Table::array, luaM_reallocvector, setnilvalue, and Table::sizearray.
Referenced by luaH_new(), and resize().
Definition at line 260 of file ltable.c.
References cast, Table::firstfree, G, gkey, gnode, gval, Table::lsizenode, lua_assert, luaG_runerror(), luaM_newvector, MAXBITS, Node::next, Table::node, setnilvalue, ttisnil, and twoto.
Referenced by luaH_new(), and resize().