summaryrefslogtreecommitdiff
path: root/ltable.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-10-14 17:13:31 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-10-14 17:13:31 -0200
commit4e9f2d13d5b6fa71ca480394e0b7e75463d4aeec (patch)
treed11eee681ce7b01a273e489f47e070494b51de1a /ltable.h
parentb6ebbb2fee13aa223fdd12921cd0411e02db9dd0 (diff)
downloadlua-4e9f2d13d5b6fa71ca480394e0b7e75463d4aeec.tar.gz
lua-4e9f2d13d5b6fa71ca480394e0b7e75463d4aeec.tar.bz2
lua-4e9f2d13d5b6fa71ca480394e0b7e75463d4aeec.zip
new implementation of hash tables.
Diffstat (limited to 'ltable.h')
-rw-r--r--ltable.h15
1 files changed, 7 insertions, 8 deletions
diff --git a/ltable.h b/ltable.h
index 034acbab..219574b9 100644
--- a/ltable.h
+++ b/ltable.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltable.h,v 1.12 1999/08/16 20:52:00 roberto Exp roberto $ 2** $Id: ltable.h,v 1.13 1999/10/04 17:51:04 roberto Exp roberto $
3** Lua tables (hash) 3** Lua tables (hash)
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -11,20 +11,19 @@
11 11
12 12
13#define node(t,i) (&(t)->node[i]) 13#define node(t,i) (&(t)->node[i])
14#define ref(n) (&(n)->ref) 14#define key(n) (&(n)->key)
15#define val(n) (&(n)->val) 15#define val(n) (&(n)->val)
16#define nhash(t) ((t)->nhash)
17 16
18#define luaH_get(t,ref) (val(luaH_present((t), (ref))))
19#define luaH_move(t,from,to) (luaH_setint(t, to, luaH_getint(t, from))) 17#define luaH_move(t,from,to) (luaH_setint(t, to, luaH_getint(t, from)))
20 18
21Hash *luaH_new (int nhash); 19Hash *luaH_new (int nhash);
22void luaH_free (Hash *t); 20void luaH_free (Hash *t);
23Node *luaH_present (const Hash *t, const TObject *key); 21const TObject *luaH_get (const Hash *t, const TObject *key);
24void luaH_set (Hash *t, const TObject *ref, const TObject *val); 22void luaH_set (Hash *t, const TObject *key, const TObject *val);
25int luaH_pos (const Hash *t, const TObject *r); 23int luaH_pos (const Hash *t, const TObject *r);
26void luaH_setint (Hash *t, int ref, const TObject *val); 24void luaH_setint (Hash *t, int key, const TObject *val);
27TObject *luaH_getint (const Hash *t, int ref); 25const TObject *luaH_getint (const Hash *t, int key);
26unsigned long luaH_hash (const TObject *key); /* exported only for debugging */
28 27
29 28
30#endif 29#endif