From 6213408838d9c63d7aac9b93e0724d7bf1e285f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Sun, 24 Feb 2008 13:41:01 +0000 Subject: [PATCH] added search.h git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24091 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/posix/search.h | 45 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 headers/posix/search.h diff --git a/headers/posix/search.h b/headers/posix/search.h new file mode 100644 index 0000000000..9680a48365 --- /dev/null +++ b/headers/posix/search.h @@ -0,0 +1,45 @@ +/* + * Copyright 2008, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _SEARCH_H_ +#define _SEARCH_H_ + +typedef enum { + FIND, + ENTER +} ACTION; + +typedef struct entry { + char *keyr; + void *data; +} ENTRY; + +typedef enum { + preorder, + postorder, + endorder, + leaf +} VISIT; + + +extern int hcreate(size_t); +extern void hdestroy(void); +extern ENTRY *hsearch(ENTRY, ACTION); +extern void insque(void *, void *); +extern void *lfind(const void *, const void *, size_t *, + size_t, int (*)(const void *, const void *)); +extern void *lsearch(const void *, void *, size_t *, + size_t, int (*)(const void *, const void *)); +extern void remque(void *); +extern void *tdelete(const void *restrict, void **restrict, + int(*)(const void *, const void *)); +extern void *tfind(const void *, void *const *, + int(*)(const void *, const void *)); +extern void *tsearch(const void *, void **, + int(*)(const void *, const void *)); +extern void twalk(const void *, + void (*)(const void *, VISIT, int )); + +#endif /* _SEARCH_H_ */ +