|
|
|
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 |
|
#if _MSC_VER > 1000 |
16 |
|
#pragma once |
17 |
|
#endif |
18 |
|
|
19 |
|
#ifndef _INC_SEARCH |
20 |
|
#define _INC_SEARCH |
21 |
|
|
22 |
|
#include <crtdefs.h> |
23 |
|
#include <stddef.h> |
24 |
|
|
25 |
|
#ifdef __cplusplus |
26 |
|
extern "C" { |
27 |
|
#endif |
28 |
|
|
29 |
|
/* Function prototypes */ |
30 |
|
|
31 |
|
#ifndef _CRT_ALGO_DEFINED |
32 |
|
#define _CRT_ALGO_DEFINED |
33 |
|
#if __STDC_WANT_SECURE_LIB__ |
34 |
|
_Check_return_ _CRTIMP void * __cdecl bsearch_s(_In_ const void * _Key, _In_bytecount_x_(_NumOfElements * _SizeOfElements) const void * _Base, |
35 |
|
_In_ rsize_t _NumOfElements, _In_ rsize_t _SizeOfElements, |
36 |
|
_In_ int (__cdecl * _PtFuncCompare)(void *, const void *, const void *), void * _Context); |
37 |
|
#endif |
38 |
|
_Check_return_ _CRTIMP void * __cdecl bsearch(_In_ const void * _Key, _In_bytecount_x_(_NumOfElements * _SizeOfElements) const void * _Base, |
39 |
|
_In_ size_t _NumOfElements, _In_ size_t _SizeOfElements, |
40 |
|
_In_ int (__cdecl * _PtFuncCompare)(const void *, const void *)); |
41 |
|
|
42 |
|
#if __STDC_WANT_SECURE_LIB__ |
43 |
|
_CRTIMP void __cdecl qsort_s(_Inout_bytecap_x_(_NumOfElements* _SizeOfElements) void * _Base, |
44 |
|
_In_ rsize_t _NumOfElements, _In_ rsize_t _SizeOfElements, |
45 |
|
_In_ int (__cdecl * _PtFuncCompare)(void *, const void *, const void *), void *_Context); |
46 |
|
#endif |
47 |
|
_CRTIMP void __cdecl qsort(_Inout_bytecap_x_(_NumOfElements * _SizeOfElements) void * _Base, |
48 |
|
_In_ size_t _NumOfElements, _In_ size_t _SizeOfElements, |
59 |
|
_Check_return_ _CRTIMP void * __cdecl _lsearch_s(_In_ const void * _Key, _Inout_bytecap_x_((*_NumOfElements ) * _SizeOfElements) void * _Base, |
60 |
|
_Inout_ unsigned int * _NumOfElements, _In_ size_t _SizeOfElements, |
61 |
|
_In_ int (__cdecl * _PtFuncCompare)(void *, const void *, const void *), void * _Context); |
62 |
|
_Check_return_ _CRTIMP void * __cdecl _lsearch(_In_ const void * _Key, _Inout_bytecap_x_((*_NumOfElements ) * _SizeOfElements) void * _Base, |
63 |
|
_Inout_ unsigned int * _NumOfElements, _In_ unsigned int _SizeOfElements, |
64 |
|
_In_ int (__cdecl * _PtFuncCompare)(const void *, const void *)); |
65 |
|
|
66 |
|
#if _MSC_VER >= 1400 && defined(__cplusplus) && defined(_M_CEE) |
67 |
|
/* |
68 |
|
* Managed search routines. Note __cplusplus, this is because we only support |
69 |
|
* managed C++. |
70 |
|
*/ |
71 |
|
extern "C++" |
72 |
|
{ |
73 |
|
|
74 |
|
#if __STDC_WANT_SECURE_LIB__ |
75 |
|
_Check_return_ void * __clrcall bsearch_s(_In_ const void * _Key, _In_bytecount_x_(_NumOfElements*_SizeOfElements) const void * _Base, |
76 |
|
_In_ rsize_t _NumOfElements, _In_ rsize_t _SizeOfElements, |
77 |
|
_In_ int (__clrcall * _PtFuncCompare)(void *, const void *, const void *), void * _Context); |
78 |
|
#endif |
79 |
|
_Check_return_ void * __clrcall bsearch(_In_ const void * _Key, _In_bytecount_x_(_NumOfElements*_SizeOfElements) const void * _Base, |
80 |
|
_In_ size_t _NumOfElements, _In_ size_t _SizeOfElements, |
81 |
|
_In_ int (__clrcall * _PtFuncCompare)(const void *, const void *)); |
82 |
|
|
83 |
|
_Check_return_ void * __clrcall _lfind_s(_In_ const void * _Key, _In_bytecount_x_(_NumOfElements*_SizeOfElements) const void * _Base, |
84 |
|
_Inout_ unsigned int * _NumOfElements, _In_ size_t _SizeOfElements, |
85 |
|
_In_ int (__clrcall * _PtFuncCompare)(void *, const void *, const void *), void * _Context); |
86 |
|
_Check_return_ void * __clrcall _lfind(_In_ const void * _Key, _In_bytecount_x_((*_NumOfElements)*_SizeOfElements) const void * _Base, |
87 |
|
_Inout_ unsigned int * _NumOfElements, _In_ unsigned int _SizeOfElements, |
88 |
|
_In_ int (__clrcall * _PtFuncCompare)(const void *, const void *)); |
89 |
|
|
90 |
|
_Check_return_ void * __clrcall _lsearch_s(_In_ const void * _Key, _In_bytecount_x_((*_NumOfElements)*_SizeOfElements) void * _Base, |
91 |
|
_In_ unsigned int * _NumOfElements, _In_ size_t _SizeOfElements, |
92 |
|
_In_ int (__clrcall * _PtFuncCompare)(void *, const void *, const void *), void * _Context); |
93 |
|
_Check_return_ void * __clrcall _lsearch(_In_ const void * _Key, _Inout_bytecap_x_((*_NumOfElements)*_SizeOfElements) void * _Base, |
94 |
|
_Inout_ unsigned int * _NumOfElements, _In_ unsigned int _SizeOfElements, |
95 |
|
_In_ int (__clrcall * _PtFuncCompare)(const void *, const void *)); |
96 |
|
|
97 |
|
#if __STDC_WANT_SECURE_LIB__ |
98 |
|
void __clrcall qsort_s(_Inout_bytecap_x_(_NumOfElements*_SizeOfElements) _Post_bytecount_x_(_NumOfElements*_SizeOfElements) void * _Base, |
99 |
|
_In_ rsize_t _NumOfElements, _In_ rsize_t _SizeOfElment, |
100 |
|
_In_ int (__clrcall * _PtFuncCompare)(void *, const void *, const void *), void * _Context); |
101 |
|
#endif |
102 |
|
void __clrcall qsort(_Inout_bytecap_x_(_NumOfElements*_SizeOfElements) _Post_bytecount_x_(_NumOfElements*_SizeOfElements) void * _Base, |
103 |
|
_In_ size_t _NumOfElements, _In_ size_t _SizeOfElements, |
104 |
|
_In_ int (__clrcall * _PtFuncCompare)(const void *, const void *)); |
105 |
|
|
106 |
|
} |
107 |
|
#endif |
108 |
|
|
109 |
|
|
110 |
|
#if !__STDC__ |
111 |
|
/* Non-ANSI names for compatibility */ |
112 |
|
|
113 |
|
_Check_return_ _CRTIMP _CRT_NONSTDC_DEPRECATE(_lfind) void * __cdecl lfind(_In_ const void * _Key, _In_bytecount_x_((*_NumOfElements) * _SizeOfElements) const void * _Base, |
114 |
|
_Inout_ unsigned int * _NumOfElements, _In_ unsigned int _SizeOfElements, |
115 |
|
_In_ int (__cdecl * _PtFuncCompare)(const void *, const void *)); |
116 |
|
_Check_return_ _CRTIMP _CRT_NONSTDC_DEPRECATE(_lsearch) void * __cdecl lsearch(_In_ const void * _Key, _Inout_bytecap_x_((*_NumOfElements) * _SizeOfElements) void * _Base, |
117 |
|
_Inout_ unsigned int * _NumOfElements, _In_ unsigned int _SizeOfElements, |
118 |
|
_In_ int (__cdecl * _PtFuncCompare)(const void *, const void *)); |
119 |
|
|
120 |
|
#endif /* __STDC__ */ |
121 |
|
|
122 |
|
|
123 |
|
#ifdef __cplusplus |
124 |
|
} |
125 |
|
#endif |
126 |
|
|
127 |
|
#endif /* _INC_SEARCH */ |
128 |
|
|
|
|
|