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.

199 lines
10 KiB

  1. #include "commondict.h"
  2. /* ************************************************************************* */
  3. /* * Definitions for dictionary support for XRW algs * */
  4. /* ************************************************************************* */
  5. #ifndef XRWORDDICT_INCLUDED
  6. #define XRWORDDICT_INCLUDED
  7. #define XRWD_SRCID_NOP 0x0000 /* Initial state - can be any */
  8. #define XRWD_SRCID_VOC 0x0001 /* Sym originates from vocabulary */
  9. #define XRWD_SRCID_USV 0x0011 /* Sym originates from user dict */
  10. #define XRWD_SRCID_LD 0x0002 /* Sym originates from lexical DB */
  11. #define XRWD_SRCID_TR 0x0004 /* Sym originates from charset */
  12. #define XRWD_SRCID_CS 0x0008 /* Sym originates from charset */
  13. #define XRWD_SRCID_PT 0x0030 /* Sym originates from punctuation */
  14. #define XRWD_SRCID_SPT 0x0010 /* Sym originates from spunctuation */
  15. #define XRWD_SRCID_EPT 0x0020 /* Sym originates from epunctuation */
  16. #define XRWD_SRCID_DGT 0x0040 /* Sym is digit */
  17. #define XRWD_IS_VOC_ONLY(x) (((x) & XRWD_SRCID_VOC) == (x))
  18. #define XRWD_N_SRCS 5 /* Num of buffer for sym sources */
  19. #define XRWD_N_VOC 0 /* Num of buffer for vocabulary */
  20. #define XRWD_N_LD 1 /* Num of buffer for lexical DB */
  21. #define XRWD_N_TR 2 /* Num of buffer for charset */
  22. #define XRWD_N_CS 3 /* Num of buffer for charset */
  23. #define XRWD_N_PT 4 /* Num of buffer for punctuation */
  24. #define XRWD_ID_ORDER XRWD_SRCID_VOC, XRWD_SRCID_LD, XRWD_SRCID_TR, XRWD_SRCID_CS, XRWD_SRCID_PT
  25. #define XRWD_MAX_LETBUF 512
  26. #define XRWD_USE_LENLIM OFF /* Len limit check support #enabled */
  27. #define XRWD_LENLIM 1 /* Len limit check enabled flag */
  28. #define XRWD_NOP 0 /* Starting state, nothing done yet */
  29. #define XRWD_INIT 1 /* Starting state, nothing done yet */
  30. #define XRWD_MIDWORD 2 /* There is no end of word in block db;*/
  31. #define XRWD_WORDEND 3 /* There is end of word in block db; */
  32. #define XRWD_BLOCKEND 4 /* There is no tails in block db; */
  33. #define XRWD_REINIT 10 /* ReStarting state, somwhere in the middle */
  34. #define XRWD_TO_BE_CONTINUED(x) ((x) == XRWD_INIT || (x) == XRWD_MIDWORD || (x) == XRWD_WORDEND)
  35. #define XRWD_TO_BE_ANSWERED(x) ((x) == XRWD_BLOCKEND || (x) == XRWD_WORDEND)
  36. #define XRWD_CA_EXACT 0 /* Command for Check Ans to verify exactly */
  37. #define XRWD_CA_INSENS 1 /* Command for Check Ans to verify caps insensitive */
  38. /* -------------------- Srtructures -------------------------------------- */
  39. #if 0
  40. typedef struct {
  41. _UCHAR l_status; /* Word continuation state */
  42. _UCHAR attribute; /* Word attribute */
  43. _UCHAR chain_num; /* Num of dictionary in chain */
  44. _UCHAR penalty; /* Penalty for current symbol */
  45. _ULONG state; /* State of sym generator */
  46. } sym_src_descr_type, _PTR p_sym_src_descr_type;
  47. typedef struct {
  48. _UCHAR sym; /* Symbol itself (OS coding) */
  49. _UCHAR penalty; /* Min penalty of the sym sources */
  50. _UCHAR sources; /* Flags of sym active sources*/
  51. sym_src_descr_type sd[XRWD_N_SRCS]; /* Sym sources descriptors */
  52. } sym_descr_type, _PTR p_sym_descr_type;
  53. #endif
  54. typedef struct {
  55. _UCHAR sym; /* Symbol itself */
  56. _UCHAR l_status; /* Word continuation state */
  57. _UCHAR attribute; /* Word attribute */
  58. _UCHAR chain_num; /* Num of dictionary in chain */
  59. _UCHAR penalty; /* Source penalty for sym */
  60. _UCHAR cdb_l_status; /* Delayed status for a codebook entry */
  61. _USHORT codeshift; /* Shift in the codebook */
  62. _ULONG state; /* State of sym generator */
  63. LMSTATE InfLMState;
  64. } fw_buf_type, _PTR p_fw_buf_type;
  65. typedef struct {
  66. _UCHAR sym; /* Symbol itself (OS coding) */
  67. _UCHAR penalty; /* Min penalty of the sym sources */
  68. _UCHAR sources; /* Flags of sym active sources*/
  69. fw_buf_type sd[XRWD_N_SRCS]; /* Sym sources descriptors */
  70. } sym_descr_type, _PTR p_sym_descr_type;
  71. #if PS_VOC /* ............................................................ */
  72. #include "vocutilp.h"
  73. typedef struct {
  74. _INT inverse; /* Direct or backward pass */
  75. _INT filter; /* Filter type (old one) */
  76. _INT flags; /* Flag register directons */
  77. _INT xrw_mode; /* XRW mode of operation */
  78. _INT dict_flags; /* Control flags for dict */
  79. sym_descr_type l_sym; /* Last assigned symbol */
  80. _INT src_id; /* ID of source of verif. */
  81. // _INT src_id_answ; /* ID of found full word */
  82. // _ULONG attribute; /* Word attribute */
  83. // _ULONG state; /* Cur verification state */
  84. _INT xrinp_len; /* Length of Xr inp seq. */
  85. _INT done_let; /* Num of letters created */
  86. _INT word_offset; /* Num let of word's last init */
  87. _INT done_xrlen; /* Num of Xr els. used */
  88. _INT main_dict_enabled; /* Is the dict enabled */
  89. p_VOID huserdict; /* user dict handle */
  90. p_VOID p_tr; /* Pointer to beg triads */
  91. p_UCHAR charset; /* Pointer to charset str. */
  92. p_UCHAR lpunct; /* Pointer to charset str. */
  93. p_UCHAR epunct; /* Pointer to charset str. */
  94. _UCHAR word[w_lim]; /* Cur word sequence */
  95. _UCHAR realword[w_lim]; /* Cur realword sequence */
  96. _UCHAR wwc_delt[w_lim]; /* Deltas betw sym-realsym in wwc */
  97. #if USE_LOCATIONS
  98. _UCHAR locations[XRINP_SIZE]; /* Positions of xr relative to step in the word */
  99. #endif
  100. p_VOID pldbsm;
  101. } lex_data_type, _PTR p_lex_data_type;
  102. #endif /* PS_VOC ......................................................... */
  103. #if AIRUS_VOC /* ......................................................... */
  104. #define BORLAND /* For Microlytics */
  105. #include "newttype.h"
  106. #include "airustyp.h"
  107. #include "microlyt.h"
  108. #include "vocutila.h"
  109. #define BLOCKEND 3 /* There is no tails in block db; */
  110. #define WORDEND 2 /* There is end of word in block db; */
  111. #define MIDWORD 1 /* There is no end of word in block db;*/
  112. typedef struct {
  113. _INT inverse;
  114. _INT filter;
  115. _INT flags;
  116. _INT xrw_mode; /* XRW mode of operation */
  117. _INT dict_flags; /* Control flags for dict */
  118. sym_descr_type l_sym; /* Last assigned symbol */
  119. _INT src_id;
  120. // _INT src_id_answ; /* ID of found full word */
  121. // _ULONG attribute;
  122. // _ULONG state;
  123. _INT xrinp_len;
  124. _INT done_let;
  125. _INT word_offset; /* Num let of word's last init */
  126. _INT done_xrlen;
  127. AirusAPtr p; /* Airus param block pointer*/
  128. ParcSpeller _PTR ps; /* Microlitycs object */
  129. _UCHAR n_vocs; /* Number of voc's in chain */
  130. _ULONG voc_IDs[MAX_DICT];/* ID codes of current dictionary */
  131. p_VOID hld; /* Character filter pointer */
  132. p_triad_type p_tr; /* Pointer to beg triads */
  133. p_UCHAR charset;
  134. p_UCHAR lpunct; /* Pointer to charset str. */
  135. p_UCHAR epunct; /* Pointer to charset str. */
  136. //CHE: _UCHARs:
  137. _UCHAR word[w_lim];
  138. _UCHAR realword[w_lim]; /* Cur realword sequence */
  139. _UCHAR wwc_delt[w_lim]; /* Deltas betw sym-realsym in wwc */
  140. #if USE_LOCATIONS
  141. _UCHAR locations[XRINP_SIZE]; /* Positions of xr relative to step in the word */
  142. #endif
  143. } lex_data_type, _PTR p_lex_data_type;
  144. #endif /* AIRUS_VOC ..................................................... */
  145. /* -------------------- Proto -------------------------------------------- */
  146. _INT GF_VocSymbolSet(lex_data_type _PTR vs, fw_buf_type (_PTR fbuf)[XRWD_MAX_LETBUF], p_rc_type prc);
  147. _INT AssignDictionaries(lex_data_type _PTR vs, rc_type _PTR rc);
  148. _INT GetWordAttributeAndID(lex_data_type _PTR vs, p_INT src_id, p_INT stat);
  149. #endif
  150. /* ************************************************************************* */
  151. /* * END OF ALLLLLLLLLLLLL * */
  152. /* ************************************************************************* */