00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef _SEARCH_H_
00010 #define _SEARCH_H_
00011
00012 #include <sys/cdefs.h>
00013 #include <sys/_types.h>
00014
00015 #ifndef _SIZE_T_DECLARED
00016 typedef __size_t size_t;
00017 #define _SIZE_T_DECLARED
00018 #endif
00019
00020 typedef struct entry {
00021 char *key;
00022 void *data;
00023 } ENTRY;
00024
00025 typedef enum {
00026 FIND, ENTER
00027 } ACTION;
00028
00029 typedef enum {
00030 preorder,
00031 postorder,
00032 endorder,
00033 leaf
00034 } VISIT;
00035
00036 #ifdef _SEARCH_PRIVATE
00037 typedef struct node {
00038 char *key;
00039 struct node *llink, *rlink;
00040 } node_t;
00041
00042 struct que_elem {
00043 struct que_elem *next;
00044 struct que_elem *prev;
00045 };
00046 #endif
00047
00048 __BEGIN_DECLS
00049 int hcreate(size_t);
00050 void hdestroy(void);
00051 ENTRY *hsearch(ENTRY, ACTION);
00052 void insque(void *, void *);
00053 void *lfind(const void *, const void *, size_t *, size_t,
00054 int (*)(const void *, const void *));
00055 void *lsearch(const void *, void *, size_t *, size_t,
00056 int (*)(const void *, const void *));
00057 void remque(void *);
00058 void *tdelete(const void * __restrict, void ** __restrict,
00059 int (*)(const void *, const void *));
00060 void *tfind(const void *, void * const *,
00061 int (*)(const void *, const void *));
00062 void *tsearch(const void *, void **, int (*)(const void *, const void *));
00063 void twalk(const void *, void (*)(const void *, VISIT, int));
00064 __END_DECLS
00065
00066 #endif