121eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng/*- 221eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng * Written by J.T. Conklin <jtc@netbsd.org> 321eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng * Public domain. 421eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng * 521eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng * $NetBSD: search.h,v 1.12 1999/02/22 10:34:28 christos Exp $ 621eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng * $FreeBSD: release/9.0.0/include/search.h 105250 2002-10-16 14:29:23Z robert $ 721eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng */ 821eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng 921eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng#ifndef _SEARCH_H_ 1021eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng#define _SEARCH_H_ 1121eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng 1221eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng#include <sys/cdefs.h> 1321eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng#include <sys/_types.h> 1421eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng 1521eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng#if 0 1621eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng#ifndef _SIZE_T_DECLARED 1721eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Chengtypedef __size_t size_t; 1821eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng#define _SIZE_T_DECLARED 1921eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng#endif 2021eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng#endif 2121eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng 2221eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Chengtypedef enum { 2321eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng preorder, 2421eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng postorder, 2521eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng endorder, 2621eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng leaf 2721eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng} VISIT; 2821eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng 2921eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng#ifdef _SEARCH_PRIVATE 3021eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Chengtypedef struct node { 3121eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng char *key; 3221eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng struct node *llink, *rlink; 3321eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng} node_t; 3421eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng#endif 3521eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng 3621eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng__BEGIN_DECLS 3721eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Chengvoid *tdelete(const void * __restrict, void ** __restrict, 3821eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng int (*)(const void *, const void *)); 3921eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Chengvoid *tfind(const void *, void * const *, 4021eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng int (*)(const void *, const void *)); 4121eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Chengvoid *tsearch(const void *, void **, int (*)(const void *, const void *)); 4221eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Chengvoid twalk(const void *, void (*)(const void *, VISIT, int)); 4321eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Chengvoid tdestroy(void *, void (*)(void *)); 4421eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng__END_DECLS 4521eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng 4621eab513e7eec280a7a8bcb9482a1a8b61e59442Ben Cheng#endif /* !_SEARCH_H_ */ 47