2
Copyright (c) 1993-2008, Cognitive Technologies
5
����������� ��������� ��������������� � ������������� ��� � ���� ��������� ����,
6
��� � � �������� �����, � ����������� ��� ���, ��� ���������� ��������� �������:
8
* ��� ��������� ��������������� ��������� ���� ������ ���������� ���������
9
���� ����������� �� ��������� �����, ���� ������ ������� � �����������
11
* ��� ��������� ��������������� ��������� ���� � ������������ �/��� �
12
������ ����������, ������������ ��� ���������������, ������ �����������
13
��������� ���� ���������� �� ��������� �����, ���� ������ ������� �
14
����������� ����� �� ��������.
15
* �� �������� Cognitive Technologies, �� ����� �� ����������� �� �����
16
���� ������������ � �������� �������� ��������� �/��� �����������
17
���������, ���������� �� ���� ��, ��� ���������������� �����������
20
��� ��������� ������������� ����������� ��������� ���� �/��� ������� ������ "���
21
��� ����" ��� ������-���� ���� ��������, ���������� ���� ��� ���������������,
22
������� �������� ������������ �������� � ����������� ��� ���������� ����, �� ��
23
������������� ���. �� �������� ��������� ���� � �� ���� ������ ����, �������
24
����� �������� �/��� �������� �������������� ���������, �� � ���� ������ ��
25
��Ѩ� ���������������, ������� ����� �����, ���������, ����������� ���
26
������������� ������, ��������� � �������������� ��� ���������� ����������
27
������������� ������������� ��������� (������� ������ ������, ��� ������,
28
������� ���������, ��� ������ �/��� ������ �������, ���������� ��-�� ��������
29
������� ��� �/��� ������ ��������� �������� ��������� � ������� �����������,
30
�� �� ������������� ����� ��������), �� �� ������������� ���, ���� ���� �����
31
�������� ��� ������ ���� ���� �������� � ����������� ����� ������� � ������.
33
Redistribution and use in source and binary forms, with or without modification,
34
are permitted provided that the following conditions are met:
36
* Redistributions of source code must retain the above copyright notice,
37
this list of conditions and the following disclaimer.
38
* Redistributions in binary form must reproduce the above copyright notice,
39
this list of conditions and the following disclaimer in the documentation
40
and/or other materials provided with the distribution.
41
* Neither the name of the Cognitive Technologies nor the names of its
42
contributors may be used to endorse or promote products derived from this
43
software without specific prior written permission.
45
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
46
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
47
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
48
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
49
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
50
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
51
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
52
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
53
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
54
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
57
/*----------------------------------------------------------------------*/
58
/* STIC_FRT.C 28.01.1994 from STIC_DIS.C */
59
/*----------------------------------------------------------------------*/
60
#define mk_80_for_CUT 80
61
/*----------------------------------------------------------------------*/
73
extern BYTE multy_language;
75
extern INT pitchsize ;
78
extern BYTE fax1x2; // MK NEW 05.01.1993
79
extern int inc_num_EEM; // in ST_TOOLS.C
80
extern int dis_LIMIT_EEM; // in ST_TOOLS.C;
81
/*......................................................................*/
82
#ifdef MKPRINT_ENABLE // MK OTLADKA Variables
83
extern WORD mkm1, mkm2, mkm3, mkm4, mkm5;
84
extern WORD mkma, mkmb, mkmc, mkmd;
85
///extern WORD d,d0,d1,d2,d3,d4,d5,d6,d7,d8,d9;
87
/*......................................................................*/
88
extern WORD left_mode_EEM; // NOTA BENE: NEPORJADOK; see ST_TOOLS, CHA;
89
/*......................................................................*/
90
#define MIN_ADD_DIS 10 /* max discrim for adding '(',')','!' */
91
#define MAX_ADD_DIS 30 /* max discrim for adding '�','1' */
92
/*----------------------------------------------------------------------*/
95
/*----------------------------------------------------------------------*/
96
INT dis_f (STICK_CHARS *l, STICK_CHARS *r, STICK_SIGNUMS *s);
97
INT dis_r (STICK_CHARS *l, STICK_CHARS *r, STICK_SIGNUMS *s);
98
INT dis_t (STICK_CHARS *l, STICK_CHARS *r, STICK_SIGNUMS *s, INT sign_f);
100
INT find_beam (STICK_CHARS *l, STICK_CHARS *r,INT lim_long);
101
INT find_neck (STICK_CHARS *l, STICK_CHARS *r,INT lim_long);
102
/*----------------------------------------------------------------------*/
104
/* ���������������������������������������������������������������� */
106
/* ��� functions for wide sticks ��� */
108
/* ���������������������������������������������������������������� */
110
INT dis_f (STICK_CHARS *l, STICK_CHARS *r, STICK_SIGNUMS *s)
112
INT i, dis=0, t, lm, rm, dy=s->height;
113
INT lf=l->num_flags, lc=l->num_concs, rf=r->num_flags;
114
INT wid=s->stick_width, inc=s->inc;
115
BYTE Flag_bad_overlay=0; // MK
117
if ( s->l_f_symptom>1 && s->r_f_symptom>1 ) return(0); /* good symptoms */
119
if ( lf==0 && lc==0 )
120
dis += tab_f[11]; /* similar 'F' */ // 70
121
else /* exist left concaves or flags */
123
t=find_beam(l,r,2); /* long beam */
125
t=find_beam(l,r,1); /* short beam */
129
dis += tab_f[0]; /* no beam : true stick */ // 40
131
lm = l->mount[t]; rm = r->mount[t];
132
if( t==0 && s->r_f_symptom==0 && s->l_f_symptom<2 ||
134
if( t==0 && lm>0 && rm>0 )
135
dis += tab_f[0]; // beam belong 0-zone // 40
136
if( lm+rm>1 ) { /* first flag>1 , second flag=0 */
137
dis += t ? tab_f[1] : 0 ; // 20,0
138
if( t==0 && r->mb_pos[0]<2 &&
139
lf==0 && rf==2 && (r->mount[3] || r->mount[4]) )
140
dis += tab_f[13]; /* similar '[' */ // 100
141
if( rf==2 && lf==0 && r->mount[4] )
142
dis += tab_f[10]; /* right half 't' */ // 60
145
if (lm+rm==1 ) /* first flag=1, second flag=0 */
146
dis += wid<4 ? tab_f[2]>>1 : tab_f[2]; // 10,20
148
dis += (lm+rm)?tab_f[2]:tab_f[2]<<2; //40,160
150
if( lm==0 && rm && r->mb_pos[0]<2 && r->mount[4]>0 &&
151
r->mount[3]==0 && r->mount[2]==0 && r->mount[1]==0 )
152
////// dis += r->up_hook?tab_f[0]<<2:tab_f[0]; //160,40
153
if (!fax1x2) // OLD OLEG
154
dis += r->up_hook?tab_f[0]<<2:tab_f[0]; //160,40
156
dis += tab_f[0]; // 160 (4*40) ==> 40 // 40
157
/* true stick + upper dust */
163
/*......................................................................*/
164
else { /* normal beam */
165
lm = l->mount[t]; rm = r->mount[t];
166
if( l->mb_pos[t]>r->me_pos[t]+1 ||
167
r->mb_pos[t]>l->me_pos[t]+1 ) /* bad overlay beam-flags */
168
{ dis += tab_f[12]; Flag_bad_overlay++; } // MK // 80
170
{ /* first flag=1, second flag=1 */
172
dis += tab_f[3]; // 8
173
/* short beam and wide stick */
174
dis+=((l->m_meandr>1)+(r->m_meandr>2))*
175
(inc?tab_f[4]:tab_f[5]); // 2,4
176
/* meandr and short beam . By inc this DIS decreased */
179
/*......................................................................*/
180
if( t>0 ) /* normal beam ; for zones 1,2,3,4 */
182
for( lm=rm=i=0;i<t;i++) { /* 0,...,t-1 zones */
183
if( lm<l->mount[i] ) lm = l->mount[i];
184
if( rm<r->mount[i] ) rm = r->mount[i];
187
if( lm==1 && l->mount[t]==1 ) /* left upper short flags */
188
dis += tab_f[6]; // 10
189
else if( lm>1 && lm>=l->mount[t] ) /* greater left top flags */
190
dis += tab_f[7]; // 40
192
if( rm==0 && l->conc[0]==0 ) /* no right upper flags */
193
dis += tab_f[8]; // 40
194
else if( rm==1 && wid<6 && rm*3<r->mount[t] )
195
dis += tab_f[9]; /* short right upper flags */ // 4
197
if ( r->down_hook && r->mount[4] && // OLD
198
rm > r->mount[0] ) // 27.07.1993 for good 'f'
199
dis += tab_f[10]; /* similar 't' */ // 60
201
// 20.01.1993: fax25/16 r.m[2]=r.m[4]=1; ?????
202
////// if( l->mount[4]==0 & r->mount[4]>r->mount[t]-1 ) // OLD OLEG
203
if( l->mount[4]==0 &&
204
r->mount[4] > MAX (r->mount[t], 2) - 1 ) // 20.01.1993
205
dis += r->mount[0]<r->mount[t] ? tab_f[10]<<1 : tab_f[10];
206
/* similar 't' : right downer long flag */ //120,60
208
if( s->base_2!=-1 ) /* base lines known */
210
INT h_beam = (l->m_pos[t]+r->m_pos[t])>>1;
211
if (Flag_bad_overlay) { // MK 14/20.01.1992
212
////// h_beam = (lm>rm) ? l->m_pos[t] : r->m_pos[t]; ######
213
if (l->mount[t] > r->mount[t]) h_beam = l->m_pos[t];
214
else if (l->mount[t] < r->mount[t]) h_beam = r->m_pos[t];
215
else h_beam = MIN (l->m_pos[t], r->m_pos[t]);
217
if ((l->down_serif + r->down_serif) < 4) // DL==DR==2 ???
218
{ // OLD OLEG VARIANT:
219
if (s->base_2 > MAX(dy/6,3) &&
220
h_beam > s->base_2+wid )
221
dis += tab_f[14]; // 100 => 60
223
else // NEW MK VARIANT:
224
if (s->base_2 > MAX(dy/6,3) &&
225
////// h_beam > MAX((h_beam>s->base_2+wid), // OLEG ######
226
h_beam > MAX((s->base_2+wid), // OLEG
228
dis += tab_f[14]; // 100 => 60
232
{ /* beam belong 0-zone */
233
if( l->mount[0] && l->mb_pos[0]==0 &&
234
r->mount[0] && r->mb_pos[0]==0 )
239
if( ( r->down_hook || r->mount[4]>2 ) && l->mount[0]>1 )
240
dis += tab_f[10]; /* similar 'l' */
242
// 22.01.1993 DISPROPORTION: GLISTA 1-3-1 zB
243
// 'l' 32*5(1-3-1) stdj7/27(34) "Parallel" (last 'l')
244
// 'E' ...*12(1-10-1)
245
// 'f' 26*5(1-3-1) stdj8/16(18) ......
246
if ((!l->num_long_flags && !r->num_long_flags) &&
247
( (dy>26 || s->width>=10) ||
248
(dy>16 && ((!l->num_flags) || (!r->num_flags)) ) ))
249
dis += tab_f[15]; // 80 (BP)
251
////// if ( l->up_serif == 2 ) // 17.02.1993 PROBA
252
////// dis += 222; // 222
254
/*......................................................................*/
256
if( s->l_f_symptom>0 && s->r_f_symptom>1 )
257
dis = (dis * plus_f[1])>>4 ;
258
/* decrease DIS if good right symptom and delicate left symptom */
260
{ // 11.03.1993 SOPLI about {f'}; NE NA MESTE !!!
261
INT l12 = MAX (l->mount[1],l->mount[2]);
262
INT r12 = MAX (r->mount[1],r->mount[2]);
263
if ( r->mount[0] > // fax23/14(16) "Cardiff's"
264
////// MAX (l12,l->mount[4]) + wid + MAX (r12,r->mount[4]) ) // a)
265
MAX (l12,l->mount[4]) + wid + MAX (r12,r->mount[4]) + 4) // b)
269
// 15.10.1993 similar 'F'
270
if (wid>4 && l->conc[0]<2 && // k11/14 "OF" 21*12 wid=5
271
(r->mount[0]>4 ? 1 : 0) + // 18.10.1993 fax4/9 "modified"
272
(r->mount[1]>4 ? 1 : 0) +
273
(r->mount[2]>4 ? 1 : 0) == 2 &&
274
l->mount[1]<3 && l->mount[2]<3) // 20.10.1993 fax18/20(25) manuf
277
if (s->cut_r && // 21.10.1993 for similar 'D' (CUT)
278
r->mount[0]==r->mount[4] &&
279
MAX(r->mount[1],r->mount[2])*3 < r->mount[0])
280
dis += mk_80_for_CUT; // 80
282
if (s->cut_r && // 18.11.1993 for similar 'E' (CUT)
283
r->mount[4]>5) // j8/13(14); really "B/" (CUT)
284
dis += mk_80_for_CUT; // 80
286
return (dis); // dis_f
288
/*----------------------------------------------------------------------*/
289
INT dis_r (STICK_CHARS *l, STICK_CHARS *r, STICK_SIGNUMS *s) {
291
INT nl=l->num_long_flags, nr=r->num_long_flags;
292
INT wid=s->stick_width, inc=s->inc;
293
INT dis=0, wid_2=wid>>1, dy=s->height; // t
294
INT lmu, rmu; // 26.01.1994 (OLD lm, rm);
295
INT lmd, rmd; // 25.01.1994
297
//////printf (" r(%d,%d) ", r->mount[0], r->mount[4]);
299
lmu = MAX(l->mount[0],l->mount[1]); // "UPPER ZONE: 0 or 1
300
rmu = MAX(r->mount[0],r->mount[1]);
302
lmd = l->mount [4]; rmd = r->mount [4]; // 25.01.1994, DOWN ZONE;
304
if( lmu>=1 && rmu>=1 ) {
305
////// if( lm*3>rm*4 && lm>3 ) // OLD OLEG
306
////// dis += (lm-rm)/2*tab_r[0]; // l.flag > r.flag // *8
308
if ( lmu>=3) { // 24.03.1993 MK PROBA
310
if ( lmu >= rmu - (lmu>=wid) ) // NO INC: NEW
311
dis += tab_r[16]; // l.flag > r.flag // 80
313
else if ( lmu>3 && lmu>rmu ) // IF INC: MODIFY
314
dis += (lmu-rmu)*tab_r[0]; // l.flag > r.flag // *20
315
} // 25.10.1993 (OLD *8)
317
if ( rmu==1 && r->mount[0]==r->mount[1] )
318
dis += tab_r[11]; // 10
320
if (lmu==2 && rmu==1) // 25.10.1993
321
dis += tab_r[17]; // too short upper flags // 40
323
if( rmu==1 && lmu==1 && l->m_meandr>1 &&
324
(r->m_meandr>1||r->mount[3]||r->mount[4]) )
325
dis += tab_r[12]; /* too short upper flags */ // 40
327
////// if( (lmu<3||!inc) && lmu>1 && lmu==rmu && nr==1 && nl==1 )
328
// 17.01.1994 PROBA CORRECT for SMALL 'r':
329
if ((!inc || lmu<3 && (inc_num_EEM!=1 || dy>16)) &&
330
lmu>1 && lmu==rmu && nr==1 && nl==1) // OLD OLEG CONDITIONS
331
dis += tab_r[13]; /* simmetrial upper zone */ // 100
336
dis += r->m_meandr?tab_r[1]<<4 :tab_r[1] ; //32,2
337
/* too little right upper flags */
339
dis += tab_r[2] ; /* no right upper flags */ // 70
342
if(l->mount[2]>wid_2 )dis += tab_r[3]; // left center flag // 10
343
////// if( r->mount[2]>wid_2 )dis += tab_r[4]; // right center flag // 10
345
if (r->mount[2]>wid_2) // right center flag
346
////// dis += (r->mount[2]<wid) ? 10 : 100; // 10/100
347
////// dis += (r->mount[2]<=wid) ? 10 : 100; // 10/100
348
dis += (r->mount[2]<=wid) ? 10 : 80; // 10/80
350
dis += ((nr>2)+(nl>2))*tab_r[5]; // too many left or right flags // *6
352
/****************************** 21.01.1994 MK_PROBA_DELETE (2 Places)
353
//////if (r->down_serif && l->down_serif==0 ||
354
if ((r->down_serif || r->mount[4]>2) && l->down_serif==0 || // 07.01.1994
355
l->down_serif && r->down_serif==0 ) {
356
if( abs(r->mount[4]-l->mount[4])>wid_2+1 )
357
dis += tab_r[6] ; // too different down flags // 4
358
////// if( l->mount[4]==0 && r->mount[4]>1 )
359
if (l->mount[4]==0 && r->mount[4] > (inc ? 2 : 1)) { // 20.11.1993
360
static BYTE OTL_similar_t=0;
361
dis += tab_r[10]; // 20
362
////// if (r->mount[4]>wid) // 07.01.1994 similar 't'
363
if (r->mount[4]>wid && // 07.01.1994 similar 't'
364
OTL_similar_t==1) // 17.01.1994 FOR DEBUG;
367
////// DIS_CURVE(l,r,4,1,tab_r[7]); // 10
368
DIS_CURVE_MK(l,r,4,1,tab_r[7]); // 27.07.1993 // 10
370
*****************************************************************************/
372
if( r->mount[0]==0 && r->mount[1] >0 && r->mb_pos[1]>dy/6 )
373
dis += tab_r[8]; /* for bad catting parts */ // 60
375
//////if (lm+rm<2 && wid>3) // OLD OLEG
376
///// || (wid>8 && rm<2) ) // and NEW MK 10.05.1993: first PROBA (||);
377
if (wid>3 && rmu<2) // MK 11.05.1993
378
dis += tab_r[9]; /* too small beam */ // 80
380
/****************************** 21.01.1994 MK_PROBA_DELETE (2 Places)
382
//////if( t>rm && l->mount[4]<2 ) // before 24.03.1993
383
////// dis += tab_r[10]*(t-rm); // too long right downer flag // *20
384
//////if( t>=rm && l->mount[4]<2 ) // from 24.03.1993
385
if( t>=rmu && l->mount[4]<2 && l->mount[3]<2) // from 09.01.1994
386
dis += tab_r[10]*(t-rmu+2); // too long right downer flag // *20
387
// NOTA BENE: DOUBLE ABOVE "too different down flags"
388
// and "similar 't'" (SEE!!!);
389
***************************************************************************/
391
//////if( abs( lmu-l->mount[4])<2 && abs(rmu-r->mount[4])<2 && lmu>1 && rmu>1 )
392
if (abs(lmu-lmd)<2 && abs(rmu-rmd)<2 && lmu>1 && rmu>1 && // MK EDITION
393
(rmu+rmd) - (lmu+lmd) < 4) // 27.01.1994 MK ADD CONDITION;
394
dis += tab_r[14]; // similar 'I' // 50
395
/*......................................................................*/
398
// 25.01.1994 NEW CHARGES:
399
// (see DIFFS 21.01.1994)
401
if (rmd>3) { // RIGTH DOWN // 25/26.01.1994
404
////// if (rmu<=rmd) // 25/26.01.1994
405
if (rmu+lmd<=rmd) // 27.01.1994
406
dis += 100; // really 't' // 100
409
if (rmd==3) { // RIGTH DOWN // 26.01.1994
411
lmd==1 && wid<4) // 1/3, NOT BIG WID
413
if (rmu<=rmd) // really 't';
417
if (rmd<3 && rmu<=rmd && // 26.01.1994 for GLUE 'u' (zB)
418
lmu==0 && lmd==0) // fax26/14 "solutions"
419
dis += (rmd==1) ? 10: // RMD=1 m.b. more ??? // 10
420
30; // RMD=2 m.b. other ??? // 30
422
if (wid>=3) { // 26.01.1994 for GLUE 'm' (zB)
423
if (rmu<2) // m16/3 "comforting" (see both 'o', 'm')
424
dis += 30; // for def Laterne ??? // 30
428
if (dy>=16) { // 26.01.1994 for GLUE
429
if (rmu<2) // m16/3 "comforting" (see 'n')
430
dis += 100; // for def Laterne ??? // 100
434
//////if (lmd>=3 && rmd<=1) // 26.01.1994 k19/5 "traditional" (4/2)
435
if (lmd>=3 && rmd==0) // 27.01.1994 k19/5 "traditional" (4/2)
436
dis += 60; // as OLD for GLUE "r."; // 60
439
////// dis += 50; // 25.01.1994 // 50
440
dis += 20; // 25.01.1994 // 20
442
if (rmu>=wid*4 && // 'c' cutted or not glued
443
wid<3) // 27.01.1994 m25/16(22) "prepare" ('r' 3/12)
446
return (dis); // dis_r
448
/*----------------------------------------------------------------------*/
449
/* sign_f = 1 - 'f' belong list of versions */
450
INT dis_t (STICK_CHARS *l, STICK_CHARS *r, STICK_SIGNUMS *s, INT sign_f)
452
INT i, dis=0, t, lm, rm, dy=s->height, dx=s->width, t2;
453
INT nl=l->num_long_flags, nr=r->num_long_flags;
454
INT sl=l->num_flags, sr=r->num_flags;
455
INT wid=s->stick_width, inc=s->inc;
456
INT tpos; // 18.11.1993 (old - use the same {t}, how for zone)
458
t = find_beam (l, r, 1);
459
/*......................................................................*/
460
if( t<0 ) { // BAD BEAM:
462
////// lm = l->mount[t]; // ###### but if t<0 - ?????? QWERTY ######
463
////// rm = r->mount[t]; // 23.03.1993 make it more akkuratno !!!
465
dis += tab_t[0]; /* no flag long >=1 */ // 40
466
lm = rm = 0; // MK 23.03.1993 about SHURIK g20/51 s->r ERR
468
else { lm = l->mount[t]; rm = r->mount[t]; } // 23.03.1993
470
if( lm+rm>1 ) { /* first flag>=2, second flag=0 */
471
////// dis += lm ? lm*tab_t[1] : tab_t[1]; // *20,20
472
/************************************************************
473
dis += lm ? lm*tab_t[1] : // 18.10.1993: // *20
474
((s->cut_l || s->cut_r) ? tab_t[32] : // 60
476
*****************************/
477
// 19.10.1993 after FARA-078:
478
if (lm) dis += lm*tab_t[1]; // *20
480
if ((s->cut_l || s->cut_r) && rm<3 && // 19.10.1993
481
rm>r->mount[4]) // 20.10.1993
482
////// dis += tab_t[32]; // 19.10.1993 // 60
483
////// dis += tab_t[32]; // 20.10.1993 // 44
484
// 20.11.1993 fax8/19(21) "using" 'n' => "tl"
485
dis += (wid>=5 ? 88 : 44); // 88/44
486
else dis += tab_t[1]; // 20
488
if( t==0 && r->mb_pos[0]<2 &&
489
////// !(s->base_2!=-1 && abs(r->m_pos[0]-s->base_2)<2 ) &&
490
!(s->base_2!=-1 && // 18.11.1993
491
abs(r->m_pos[0]-s->base_2) < (fax1x2 ? 3 : 2 )) &&
492
!(r->m_pos[0]>dy/6&&r->me_pos[0]>dy/3) )
493
dis += tab_t[24]; //100
494
//long right flag belong 0-zone
497
else { /* first flag=1, second flag=0 */
499
dis += wid>2 ? tab_t[2] : tab_t[20] ; // 50,4
501
dis += tab_t[17]; // 120
503
if( t==2 && r->mount[3] )
504
dis += tab_t[20]; // 4
506
r->m_meandr==2 && r->mount[4]==0 )
507
dis += tab_t[25]; // 40
509
if( rm && lm==0 && t>0 && l->mount[0] )
510
dis += tab_t[2]; // 50
513
/*......................................................................*/
514
else { // NORMAL BEAM:
515
lm = l->mount[t]; rm = r->mount[t];
517
// MK PROBA 03.02.1993 about 'r'=>'t'
518
if ((t==0) && (wid>=4) && (lm<=1) && (rm>=4) &&
519
(r->mount[4]<5)) // 07.01.1994 EDITION
520
////// dis += 122; // MK PROBA 03.02.1993 // ###########
521
dis += 22; // MK PROBA 04.02.1993 // 22
523
if (!fax1x2) { // OTLADKA 20.01.1993
524
if ( (l->me_pos[t] - l->mb_pos[t]) > dx && // OLD ###########
525
(r->me_pos[t] - r->mb_pos[t]) > dx )
526
dis += tab_t[21]; /* bad overlay beam-flags */ // 100
528
if (fax1x2) { // OTLADKA 20.01.1993
529
if ( ((l->mb_pos[t] - r->me_pos[t]) > 1) || // NEW PROBA
530
((r->mb_pos[t] - l->me_pos[t]) > 1) )
531
dis += tab_t[21]; /* bad overlay beam-flags */ // 100
534
/* N.B. in TC-interface base lines are not known */
535
if( s->base_2!=-1 ) { /* base lines known */
537
if( multy_language ) t2=4;
538
if (s->base_2>MAX(s->height/6,3) &&
539
(MAX(l->m_pos[t],r->m_pos[t]) < s->base_2-t2 ||
540
////// MIN(l->m_pos[t],r->m_pos[t]) > s->base_2+4)) // 18.10.1993
541
////// MAX(l->m_pos[t],r->m_pos[t]) > s->base_2+4)) // 18.10.1993
542
MAX(l->mb_pos[t],r->mb_pos[t]) > s->base_2+4)) // 19.10.1993
543
dis += tab_t[18]; // 100
544
else if (inc_num_EEM>=2 && // 18.11.1993 similar '7'
545
t==0 && // j10/29 "08/77" first '7'
547
l->me_pos[0] + 2 <= r->me_pos[0] &&
548
l->me_pos[0] + 2 <= s->base_2)
549
dis += tab_t[18]; // 100
552
if( lm+rm>3 ) /* flags : 1,2 2,1 2,2 ... */
555
if( lm*3>rm*4 && lm>3 )
556
dis += tab_t[3]; /* left>right */ // 4
560
if( l->mount[i]>=l->mount[t]) break;
563
// 26.08.1993 INCREASE for "ft"
564
if (i==0 && nl==2 && nr==2 &&
566
(!inc && l->mount[0]==lm || inc && l->mount[0]>lm) &&
567
////// rm>wid && r->mount[4]>=wid) // first variant
568
rm>=3 && r->mount[4]>=3) // second variant
569
return (-444); // NOTA BENE: INCREASE !!!!!!!!!!
570
/************************************************/
572
if ( i<3 ) { /* exist left top long flag */
574
dis += tab_t[4]; // 30
576
dis += tab_t[4]>>2; // 7
578
/* exist big flag and beam */
580
for (im=ma=-1,i=0;i<3;i++) {
582
if( r->mount[i]>=r->mount[t]) break;
584
ma = r->mount[(im=i)];
587
if( i<3 ) { /* exist long right upper flag */
588
dis += ( r->me_pos[i]-r->mb_pos[i])*tab_t[14]; // *15
591
if( s->width>4 && im==0 && ma>=r->mount[t]-1 &&
593
dis += tab_t[23]; // 20
596
else if( lm + rm==2 ) {
599
if( l->mount[i]>1) break;
600
if( r->mount[i]>2) break;
603
dis += tab_t[4]; // 30
604
/* exist big flag and beam */
606
dis += tab_t[5]; // short beam and wide stick // 2
607
if( s->width>2 && !(l->mount[3]==1&&l->conc[4]) )
608
dis+=((sl>1)+(sr>2))*
609
(inc ? tab_t[6] : // *2
610
(s->width<4?tab_t[26]:tab_t[7])); //*20,40
611
else if( sl>1 || sr>2 )
612
dis += tab_t[20]; // 4
613
/* meandr and narrow beam */
615
(l->me_pos[t]<=r->mb_pos[t]||r->me_pos[t]<=l->mb_pos[t]))
616
dis += tab_t[22]; // 40
618
} // IF ELSE: NORMAL BEEM;
619
/*......................................................................*/
620
dis += ((nr>3)+(nl>1))*tab_t[8]; // *24
621
/* too many left or right flags */
622
if( l->mount[4]>1 && !inc || l->mount[4]>2 && inc )
623
dis += tab_t[10] ; /* left downer flag */ // 40
625
DIS_CENTER_FLAGS(l,r,2,wid,inc,tab_t[11],tab_t[12]); //40,4
627
if( t>0 && t<3 && dx<<2 < dy*3 )
628
{ /* KNOT : find big flags of beam - part bold 'H' */
629
if( l->num_flags==1 && l->me_pos[t]-l->mb_pos[t]+1>dy/3 &&
631
r->num_flags==1 && r->me_pos[t]-r->mb_pos[t]+1>dy/3 &&
633
dis += tab_t[28]; // 40
636
if( l->up_serif==2 && l->down_serif==2 &&
637
r->up_serif==0 && r->down_serif==0 && t<2 )
638
dis += tab_t[15]; /* similar ],) */ // 60
640
//////t = MAX( l->m_pos[t], r->m_pos[t])+1;
641
tpos = MAX( l->m_pos[t], r->m_pos[t])+1; // 18.11.1993
643
dis += tab_t[13]*(tpos-(dy>>1)); /* too low beam */ // *16
644
/* ----------------- FIND f-CONFIGURATIONS ------------------- */
646
//////if (tpos>(dy>>2) && r->mount[0]>2 && r->mount[1]>2 && l->conc[0]>0 )
647
if (t>0 && // 18.11.1993 PROBA for f10/15 "of"
648
r->mount[0] > (wid>2 ? 2 : 1) &&
650
dis += tab_t[14]; /* head : similar to 'f' */ // 14
651
// NB: include THIN STICK, but EXCLUDE SOME OTHER CASES;
653
/**********************************
654
if( (s->l_f_symptom>0 && s->l_f_symptom<3 &&
656
s->l_f_symptom==3 && s->r_f_symptom==2 ||
657
sl==1 && s->r_f_symptom && (!inc || s->l_f_symptom) )
658
&& sign_f && r->down_hook==0 )
659
dis += tab_t[16]; // similar 'f' ! MANY KNOTs // 70
660
**********************************************/
661
if ( s->r_f_symptom==2 ) // similar 'f' // 10.02.1993
663
dis += tab_t[16]; // 70
664
else if ( r->up_serif==1 && s->l_f_symptom )
665
dis += tab_t[30]; // 16
666
else dis += tab_t[31]; // 8
668
if( s->l_f_symptom==2 && s->r_f_symptom==2 && sign_f &&
670
dis += tab_t[19]; /* similar 'f' */ // 10
672
if (l->down_hook || // 04/07.06.1993
673
////l->mount[4]>1) // 04.06.1993
674
l->mount[4] >= 2 + inc + fax1x2) // 07.06.1993
675
dis += tab_t[16]; // similar 'f' // 70
676
// NB: I can use SERIF==2, SERIF==1, !INC in combinations with L.M.4
678
/* ----------------- FIND l-CONFIGURATIONS ------------------- */
680
if( l->m_meandr==1 && l->num_flags==1 && l->mount[4] &&
681
r->m_meandr==1 && r->num_flags==1 && r->mount[0] )
682
dis += tab_t[27]; /* head : similar to 'f' */ // 40
684
/*......................................................................*/
685
{ // MK: TOO LONG HOOK: for "t." ==> 't'
686
///INT n1, n2; // NB: tab_t[29]=80 (fax12/32 "document.")
687
/// n1 = MAX (wid, (lm+rm));
688
////// n2 = (n1<4) ? (n1+4) : (n1*2); // 4 - MK VOLUNTAR. before 9.3.1993
689
/// n2 = (n1<4) ? (n1+4) : (n1*2)-2; // 4 - MK VOLUNTAR. from 09.03.1993
690
////// if (r->mount[4]>n2) dis += tab_t [29]; // before 26.01.1993 // 80
691
////// if (r->mount[4]>=n2) dis += tab_t [29]; // from 26.01.1993 // 80
692
if ((r->mount[4]>=lm+wid+rm) && // 10.03.1993
693
////// (r->mb_pos[4]+wid > dy)) // 10.03.1993 no big hook
694
(r->m_pos[4]+wid+3 > dy)) // 11.03.1993 no big hook
695
dis += tab_t [29]; //80=>100
696
// fax12/32 "document." 1-5-4 / 11
697
// fax41/72 "support." 2-5-4 / 12
698
// fax35/21(24) "format." 2-4-3 / 9
699
// b18/27 "this" 1-4-3 / 6
700
// d19/35(36) "with" 2-3-2 / 7, BIG HOOK (-7)
702
/*......................................................................*/
703
/********************************************************************
704
if (s->neck==1) // 18.10.1993 for d7/2
706
if (s->neck>=2) // 18.10.1993 for d7/2
708
*************************************************************/
710
if (s->neck>=2) // 20.10.1993
712
/*......................................................................*/
714
if (dis==0 && // NO DISCRIM;
716
l->mount[0] && // LMU EXIST;
717
l->conc[4] && // LDC EXIST;
718
s->base_2mk>0 && // BASE_2 1 or 2;
720
dis = -32; // BONUS !!!!!!!!!!!!
721
/*......................................................................*/
724
/*----------------------------------------------------------------------*/
725
/* ���������������������������������������������������������������� */
727
/* ��� auxiliary functions ��� */
729
/* ���������������������������������������������������������������� */
730
/*----------------------------------------------------------------------*/
731
/* find beam (lim_long - width of beam-flag) in stick */
732
INT find_beam (STICK_CHARS *l, STICK_CHARS *r,INT lim_long)
734
INT i,num,maxim,m,rr,ll;
736
for(num=-1,maxim=m=i=0;i<3;i++)
741
if( rr>=lim_long && ll>=lim_long &&
742
maxim<=m ) /* two flags>=lim_long, find last maximum */
751
/*----------------------------------------------------------------------*/
752
INT find_neck(STICK_CHARS *l, STICK_CHARS *r,INT lim_long)
754
INT i,num,minim,m,rr,ll;
756
for(num=-1,minim=m=i=0;i<3;i++)
761
if( rr>=lim_long && ll>=lim_long &&
762
minim>=m ) /* two flags>lim_long, find last minimum */
771
/*----------------------------------------------------------------------*/
773
/*----------------------------------------------------------------------*/