Source code of Windows XP (NT5)
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.

68 lines
2.2 KiB

  1. //*******************************************************************************************
  2. //
  3. // Filename : Dpda.h
  4. //
  5. // Definitions of DPA routines
  6. //
  7. // Copyright (c) 1994 - 1996 Microsoft Corporation. All rights reserved
  8. //
  9. //*******************************************************************************************
  10. #ifndef _DPDA_H_
  11. #define _DPDA_H_
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. // Dynamic pointer array
  16. typedef struct _DPA * HDPA;
  17. HDPA DPA_Create(int cItemGrow);
  18. HDPA DPA_CreateEx(int cpGrow, HANDLE hheap);
  19. BOOL DPA_Destroy(HDPA hdpa);
  20. HDPA DPA_Clone(HDPA hdpa, HDPA hdpaNew);
  21. void * DPA_GetPtr(HDPA hdpa, int i);
  22. int DPA_GetPtrIndex(HDPA hdpa, LPVOID p);
  23. BOOL DPA_Grow(HDPA pdpa, int cp);
  24. BOOL DPA_SetPtr(HDPA hdpa, int i, LPVOID p);
  25. int DPA_InsertPtr(HDPA hdpa, int i, LPVOID p);
  26. void * DPA_DeletePtr(HDPA hdpa, int i);
  27. BOOL DPA_DeleteAllPtrs(HDPA hdpa);
  28. #define DPA_GetPtrCount(hdpa) (*(int *)(hdpa))
  29. #define DPA_GetPtrPtr(hdpa) (*((LPVOID * *)((BYTE *)(hdpa) + sizeof(int))))
  30. #define DPA_FastGetPtr(hdpa, i) (DPA_GetPtrPtr(hdpa)[i])
  31. typedef int (CALLBACK *PFNDPACOMPARE)(LPVOID p1, LPVOID p2, LPARAM lParam);
  32. BOOL DPA_Sort(HDPA hdpa, PFNDPACOMPARE pfnCompare, LPARAM lParam);
  33. typedef struct _DSA * HDSA;
  34. // Search array. If DPAS_SORTED, then array is assumed to be sorted
  35. // according to pfnCompare, and binary search algorithm is used.
  36. // Otherwise, linear search is used.
  37. //
  38. // Searching starts at iStart (-1 to start search at beginning).
  39. //
  40. // DPAS_INSERTBEFORE/AFTER govern what happens if an exact match is not
  41. // found. If neither are specified, this function returns -1 if no exact
  42. // match is found. Otherwise, the index of the item before or after the
  43. // closest (including exact) match is returned.
  44. //
  45. // Search option flags
  46. //
  47. #define DPAS_SORTED 0x0001
  48. #define DPAS_INSERTBEFORE 0x0002
  49. #define DPAS_INSERTAFTER 0x0004
  50. int DPA_Search(HDPA hdpa, LPVOID pFind, int iStart,
  51. PFNDPACOMPARE pfnCompare,
  52. LPARAM lParam, UINT options);
  53. #ifdef __cplusplus
  54. }
  55. #endif
  56. #endif // _DPDA_H_