| 1 | /* search.h,v 1.3 2004/09/14 22:27:35 bird Exp */ | 
|---|
| 2 | /** @file | 
|---|
| 3 | * FreeBSD 5.1 | 
|---|
| 4 | * @changed bird: _SIZE_T | 
|---|
| 5 | */ | 
|---|
| 6 | /*- | 
|---|
| 7 | * Written by J.T. Conklin <jtc@netbsd.org> | 
|---|
| 8 | * Public domain. | 
|---|
| 9 | * | 
|---|
| 10 | *      $NetBSD: search.h,v 1.12 1999/02/22 10:34:28 christos Exp $ | 
|---|
| 11 | * $FreeBSD: src/include/search.h,v 1.10 2002/10/16 14:29:23 robert Exp $ | 
|---|
| 12 | */ | 
|---|
| 13 |  | 
|---|
| 14 | #ifndef _SEARCH_H_ | 
|---|
| 15 | #define _SEARCH_H_ | 
|---|
| 16 |  | 
|---|
| 17 | #include <sys/cdefs.h> | 
|---|
| 18 | #include <sys/_types.h> | 
|---|
| 19 |  | 
|---|
| 20 | #if !defined(_SIZE_T_DECLARED) && !defined(_SIZE_T) /* bird: emx */ | 
|---|
| 21 | typedef __size_t        size_t; | 
|---|
| 22 | #define _SIZE_T_DECLARED | 
|---|
| 23 | #define _SIZE_T                         /* bird: emx */ | 
|---|
| 24 | #endif | 
|---|
| 25 |  | 
|---|
| 26 | typedef struct entry { | 
|---|
| 27 | char    *key; | 
|---|
| 28 | void    *data; | 
|---|
| 29 | } ENTRY; | 
|---|
| 30 |  | 
|---|
| 31 | typedef enum { | 
|---|
| 32 | FIND, ENTER | 
|---|
| 33 | } ACTION; | 
|---|
| 34 |  | 
|---|
| 35 | typedef enum { | 
|---|
| 36 | preorder, | 
|---|
| 37 | postorder, | 
|---|
| 38 | endorder, | 
|---|
| 39 | leaf | 
|---|
| 40 | } VISIT; | 
|---|
| 41 |  | 
|---|
| 42 | #ifdef _SEARCH_PRIVATE | 
|---|
| 43 | typedef struct node { | 
|---|
| 44 | char         *key; | 
|---|
| 45 | struct node  *llink, *rlink; | 
|---|
| 46 | } node_t; | 
|---|
| 47 |  | 
|---|
| 48 | struct que_elem { | 
|---|
| 49 | struct que_elem *next; | 
|---|
| 50 | struct que_elem *prev; | 
|---|
| 51 | }; | 
|---|
| 52 | #endif | 
|---|
| 53 |  | 
|---|
| 54 | __BEGIN_DECLS | 
|---|
| 55 | int      hcreate(size_t); | 
|---|
| 56 | void     hdestroy(void); | 
|---|
| 57 | ENTRY   *hsearch(ENTRY, ACTION); | 
|---|
| 58 | void     insque(void *, void *); | 
|---|
| 59 | void    *lfind(const void *, const void *, size_t *, size_t, | 
|---|
| 60 | int (*)(const void *, const void *)); | 
|---|
| 61 | void    *lsearch(const void *, void *, size_t *, size_t, | 
|---|
| 62 | int (*)(const void *, const void *)); | 
|---|
| 63 | void     remque(void *); | 
|---|
| 64 | void    *tdelete(const void * __restrict, void ** __restrict, | 
|---|
| 65 | int (*)(const void *, const void *)); | 
|---|
| 66 | void    *tfind(const void *, void * const *, | 
|---|
| 67 | int (*)(const void *, const void *)); | 
|---|
| 68 | void    *tsearch(const void *, void **, int (*)(const void *, const void *)); | 
|---|
| 69 | void     twalk(const void *, void (*)(const void *, VISIT, int)); | 
|---|
| 70 | __END_DECLS | 
|---|
| 71 |  | 
|---|
| 72 | #endif /* !_SEARCH_H_ */ | 
|---|