deb4998ba50060c48cce222fd18a8eed053918d7vboxsync/* x-hash.h -- basic hash table class
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync $Id$
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync Permission is hereby granted, free of charge, to any person
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync obtaining a copy of this software and associated documentation files
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync (the "Software"), to deal in the Software without restriction,
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync including without limitation the rights to use, copy, modify, merge,
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync publish, distribute, sublicense, and/or sell copies of the Software,
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync and to permit persons to whom the Software is furnished to do so,
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync subject to the following conditions:
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync The above copyright notice and this permission notice shall be
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync included in all copies or substantial portions of the Software.
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync DEALINGS IN THE SOFTWARE.
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync Except as contained in this notice, the name(s) of the above
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync copyright holders shall not be used in advertising or otherwise to
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync promote the sale, use or other dealings in this Software without
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync prior written authorization. */
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync#ifndef X_HASH_H
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync#define X_HASH_H 1
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync
deb4998ba50060c48cce222fd18a8eed053918d7vboxsynctypedef struct x_hash_table_struct x_hash_table;
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync
deb4998ba50060c48cce222fd18a8eed053918d7vboxsynctypedef int (x_compare_fun) (const void *a, const void *b);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsynctypedef unsigned int (x_hash_fun) (const void *k);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsynctypedef void (x_destroy_fun) (void *x);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsynctypedef void (x_hash_foreach_fun) (void *k, void *v, void *data);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync/* for X_PFX and X_EXTERN */
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync#include "x-list.h"
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncX_EXTERN x_hash_table *X_PFX (hash_table_new) (x_hash_fun *hash,
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync x_compare_fun *compare,
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync x_destroy_fun *key_destroy,
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync x_destroy_fun *value_destroy);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncX_EXTERN void X_PFX (hash_table_free) (x_hash_table *h);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncX_EXTERN unsigned int X_PFX (hash_table_size) (x_hash_table *h);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncX_EXTERN void X_PFX (hash_table_insert) (x_hash_table *h, void *k, void *v);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncX_EXTERN void X_PFX (hash_table_replace) (x_hash_table *h, void *k, void *v);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncX_EXTERN void X_PFX (hash_table_remove) (x_hash_table *h, void *k);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncX_EXTERN void *X_PFX (hash_table_lookup) (x_hash_table *h,
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync void *k, void **k_ret);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncX_EXTERN void X_PFX (hash_table_foreach) (x_hash_table *h,
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync x_hash_foreach_fun *fun,
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync void *data);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync#endif /* X_HASH_H */