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.

218 lines
8.8 KiB

  1. #ifndef STROKA1_H_INC
  2. #define STROKA1_H_INC
  3. #include "hwr_sys.h"
  4. #include "ams_mg.h"
  5. #include "lowlevel.h"
  6. #include "calcmacr.h"
  7. #include "def.h"
  8. #include "low_dbg.h"
  9. #if PG_DEBUG
  10. #include "pg_debug.h"
  11. #endif
  12. #define MAX_NUM_EXTR 100
  13. #define NUM_EXTR_IN_SHOULD 10
  14. #define MIN_STR_HEIGHT 12
  15. #define NORM 1
  16. #define HOR_STR 2
  17. #define T_MIN 3
  18. #define PNT 4
  19. #define I_MIN 5
  20. #define S_MIN 6
  21. #define O_MAX 61
  22. #define E_MAX 62
  23. #define E_MIN 63
  24. #define UML 7
  25. #define PUNC 8
  26. #define BEG_MAX 9
  27. #define END_MIN 10
  28. #define BEG_MIN 11
  29. #define END_MAX 12
  30. #define TAIL_MIN 13
  31. #define GAP_LEFT_UP 15
  32. #define GAP_LEFT_DOWN 16
  33. #define GAP_RIGHT_UP 17
  34. #define GAP_RIGHT_DOWN 18
  35. #define GLITCH_UP 20
  36. #define GLITCH_DOWN 30
  37. #define DBL_GLITCH_UP 40
  38. #define DBL_GLITCH_DOWN 50
  39. #define TRP_GLITCH_UP 60
  40. #define TRP_GLITCH_DOWN 70
  41. #define ON_LINE 100
  42. #define SUB_SCRIPT 101
  43. #define SUPER_SCRIPT 102
  44. #define INSIDE_LINE 103
  45. #define NARROW_LINE 104
  46. #define RET_ON_LINE 110
  47. #define NOT_ON_LINE 111
  48. #define TOO_WIDE 1
  49. #define STR_TOO_NARROW -1
  50. #define COM 201
  51. #define STRT 202
  52. #define HOR 203
  53. #define OPER 204
  54. #define FOUR_TYPE 205
  55. #define SLASH 206
  56. #define L_BRKT 207
  57. #define R_BRKT 208
  58. #define NOT_BRKT 10
  59. #define UP 0
  60. #define DOWN 1
  61. #define USE_WORDSPLIT_PARMS 1
  62. #ifdef FOR_GERMAN
  63. ROM_DATA_EXTERNAL _SCHAR TG1[3][2][2];
  64. ROM_DATA_EXTERNAL _SCHAR TG2[3][2][2];
  65. ROM_DATA_EXTERNAL _SCHAR H1[3][2][2];
  66. ROM_DATA_EXTERNAL _SCHAR H2[3][2][2];
  67. #else
  68. ROM_DATA_EXTERNAL _SCHAR TG1[3][2][2];
  69. ROM_DATA_EXTERNAL _SCHAR TG2[3][2][2];
  70. ROM_DATA_EXTERNAL _SCHAR H1[3][2][2];
  71. ROM_DATA_EXTERNAL _SCHAR H2[3][2][2];
  72. #endif
  73. //const static _LONG TG1=45/*50*/; //01_31
  74. //const static _LONG TGB=35;//50; 02_24
  75. //const static _LONG TGE1=50;
  76. //const static _LONG TGE2=35;//40; 02_17
  77. //const static _LONG H1=32/*40*/; //01_25b
  78. //const static _LONG HB1=34;//48; 02_17
  79. //const static _LONG HB2=37;//48; 02_23
  80. //const static _LONG HB3=48;
  81. //const static _LONG HE1=50;
  82. //const static _LONG HE2=47;
  83. //const static _LONG D1=57;///*55*/ //01_31
  84. //const static _LONG DB=75; ///*45 40*/ //01_24b
  85. //const static _LONG DB2=55;
  86. //const static _LONG DE1=35;
  87. //const static _LONG DE2=73;///*62 60*/ /*57*/ //02_01
  88. //const static _LONG H2=10;
  89. ROM_DATA_EXTERNAL _SCHAR CS;
  90. typedef struct
  91. {
  92. _SHORT susp;
  93. _SHORT x;
  94. _SHORT y;
  95. _SHORT i;
  96. _SHORT shift;
  97. p_SPECL pspecl;
  98. } EXTR, _PTR p_EXTR ;
  99. _INT extract_all_extr(low_type _PTR D, _UCHAR TYPE, p_EXTR line_extr,
  100. p_INT pn_all_extr,p_INT pn_extr,p_SHORT pshift);
  101. _INT extract_num_extr(low_type _PTR D, _UCHAR TYPE, p_EXTR line_extr,
  102. p_INT p_all_extr);
  103. _INT classify_strokes(low_type _PTR D,_INT med_ampl,_INT max_ampl,
  104. _INT n_ampl,p_INT pt_height,p_INT pft_height,p_BOOL psep_let);
  105. _INT classify_num_strokes(low_type _PTR D, p_INT pmed_ampl);
  106. _INT extract_ampl(low_type _PTR D,p_SHORT ampl,p_INT pn_ampl);
  107. _INT calc_mediana(p_SHORT array, _INT n_arg);
  108. _BOOL hor_stroke(p_SPECL cur, p_SHORT x, p_SHORT y, _INT n_str);
  109. _BOOL is_i_point(low_type _PTR D,p_SPECL cur,_RECT stroke_box,
  110. _INT med_ampl);
  111. _BOOL is_umlyut(p_SPECL cur, _RECT stroke_box, _INT ibeg_str, _INT iend_str,
  112. p_SHORT x, p_SHORT y,_INT med_ampl);
  113. _INT curve_com_or_brkt(low_type _PTR D,p_SPECL pend,_INT ibeg_str,
  114. _INT iend_str,_INT C_str,_USHORT lmod);
  115. _BOOL com(low_type _PTR D,p_SPECL pend,_INT ibeg_str,_INT iend_str,
  116. _INT C_str);
  117. _BOOL str_com(_INT ibeg_str,_INT iend_str,p_SHORT x,p_SHORT y,_INT C_str);
  118. _BOOL pnt(_RECT box,_INT med_ampl);
  119. _UCHAR end_punct(low_type _PTR D,p_SPECL cur,_INT med_ampl);
  120. _UCHAR lead_punct(low_type _PTR D);
  121. _VOID sort_extr(p_EXTR extr,_INT n_extr);
  122. _VOID find_gaps_in_line(p_EXTR extr,_INT n_extr,_INT n_allextr,
  123. _INT med_ampl,_UCHAR type,_INT x_left,_INT x_right,
  124. p_SHORT bord_d,p_SHORT y,_BOOL sl,_BOOL strict);
  125. _VOID find_glitches_in_line(p_EXTR line_extr, _INT n_extr,
  126. _INT med_ampl, _UCHAR type, _INT x_left, _INT x_right,
  127. p_SHORT bord_d, p_SHORT x,p_SHORT y,_INT MAX_SHIFT,_BOOL sl,_BOOL strict);
  128. _VOID glitch_to_sub_max(low_type _PTR D,p_EXTR line_max, _INT n_line_max,
  129. _INT mid_ampl,_BOOL gl_down_left);
  130. _VOID glitch_to_inside(p_EXTR extr, _INT n_extr, _UCHAR type, p_SHORT y,
  131. _INT mid_ampl,_INT x_left,_INT x_right);
  132. _VOID glitch_to_super_min(p_EXTR line_min, _INT n_line_min,p_SHORT bord_d,
  133. _INT max_height,p_SHORT x,p_SHORT y,_BOOL gl_up_left);
  134. _BOOL sub_max_to_line(low_type _PTR D,p_EXTR line_max,p_INT pn_line_max,
  135. p_SHORT bord_d,_INT max_dist);
  136. _VOID super_min_to_line(p_EXTR line_min, _INT n_line_min, p_SHORT bord_d,
  137. _INT max_line_height,_INT mid_line_height, p_INT pn_super);
  138. _INT neibour_susp_extr(p_EXTR extr,_INT n_extr,_UCHAR type,p_SHORT bord_d,
  139. _INT ft_height);
  140. _VOID all_susp_extr(p_EXTR extr,_INT n_extr,_INT n_allextr,_UCHAR type,p_SHORT y,
  141. _INT base_ampl,_INT base_ampl_sure,_INT max_ampl,
  142. p_SHORT bord_d,_INT ft_height);
  143. _INT calc_ampl(EXTR extr, p_SHORT y,_UCHAR type);
  144. _VOID spec_neibour_extr(p_EXTR extr,_INT n_extr,_UCHAR type,_INT LINE_POS);
  145. _VOID ret_to_line(p_EXTR extr,_INT n_extr,_INT i,_INT ind);
  146. _BOOL delete_line_extr(p_EXTR line_extr, p_INT pn_extr,_INT MARK);
  147. _BOOL insert_line_extr(low_type _PTR D, p_SPECL cur, p_EXTR extr,
  148. p_INT pn_extr);
  149. _INT calc_average(p_SHORT array, _INT N);
  150. _SHORT point_of_smooth_bord(_INT cur_point,_INT n_extr,p_EXTR extr,
  151. low_type _PTR D,_INT should);
  152. _VOID smooth_d_bord(p_EXTR line_max,_INT n_line_max,low_type _PTR D,
  153. _INT should,p_SHORT bord_d);
  154. _VOID smooth_u_bord(p_EXTR line_min,_INT n_line_min,low_type _PTR D,
  155. _INT should,p_SHORT bord_u,p_SHORT bord_d);
  156. _BOOL straight_stroke(_INT ibeg, _INT iend, p_SHORT x, p_SHORT y,_INT C);
  157. _INT mid_other(p_EXTR extr,_INT n_extr,_INT i);
  158. _INT sign(_INT a, _INT b);
  159. _BOOL num_bord_correction(p_EXTR extr,p_INT pn_extr,_INT n_allextr,
  160. _UCHAR type,_INT med_ampl,p_SHORT bord_d,p_SHORT y);
  161. _BOOL bord_correction(low_type _PTR D,p_EXTR extr,p_INT pn_extr,_INT n_allextr,
  162. _UCHAR type,_INT step,_INT med_ampl,_INT mid_ampl,
  163. _INT max_ampl,_INT x_left,_INT x_right,_INT LINE_POS,
  164. _UCHAR pass,p_SHORT bord_d,_INT max_height,_INT ft_height,
  165. _BOOL gl_up_left,_BOOL gl_down_left
  166. #if PG_DEBUG
  167. ,p_UCHAR pn_call1
  168. #endif
  169. );
  170. _VOID del_tail_min(p_EXTR line_min,p_INT pn_line_min,p_SHORT y,
  171. p_SHORT bord_d,_UCHAR pass);
  172. _INT line_pos_mist(low_type _PTR D,_INT med_u_bord,_INT med_d_bord,
  173. _INT med_height,_INT n_line_min,_INT n_line_max,
  174. p_EXTR line_max,p_INT pUP_LINE_POS,p_INT pDOWN_LINE_POS,
  175. p_SHORT bord_u, p_SHORT bord_d, _UCHAR pass);
  176. _BOOL extrs_open(low_type _PTR D,p_SPECL cur,_UCHAR type,_INT num);
  177. _BOOL numbers_in_text(low_type _PTR D,p_SHORT bord_u,p_SHORT bord_d);
  178. _INT fill_i_point(p_SHORT i_point, low_type _PTR D);
  179. _INT calc_med_heights(low_type _PTR D,p_EXTR line_min,p_EXTR line_max,
  180. p_SHORT bord_u,p_SHORT bord_d,p_SHORT i_point,
  181. _INT n_line_min,_INT n_line_max,_INT n_x,
  182. p_INT pmed_height,p_INT pmed_u_bord,p_INT pmed_d_bord);
  183. _BOOL correct_narrow_segments(p_EXTR extr,p_INT pn_extr,p_SHORT bord_opp,
  184. _UCHAR type,_INT med_height,_INT max_height);
  185. _BOOL correct_narrow_ends(p_EXTR extr,p_INT pn_extr,p_EXTR extr_opp,
  186. _INT n_extr_opp,_INT height,_UCHAR type);
  187. #if PG_DEBUG
  188. _VOID DBG_picture1(p_EXTR line_extr, _INT n_line_extr, _RECT box,
  189. _INT step, _INT yd, p_UCHAR pn_call);
  190. _VOID DBG_picture2(p_EXTR extr, _INT n_extr, _INT MARK);
  191. _VOID DBG_picture3(low_type _PTR D, p_SHORT bord, p_UCHAR pn_call);
  192. //_VOID save_par(p_EXTR extr,_INT n_extr,_UCHAR type,_INT med_ampl,
  193. // p_SHORT bord_d);
  194. #endif
  195. _BOOL is_defis(low_type _PTR D,_INT n_str);
  196. _VOID SpecBord(low_type _PTR D,p_SHORT bord_d,p_SHORT bord_u,
  197. p_INT pmed_d_bord,p_INT pmed_u_bord,p_INT pmed_height,
  198. #if PG_DEBUG
  199. p_UCHAR pn_call3_u,p_UCHAR pn_call3_d,
  200. #endif
  201. p_INT pn_x,_BOOL defis,p_EXTR line_max,_INT n_line_max);
  202. /*********** AVP functions for filling border values in "rc" **********/
  203. typedef _UCHAR cb_type[CB_NUM_VERTEX*2];
  204. _INT FillRCNB(p_SHORT ip, _INT nip, low_type _PTR D, /* AVP */
  205. p_SHORT bord_u, p_SHORT bord_d);
  206. _INT FillRCSpec( cb_type _PTR cb, low_type _PTR D );
  207. #endif // #ifndef STROKA1_H_INC