| 1 | /** |
| 2 | * This file has no copyright assigned and is placed in the Public Domain. |
| 3 | * This file is part of the mingw-w64 runtime package. |
| 4 | * No warranty is given; refer to the file DISCLAIMER.PD within this package. |
| 5 | */ |
| 6 | #ifndef _INC_SEARCH |
| 7 | #define _INC_SEARCH |
| 8 | |
| 9 | #include <crtdefs.h> |
| 10 | #include <stddef.h> |
| 11 | |
| 12 | #ifdef __cplusplus |
| 13 | extern "C" { |
| 14 | #endif |
| 15 | |
| 16 | #ifndef _CRT_ALGO_DEFINED |
| 17 | #define _CRT_ALGO_DEFINED |
| 18 | void *__cdecl bsearch(const void *_Key,const void *_Base,size_t _NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(const void *,const void *)); |
| 19 | void __cdecl qsort(void *_Base,size_t _NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(const void *,const void *)); |
| 20 | #endif |
| 21 | _CRTIMP void *__cdecl _lfind(const void *_Key,const void *_Base,unsigned int *_NumOfElements,unsigned int _SizeOfElements,int (__cdecl *_PtFuncCompare)(const void *,const void *)); |
| 22 | _CRTIMP void *__cdecl _lsearch(const void *_Key,void *_Base,unsigned int *_NumOfElements,unsigned int _SizeOfElements,int (__cdecl *_PtFuncCompare)(const void *,const void *)); |
| 23 | |
| 24 | #ifndef	NO_OLDNAMES |
| 25 | void *__cdecl lfind(const void *_Key,const void *_Base,unsigned int *_NumOfElements,unsigned int _SizeOfElements,int (__cdecl *_PtFuncCompare)(const void *,const void *)) __MINGW_ATTRIB_DEPRECATED_MSVC2005; |
| 26 | void *__cdecl lsearch(const void *_Key,void *_Base,unsigned int *_NumOfElements,unsigned int _SizeOfElements,int (__cdecl *_PtFuncCompare)(const void *,const void *)) __MINGW_ATTRIB_DEPRECATED_MSVC2005; |
| 27 | #endif |
| 28 | |
| 29 | /* |
| 30 | Documentation for these POSIX definitions and prototypes can be found in |
| 31 | The Open Group Base Specifications Issue 6 |
| 32 | IEEE Std 1003.1, 2004 Edition. |
| 33 | eg: http://www.opengroup.org/onlinepubs/009695399/functions/twalk.html |
| 34 | */ |
| 35 | |
| 36 | typedef struct entry { |
| 37 | 	char *key; |
| 38 | 	void *data; |
| 39 | } ENTRY; |
| 40 | |
| 41 | typedef enum { |
| 42 | 	FIND, |
| 43 | 	ENTER |
| 44 | } ACTION; |
| 45 | |
| 46 | typedef enum { |
| 47 | 	preorder, |
| 48 | 	postorder, |
| 49 | 	endorder, |
| 50 | 	leaf |
| 51 | } VISIT; |
| 52 | |
| 53 | #ifdef _SEARCH_PRIVATE |
| 54 | typedef struct node { |
| 55 | 	char *key; |
| 56 | 	struct node *llink, *rlink; |
| 57 | } node_t; |
| 58 | #endif |
| 59 | |
| 60 | void * __cdecl tdelete (const void * __restrict__, void ** __restrict__, int (*)(const void *, const void *)) __MINGW_ATTRIB_NONNULL (2) __MINGW_ATTRIB_NONNULL (3); |
| 61 | void * __cdecl tfind (const void *, void * const *, int (*)(const void *, const void *)) __MINGW_ATTRIB_NONNULL (2) __MINGW_ATTRIB_NONNULL (3); |
| 62 | void * __cdecl tsearch (const void *, void **, int (*)(const void *, const void *)) __MINGW_ATTRIB_NONNULL (2) __MINGW_ATTRIB_NONNULL (3); |
| 63 | void __cdecl twalk (const void *, void (*)(const void *, VISIT, int)); |
| 64 | |
| 65 | #ifdef _GNU_SOURCE |
| 66 | void __cdecl tdestroy(void *, void (*)(void *)) __MINGW_ATTRIB_NONNULL (2); |
| 67 | #endif |
| 68 | |
| 69 | #ifdef __cplusplus |
| 70 | } |
| 71 | #endif |
| 72 | |
| 73 | #include <sec_api/search_s.h> |
| 74 | |
| 75 | #endif |