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.

73 lines
5.8 KiB

  1. //
  2. // da.h: Dynamic array functions taken from commctrl.
  3. //
  4. #if 0
  5. #ifndef _DA_H_
  6. #define _DA_H_
  7. //====== Dynamic Array routines ========================================== /* ;Internal */
  8. // Dynamic structure array /* ;Internal */
  9. typedef struct _DSA * HDSA; /* ;Internal */
  10. /* ;Internal */
  11. HDSA PUBLIC DSA_Create(int cbItem, int cItemGrow); /* ;Internal */
  12. BOOL PUBLIC DSA_Destroy(HDSA hdsa); /* ;Internal */
  13. BOOL PUBLIC DSA_GetItem(HDSA hdsa, int i, void * pitem); /* ;Internal */
  14. LPVOID PUBLIC DSA_GetItemPtr(HDSA hdsa, int i); /* ;Internal */
  15. BOOL PUBLIC DSA_SetItem(HDSA hdsa, int i, void * pitem); /* ;Internal */
  16. int PUBLIC DSA_InsertItem(HDSA hdsa, int i, void * pitem); /* ;Internal */
  17. BOOL PUBLIC DSA_DeleteItem(HDSA hdsa, int i); /* ;Internal */
  18. BOOL PUBLIC DSA_DeleteAllItems(HDSA hdsa); /* ;Internal */
  19. #define DSA_GetItemCount(hdsa) (*(int *)(hdsa)) /* ;Internal */
  20. /* ;Internal */
  21. // Dynamic pointer array /* ;Internal */
  22. typedef struct _DPA * HDPA; /* ;Internal */
  23. /* ;Internal */
  24. HDPA PUBLIC DPA_Create(int cItemGrow); /* ;Internal */
  25. HDPA PUBLIC DPA_CreateEx(int cpGrow, HANDLE hheap); /* ;Internal */
  26. BOOL PUBLIC DPA_Destroy(HDPA hdpa); /* ;Internal */
  27. HDPA PUBLIC DPA_Clone(HDPA hdpa, HDPA hdpaNew); /* ;Internal */
  28. LPVOID PUBLIC DPA_GetPtr(HDPA hdpa, int i); /* ;Internal */
  29. int PUBLIC DPA_GetPtrIndex(HDPA hdpa, LPVOID p); /* ;Internal */
  30. BOOL PUBLIC DPA_Grow(HDPA pdpa, int cp); /* ;Internal */
  31. BOOL PUBLIC DPA_SetPtr(HDPA hdpa, int i, LPVOID p); /* ;Internal */
  32. int PUBLIC DPA_InsertPtr(HDPA hdpa, int i, LPVOID p); /* ;Internal */
  33. LPVOID PUBLIC DPA_DeletePtr(HDPA hdpa, int i); /* ;Internal */
  34. BOOL PUBLIC DPA_DeleteAllPtrs(HDPA hdpa); /* ;Internal */
  35. #define DPA_GetPtrCount(hdpa) (*(int *)(hdpa)) /* ;Internal */
  36. #define DPA_GetPtrPtr(hdpa) (*((LPVOID * *)((BYTE *)(hdpa) + sizeof(int)))) /* ;Internal */
  37. #define DPA_FastGetPtr(hdpa, i) (DPA_GetPtrPtr(hdpa)[i]) /* ;Internal */
  38. typedef int (CALLBACK *PFNDPACOMPARE)(LPVOID p1, LPVOID p2, LPARAM lParam); /* ;Internal */
  39. /* ;Internal */
  40. BOOL PUBLIC DPA_Sort(HDPA hdpa, PFNDPACOMPARE pfnCompare, LPARAM lParam); /* ;Internal */
  41. /* ;Internal */
  42. // Search array. If DPAS_SORTED, then array is assumed to be sorted /* ;Internal */
  43. // according to pfnCompare, and binary search algorithm is used. /* ;Internal */
  44. // Otherwise, linear search is used. /* ;Internal */
  45. // /* ;Internal */
  46. // Searching starts at iStart (-1 to start search at beginning). /* ;Internal */
  47. // /* ;Internal */
  48. // DPAS_INSERTBEFORE/AFTER govern what happens if an exact match is not /* ;Internal */
  49. // found. If neither are specified, this function returns -1 if no exact /* ;Internal */
  50. // match is found. Otherwise, the index of the item before or after the /* ;Internal */
  51. // closest (including exact) match is returned. /* ;Internal */
  52. // /* ;Internal */
  53. // Search option flags /* ;Internal */
  54. // /* ;Internal */
  55. #define DPAS_SORTED 0x0001 /* ;Internal */
  56. #define DPAS_INSERTBEFORE 0x0002 /* ;Internal */
  57. #define DPAS_INSERTAFTER 0x0004 /* ;Internal */
  58. /* ;Internal */
  59. int PUBLIC DPA_Search(HDPA hdpa, LPVOID pFind, int iStart, /* ;Internal */
  60. PFNDPACOMPARE pfnCompare, /* ;Internal */
  61. LPARAM lParam, UINT options); /* ;Internal */
  62. /* ;Internal */
  63. //====================================================================== /* ;Internal */
  64. // String management helper routines /* ;Internal */
  65. /* ;Internal */
  66. int PUBLIC Str_GetPtr(LPCTSTR psz, LPTSTR pszBuf, int cchBuf); /* ;Internal */
  67. BOOL PUBLIC Str_SetPtr(LPTSTR * ppsz, LPCTSTR psz); /* ;Internal */
  68. #endif // _DA_H_
  69. #endif