/* * Pure Data Packet header file. Hash class * Copyright (c) by Tom Schouten * * This program 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 of the License, or * (at your option) any later version. * * This program 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 program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /** @file hash.h @brief Hash tables Not used. */ /* A basic pointer (int) to atom hash, tailored to symbol pointers. Adding an item does NOT check if the item is already present. This was supposed to be used in the dictionary/forth rewrite but is not used at the moment. */ #ifndef __pf_hash__ #define __pf_hash__ #include //#include struct pf_hash { unsigned int elements; unsigned int logsize; pf_list_t **table; }; pf_hash_t *pf_hash_new(unsigned int logsize); void pf_hash_free(pf_hash_t *h); void pf_hash_strip_packets(pf_hash_t *h); void pf_hash_add(pf_hash_t *h, void *key, pf_atom_t *); pf_atom_t *pf_hash_lookup(pf_hash_t *h, void *key); typedef void* (*pf_method_hash_t)(void *key, pf_atom_t *val, void *closure); void* pf_hash_apply(pf_hash_t *h, pf_method_hash_t m, void *closure); #endif