fix bug in astnode_clone() that caused crash when expanding a macro containing forwar...
[xorcyst.git] / hashtab.h
blob02cbfb637acaf606cecf27175a49f22f1aa53441
1 /*
2 * $Id: hashtab.h,v 1.2 2007/07/22 13:35:20 khansen Exp $
3 * $Log: hashtab.h,v $
4 * Revision 1.2 2007/07/22 13:35:20 khansen
5 * convert tabs to whitespaces
7 * Revision 1.1 2004/06/30 07:56:26 kenth
8 * Initial revision
12 /**
13 * (C) 2004 Kent Hansen
15 * The XORcyst is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
20 * The XORcyst is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with The XORcyst; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 #ifndef HASHTAB_H
31 #define HASHTAB_H
33 /** Linked list of entries in hash table slot */
34 struct tag_hashtab_slot
36 void *key;
37 void *data;
38 struct tag_hashtab_slot *next;
41 typedef struct tag_hashtab_slot hashtab_slot;
43 /** Signature for procedure that hashes a key to a slot */
44 typedef int (*keyhashproc)(void *);
46 /** Signature for procedure that compares two keys */
47 typedef int (*keycompareproc)(void *, void *);
49 /** Hash table */
50 struct tag_hashtab
52 hashtab_slot **slots;
53 int size;
54 keyhashproc keyhsh;
55 keycompareproc keycmp;
58 typedef struct tag_hashtab hashtab;
60 /** Function prototypes */
61 hashtab *hashtab_create(int, keyhashproc, keycompareproc);
62 void hashtab_put(hashtab *, void *, void *);
63 void *hashtab_get(hashtab *, void *);
64 void *hashtab_remove(hashtab *, void *);
65 void hashtab_finalize(hashtab *);
67 extern int HASHTAB_STRKEYHSH(void *);
68 extern int HASHTAB_STRKEYCMP(void *, void *);
70 #endif /* !HASHTAB_H */