1 /* $NetBSD: search.h,v 1.12 1999/02/22 10:34:28 christos Exp $ */ 2 /* $FreeBSD$ */ 3 4 /* 5 * Written by J.T. Conklin <jtc@netbsd.org> 6 * Public domain. 7 */ 8 9 #ifndef _SEARCH_H_ 10 #define _SEARCH_H_ 11 12 #include <sys/cdefs.h> 13 #include <machine/ansi.h> 14 15 #ifdef _BSD_SIZE_T_ 16 typedef _BSD_SIZE_T_ size_t; 17 #undef _BSD_SIZE_T_ 18 #endif 19 20 typedef struct entry { 21 char *key; 22 void *data; 23 } ENTRY; 24 25 typedef enum { 26 FIND, ENTER 27 } ACTION; 28 29 typedef enum { 30 preorder, 31 postorder, 32 endorder, 33 leaf 34 } VISIT; 35 36 #ifdef _SEARCH_PRIVATE 37 typedef struct node { 38 char *key; 39 struct node *llink, *rlink; 40 } node_t; 41 #endif 42 43 __BEGIN_DECLS 44 int hcreate __P((size_t)); 45 void hdestroy __P((void)); 46 ENTRY *hsearch __P((ENTRY, ACTION)); 47 void *tdelete __P((const void *, void **, 48 int (*)(const void *, const void *))); 49 void *tfind __P((const void *, void **, 50 int (*)(const void *, const void *))); 51 void *tsearch __P((const void *, void **, 52 int (*)(const void *, const void *))); 53 void twalk __P((const void *, void (*)(const void *, VISIT, int))); 54 __END_DECLS 55 56 #endif /* !_SEARCH_H_ */ 57