/* libsizzle/hashtab.h - hash function declarations
 
  Copyright (C) 2000 Martin Grabmueller <mgrabmue@cs.tu-berlin.de>
 
  This is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2, or (at your option)
  any later version.
  
  This software is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.
  
  You should have received a copy of the GNU General Public License
  along with this package; see the file COPYING.  If not, write to the
  Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
  MA 02111-1307, USA.  */

#ifndef __SIZZLE_HASHTAB_H__
#define __SIZZLE_HASHTAB_H__

#if HAVE_CONFIG_H
# include <config.h>
#endif 

#if __SIZZLE_IMPORT__
# define SIZZLE_API __declspec (dllimport)
#elif __SIZZLE_EXPORT__ 
# define SIZZLE_API __declspec (dllexport)
#else
# define SIZZLE_API
#endif

#include "node.h"

/* Calculate the hash code for the Scheme object @var{object}.
   zzz_hashq_function() uses the predicate @code{eq?},
   zzz_hashv_object() the predicate @code{eqv?} and
   zzz_hash_function() the predicate @code{equal?} when testing for
   equality.  */
SIZZLE_API zzz_object_t zzz_hashq_function (zzz_scm_t object);
SIZZLE_API zzz_object_t zzz_hashv_function (zzz_scm_t object);
SIZZLE_API zzz_object_t zzz_hash_function (zzz_scm_t object);

/* Fetch the object associated with @var{key} from the hash table
   @var{tab}.  If not found, return the value @var{def}.
   zzz_hashq_ref() uses the predicate @code{eq?}, zzz_hashv_ref() the
   predicate @code{eqv?} and zzz_hash_ref() the predicate
   @code{equal?} when testing for equality.  */
SIZZLE_API zzz_scm_t zzz_hashq_ref (zzz_scm_t tab, zzz_scm_t key,
				    zzz_scm_t def);
SIZZLE_API zzz_scm_t zzz_hashv_ref (zzz_scm_t tab, zzz_scm_t key,
				    zzz_scm_t def);
SIZZLE_API zzz_scm_t zzz_hash_ref (zzz_scm_t tab, zzz_scm_t key, 
				   zzz_scm_t def);

/* Associate the key @var{key} with the value @var{value} in the hash
   table @var{tab}.  zzz_hashq_set() uses the predicate @code{eq?},
   zzz_hashv_set() the predicate @code{eqv?} and zzz_hash_set() the
   predicate @code{equal?} when testing for equality.  */
SIZZLE_API zzz_scm_t zzz_hashq_set (zzz_scm_t tab, zzz_scm_t key,
				    zzz_scm_t value);
SIZZLE_API zzz_scm_t zzz_hashv_set (zzz_scm_t tab, zzz_scm_t key,
				    zzz_scm_t value);
SIZZLE_API zzz_scm_t zzz_hash_set (zzz_scm_t tab, zzz_scm_t key,
				   zzz_scm_t value);

/* Initialize the hash table module.  */
SIZZLE_API result_t zzz_init_hash (void);

#endif /* not __SIZZLE_HASHTAB_H__ */
