Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

204 lines
6.6 KiB

  1. /////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1998 Active Voice Corporation. All Rights Reserved.
  4. //
  5. // Active Agent(r) and Unified Communications(tm) are trademarks of Active Voice Corporation.
  6. //
  7. // Other brand and product names used herein are trademarks of their respective owners.
  8. //
  9. // The entire program and user interface including the structure, sequence, selection,
  10. // and arrangement of the dialog, the exclusively "yes" and "no" choices represented
  11. // by "1" and "2," and each dialog message are protected by copyrights registered in
  12. // the United States and by international treaties.
  13. //
  14. // Protected by one or more of the following United States patents: 5,070,526, 5,488,650,
  15. // 5,434,906, 5,581,604, 5,533,102, 5,568,540, 5,625,676, 5,651,054.
  16. //
  17. // Active Voice Corporation
  18. // Seattle, Washington
  19. // USA
  20. //
  21. /////////////////////////////////////////////////////////////////////////////////////////
  22. ////
  23. // array.h - interface for array functions in array.c
  24. ////
  25. #ifndef __ARRAY_H__
  26. #define __ARRAY_H__
  27. #include "winlocal.h"
  28. #define ARRAY_VERSION 0x00000106
  29. // handle to a array
  30. //
  31. DECLARE_HANDLE32(HARRAY);
  32. // array data element
  33. //
  34. typedef LPVOID ARRAYELEM, FAR *LPARRAYELEM;
  35. // type required to hold the max number of array elements
  36. //
  37. typedef long ARRAYSIZE_T;
  38. ////
  39. // array constructor and destructor functions
  40. ////
  41. #ifdef __cplusplus
  42. extern "C" {
  43. #endif
  44. // ArrayCreate - array constructor (array is initially empty)
  45. // <dwVersion> (i) must be ARRAY_VERSION
  46. // <hInst> (i) instance handle of calling module
  47. // return new array handle (NULL if error)
  48. //
  49. HARRAY DLLEXPORT WINAPI ArrayCreate(DWORD dwVersion, HINSTANCE hInst);
  50. // ArrayDestroy - array destructor
  51. // <hArray> (i) handle returned from ArrayCreate
  52. // return 0 if success
  53. //
  54. int DLLEXPORT WINAPI ArrayDestroy(HARRAY hArray);
  55. ////
  56. // array size functions
  57. ////
  58. // ArrayGetSize - get array size
  59. // <hArray> (i) handle returned from ArrayCreate
  60. // return size of array (0 if empty, -1 if error)
  61. // array indexes are zero-based, so the size is 1 greater than largest index
  62. //
  63. ARRAYSIZE_T DLLEXPORT WINAPI ArrayGetSize(HARRAY hArray);
  64. // ArrayGetUpperBound - get array upper bound
  65. // <hArray> (i) handle returned from ArrayCreate
  66. // return largest valid array index (-1 if empty, -2 if error)
  67. //
  68. ARRAYSIZE_T DLLEXPORT WINAPI ArrayGetUpperBound(HARRAY hArray);
  69. // ArraySetSize - establish new size and grow amount for array
  70. // <hArray> (i) handle returned from ArrayCreate
  71. // <nNewSize> (i) new array size (number of elements)
  72. // 0 make empty array
  73. // <nGrowBy> (i) when array needs to grow, grow by this amount
  74. // 0 use default grow amount
  75. // -1 leave grow amount unchanged
  76. // return 0 if success
  77. //
  78. int DLLEXPORT WINAPI ArraySetSize(HARRAY hArray, ARRAYSIZE_T nNewSize, ARRAYSIZE_T nGrowBy);
  79. ////
  80. // array clean up functions
  81. ////
  82. // ArrayFreeExtra - free unused memory above the array upper bound
  83. // <hArray> (i) handle returned from ArrayCreate
  84. // return 0 if success
  85. //
  86. int DLLEXPORT WINAPI ArrayFreeExtra(HARRAY hArray);
  87. // ArrayRemoveAll - remove all elements from array
  88. // <hArray> (i) handle returned from ArrayCreate
  89. // return 0 if success
  90. //
  91. int DLLEXPORT WINAPI ArrayRemoveAll(HARRAY hArray);
  92. ////
  93. // array element access functions
  94. ////
  95. // ArrayGetAt - return data element at specified index
  96. // <hArray> (i) handle returned from ArrayCreate
  97. // <nIndex> (i) zero based index into array
  98. // return data element value (NULL if error)
  99. //
  100. ARRAYELEM DLLEXPORT WINAPI ArrayGetAt(HARRAY hArray, ARRAYSIZE_T nIndex);
  101. // ArraySetAt - set data element at specified index
  102. // <hArray> (i) handle returned from ArrayCreate
  103. // <nIndex> (i) zero based index into array
  104. // <elem> (i) new data element value
  105. // return 0 if success
  106. //
  107. int DLLEXPORT WINAPI ArraySetAt(HARRAY hArray, ARRAYSIZE_T nIndex, ARRAYELEM elem);
  108. ////
  109. // array grow functions
  110. ////
  111. // ArraySetAtGrow - set data element at specified index
  112. // <hArray> (i) handle returned from ArrayCreate
  113. // <nIndex> (i) zero based index into array
  114. // <elem> (i) new data element value
  115. // return 0 if success
  116. // NOTE: array size is increased if nIndex > upper bound
  117. //
  118. int DLLEXPORT WINAPI ArraySetAtGrow(HARRAY hArray, ARRAYSIZE_T nIndex, ARRAYELEM elem);
  119. // ArrayAdd - add data element to end of array
  120. // <hArray> (i) handle returned from ArrayCreate
  121. // <elem> (i) new data element value
  122. // return index of added element (-1 if error)
  123. //
  124. ARRAYSIZE_T DLLEXPORT WINAPI ArrayAdd(HARRAY hArray, ARRAYELEM elem);
  125. ////
  126. // array element insertion and removal
  127. ////
  128. // ArrayInsertAt - insert <nCount> copies of <elem> at specified index
  129. // <hArray> (i) handle returned from ArrayCreate
  130. // <nIndex> (i) zero based index into array
  131. // <elem> (i) new data element value
  132. // <nCount> (i) number of elements to insert
  133. // return 0 if success
  134. // NOTE: elements at end of array will be shifted if necessary
  135. //
  136. int DLLEXPORT WINAPI ArrayInsertAt(HARRAY hArray, ARRAYSIZE_T nIndex, ARRAYELEM elem, ARRAYSIZE_T nCount);
  137. // ArrayRemoveAt - remove <nCount> data elements at specified index
  138. // <hArray> (i) handle returned from ArrayCreate
  139. // <nIndex> (i) zero based index into array
  140. // <nCount> (i) number of elements to remove
  141. // return 0 if success
  142. // NOTE: elements at end of array will be shifted if necessary
  143. //
  144. int DLLEXPORT WINAPI ArrayRemoveAt(HARRAY hArray, ARRAYSIZE_T nIndex, ARRAYSIZE_T nCount);
  145. ////
  146. // array element sorting and searching
  147. ////
  148. // ArraySort - sort array
  149. // <hArray> (i) handle returned from ArrayCreate
  150. // <lpfnCompare> (i) comparison function pointer
  151. // NULL direct comparison (MemCmp)
  152. // return 0 if success
  153. //
  154. int DLLEXPORT WINAPI ArraySort(HARRAY hArray,
  155. int (WINAPI *lpfnCompare)(const LPARRAYELEM lpElem1, const LPARRAYELEM lpElem2));
  156. // ArraySearch - search array for matching element
  157. // <hArray> (i) handle returned from ArrayCreate
  158. // <elem> (i) data element to match
  159. // <nIndex> (i) start search after this array index
  160. // -1 start search at start of array
  161. // <dwFlags> (i) reserved; must be 0
  162. // <lpfnCompare> (i) comparison function pointer
  163. // NULL direct comparison (MemCmp)
  164. // return index of matching element (-1 if no match, -2 if error)
  165. //
  166. ARRAYSIZE_T DLLEXPORT WINAPI ArraySearch(HARRAY hArray, ARRAYELEM elem,
  167. ARRAYSIZE_T nIndex, DWORD dwFlags,
  168. int (WINAPI *lpfnCompare)(const LPARRAYELEM lpElem1, const LPARRAYELEM lpElem2));
  169. #ifdef __cplusplus
  170. }
  171. #endif
  172. #endif // __ARRAY_H__