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.

91 lines
5.0 KiB

  1. /* *************************************************************** */
  2. /* * Word segmentation algorithm dafinitions & prototypes * */
  3. /* *************************************************************** */
  4. #ifndef WS_H_INCLUDED
  5. #define WS_H_INCLUDED
  6. /* ---- Public -- Word segmentation definitions ------------------------- */
  7. /* Defines for memory max allocation and array sizes */
  8. #define WS_MAX_LINES 128 /* Max allowed number of lines during the single session */
  9. #define WS_MAX_WORDS 128 /* Max words per session */
  10. #define WS_MAX_STROKES 128 /* Max strokes per session */
  11. #define WS_LRN_SIZE 4 /* Size of memory for learning (in words) */
  12. #define WS_TABLET_XS 8000 /* Max value of x coord from the tablet */
  13. #define WS_TABLET_DPI 400 /* Reference tablet DPI */
  14. #define WS_FL_TENTATIVE 0x01 /* Current (last) word, not segmented yet -- all unattached strokes */
  15. #define WS_FL_FINISHED 0x02 /* Word finished flag -- will not be changed any more */
  16. #define WS_FL_CHANGED 0x04 /* Word changed flag -- word was changed since last flag-reset(by recognition routine) */
  17. #define WS_FL_PROCESSED 0x08 /* Word used flag -- word was captured by calling program -- can't be changed any more */
  18. #define WS_FL_CARRYDASH 0x10 /* Last word on the line has 'carry' dash at the end */
  19. #define WS_FL_NL_GESTURE 0x20 /* Word has leading word split gesture */
  20. #define WS_FL_SPSURE 0x40 /* Size and pos of baseline are reliable for the word */
  21. #define WS_FL_LEARNED 0x80 /* Word was already used for learning */
  22. #define WS_FL_LAST 0x01 /* Input flag -- it is last stroke */
  23. #define WS_FL_FAKE 0x02 /* Input flag -- it is fake stroke */
  24. #define WS_FL_SPGESTURE 0x04 /* Input flag -- do check for space gesture */
  25. #define WS_FL_CLOSE 0x80 /* Input flag -- command to free all memory, forget learning */
  26. #define WS_FLS_UNSURE 0x01 /* Out flag for a stroke -- segm code was unsure about segmenting on this gap */
  27. /* -------------- Word segmentation definitions ------------------------- */
  28. typedef struct {
  29. _UCHAR flags; /* Word flags */
  30. _UCHAR line_num; /* Num line */
  31. _UCHAR word_num; /* Num word in line */
  32. _UCHAR seg_sure; /* Segmentation confidence */
  33. _UCHAR sep_let_level; /* Sepletovost up to now */
  34. _SCHAR slope; /* Sepletovost up to now */
  35. _UCHAR first_stroke_index; /* Loc of first word stroke in stroke index array */
  36. _UCHAR num_strokes; /* Number of strokes assigned to the word */
  37. _SHORT word_mid_line; /* Y coord of word middle line */
  38. _SHORT ave_h_bord; /* Ave size of word borders */
  39. _SHORT word_x_st; /* X coord of word start */
  40. _SHORT word_x_end; /* X coord of word end */
  41. _SHORT writing_step; /* Writing step up to now */
  42. } word_strokes_type, _PTR p_word_strokes_type;
  43. typedef word_strokes_type (_PTR p_word_strokes_array_type)[WS_MAX_WORDS];
  44. typedef struct {
  45. _UCHAR num_words; /* Num of created words */
  46. _UCHAR num_finished_words; /* Num of finished words */
  47. _UCHAR num_finished_strokes; /* Num of eternally finished strokes */
  48. p_word_strokes_array_type pwsa;
  49. _UCHAR stroke_index[WS_MAX_STROKES];
  50. _SCHAR k_surs[WS_MAX_STROKES];
  51. } ws_results_type, _PTR p_ws_results_type;
  52. typedef struct {
  53. _INT num_points; /* Number of points in current stroke */
  54. _INT flags; /* Last, fake stroke attributes, etc */
  55. _INT x_delay; /* Xdist to the end of line, which if prohibited for split */
  56. _INT sure_level; /* Input sure threshhold for NN segmentation */
  57. _INT word_dist_in; /* Input distance between words -- overwrites internal calculations */
  58. _INT line_dist_in; /* Input distance between lines -- overwrites internal calculations */
  59. // _INT tablet_max_x; /* Horizontal tablet coord range (used for memory allocation) */
  60. _INT def_h_line; /* Average estimated height of small letters in text */
  61. _ULONG hdata; /* Handle to internal data storage */
  62. _UCHAR (_PTR cmp)[WS_MAX_WORDS]; /* Debug cmp array */
  63. } ws_control_type, _PTR p_ws_control_type;
  64. /* ------------------ Export function prototypes -------------- */
  65. #endif // WS_H_INCLUDED
  66. /* *************************************************************** */
  67. /* * Word segmentation prototypes END * */
  68. /* *************************************************************** */