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.

689 lines
30 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: recogp.h
  3. *
  4. * Contains all the API for the full functionality of the recognizer for
  5. * training, testing, tuning.
  6. *
  7. * Created: 18-Feb-1996 16:34:00
  8. * Copyright (c) 1996 Microsoft Corporation
  9. \**************************************************************************/
  10. #ifndef _INC_RECOGP
  11. #define _INC_RECOGP
  12. #include "recog.h" // Contains just recognizer stuff.
  13. #ifndef _WIN32
  14. #ifndef RC_INVOKED
  15. #pragma pack(1)
  16. #endif /* RC_INVOKED */
  17. #endif //!_WIN32
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif /* __cplusplus */
  21. /**************************************************************************\
  22. * Old API declerations from recog.h
  23. * This stuff should go away as soon as we can convert all to code
  24. * to work directly with the new API.
  25. \**************************************************************************/
  26. /* Special Symbol Values potentially returned by HwxGetResults. */
  27. #define SYV_NULL 0x00000000L // Filler when list is not full
  28. /* Possible High Words of SYVs */
  29. #define SYVHI_FIRST 0 // first valid value
  30. #define SYVHI_SPECIAL 0
  31. #define SYVHI_ANSI 1
  32. #define SYVHI_GESTURE 2
  33. #define SYVHI_KANJI 3 // This is the only one actually used
  34. #define SYVHI_SHAPE 4
  35. #define SYVHI_UNICODE 5
  36. #define SYVHI_VKEY 6
  37. #define SYVHI_LAST 6 // last valid value
  38. /* Used in HwxInput in the STROKEINFO structure */
  39. #define PDK_UP 0x0000 // PDK_NULL alias
  40. #define PDK_DOWN 0x0001 // pentip switch ON due to contact
  41. #define PDK_TRANSITION 0x0010 // set by GetPenHwData
  42. #define PDK_TIPMASK 0x0001 // mask for testing PDK_DOWN
  43. // General HRC API return values (HRCR_xx):
  44. #define HRCR_COMPLETE 3 // finished recognition
  45. #define HRCR_OK 1 // success
  46. #define HRCR_ERROR (-1) // invalid param or unspecified error
  47. #define HRCR_MEMERR (-2) // memory error
  48. // SYV macros:
  49. #define FIsSpecial(syv) (HIWORD((syv))==SYVHI_SPECIAL)
  50. #define FIsAnsi(syv) (HIWORD((syv))==SYVHI_ANSI)
  51. #define FIsGesture(syv) (HIWORD((syv))==SYVHI_GESTURE)
  52. #define FIsKanji(syv) (HIWORD((syv))==SYVHI_KANJI)
  53. #define FIsShape(syv) (HIWORD((syv))==SYVHI_SHAPE)
  54. #define FIsUniCode(syv) (HIWORD((syv))==SYVHI_UNICODE)
  55. #define FIsVKey(syv) (HIWORD((syv))==SYVHI_VKEY)
  56. #define ChSyvToAnsi(syv) ((BYTE) (LOBYTE(LOWORD((syv)))))
  57. #define WSyvToKanji(syv) ((WORD) (LOWORD((syv))))
  58. #define SyvToUnicode(syv) ((WORD) (LOWORD((syv))))
  59. #define SyvCharacterToSymbol(c) ((LONG)(unsigned char)(c) | 0x00010000)
  60. #define SyvKanjiToSymbol(c) ((LONG)(UINT)(c) | 0x00030000)
  61. typedef LONG SYV; // Symbol Value
  62. typedef SYV FAR* PSYV; // ptr to SYV
  63. DECLARE_HANDLE(HINKSET); // handle to an inkset
  64. typedef HINKSET FAR* LPHINKSET;
  65. typedef struct tagSTROKEINFO // 1.0 stroke header
  66. {
  67. UINT cPnt; // count of points in stroke
  68. UINT cbPnts; // size of stroke in bytes
  69. UINT wPdk; // state of stroke
  70. DWORD dwTick; // time at beginning of stroke
  71. } STROKEINFO, *PSTROKEINFO, FAR *LPSTROKEINFO;
  72. typedef struct tagBOXRESULTS // 2.0
  73. {
  74. UINT indxBox; // zero-based index in guide structure where char was written
  75. HINKSET hinksetBox; // unused
  76. SYV rgSyv[1]; // variable-sized array of characters returned
  77. } BOXRESULTS, *PBOXRESULTS, FAR *LPBOXRESULTS;
  78. /* Passed in to HwxSetGuide. Specifies where the boxes are on the screen */
  79. typedef struct tagGUIDE // 1.0 guide structure
  80. {
  81. int xOrigin; // left edge of first box (screen coord)
  82. int yOrigin; // top edge of first box (screen coord)
  83. int cxBox; // width of a single box
  84. int cyBox; // height of a single box
  85. int cxBase; // in-box x-margin to guideline
  86. int cyBase; // in-box y offset from top to baseline
  87. int cHorzBox; // count of boxed columns
  88. int cVertBox; // count of boxed rows
  89. int cyMid; // 0 or distance from baseline to midline
  90. } GUIDE, *PGUIDE, FAR *LPGUIDE;
  91. //////////////////
  92. // Mappings to deal with names that changed during cleanup.
  93. //////////////////
  94. #define ALC_COMMON_KANJI ALC_KANJI_COMMON
  95. #define ALC_RARE_KANJI ALC_KANJI_RARE
  96. #define ALC_COMMON_HANGUL ALC_HANGUL_COMMON
  97. #define ALC_RARE_HANGUL ALC_HANGUL_RARE
  98. /**************************************************************************\
  99. * END Old API declerations from recog.h
  100. \**************************************************************************/
  101. // Gesture sets for EnableGestureSetHRC (bit flags):
  102. #define GST_SEL 0x00000001L // sel & lasso
  103. #define GST_CLIP 0x00000002L // cut copy paste
  104. #define GST_WHITE 0x00000004L // sp tab ret
  105. #define GST_KKCONVERT 0x00000008L // kkconvert
  106. #define GST_EDIT 0x00000010L // insert correct undo clear
  107. #define GST_SYS 0x00000017L // all of the above
  108. #define GST_CIRCLELO 0x00000100L // lowercase circle
  109. #define GST_CIRCLEUP 0x00000200L // uppercase circle
  110. #define GST_CIRCLE 0x00000300L // all circle
  111. #define GST_ALL 0x00000317L // all of the above
  112. // SetWordlistCoercionHRC options:
  113. #define SCH_FIRST 0 // first valid value /* ;Internal */
  114. #define SCH_NONE 0 // turn off coercion
  115. #define SCH_ADVISE 1 // macro is hint only
  116. #define SCH_FORCE 2 // some result is forced from macro
  117. #define SCH_LAST 2 // last value /* ;Internal */
  118. // SetInternationalHRC options:
  119. #define SSH_FIRST 1 // first valid value /* ;Internal */
  120. #define SSH_RD 1 // to right and down (English)
  121. #define SSH_RU 2 // to right and up
  122. #define SSH_LD 3 // to left and down (Hebrew)
  123. #define SSH_LU 4 // to left and up
  124. #define SSH_DL 5 // down and to the left (Chinese)
  125. #define SSH_DR 6 // down and to the right (Chinese)
  126. #define SSH_UL 7 // up and to the left
  127. #define SSH_UR 8 // up and to the right
  128. #define SSH_LAST 8 // last valid value /* ;Internal */
  129. #define SIH_ALLANSICHAR 1 // use all ANSI
  130. // ConfigRecognizer and ConfigHREC options:
  131. #define WCR_RECOGNAME 0 // ConfigRecognizer 1.0
  132. #define WCR_QUERY 1
  133. #define WCR_CONFIGDIALOG 2
  134. #define WCR_DEFAULT 3
  135. #define WCR_RCCHANGE 4
  136. #define WCR_VERSION 5
  137. #define WCR_TRAIN 6
  138. #define WCR_TRAINSAVE 7
  139. #define WCR_TRAINMAX 8
  140. #define WCR_TRAINDIRTY 9
  141. #define WCR_TRAINCUSTOM 10
  142. #define WCR_QUERYLANGUAGE 11
  143. #define WCR_USERCHANGE 12
  144. // Misc RC Definitions:
  145. #define CL_NULL 0
  146. #define CL_MINIMUM 1 // minimum confidence level
  147. #define CL_MAXIMUM 100 // max (require perfect recog)
  148. #define cwRcReservedMax 8 // rc.rgwReserved[cwRcReservedMax]
  149. #define ENUM_MINIMUM 1
  150. #define ENUM_MAXIMUM 4096
  151. #define HKP_SETHOOK 0 // SetRecogHook()
  152. #define HKP_UNHOOK 0xFFFF
  153. #define HWR_FIRST 0 // first valid value /* ;Internal */
  154. #define HWR_RESULTS 0
  155. #define HWR_APPWIDE 1
  156. #define HWR_LAST 1 // last valid value /* ;Internal */
  157. #define iSycNull (-1)
  158. #define MAXDICTIONARIES 16 // rc.rglpdf[MAXDICTIONARIES]
  159. #define wPntAll (UINT)0xFFFF
  160. #define cbRcLanguageMax 44 // rc.lpLanguage[cbRcLanguageMax]
  161. #define cbRcUserMax 32 // rc.lpUser[cbRcUserMax]
  162. #define cbRcrgbfAlcMax 32 // rc.rgbfAlc[cbRcrgbfAlcMax]
  163. #define RC_WDEFAULT 0xffff
  164. #define RC_LDEFAULT 0xffffffffL
  165. #define RC_WDEFAULTFLAGS 0x8000
  166. #define RC_LDEFAULTFLAGS 0x80000000L
  167. // ALC macros:
  168. #define MpAlcB(lprc,i) ((lprc)->rgbfAlc[((i) & 0xff) >> 3])
  169. #define MpIbf(i) ((BYTE)(1 << ((i) & 7)))
  170. #define SetAlcBitAnsi(lprc,i) do {MpAlcB(lprc,i) |= MpIbf(i);} while (0)
  171. #define ResetAlcBitAnsi(lprc,i) do {MpAlcB(lprc,i) &= ~MpIbf(i);} while (0)
  172. #define IsAlcBitAnsi(lprc, i) ((MpAlcB(lprc,i) & MpIbf(i)) != 0)
  173. // Intervals:
  174. typedef struct tagABSTIME // 2.0 absolute date/time
  175. {
  176. DWORD sec; // number of seconds since 1/1/1970, ret by CRTlib time() fn
  177. UINT ms; // additional offset in ms, 0..999
  178. } ABSTIME, *PABSTIME, FAR *LPABSTIME;
  179. // difference of two absolute times (at2 > at1 for positive result):
  180. #define dwDiffAT(at1, at2)\
  181. (1000L*((at2).sec - (at1).sec) - (DWORD)(at1).ms + (DWORD)(at2).ms)
  182. // comparison of two absolute times (TRUE if at1 < at2):
  183. #define FLTAbsTime(at1, at2)\
  184. ((at1).sec < (at2).sec || ((at1).sec == (at2).sec && (at1).ms < (at2).ms))
  185. #define FLTEAbsTime(at1, at2)\
  186. ((at1).sec < (at2).sec || ((at1).sec == (at2).sec && (at1).ms <= (at2).ms))
  187. #define FEQAbsTime(at1, at2)\
  188. ((at1).sec == (at2).sec && (at1).ms == (at2).ms)
  189. // test if abstime is within an interval:
  190. #define FAbsTimeInInterval(at, lpi)\
  191. (FLTEAbsTime((lpi)->atBegin, at) && FLTEAbsTime(at, (lpi)->atEnd))
  192. // test if interval (lpiT) is within an another interval (lpiS):
  193. #define FIntervalInInterval(lpiT, lpiS)\
  194. (FLTEAbsTime((lpiS)->atBegin, (lpiT)->atBegin)\
  195. && FLTEAbsTime((lpiT)->atEnd, (lpiS)->atEnd))
  196. // test if interval (lpiT) intersects another interval (lpiS):
  197. #define FIntervalXInterval(lpiT, lpiS)\
  198. (!(FLTAbsTime((lpiT)->atEnd, (lpiS)->atBegin)\
  199. || FLTAbsTime((lpiS)->atEnd, (lpiT)->atBegin)))
  200. // duration of an LPINTERVAL in ms:
  201. #define dwDurInterval(lpi) dwDiffAT((lpi)->atBegin, (lpi)->atEnd)
  202. // fill a pointer to an ABSTIME structure from a count of seconds and ms:
  203. #define MakeAbsTime(lpat, isec, ims) do {\
  204. (lpat)->sec = isec + ((ims) / 1000);\
  205. (lpat)->ms = (ims) % 1000;\
  206. } while (0)
  207. // This should not be used any more.
  208. /*
  209. #define SYV_UNKNOWN 0x00000001L
  210. #define SYV_EMPTY 0x00000003L // no longer used
  211. #define SYV_BEGINOR 0x00000010L // no longer used
  212. #define SYV_ENDOR 0x00000011L // no longer used
  213. #define SYV_OR 0x00000012L // no longer used
  214. #define SYV_SOFTNEWLINE 0x00000020L // no longer used
  215. #define SYV_SPACENULL 0x00010000L // no longer used
  216. */
  217. // SYV values for gestures:
  218. /* Not used any more
  219. #define SYV_SELECTFIRST 0x0002FFC0L // . means circle in following
  220. #define SYV_LASSO 0x0002FFC1L // lasso o-tap
  221. #define SYV_SELECTLEFT 0x0002FFC2L // no glyph
  222. #define SYV_SELECTRIGHT 0x0002FFC3L // no glyph
  223. #define SYV_SELECTLAST 0x0002FFCFL // 16 SYVs reserved for selection
  224. #define SYV_CLEARCHAR 0x0002FFD2L // d.
  225. #define SYV_HELP 0x0002FFD3L // no glyph
  226. #define SYV_KKCONVERT 0x0002FFD4L // k.
  227. #define SYV_CLEAR 0x0002FFD5L // d.
  228. #define SYV_INSERT 0x0002FFD6L // ^.
  229. #define SYV_CONTEXT 0x0002FFD7L // m.
  230. #define SYV_EXTENDSELECT 0x0002FFD8L // no glyph
  231. #define SYV_UNDO 0x0002FFD9L // u.
  232. #define SYV_COPY 0x0002FFDAL // c.
  233. #define SYV_CUT 0x0002FFDBL // x.
  234. #define SYV_PASTE 0x0002FFDCL // p.
  235. #define SYV_CLEARWORD 0x0002FFDDL // no glyph
  236. #define SYV_USER 0x0002FFDEL // reserved
  237. #define SYV_CORRECT 0x0002FFDFL // check.
  238. #define SYV_BACKSPACE 0x00020008L // no glyph
  239. #define SYV_TAB 0x00020009L // t.
  240. #define SYV_RETURN 0x0002000DL // n.
  241. #define SYV_SPACE 0x00020020L // s.
  242. */
  243. // Application specific gestures, Circle a-z and Circle A-Z:
  244. /* Not used any more
  245. #define SYV_APPGESTUREMASK 0x00020000L
  246. #define SYV_CIRCLEUPA 0x000224B6L // map into Unicode space
  247. #define SYV_CIRCLEUPZ 0x000224CFL // for circled letters
  248. #define SYV_CIRCLELOA 0x000224D0L
  249. #define SYV_CIRCLELOZ 0x000224E9L
  250. */
  251. // SYV definitions for shapes:
  252. /* Not used any more
  253. #define SYV_SHAPELINE 0x00040001L
  254. #define SYV_SHAPEELLIPSE 0x00040002L
  255. #define SYV_SHAPERECT 0x00040003L
  256. #define SYV_SHAPEMIN SYV_SHAPELINE // alias
  257. #define SYV_SHAPEMAX SYV_SHAPERECT // alias
  258. */
  259. /* Not used any more
  260. #define FIsSelectGesture(syv) \
  261. ((syv) >= SYVSELECTFIRST && (syv) <= SYVSELECTLAST)
  262. #define FIsStdGesture(syv) \
  263. ( \
  264. FIsSelectGesture(syv) \
  265. || (syv)==SYV_CLEAR \
  266. || (syv)==SYV_HELP \
  267. || (syv)==SYV_EXTENDSELECT \
  268. || (syv)==SYV_UNDO \
  269. || (syv)==SYV_COPY \
  270. || (syv)==SYV_CUT \
  271. || (syv)==SYV_PASTE \
  272. || (syv)==SYV_CLEARWORD \
  273. || (syv)==SYV_KKCONVERT \
  274. || (syv)==SYV_USER \
  275. || (syv)==SYV_CORRECT \
  276. )
  277. #define FIsAnsiGesture(syv) \
  278. ( \
  279. (syv) == SYV_BACKSPACE \
  280. || (syv) == SYV_TAB \
  281. || (syv) == SYV_RETURN \
  282. || (syv) == SYV_SPACE \
  283. )
  284. */
  285. // GetPenDataAttributes options (GPA_xx):
  286. #define GPA_FIRST 1 // first valid value /* ;Internal */
  287. #define GPA_MAXLEN 1 // length of longest stroke
  288. #define GPA_POINTS 2 // total number of points
  289. #define GPA_PDTS 3 // PDTS_xx bits
  290. #define GPA_RATE 4 // get sampling rate
  291. #define GPA_RECTBOUND 5 // bounding rect of all points
  292. #define GPA_RECTBOUNDINK 6 // ditto, adj for fat ink
  293. #define GPA_SIZE 7 // size of pendata in bytes
  294. #define GPA_STROKES 8 // total number of strokes
  295. #define GPA_TIME 9 // absolute time at creation of pendata
  296. #define GPA_USER 10 // number of user bytes available: 0, 1, 2, 4
  297. #define GPA_VERSION 11 // version number of pendata
  298. #define GPA_LAST 11 // last valid value /* ;Internal */
  299. #define GPA_VERCHKINTERNAL 98 // to validate pendata /* ;Internal */
  300. #define GPA_TICKREFINTERNAL 99 // to get tickref /* ;Internal */
  301. // GetStrokeAttributes options (GSA_xx):
  302. #define GSA_FIRST 1 // first valid value /* ;Internal */
  303. #define GSA_PENTIP 1 // get stroke pentip (color, width, nib)
  304. #define GSA_PENTIPCLASS 2 // same as GSA_PENTIP
  305. #define GSA_USER 3 // get stroke user value
  306. #define GSA_USERCLASS 4 // get stroke's class user value
  307. #define GSA_TIME 5 // get time of stroke
  308. #define GSA_SIZE 6 // get size of stroke in points and bytes
  309. #define GSA_SELECT 7 // get selection status of stroke
  310. #define GSA_DOWN 8 // get up/down state of stroke
  311. #define GSA_RECTBOUND 9 // get the bounding rectangle of the stroke
  312. #define GSA_LAST 9 // last valid value /* ;Internal */
  313. // GetStrokeTableAttributes options (GSA_xx):
  314. #define GSA_PENTIPTABLE 10 // get table-indexed pentip
  315. #define GSA_SIZETABLE 11 // get count of Stroke Class Table entries
  316. #define GSA_USERTABLE 12 // get table-indexed user value
  317. // General PenData API return values (PDR_xx):
  318. #define PDR_NOHIT 3 // hit test failed
  319. #define PDR_HIT 2 // hit test succeeded
  320. #define PDR_OK 1 // success
  321. #define PDR_CANCEL 0 // callback cancel or impasse
  322. #define PDR_ERROR (-1) // parameter or unspecified error
  323. #define PDR_PNDTERR (-2) // bad pendata
  324. #define PDR_VERSIONERR (-3) // pendata version error
  325. #define PDR_COMPRESSED (-4) // pendata is compressed
  326. #define PDR_STRKINDEXERR (-5) // stroke index error
  327. #define PDR_PNTINDEXERR (-6) // point index error
  328. #define PDR_MEMERR (-7) // memory error
  329. #define PDR_INKSETERR (-8) // bad inkset
  330. #define PDR_ABORT (-9) // pendata has become invalid, e.g.
  331. #define PDR_NA (-10) // option not available (pw kernel)
  332. #define PDR_USERDATAERR (-16) // user data error
  333. #define PDR_SCALINGERR (-17) // scale error
  334. #define PDR_TIMESTAMPERR (-18) // timestamp error
  335. #define PDR_OEMDATAERR (-19) // OEM data error
  336. #define PDR_SCTERR (-20) // SCT error (full)
  337. // PenData Scaling (PDTS):
  338. #define PDTS_FIRST 0 // first valid value /* ;Internal */
  339. #define PDTS_LOMETRIC 0 // 0.01mm
  340. #define PDTS_HIMETRIC 1 // 0.001mm
  341. #define PDTS_HIENGLISH 2 // 0.001"
  342. #define PDTS_STANDARDSCALE 2 // PDTS_HIENGLISH alias
  343. #define PDTS_DISPLAY 3 // display pixel
  344. #define PDTS_ARBITRARY 4 // app-specific scaling
  345. #define PDTS_SCALEMASK 0x000F // scaling values in low nibble
  346. #define PDTS_LAST 4 // last valid value /* ;Internal */
  347. #define PDTS_SCALEMAX 3 // largest scaling type /* ;Internal */
  348. #define MAXOEMDATAWORDS 6 // rgwOemData[MAXOEMDATAWORDS]
  349. // Handwriting Recognizer:
  350. // GetResultsHRC options:
  351. #define GRH_FIRST 0 // first valid value /* ;Internal */
  352. #define GRH_ALL 0 // get all results
  353. #define GRH_GESTURE 1 // get only gesture results
  354. #define GRH_NONGESTURE 2 // get all but gesture results
  355. #define GRH_LAST 2 // last valid value /* ;Internal */
  356. // system wordlist for AddWordsHWL:
  357. #define HWL_SYSTEM ((HWL)1) // magic value means system wordlist
  358. // TrainHREC options:
  359. #define TH_FIRST 0 // first valid value /* ;Internal */
  360. #define TH_QUERY 0 // query the user if conflict
  361. #define TH_FORCE 1 // ditto no query
  362. #define TH_SUGGEST 2 // abandon training if conflict
  363. #define TH_LAST 2 // last valid value /* ;Internal */
  364. // Return values for WCR_TRAIN Function
  365. #define TRAIN_NONE 0x0000
  366. #define TRAIN_DEFAULT 0x0001
  367. #define TRAIN_CUSTOM 0x0002
  368. #define TRAIN_BOTH (TRAIN_DEFAULT | TRAIN_CUSTOM)
  369. // Control values for TRAINSAVE
  370. #define TRAIN_FIRST 0 // first valid value /* ;Internal */
  371. #define TRAIN_SAVE 0 // save changes that have been made
  372. #define TRAIN_REVERT 1 // discard changes that have been made
  373. #define TRAIN_RESET 2 // use factory settings
  374. #define TRAIN_LAST 3 // last valid value /* ;Internal */
  375. // ConfigHREC options:
  376. #define WCR_PWVERSION 13 // ver of PenWin recognizer supports
  377. #define WCR_GETALCPRIORITY 14 // get recognizer's ALC priority
  378. #define WCR_SETALCPRIORITY 15 // set recognizer's ALC priority
  379. #define WCR_GETANSISTATE 16 // get ALLANSICHAR state
  380. #define WCR_SETANSISTATE 17 // set ALLANSICHAR if T
  381. #define WCR_GETHAND 18 // get writing hand
  382. #define WCR_SETHAND 19 // set writing hand
  383. #define WCR_GETDIRECTION 20 // get writing direction
  384. #define WCR_SETDIRECTION 21 // set writing direction
  385. #define WCR_INITRECOGNIZER 22 // init recognizer and set user name
  386. #define WCR_CLOSERECOGNIZER 23 // close recognizer
  387. #define WCR_LAST 23 // last valid std value /* ;Internal */
  388. #define WCR_PRIVATE 1024
  389. // sub-functions of WCR_USERCHANGE
  390. #define CRUC_FIRST 0 // first valid value /* ;Internal */
  391. #define CRUC_NOTIFY 0 // user name change
  392. #define CRUC_REMOVE 1 // user name deleted
  393. #define CRUC_LAST 1 // last valid value /* ;Internal */
  394. // Word List Types:
  395. #define WLT_FIRST 0 // first valid value /* ;Internal */
  396. #define WLT_STRING 0 // one string
  397. #define WLT_STRINGTABLE 1 // array of strings
  398. #define WLT_EMPTY 2 // empty wordlist
  399. #define WLT_WORDLIST 3 // handle to a wordlist
  400. #define WLT_LAST 3 // last valid value /* ;Internal */
  401. // RC Direction:
  402. #define RCD_FIRST 0 // first valid value /* ;Internal */
  403. #define RCD_DEFAULT 0 // def none
  404. #define RCD_LR 1 // left to right like English
  405. #define RCD_RL 2 // right to left like Arabic
  406. #define RCD_TB 3 // top to bottom like Japanese
  407. #define RCD_BT 4 // bottom to top like some Chinese
  408. #define RCD_LAST 4 // last valid value /* ;Internal */
  409. // ProcessHRC time constants:
  410. #define PH_DEFAULT 0xFFFFFFFEL // reasonable time
  411. #define PH_MIN 0xFFFFFFFDL // minimum time
  412. //////////////////////////////////////////////////////////////////////////////
  413. /****** Typedefs ************************************************************/
  414. typedef int CL; // Confidence Level
  415. typedef UINT HKP; // Hook Parameter
  416. typedef int REC; // recognition result
  417. // ;Internal comment: DECLARE_HANDLE32 is not defined in 32-bit windows.h
  418. #ifndef DECLARE_HANDLE32
  419. #define DECLARE_HANDLE32(name)\
  420. struct name##__ { int unused; };\
  421. typedef const struct name##__ FAR* name
  422. #endif //!DECLARE_HANDLE32
  423. DECLARE_HANDLE(HPENDATA); // handle to ink
  424. DECLARE_HANDLE(HREC); // handle to recognizer
  425. typedef ALC FAR* LPALC; // ptr to ALC
  426. typedef SYV FAR* LPSYV; // ptr to SYV
  427. // Pointer Types:
  428. typedef LPVOID LPOEM; // alias
  429. typedef HPENDATA FAR* LPHPENDATA; // ptr to HPENDATA
  430. // Structures:
  431. #define cbABSTIME32 (4+4) /* ;Internal */
  432. typedef struct tagPENDATAHEADER // 1.0 main pen data header
  433. {
  434. UINT wVersion; // pen data format version
  435. UINT cbSizeUsed; // size of pendata mem block in bytes
  436. UINT cStrokes; // number of strokes (incl up-strokes)
  437. UINT cPnt; // count of all points
  438. UINT cPntStrokeMax; // length (in points) of longest stroke
  439. RECT rectBound; // bounding rect of all down points
  440. UINT wPndts; // PDTS_xx bits
  441. int nInkWidth; // ink width in pixels
  442. DWORD rgbInk; // ink color
  443. }
  444. PENDATAHEADER, FAR *LPPENDATAHEADER, FAR *LPPENDATA;
  445. #define cbPENDATAHEADER32 (4+4+4+4+4+16+4+4+4) /* ;Internal */
  446. #define cbSTROKEINFO32 (4+4+4+4) /* ;Internal */
  447. typedef struct tagOEMPENINFO // 1.0 OEM pen/tablet hdwe info
  448. {
  449. UINT wPdt; // pen data type
  450. UINT wValueMax; // largest val ret by device
  451. UINT wDistinct; // number of distinct readings possible
  452. }
  453. OEMPENINFO, FAR *LPOEMPENINFO;
  454. #define cbOEMPENINFO32 (4+4+4) /* ;Internal */
  455. typedef struct tagPENINFO // 1.0 pen/tablet hdwe info
  456. {
  457. UINT cxRawWidth; // max x coord and tablet width in 0.001"
  458. UINT cyRawHeight; // ditto y, height
  459. UINT wDistinctWidth; // number of distinct x values tablet ret
  460. UINT wDistinctHeight; // ditto y
  461. int nSamplingRate; // samples / second
  462. int nSamplingDist; // min distance to move before generating event
  463. LONG lPdc; // Pen Device Capabilities
  464. int cPens; // number of pens supported
  465. int cbOemData; // width of OEM data packet
  466. OEMPENINFO rgoempeninfo[MAXOEMDATAWORDS]; // supported OEM data types
  467. UINT rgwReserved[7]; // for internal use
  468. UINT fuOEM; // which OEM data, timing, PDK_xx to report
  469. }
  470. PENINFO, FAR *LPPENINFO;
  471. #define cbPENINFO32 (4+4+4+4+4+4+4+4+4+cbOEMPENINFO32*MAXOEMDATAWORDS+4*7+4) /* ;Internal */
  472. // Handwriting Recognizer:
  473. DECLARE_HANDLE32(HRCRESULT); // HRC result
  474. DECLARE_HANDLE32(HWL); // Handwriting wordlist
  475. typedef HRCRESULT FAR *LPHRCRESULT;
  476. typedef HWL FAR *LPHWL;
  477. typedef struct tagINTERVAL // 2.0 interval structure for inksets
  478. {
  479. ABSTIME atBegin; // begining of 1-ms granularity interval
  480. ABSTIME atEnd; // 1 ms past end of interval
  481. }
  482. INTERVAL, FAR *LPINTERVAL;
  483. #define cbINTERVAL32 (cbABSTIME32*2) /* ;Internal */
  484. #define cbBOXRESULTS32 (4+4+4) /* ;Internal */
  485. #define cbGUIDE32 (4+4+4+4+4+4+4+4+4) /* ;Internal */
  486. #define HRCR_NORESULTS 4 // No possible results to be found
  487. #define HRCR_GESTURE 2 // recognized gesture
  488. #define HRCR_INCOMPLETE 0 // recognizer is processing input
  489. #define HRCR_INVALIDGUIDE (-3) // invalid GUIDE struct
  490. #define HRCR_INVALIDPNDT (-4) // invalid pendata
  491. #define HRCR_UNSUPPORTED (-5) // recognizer does not support feature
  492. #define HRCR_CONFLICT (-6) // training conflict
  493. #define HRCR_HOOKED (-8) // hookasaurus ate the result
  494. // PenData:
  495. LPPENDATA WINAPI BeginEnumStrokes(HPENDATA);
  496. LPPENDATA WINAPI EndEnumStrokes(HPENDATA);
  497. HPENDATA WINAPI CreatePenData(LPPENINFO, int, UINT, UINT);
  498. BOOL WINAPI GetPenDataStroke(LPPENDATA, UINT, LPPOINT FAR*,
  499. LPVOID FAR*, LPSTROKEINFO);
  500. HPENDATA WINAPI AddPointsPenData(HPENDATA, LPPOINT, LPVOID, LPSTROKEINFO);
  501. BOOL WINAPI DestroyPenData(HPENDATA);
  502. HPENDATA WINAPI DuplicatePenData(HPENDATA, UINT);
  503. int WINAPI GetPenDataAttributes(HPENDATA, LPVOID, UINT);
  504. BOOL WINAPI GetPenDataInfo(HPENDATA, LPPENDATAHEADER, LPPENINFO, DWORD);
  505. int WINAPI GetStrokeAttributes(HPENDATA, UINT, LPVOID, UINT);
  506. // Parameter to GetPrivateRecInfoHRC
  507. #define PRI_WEIGHT (WPARAM) 0
  508. #define PRI_GUIDE (WPARAM) 1
  509. #define PRI_GLYPHSYM (WPARAM) 2
  510. #define PRI_SIGMA (WPARAM) 3
  511. // Private version of HwxConfig used to load recognizer databases from files instead
  512. // of resources.
  513. BOOL WINAPI HwxConfigEx(wchar_t *pLocale, wchar_t *pLocaleDir, wchar_t *pRecogDir);
  514. // Private API for training/tuning
  515. int WINAPI GetPrivateRecInfoHRC(HRC, WPARAM, LPARAM);
  516. int WINAPI SetPrivateRecInfoHRC(HRC, WPARAM, LPARAM);
  517. // Handwriting Recognizer:
  518. int WINAPI AddPenDataHRC(HRC, HPENDATA);
  519. int WINAPI AddPenInputHRC(HRC, LPPOINT, LPVOID, UINT, LPSTROKEINFO);
  520. int WINAPI AddWordsHWL(HWL, LPSTR, UINT);
  521. HRC WINAPI CreateCompatibleHRC(HRC, HREC);
  522. HWL WINAPI CreateHWL(HREC, LPSTR, UINT, DWORD);
  523. HINKSET WINAPI CreateInksetHRCRESULT(HRCRESULT, UINT, UINT);
  524. HPENDATA WINAPI CreatePenDataHRC(HRC);
  525. int WINAPI DestroyHRC(HRC);
  526. int WINAPI DestroyHRCRESULT(HRCRESULT);
  527. int WINAPI DestroyHWL(HWL);
  528. int WINAPI EnableGestureSetHRC(HRC, SYV, BOOL);
  529. int WINAPI EnableSystemDictionaryHRC(HRC, BOOL);
  530. int WINAPI EndPenInputHRC(HRC);
  531. int WINAPI GetAlphabetHRC(HRC, LPALC, LPBYTE);
  532. int WINAPI GetAlphabetPriorityHRC(HRC, LPALC, LPBYTE);
  533. int WINAPI GetAlternateWordsHRCRESULT(HRCRESULT, UINT, UINT,
  534. LPHRCRESULT, UINT);
  535. int WINAPI GetBoxMappingHRCRESULT(HRCRESULT, UINT, UINT, UINT FAR*);
  536. int WINAPI GetBoxResultsHRC(HRC, UINT, UINT, UINT, LPBOXRESULTS, BOOL);
  537. int WINAPI GetGuideHRC(HRC, LPGUIDE, UINT FAR*);
  538. int WINAPI GetHotspotsHRCRESULT(HRCRESULT, UINT, LPPOINT, UINT);
  539. HREC WINAPI GetHRECFromHRC(HRC);
  540. int WINAPI GetInternationalHRC(HRC, UINT FAR*, LPSTR, UINT FAR*,
  541. UINT FAR*);
  542. int WINAPI GetMaxResultsHRC(HRC);
  543. int WINAPI GetResultsHRC(HRC, UINT, LPHRCRESULT, UINT);
  544. int WINAPI GetSymbolCountHRCRESULT(HRCRESULT);
  545. int WINAPI GetSymbolsHRCRESULT(HRCRESULT, UINT, LPSYV, UINT);
  546. int WINAPI GetWordlistHRC(HRC, LPHWL);
  547. int WINAPI GetWordlistCoercionHRC(HRC);
  548. int WINAPI ReadHWL(HWL, HFILE);
  549. int WINAPI SetAlphabetHRC(HRC, ALC, LPBYTE);
  550. int WINAPI SetAlphabetPriorityHRC(HRC, ALC, LPBYTE);
  551. int WINAPI SetAbortHRC(HRC, DWORD *);
  552. int WINAPI SetBoxAlphabetHRC(HRC, LPALC, UINT);
  553. int WINAPI SetGuideHRC(HRC, LPGUIDE, UINT);
  554. int WINAPI SetInternationalHRC(HRC, UINT, LPCSTR, UINT, UINT);
  555. int WINAPI SetMaxResultsHRC(HRC, UINT);
  556. int WINAPI SetPartialHRC(HRC, DWORD);
  557. int WINAPI SetWordlistCoercionHRC(HRC, UINT);
  558. int WINAPI SetWordlistHRC(HRC, HWL);
  559. int WINAPI TrainHREC(HREC, LPSYV, UINT, HPENDATA, UINT);
  560. int WINAPI WriteHWL(HWL, HFILE);
  561. int WINAPI ProcessHRC(HRC, DWORD);
  562. HREC WINAPI InstallRecognizer(LPSTR);
  563. // Inksets:
  564. BOOL WINAPI AddInksetInterval(HINKSET, LPINTERVAL);
  565. HINKSET WINAPI CreateInkset(UINT);
  566. BOOL WINAPI DestroyInkset(HINKSET);
  567. int WINAPI GetInksetInterval(HINKSET, UINT, LPINTERVAL);
  568. int WINAPI GetInksetIntervalCount(HINKSET);
  569. // Symbol Values:
  570. int WINAPI CharacterToSymbol(LPSTR, int, LPSYV);
  571. BOOL WINAPI SymbolToCharacter(LPSYV, int, LPSTR, LPINT);
  572. UINT WINAPI ConfigRecognizer(UINT, WPARAM, LPARAM);
  573. #ifdef __cplusplus
  574. }
  575. #endif /* __cplusplus */
  576. #ifndef _WIN32
  577. #ifndef RC_INVOKED
  578. #pragma pack()
  579. #endif /* RC_INVOKED */
  580. #endif //!_WIN32
  581. #endif /* #define _INC_RECOGP */