1 /* 2 * Copyright 2008, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _SEARCH_H_ 6 #define _SEARCH_H_ 7 8 typedef enum { 9 FIND, 10 ENTER 11 } ACTION; 12 13 typedef struct entry { 14 char *keyr; 15 void *data; 16 } ENTRY; 17 18 typedef enum { 19 preorder, 20 postorder, 21 endorder, 22 leaf 23 } VISIT; 24 25 26 extern int hcreate(size_t); 27 extern void hdestroy(void); 28 extern ENTRY *hsearch(ENTRY, ACTION); 29 extern void insque(void *, void *); 30 extern void *lfind(const void *, const void *, size_t *, 31 size_t, int (*)(const void *, const void *)); 32 extern void *lsearch(const void *, void *, size_t *, 33 size_t, int (*)(const void *, const void *)); 34 extern void remque(void *); 35 extern void *tdelete(const void *restrict, void **restrict, 36 int(*)(const void *, const void *)); 37 extern void *tfind(const void *, void *const *, 38 int(*)(const void *, const void *)); 39 extern void *tsearch(const void *, void **, 40 int(*)(const void *, const void *)); 41 extern void twalk(const void *, 42 void (*)(const void *, VISIT, int )); 43 44 #endif /* _SEARCH_H_ */ 45 46