summaryrefslogtreecommitdiff
path: root/include/search.h
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-06-25 18:18:57 -0400
committerRich Felker <dalias@aerifal.cx>2011-06-25 18:18:57 -0400
commitfebbd12d00883a716a9edca25011f8aa306b859b (patch)
tree45d291973571bebe85963add9ba94d4c8556d5e3 /include/search.h
parent49388f3b7b72a1695bef05f64439b602b2e77a53 (diff)
downloadmusl-febbd12d00883a716a9edca25011f8aa306b859b.tar.gz
XSI search.h API implementation by Szabolcs Nagy
Diffstat (limited to 'include/search.h')
-rw-r--r--include/search.h36
1 files changed, 35 insertions, 1 deletions
diff --git a/include/search.h b/include/search.h
index 9254ed0c..f1246ade 100644
--- a/include/search.h
+++ b/include/search.h
@@ -1,6 +1,40 @@
#ifndef _SEARCH_H
#define _SEARCH_H
-// FIXME!!!
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_size_t
+#include <bits/alltypes.h>
+
+typedef enum { FIND, ENTER } ACTION;
+typedef enum { preorder, postorder, endorder, leaf } VISIT;
+
+typedef struct {
+ char *key;
+ void *data;
+} ENTRY;
+
+int hcreate(size_t);
+void hdestroy(void);
+ENTRY *hsearch(ENTRY, ACTION);
+
+void insque(void *, void *);
+void remque(void *);
+
+void *lsearch(const void *, void *, size_t *, size_t,
+ int (*)(const void *, const void *));
+void *lfind(const void *, const void *, size_t *, size_t,
+ int (*)(const void *, const void *));
+
+void *tdelete(const void *, void **, 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));
+
+#ifdef __cplusplus
+}
+#endif
#endif