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.

172 lines
5.4 KiB

  1. /************************************************************************
  2. *
  3. * WWHEEL.H
  4. *
  5. * Copyright (c) Microsoft Corporation 1993
  6. * All rights reserved.
  7. *
  8. *************************************************************************
  9. *
  10. * The WordWheel API
  11. *
  12. *
  13. ************************************************************************/
  14. #ifndef __WWHEEL_H_
  15. #define __WWHEEL_H_
  16. #include <mvopsys.h>
  17. //#include <itww.h>
  18. #include <itgroup.h>
  19. #include "common.h"
  20. #include <wrapstor.h>
  21. #include <orkin.h>
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /*****************************************************************************
  26. *
  27. * error handling defines
  28. *
  29. * many routines are structured to have a single exit point labelled
  30. * "cleanup". The following defines are a procedure-level "break"
  31. * that force execution to drop down to cleanup.
  32. *
  33. *****************************************************************************/
  34. #ifdef _DEBUG
  35. #define warning_abort { DPF("\nwarning, %s, line %u\n", \
  36. (LPSTR)s_aszModule, __LINE__); goto cleanup; }
  37. #else
  38. #define warning_abort { goto cleanup; }
  39. #endif
  40. #define assert_abort { assert(FALSE); goto cleanup; }
  41. // Typedefs
  42. //
  43. typedef HANDLE HWHEEL;
  44. // Critical structures that gets messed up in /Zp8
  45. #pragma pack(1)
  46. typedef struct tagWHEELINFO
  47. {
  48. DWORD magic; // magic value for verification
  49. HBT hbt; // handle to btree subfile
  50. HMAPBT hmapbt; // handle to map subfile
  51. long lNumKws; // number of keywords in the word wheel.
  52. LPIDX lpIndex; // index for searching.
  53. HF hf; // handle to keyword index subfile
  54. LPBYTE pOccHdr; // Header for occurrence properties
  55. LPBYTE pKeyHdr; // Header for key properties
  56. } WHEELINFO, FAR * PWHEELINFO;
  57. typedef struct
  58. {
  59. DWORD magic; // magic value for verification
  60. HANDLE hMergeData; // Handle to merge data info if using multiple titles
  61. DWORD dwMergeLength; // Length in bytes of merge data for this wheel combo
  62. LONG lNumEntries; // Total number of 'virtual' (could be filtered) entries (same as lNumKws if one title)
  63. LPSTR lpszCacheData; // Key for cached data following
  64. HANDLE hCacheData; // Results of last KeyIndexGet call
  65. DWORD dwCacheNumItems; // Cached number of items from last KeyIndexGet call
  66. DWORD wNumWheels; // Number of titles for merging
  67. WHEELINFO pInfo[1]; // Info for each particular title
  68. IITGroup* pIITGroup; // Group for filtering
  69. LONG lNumRealEntries; // Real number of entries (without filtering).
  70. LPSIPB lpsipb; // Stop word structure for full-text search
  71. } WHEEL, FAR *PWHEEL;
  72. typedef struct
  73. {
  74. WORD nTopics;
  75. DWORD dwOffset;
  76. } QREC;
  77. // Critical structures that gets messed up in /Zp8
  78. #pragma pack()
  79. // Defines
  80. //
  81. // This must be at least as big as CBMAX_WWTITLE defined in ciextern.h
  82. #define MAXWHEELNAME 80
  83. // magic is "WW!\0"
  84. #define WHEEL_MAGIC 0x00215757
  85. #define WHEEL_INFO_MAGIC 0x00215758
  86. #define PWHEEL_OK(p) ((p)!=NULL&&(p)->magic==WHEEL_MAGIC)
  87. #define MERGEFILE_HEADERSIZE 1024
  88. #define MERGEFILE_HEADERALIGN 32
  89. #define MERGEFILE_FILEALIGN 8
  90. #define MERGEFILE_ENTRYSIZE 32
  91. typedef struct mergefile_tag
  92. {
  93. HFPB hfpb;
  94. WORD wNumRecords;
  95. LONG lctFile;
  96. LONG lHeaderBlockStart;
  97. char szHeader[MERGEFILE_HEADERSIZE];
  98. } MERGEFILE, FAR * LPMERGEFILE;
  99. #if 0
  100. #define MERGEFILE_WW_TRE_EXT ".WWT"
  101. #define MERGEFILE_WW_DAT_EXT ".WWD"
  102. #define MERGEFILE_WW_IDX_EXT ".WWI"
  103. #define MERGEFILE_WW_MAP_EXT ".WWM"
  104. #define MERGEFILE_WW_STP_EXT ".WWS"
  105. #define MERGEFILE_KW_TRE_EXT ".KWT"
  106. #define MERGEFILE_KW_DAT_EXT ".KWD"
  107. #define MERGEFILE_KW_IDX_EXT ".KWI"
  108. #define MERGEFILE_KW_MAP_EXT ".KWM"
  109. #define MERGEFILE_KW_STP_EXT ".STP"
  110. #define WW_BTREE_FILENAME L"BTREE.WW3"
  111. #define WW_DATA_FILENAME L"DATA.WW3"
  112. #define WW_MAP_FILENAME L"MAP.WW3"
  113. #define WW_PROP_FILENAME L"PROPERTY.WW3"
  114. #define WW_INDEX_FILENAME L"FTI.WW3"
  115. #define WW_STOP_FILENAME L"FTISTOP.WW3"
  116. #endif
  117. // Prototypes
  118. //ERR FAR PASCAL EXPORT_API WordWheelQuery(HANDLE hWheel, DWORD dwFlags,LPCSTR lpstrQuery,LPVOID lpGroupLimit,LPVOID lpGroupHits);
  119. HWHEEL FAR PASCAL EXPORT_API WordWheelOpen(IITDatabase* lpITDB,
  120. IStorage* pWWStorage, HRESULT* phr);
  121. void FAR PASCAL EXPORT_API WordWheelClose(HWHEEL hWheel);
  122. long FAR PASCAL EXPORT_API WordWheelLength(HWHEEL hWheel, HRESULT* phr);
  123. long FAR PASCAL EXPORT_API WordWheelPrefix(HWHEEL hWheel,LPCVOID lpcvPrefix, BOOL fExactMatch, HRESULT* phr);
  124. HRESULT FAR PASCAL EXPORT_API WordWheelLookup(HWHEEL hWheel, long lIndex, LPVOID lpvKeyBuf, DWORD cbKeyBuf);
  125. //ERR FAR PASCAL EXPORT_API KeyIndexGetAddrs (HWHEEL hWheel, LPBYTE lpKey, int nStart, int nCount, LPBYTE lpAddrs);
  126. //DWORD FAR PASCAL EXPORT_API KeyIndexGetData (HWHEEL hWheel, LPBYTE lpKey, int nWhich, LPBYTE lpMem, DWORD dwMaxLen, LPERRB lperrb);
  127. //WORD FAR PASCAL EXPORT_API KeyIndexGetCount (HWHEEL,LPBYTE, LPERRB);
  128. //ERR FAR PASCAL EXPORT_API WordWheelSetKeyFilter(HWHEEL, LPVOID);
  129. //LPVOID FAR PASCAL EXPORT_API WordWheelGetKeyFilter(HWHEEL, LPERRB);
  130. //ERR FAR PASCAL EXPORT_API WordWheelGetInfo (HWHEEL, PWWINFO);
  131. HRESULT FAR PASCAL CheckWordWheelKeyType(HBT hbt, IITSortKey **ppITSortKey);
  132. DWORD FAR PASCAL CbKeyWordWheel(LPVOID lpvKey, IITSortKey *pITSortKey);
  133. #ifdef __cplusplus
  134. }
  135. #endif
  136. #endif // __WWHEEL_H_