klisp

an open source interpreter for the Kernel Programming Language.
git clone http://git.hanabi.in/repos/klisp.git
Log | Files | Refs | README

ktable.h (1311B)


      1 /*
      2 ** ktable.h
      3 ** Kernel Hashtables
      4 ** See Copyright Notice in klisp.h
      5 */
      6 
      7 /*
      8 ** SOURCE NOTE: This is almost textually from lua.
      9 ** Parts that don't apply, or don't apply yet to klisp are in comments.
     10 */
     11 
     12 #ifndef ktable_h
     13 #define ktable_h
     14 
     15 #include "kobject.h"
     16 #include "kstate.h"
     17 
     18 #define gnode(t,i)	(&(t)->node[i])
     19 #define gkey(n)		(&(n)->i_key.nk)
     20 #define gval(n)		((n)->i_val)
     21 #define gnext(n)	((n)->i_key.nk.next)
     22 
     23 #define key2tval(n)	((n)->i_key.tvk)
     24 
     25 const TValue *klispH_getfixint (Table *t, int32_t key);
     26 TValue *klispH_setfixint (klisp_State *K, Table *t, int32_t key);
     27 const TValue *klispH_getstr (Table *t, String *key);
     28 TValue *klispH_setstr (klisp_State *K, Table *t, String *key);
     29 const TValue *klispH_getsym (Table *t, Symbol *key);
     30 TValue *klispH_setsym (klisp_State *K, Table *t, Symbol *key);
     31 const TValue *klispH_get (Table *t, TValue key);
     32 TValue *klispH_set (klisp_State *K, Table *t, TValue key);
     33 TValue klispH_new (klisp_State *K, int32_t narray, int32_t nhash, 
     34                    int32_t wflags);
     35 void klispH_resizearray (klisp_State *K, Table *t, int32_t nasize);
     36 void klispH_free (klisp_State *K, Table *t);
     37 int32_t klispH_next (klisp_State *K, Table *t, TValue *key, TValue *data);
     38 int32_t klispH_getn (Table *t);
     39 
     40 int32_t klispH_numuse(Table *t);
     41 bool ktablep(TValue obj);
     42 
     43 #endif