2014-07-17 21:16:09 -07:00
|
|
|
/* $OpenBSD: search.h,v 1.10 2014/07/18 04:16:09 matthew Exp $ */
|
1995-10-18 01:37:01 -07:00
|
|
|
/* $NetBSD: search.h,v 1.9 1995/08/08 21:14:45 jtc Exp $ */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Written by J.T. Conklin <jtc@netbsd.org>
|
|
|
|
* Public domain.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _SEARCH_H_
|
|
|
|
#define _SEARCH_H_
|
2004-07-08 14:15:11 -07:00
|
|
|
|
1995-10-18 01:37:01 -07:00
|
|
|
#include <sys/cdefs.h>
|
2006-01-06 10:53:04 -08:00
|
|
|
#include <machine/_types.h>
|
1995-10-18 01:37:01 -07:00
|
|
|
|
2006-01-06 10:53:04 -08:00
|
|
|
#ifndef _SIZE_T_DEFINED_
|
|
|
|
#define _SIZE_T_DEFINED_
|
|
|
|
typedef __size_t size_t;
|
1995-10-18 01:37:01 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef struct entry {
|
|
|
|
char *key;
|
2004-07-08 14:15:11 -07:00
|
|
|
void *data;
|
1995-10-18 01:37:01 -07:00
|
|
|
} ENTRY;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
FIND, ENTER
|
|
|
|
} ACTION;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
preorder,
|
|
|
|
postorder,
|
|
|
|
endorder,
|
|
|
|
leaf
|
|
|
|
} VISIT;
|
|
|
|
|
|
|
|
__BEGIN_DECLS
|
2004-07-08 14:15:11 -07:00
|
|
|
int hcreate(size_t);
|
|
|
|
void hdestroy(void);
|
|
|
|
ENTRY *hsearch(ENTRY, ACTION);
|
|
|
|
|
|
|
|
void *lfind(const void *, const void *, size_t *, size_t,
|
|
|
|
int (*)(const void *, const void *));
|
2014-07-17 21:16:09 -07:00
|
|
|
void *lsearch(const void *, void *, size_t *, size_t,
|
2004-07-08 14:15:11 -07:00
|
|
|
int (*)(const void *, const void *));
|
|
|
|
void insque(void *, void *);
|
|
|
|
void remque(void *);
|
|
|
|
|
2012-07-10 04:44:55 -07:00
|
|
|
void *tdelete(const void * __restrict, void ** __restrict,
|
2004-07-08 14:15:11 -07:00
|
|
|
int (*)(const void *, const void *));
|
|
|
|
void *tfind(const void *, void * const *,
|
|
|
|
int (*)(const void *, const void *));
|
|
|
|
void *tsearch(const void *, void **,
|
|
|
|
int (*)(const void *, const void *));
|
|
|
|
void twalk(const void *, void (*)(const void *, VISIT, int));
|
1995-10-18 01:37:01 -07:00
|
|
|
__END_DECLS
|
|
|
|
|
2004-07-08 14:15:11 -07:00
|
|
|
#endif /* !_SEARCH_H_ */
|