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