STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
search.h
Go to the documentation of this file.
1 /***
2 *search.h - declarations for searcing/sorting routines
3 *
4 * Copyright (c) Microsoft Corporation. All rights reserved.
5 *
6 *Purpose:
7 * This file contains the declarations for the sorting and
8 * searching routines.
9 * [System V]
10 *
11 * [Public]
12 *
13 ****/
14 
15 #pragma once
16 
17 #ifndef _INC_SEARCH
18 #define _INC_SEARCH
19 
20 #include <crtdefs.h>
21 #include <stddef.h>
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif /* __cplusplus */
26 
27 /* Function prototypes */
28 
29 #ifndef _CRT_ALGO_DEFINED
30 #define _CRT_ALGO_DEFINED
31 #if __STDC_WANT_SECURE_LIB__
32 _Check_return_ _CRTIMP void * __cdecl bsearch_s(_In_ const void * _Key, _In_reads_bytes_(_NumOfElements * _SizeOfElements) const void * _Base,
33  _In_ rsize_t _NumOfElements, _In_ rsize_t _SizeOfElements,
34  _In_ int (__cdecl * _PtFuncCompare)(void *, const void *, const void *), void * _Context);
35 #endif /* __STDC_WANT_SECURE_LIB__ */
36 _Check_return_ _CRTIMP void * __cdecl bsearch(_In_ const void * _Key, _In_reads_bytes_(_NumOfElements * _SizeOfElements) const void * _Base,
37  _In_ size_t _NumOfElements, _In_ size_t _SizeOfElements,
38  _In_ int (__cdecl * _PtFuncCompare)(const void *, const void *));
39 
40 #if __STDC_WANT_SECURE_LIB__
41 _CRTIMP void __cdecl qsort_s(_Inout_updates_bytes_(_NumOfElements* _SizeOfElements) void * _Base,
42  _In_ rsize_t _NumOfElements, _In_ rsize_t _SizeOfElements,
43  _In_ int (__cdecl * _PtFuncCompare)(void *, const void *, const void *), void *_Context);
44 #endif /* __STDC_WANT_SECURE_LIB__ */
45 _CRTIMP void __cdecl qsort(_Inout_updates_bytes_(_NumOfElements * _SizeOfElements) void * _Base,
46  _In_ size_t _NumOfElements, _In_ size_t _SizeOfElements,
47  _In_ int (__cdecl * _PtFuncCompare)(const void *, const void *));
48 #endif /* _CRT_ALGO_DEFINED */
49 
50 _Check_return_ _CRTIMP void * __cdecl _lfind_s(_In_ const void * _Key, _In_reads_bytes_((*_NumOfElements) * _SizeOfElements) const void * _Base,
51  _Inout_ unsigned int * _NumOfElements, _In_ size_t _SizeOfElements,
52  _In_ int (__cdecl * _PtFuncCompare)(void *, const void *, const void *), void * _Context);
53 _Check_return_ _CRTIMP void * __cdecl _lfind(_In_ const void * _Key, _In_reads_bytes_((*_NumOfElements) * _SizeOfElements) const void * _Base,
54  _Inout_ unsigned int * _NumOfElements, _In_ unsigned int _SizeOfElements,
55  _In_ int (__cdecl * _PtFuncCompare)(const void *, const void *));
56 
57 _Check_return_ _CRTIMP void * __cdecl _lsearch_s(_In_ const void * _Key, _Inout_updates_bytes_((*_NumOfElements ) * _SizeOfElements) void * _Base,
58  _Inout_ unsigned int * _NumOfElements, _In_ size_t _SizeOfElements,
59  _In_ int (__cdecl * _PtFuncCompare)(void *, const void *, const void *), void * _Context);
60 _Check_return_ _CRTIMP void * __cdecl _lsearch(_In_ const void * _Key, _Inout_updates_bytes_((*_NumOfElements ) * _SizeOfElements) void * _Base,
61  _Inout_ unsigned int * _NumOfElements, _In_ unsigned int _SizeOfElements,
62  _In_ int (__cdecl * _PtFuncCompare)(const void *, const void *));
63 
64 #if defined (__cplusplus) && defined (_M_CEE)
65 /*
66  * Managed search routines. Note __cplusplus, this is because we only support
67  * managed C++.
68  */
69 extern "C++"
70 {
71 
72 #if __STDC_WANT_SECURE_LIB__
73 _Check_return_ void * __clrcall bsearch_s(_In_ const void * _Key, _In_reads_bytes_(_NumOfElements*_SizeOfElements) const void * _Base,
74  _In_ rsize_t _NumOfElements, _In_ rsize_t _SizeOfElements,
75  _In_ int (__clrcall * _PtFuncCompare)(void *, const void *, const void *), void * _Context);
76 #endif /* __STDC_WANT_SECURE_LIB__ */
77 _Check_return_ void * __clrcall bsearch(_In_ const void * _Key, _In_reads_bytes_(_NumOfElements*_SizeOfElements) const void * _Base,
78  _In_ size_t _NumOfElements, _In_ size_t _SizeOfElements,
79  _In_ int (__clrcall * _PtFuncCompare)(const void *, const void *));
80 
81 _Check_return_ void * __clrcall _lfind_s(_In_ const void * _Key, _In_reads_bytes_(_NumOfElements*_SizeOfElements) const void * _Base,
82  _Inout_ unsigned int * _NumOfElements, _In_ size_t _SizeOfElements,
83  _In_ int (__clrcall * _PtFuncCompare)(void *, const void *, const void *), void * _Context);
84 _Check_return_ void * __clrcall _lfind(_In_ const void * _Key, _In_reads_bytes_((*_NumOfElements)*_SizeOfElements) const void * _Base,
85  _Inout_ unsigned int * _NumOfElements, _In_ unsigned int _SizeOfElements,
86  _In_ int (__clrcall * _PtFuncCompare)(const void *, const void *));
87 
88 _Check_return_ void * __clrcall _lsearch_s(_In_ const void * _Key, _In_reads_bytes_((*_NumOfElements)*_SizeOfElements) void * _Base,
89  _In_ unsigned int * _NumOfElements, _In_ size_t _SizeOfElements,
90  _In_ int (__clrcall * _PtFuncCompare)(void *, const void *, const void *), void * _Context);
91 _Check_return_ void * __clrcall _lsearch(_In_ const void * _Key, _Inout_updates_bytes_((*_NumOfElements)*_SizeOfElements) void * _Base,
92  _Inout_ unsigned int * _NumOfElements, _In_ unsigned int _SizeOfElements,
93  _In_ int (__clrcall * _PtFuncCompare)(const void *, const void *));
94 
95 #if __STDC_WANT_SECURE_LIB__
96 void __clrcall qsort_s(_Inout_updates_bytes_(_NumOfElements*_SizeOfElements) void * _Base,
97  _In_ rsize_t _NumOfElements, _In_ rsize_t _SizeOfElements,
98  _In_ int (__clrcall * _PtFuncCompare)(void *, const void *, const void *), void * _Context);
99 #endif /* __STDC_WANT_SECURE_LIB__ */
100 void __clrcall qsort(_Inout_updates_bytes_(_NumOfElements*_SizeOfElements) void * _Base,
101  _In_ size_t _NumOfElements, _In_ size_t _SizeOfElements,
102  _In_ int (__clrcall * _PtFuncCompare)(const void *, const void *));
103 
104 }
105 #endif /* defined (__cplusplus) && defined (_M_CEE) */
106 
107 
108 #if !__STDC__
109 /* Non-ANSI names for compatibility */
110 
111 _Check_return_ _CRTIMP _CRT_NONSTDC_DEPRECATE(_lfind) void * __cdecl lfind(_In_ const void * _Key, _In_reads_bytes_((*_NumOfElements) * _SizeOfElements) const void * _Base,
112  _Inout_ unsigned int * _NumOfElements, _In_ unsigned int _SizeOfElements,
113  _In_ int (__cdecl * _PtFuncCompare)(const void *, const void *));
114 _Check_return_ _CRTIMP _CRT_NONSTDC_DEPRECATE(_lsearch) void * __cdecl lsearch(_In_ const void * _Key, _Inout_updates_bytes_((*_NumOfElements) * _SizeOfElements) void * _Base,
115  _Inout_ unsigned int * _NumOfElements, _In_ unsigned int _SizeOfElements,
116  _In_ int (__cdecl * _PtFuncCompare)(const void *, const void *));
117 
118 #endif /* !__STDC__ */
119 
120 
121 #ifdef __cplusplus
122 }
123 #endif /* __cplusplus */
124 
125 #endif /* _INC_SEARCH */
#define _CRTIMP
Definition: crtdefs.h:23
typedef void(__cdecl *_se_translator_function)(unsigned int
_Check_return_ _CRTIMP void *__cdecl _lsearch_s(_In_ const void *_Key, _Inout_updates_bytes_((*_NumOfElements)*_SizeOfElements) void *_Base, _Inout_ unsigned int *_NumOfElements, _In_ size_t _SizeOfElements, _In_ int(__cdecl *_PtFuncCompare)(void *, const void *, const void *), void *_Context)
_Check_return_ _CRTIMP _Inout_ unsigned int _In_ unsigned int _SizeOfElements
Definition: search.h:112
_Check_return_ _CRTIMP _Inout_ unsigned int _In_ unsigned int _In_ const void *_Check_return_ _CRTIMP _Inout_updates_bytes_((*_NumOfElements)*_SizeOfElements) void *_Base
_Check_return_ _CRTIMP _Inout_ unsigned int * _NumOfElements
Definition: search.h:112
#define _Check_return_
Definition: sal.h:563
#define _In_
Definition: sal.h:314
_Check_return_ _CRTIMP _CRT_NONSTDC_DEPRECATE(_lfind) void *__cdecl lfind(_In_ const void *_Key
_Check_return_ _CRTIMP void *__cdecl bsearch_s(_In_ const void *_Key, _In_reads_bytes_(_NumOfElements *_SizeOfElements) const void *_Base, _In_ rsize_t _NumOfElements, _In_ rsize_t _SizeOfElements, _In_ int(__cdecl *_PtFuncCompare)(void *, const void *, const void *), void *_Context)
_CRTIMP void __cdecl qsort_s(_Inout_updates_bytes_(_NumOfElements *_SizeOfElements) void *_Base, _In_ rsize_t _NumOfElements, _In_ rsize_t _SizeOfElements, _In_ int(__cdecl *_PtFuncCompare)(void *, const void *, const void *), void *_Context)
_Check_return_ _CRTIMP void *__cdecl _lfind(_In_ const void *_Key, _In_reads_bytes_((*_NumOfElements)*_SizeOfElements) const void *_Base, _Inout_ unsigned int *_NumOfElements, _In_ unsigned int _SizeOfElements, _In_ int(__cdecl *_PtFuncCompare)(const void *, const void *))
size_t rsize_t
Definition: crtdefs.h:503
_Check_return_ _CRTIMP void *__cdecl _lfind_s(_In_ const void *_Key, _In_reads_bytes_((*_NumOfElements)*_SizeOfElements) const void *_Base, _Inout_ unsigned int *_NumOfElements, _In_ size_t _SizeOfElements, _In_ int(__cdecl *_PtFuncCompare)(void *, const void *, const void *), void *_Context)
_CRTIMP void __cdecl qsort(_Inout_updates_bytes_(_NumOfElements *_SizeOfElements) void *_Base, _In_ size_t _NumOfElements, _In_ size_t _SizeOfElements, _In_ int(__cdecl *_PtFuncCompare)(const void *, const void *))
_Check_return_ _CRTIMP void *__cdecl bsearch(_In_ const void *_Key, _In_reads_bytes_(_NumOfElements *_SizeOfElements) const void *_Base, _In_ size_t _NumOfElements, _In_ size_t _SizeOfElements, _In_ int(__cdecl *_PtFuncCompare)(const void *, const void *))
#define _Inout_
Definition: sal.h:384
_Check_return_ _CRTIMP _In_reads_bytes_((*_NumOfElements)*_SizeOfElements) const void *_Base
_Check_return_ _CRTIMP void *__cdecl _lsearch(_In_ const void *_Key, _Inout_updates_bytes_((*_NumOfElements)*_SizeOfElements) void *_Base, _Inout_ unsigned int *_NumOfElements, _In_ unsigned int _SizeOfElements, _In_ int(__cdecl *_PtFuncCompare)(const void *, const void *))