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.

70 lines
2.1 KiB

  1. /******************************************************
  2. *
  3. * uDictP.h
  4. *
  5. * Private dclartaions involving the user dictionary
  6. *
  7. *****************************************************/
  8. #ifndef H_UDICTP_H
  9. #define H_UDICTP_H
  10. #define NO_LINK (-1) // Offset value use when no valid link.
  11. // User dictionary Flags.
  12. #define UDF_VALID 0x0001 // End of valid word.
  13. #define UDF_HAS_TAG 0x0002 // Tag information stored for this node.
  14. #define UDF_IS_TAG 0x0004 // Tag information, is NOT normal node.
  15. #ifdef __cplusplus
  16. extern "C"
  17. {
  18. #endif
  19. // Node in user dictionary.
  20. typedef struct tagNODE {
  21. wchar_t wchLabel; // Character label of node
  22. WORD flags; // Node flags.
  23. int iDown; // Index of down node.
  24. union {
  25. int iRight; // Index of right node.
  26. const wchar_t *pTag; // Pointer to tag info.
  27. } uu;
  28. } NODE;
  29. typedef enum tagUDICT_IDX {READER=1, WRITER} UDICT_IDX; // Identifer if I am a reader or writer of the XWL
  30. // The header structure for the user dictionary.
  31. // June 2001. Implement read/write locking to protect
  32. // multiple thread access as in the following table:
  33. // Read Access Write Access
  34. // Reading Yes No
  35. // Writing No No
  36. //
  37. typedef struct tagUDICT {
  38. NODE *pNodeAlloc; // Allocated array of nodes.
  39. int cNodes; // Count of allocated nodes in array.
  40. int cNodesUsed; // Count of nodes used in array.
  41. int iFreeList; // Offset of first item in free list.
  42. int iRoot; // Offset of root of trie.
  43. BOOL bIsChanged; // True if dictionary has changed since last save
  44. int iLen; // Amount of space needed to save all the words in the dictionary
  45. int cReadLock; // Number of read locks on to prevent write updates during a read
  46. HANDLE hReadLockEvent; // Signal reading of the User dictiionary
  47. HANDLE hWriteLockMutex; // Signals a writing thread has ownership
  48. HANDLE hRWevent; // Signals either read or write has ownership
  49. } UDICT;
  50. // Synchronization functions
  51. BOOL UDictInitLocks(UDICT *pDict);
  52. void UDictDestroyLocks(UDICT *pDict);
  53. void UDictGetLock(HWL hwl, UDICT_IDX idx );
  54. void UDictReleaseLock(HWL hwl, UDICT_IDX idx);
  55. #ifdef __cplusplus
  56. };
  57. #endif
  58. #endif