From 15d81e593f0438075c090dc174b9dcaf414c3697 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Sun, 8 May 2005 15:54:44 +0000 Subject: [PATCH] *** empty log message *** --- ase/stx/hash.c | 46 ++++++++++++++++++++++++++++++++++++++++++++ ase/stx/hash.h | 16 +++++++++++++++ ase/test/stx/stx.wpj | 6 +++--- 3 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 ase/stx/hash.c create mode 100644 ase/stx/hash.h diff --git a/ase/stx/hash.c b/ase/stx/hash.c new file mode 100644 index 00000000..72a889c0 --- /dev/null +++ b/ase/stx/hash.c @@ -0,0 +1,46 @@ +/* + * $Id: hash.c,v 1.1 2005-05-08 15:54:44 bacon Exp $ + */ + +#include + +int xp_stx_new_link ( + xp_stx_t* stx, xp_stx_word_t key, xp_stx_word_t value) +{ + xp_stx_word_t x; + + x = xp_stx_alloc_object (3); + XP_STX_CLASS(stx,x) = hash_lookup(stx, XP_STX_TEXT("Link")); + XP_STX_AT(stx,x,0) = key; + XP_STX_AT(stx,x,1) = value; + /* XP_STX_AT(stx,x,2) = stx->nil; */ + + return x; +} + +void xp_stx_hash_insert ( + xp_stx_t* stx, xp_stx_word_t key, xp_stx_word_t value) +{ + xp_stx_word_t table; + + table = XP_STX_AT(stx,stx->globals,0); + hash = __hash(key); + + link = XP_STX_AT(stx,table,hash); + + for (;;) { + if (XP_STX_AT(stx,link,0) == key) { + XP_STX_AT(stx,link,1) = value; + break; + } + + next = XP_STX_AT(stx,link,2); + if (next == stx->nil) { + new = xp_stx_new_link (stx, key, value); + XP_STX_AT(stx,link,2) = new; + break; + } + + link = next; + } +} diff --git a/ase/stx/hash.h b/ase/stx/hash.h new file mode 100644 index 00000000..66fe6e6e --- /dev/null +++ b/ase/stx/hash.h @@ -0,0 +1,16 @@ +/* + * $Id: hash.h,v 1.1 2005-05-08 15:54:44 bacon Exp $ + */ + +#ifndef _XP_STX_HASH_H_ +#define _XP_STX_HASH_H_ + +#ifdef __cplusplus +extern "C" +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/ase/test/stx/stx.wpj b/ase/test/stx/stx.wpj index 4481ab97..a65a1d24 100644 --- a/ase/test/stx/stx.wpj +++ b/ase/test/stx/stx.wpj @@ -6,7 +6,7 @@ VpeMain WRect 1500 440 -7680 +3770 9200 2 MProject @@ -30,7 +30,7 @@ VComponent WRect 0 0 -5700 +3260 4280 0 0 @@ -39,5 +39,5 @@ WFileName 7 stx.tgt 0 -3 +4 7