| Ben Cheng | 21eab51 | 2012-03-13 23:04:57 -0700 | [diff] [blame] | 1 | /*- | 
 | 2 |  * Written by J.T. Conklin <jtc@netbsd.org> | 
 | 3 |  * Public domain. | 
 | 4 |  * | 
 | 5 |  *	$NetBSD: search.h,v 1.12 1999/02/22 10:34:28 christos Exp $ | 
 | 6 |  * $FreeBSD: release/9.0.0/include/search.h 105250 2002-10-16 14:29:23Z robert $ | 
 | 7 |  */ | 
 | 8 |  | 
 | 9 | #ifndef _SEARCH_H_ | 
 | 10 | #define _SEARCH_H_ | 
 | 11 |  | 
 | 12 | #include <sys/cdefs.h> | 
| Elliott Hughes | 7f3a272 | 2014-04-01 12:40:00 -0700 | [diff] [blame] | 13 | #include <sys/types.h> | 
| Ben Cheng | 21eab51 | 2012-03-13 23:04:57 -0700 | [diff] [blame] | 14 |  | 
| Elliott Hughes | 7f3a272 | 2014-04-01 12:40:00 -0700 | [diff] [blame] | 15 | typedef enum { | 
 | 16 |   preorder, | 
 | 17 |   postorder, | 
 | 18 |   endorder, | 
 | 19 |   leaf | 
| Ben Cheng | 21eab51 | 2012-03-13 23:04:57 -0700 | [diff] [blame] | 20 | } VISIT; | 
 | 21 |  | 
 | 22 | #ifdef _SEARCH_PRIVATE | 
| Elliott Hughes | 7f3a272 | 2014-04-01 12:40:00 -0700 | [diff] [blame] | 23 | typedef struct node { | 
 | 24 |   char* key; | 
 | 25 |   struct node* llink; | 
 | 26 |   struct node* rlink; | 
| Ben Cheng | 21eab51 | 2012-03-13 23:04:57 -0700 | [diff] [blame] | 27 | } node_t; | 
 | 28 | #endif | 
 | 29 |  | 
 | 30 | __BEGIN_DECLS | 
| Elliott Hughes | 7f3a272 | 2014-04-01 12:40:00 -0700 | [diff] [blame] | 31 |  | 
| Elliott Hughes | 3e424d0 | 2014-07-23 16:02:26 -0700 | [diff] [blame] | 32 | void insque(void*, void*); | 
 | 33 | void remque(void*); | 
 | 34 |  | 
| Elliott Hughes | 7f3a272 | 2014-04-01 12:40:00 -0700 | [diff] [blame] | 35 | void* lfind(const void*, const void*, size_t*, size_t, int (*)(const void*, const void*)); | 
 | 36 | void* lsearch(const void*, void*, size_t*, size_t, int (*)(const void*, const void*)); | 
 | 37 |  | 
 | 38 | void* tdelete(const void* __restrict, void** __restrict, int (*)(const void*, const void*)); | 
 | 39 | void tdestroy(void*, void (*)(void*)); | 
 | 40 | void* tfind(const void*, void* const*, int (*)(const void*, const void*)); | 
 | 41 | void* tsearch(const void*, void**, int (*)(const void*, const void*)); | 
 | 42 | void twalk(const void*, void (*)(const void*, VISIT, int)); | 
 | 43 |  | 
| Ben Cheng | 21eab51 | 2012-03-13 23:04:57 -0700 | [diff] [blame] | 44 | __END_DECLS | 
 | 45 |  | 
 | 46 | #endif /* !_SEARCH_H_ */ |