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
/*********************************************************************/
60
/* the processing of the 'percent' symbol */
61
/*********************************************************************/
64
This procedure inspects given cell and makes a decision whether it is
65
the percent symbol or not. The object under consideration is 'left
66
upper' percent or 'right lower' percent or right slash '/'.
68
1. 'left upper' percent case:
69
right dust exists, and the box of the dust has the correct
70
overlap with the box of given cell. The overlap is correct if:
71
a) dust right lower corner can stretch out of given cell by
73
---------- * height of the cell and ----------- * width of the cell;
77
b) the width of the dust must be less, than ---------- of the
79
width of the cell, and the height of the dust must be less,
81
than ---------- of the height of the cell.
84
2. 'right lower' percent case:
85
the left dust exists, and the box of the dust has the correct
86
overlap with the box of given cell. The overlap is correct if:
87
a). dust left upper corner can stretch out of given cell by
89
---------- * height of the cell and ----------- * width of the cell;
93
b). the width of the dust must be less, than ---------- of the
95
width of the cell, and the height of the dust must be less,
97
than ---------- of the height of the cell.
100
3. 'right slash' case:
101
the left and rights dusts exist, and the boxes of the dusts have
102
the correct overlaps with the box of given cell. The correctness
103
of the overlaps is the same as p.1. and p.2. for right dust
104
and left dust respectevly.
119
#include "compat_defs.h"
122
#define PRO_NUMBER 0xC3
123
#define PRO_NUM_PART '�'
131
#define EH_K_NOM 4 //for percent
133
#define EH_K_NOM_N 11 //for number
134
#define EH_K_DENOM_N 10
135
#define H_K_DENOM_N 8 //for number
140
#define RELIABLE_SL 220
141
#define RELIABLE_O 210
142
#define RELIABLE_NUM 200
144
#define middle(x) ((x)->r_col + ((x)->w>>1))
146
extern uchar db_status;
149
typedef struct bnd_allowed
151
int16_t bw, /* beginning of the widht interval */
152
ew, /* end of the widht interval */
153
bh, /* beginning of the height interval */
154
eh; /* end of the height interval */
157
typedef struct perc_struct
159
cell * BC; /* pointer to the currente cell */
160
cell * RC; /* the first 'right dust' cells */
161
cell * ldcp; /* pointer to the 'left dust' cell for percent
162
or 'undeline cell' for number */
163
cell * rdcp; /* pointer to the 'right dust' cell */
164
uchar FL; /* existing 'good' dusts flag */
165
int16_t rcps; /* the return code of the percent searching */
166
int16_t n_ver_perc; /* the number of the found percent version */
167
/* the allowed boundaries of the upper dust */
168
int16_t ubw, /* beginning of the widht interval */
169
uew, /* end of the widht interval */
170
ubh, /* beginning of the height interval */
171
ueh; /* end of the height interval */
172
/* the allowed boundaries of the lower dust */
173
int16_t lbw, /* beginning of the widht interval */
174
lew, /* end of the widht interval */
175
lbh, /* beginning of the height interval */
176
leh; /* end of the height interval */
177
int16_t mw, /* "middl" of the widht */
178
mh; /* "middl" of the height */
179
int16_t maxh; /* maximum of height */
180
int16_t like_O; /* tolerence for circle in number */
184
This procedure inspects given cell and makes a desision
185
whether it is the percent symbol or not.
187
/********** Prototypes of the functions ******************/
188
static int16_t search_perc_vers();
189
static int16_t search_left_dust();
190
static int16_t search_right_dust(int16_t like_o);
191
static int16_t compare_bound(cell *,char);
192
static int16_t rec_O0(cell *);
193
static int16_t change_vers();
194
static void collect_cell(cell *mainc, cell *c2);
195
static cell *collect_cell_save(cell *mainc, cell *c2);
196
static void prc_setup();
197
static void proc_perc();
198
static void merge_ld();
199
static void merge_rd();
200
static void compute_bnd_lbox(cell *pc,bnd_allowed *bnd);
201
static void compute_bnd_ubox(cell *pc,bnd_allowed *bnd);
202
static int16_t search_underline_dust();
203
static cell *rest_composition(cell *cmplx);
204
static int16_t test_O0(cell *c);
205
static void improve_proN();
207
Bool test_cell(cell *c);
208
//void Leo_ContStoreC(cell *c);
209
/******* Global variable *********/
213
void number( void ) // Andrew for compose number
223
gpt->BC=gpt->BC->nextl;
225
if (!gpt->BC->next) break; /* dummy cell at end reached */
227
if( language==LANG_CROATIAN )
230
// �������� ��� ��� ��� PRO_NUMBER=0xc3 �����������
231
// � ��������� ������ AA_semicircle. 31.05.2001 E.P.
232
if( language==LANG_ROMAN)
235
if ((gpt->rcps=search_perc_vers()) != (uchar)PRO_NUMBER && /* find the proNumber version */
239
if( db_status && snap_activity('h') ){
240
snap_newcell(gpt->BC);
244
if (gpt->rcps==(uchar)PRO_NUMBER && gpt->BC->vers[0].prob<RELIABLE_NUM)
247
if (gpt->rcps==(uchar)PRO_NUM_PART)
250
if (gpt->BC->vers[0].let != (uchar)PRO_NUMBER)
257
if( gpt->BC->vers[0].let != (uchar)NUMBER && gpt->rcps != 'N'){
258
gpt->BC->vers[gpt->n_ver_perc].prob = 0; // kill proNumber
260
gpt->BC->vers[gpt->BC->nvers].let = gpt->BC->nvers>0? 0:bad_char;
261
gpt->BC->vers[gpt->BC->nvers].prob= 0; /* Set correct tail */
280
gpt->BC=gpt->BC->nextl;
282
if (!gpt->BC->next) break; /* dummy cell at end reached */
283
if ((gpt->rcps=search_perc_vers())== 0) /* find the percent version */
286
if( db_status && snap_activity('h') ){
287
snap_newcell(gpt->BC);
291
if (gpt->rcps==(uchar)PRO_NUMBER && gpt->BC->vers[0].prob<RELIABLE_NUM)
294
if (gpt->rcps==(uchar)PRO_NUM_PART)
297
if (gpt->BC->vers[0].let != (uchar)PRO_NUMBER)
306
static void prc_setup()
309
int16_t midBC=middle(gpt->BC);
311
while (!(prd->next->flg & c_f_fict) && middle(prd)<=midBC)
316
gpt->ldcp = gpt->rdcp = NULL;
318
gpt->ubw=(gpt->rcps=='/') ?
319
(midBC - gpt->BC->h*2/3) :
320
(gpt->BC->r_col - (gpt->BC->w*BW_K_NOM)/BW_K_DENOM);
321
gpt->ubh=(gpt->BC->r_row - (gpt->BC->h*BH_K_NOM)/BH_K_DENOM);
322
gpt->uew=(gpt->BC->r_col + (gpt->BC->w*EW_K_NOM)/EW_K_DENOM);
323
gpt->ueh=(gpt->BC->r_row + (gpt->BC->h*EH_K_NOM)/EH_K_DENOM);
325
gpt->lbw=(gpt->BC->r_col + (gpt->BC->w*(EW_K_DENOM-EW_K_NOM))/EW_K_DENOM);
326
gpt->lbh=(gpt->rcps=='N') ?
328
((gpt->rcps==(uchar)PRO_NUMBER) ?
329
(gpt->BC->r_row + (gpt->BC->h*(EH_K_DENOM_N-EH_K_NOM_N))/EH_K_DENOM_N) :
330
(gpt->BC->r_row + (gpt->BC->h*(EH_K_DENOM-EH_K_NOM))/EH_K_DENOM)
332
gpt->lew=(gpt->rcps=='/') ?
333
(midBC + gpt->BC->h*2/3) :
335
(gpt->BC->r_col + gpt->BC->w*2) :
336
(gpt->BC->r_col + gpt->BC->w*(BW_K_DENOM+BW_K_NOM)/BW_K_DENOM)
338
gpt->leh=(gpt->BC->r_row + gpt->BC->h*(BH_K_DENOM+BH_K_NOM)/BH_K_DENOM);
340
gpt->maxh=gpt->BC->h-(gpt->BC->h+H_K_DENOM_N/2)/H_K_DENOM_N;
342
gpt->mw = gpt->BC->r_col + ((gpt->BC->w)/3);
343
gpt->mh = gpt->BC->r_row + ((gpt->BC->h)>>1);
344
gpt->like_O = LIKE_O;
345
} /*------------------------------------------------------------------*/
347
static void proc_perc()
350
int16_t rcslds; /* the return code of the left dust searching */
351
int16_t rcsrds; /* the return code of the right dust searching */
356
rcslds=search_left_dust();
357
rcsrds=search_right_dust(gpt->like_O);
358
// if ( gpt->ldcp == gpt->rdcp )
360
if ( (rcslds) && (rcsrds)&& gpt->BC->vers[gpt->n_ver_perc].prob>=RELIABLE_SL ||
361
rcslds>=RELIABLE_O && gpt->FL & RightDust ||
362
rcsrds>=RELIABLE_O && gpt->FL & LeftDust
367
rcsrds=search_right_dust(gpt->like_O);
368
if (rcsrds == 0) break;
371
rcslds=search_left_dust();
372
if (rcslds == 0) break;
374
case (uchar)PRO_NUMBER:
375
rcslds=search_underline_dust();
376
rcsrds=search_right_dust(gpt->like_O);
377
p=gpt->BC->vers[gpt->n_ver_perc].prob;
378
if (p>=RELIABLE_NUM && rcsrds ||
379
rcsrds>=RELIABLE_O && rcslds &&
380
gpt->ldcp->r_row > gpt->rdcp->r_row+gpt->rdcp->h)
384
rcslds=search_underline_dust();
385
rcsrds=search_right_dust(gpt->like_O);
386
p=gpt->BC->vers[gpt->n_ver_perc].prob;
387
if (p>=RELIABLE_NUM && rcsrds && rcslds ||
388
rcsrds>=RELIABLE_O && rcslds &&
389
gpt->ldcp->r_row > gpt->rdcp->r_row+gpt->rdcp->h)
395
if (gpt->ldcp) rest_composition(gpt->ldcp);
396
if (gpt->rdcp) rest_composition(gpt->rdcp);
404
// Leo_ContStoreC(gpt->BC);
406
} /*------------------------------------------------------------------*/
408
static int16_t search_perc_vers()
409
{ /* searching the percent-symbol version */
412
uchar l=gpt->BC->vers[0].let;
413
if (language==LANG_RUSSIAN)
414
if (l==(uchar)'�' || l==(uchar)'�') return PRO_NUM_PART;
416
for (i=0,rc=0; i<=gpt->BC->nvers; i++)
418
if ( gpt->BC->vers[i].let == '/' )
424
if ( gpt->BC->vers[i].let == liga_uperc )
430
if ( gpt->BC->vers[i].let == liga_lperc )
436
if ( gpt->BC->vers[i].let == (uchar)PRO_NUMBER )
438
rc=(uchar)PRO_NUMBER;
442
if ( gpt->BC->vers[i].let == 'N' )
449
} /*------------------------------------------------------------------*/
451
static int16_t search_left_dust()
457
while (pld->prev && pld->r_col>=gpt->ubw)
459
if (pld != gpt->BC && compare_bound(pld,'L'))
461
pld->complist=NULL; //single
462
gpt->FL=gpt->FL | LeftDust;
463
if ((rv=test_O0(pld))>LIKE_O)
465
if (gpt->ldcp) rest_composition(gpt->ldcp);
471
pld=collect_cell_save(gpt->ldcp,pld);
472
if ((rv=test_O0(pld))>LIKE_O) break;
480
} /*------------------------------------------------------------------*/
482
static int16_t search_right_dust(int16_t like_o)
488
while (prd->next && prd->r_col<=gpt->lew)
490
if (prd != gpt->BC && prd != gpt->ldcp && compare_bound(prd,'R'))
492
if (prd->h > gpt->maxh/2 && prd->w > (gpt->lew-gpt->lbw)/5)
494
prd->complist=NULL; //single
495
gpt->FL=gpt->FL | RightDust;
496
if ((po=test_O0(prd))>like_o)
498
if (gpt->rdcp) rest_composition(gpt->rdcp);
504
prd=collect_cell_save(gpt->rdcp,prd);
505
if ((po=test_O0(prd))>like_o) break;
513
} /*------------------------------------------------------------------*/
515
static int16_t change_vers()
517
if ( gpt->rcps == (uchar)PRO_NUMBER || gpt->rcps == 'N' ){
518
gpt->BC->vers[0].let = NUMBER; /* first version is number */
521
gpt->BC->vers[0].let = '%'; /* first version is '%' */
523
gpt->BC->dens = 255; // undef for calc BOLD
524
gpt->BC->vers[0].prob=254;
525
gpt->BC->nvers=1; /* the number of versions is 1 */
526
gpt->BC->vers[1].let=0; /* end of list */
527
if (gpt->BC->flg & c_f_bad) gpt->BC->flg ^= c_f_bad | c_f_let;
531
} /*------------------------------------------------------------------*/
533
static void merge_ld()
536
if (gpt->ldcp) collect_cell(gpt->BC, gpt->ldcp);
537
// del_cell(gpt->ldcp);
538
} /*------------------------------------------------------------------*/
540
static void merge_rd()
543
if (gpt->rdcp) collect_cell(gpt->BC, gpt->rdcp);
544
// del_cell(gpt->rdcp);
545
} /*------------------------------------------------------------------*/
547
static void collect_cell(cell *mainc, cell *c2)
552
compose_cell (2,coll,mainc);
554
} /*------------------------------------------------------------------*/
556
static cell *collect_cell_save(cell *mainc, cell *c2)
559
if (!mainc->complist) // store single cell
560
{ // complex cell is stored by components
562
memcpy(nc,mainc,sizeof(cell));
563
insert_cell(nc,mainc);
564
mainc->complist=(c_comp *)del_save_cell(nc);
568
compose_cell_save (2,coll,mainc);
569
c2->complist=mainc->complist;
570
mainc->complist=(c_comp *)del_save_cell(c2);
573
} /*------------------------------------------------------------------*/
575
static int16_t compare_bound(cell *pc, char rorl)
580
{ /* right (lower) 'dust' box case */
581
compute_bnd_lbox(pc,&ldbnd);
583
( (ldbnd.bw >= gpt->lbw) && (ldbnd.bw >= gpt->mw) ) &&
584
(ldbnd.bh >= gpt->lbh) &&
585
(ldbnd.ew <= gpt->lew) &&
586
(ldbnd.eh <= gpt->leh) &&
592
{ /* left (upper) 'dust' box case */
593
compute_bnd_ubox(pc,&ldbnd);
595
(ldbnd.bw >= gpt->ubw) &&
596
( (ldbnd.bh >= gpt->ubh) && (ldbnd.bh <= gpt->mh) ) &&
597
(ldbnd.ew <= gpt->uew) &&
598
(ldbnd.eh <= gpt->ueh) &&
604
} /*------------------------------------------------------------------*/
606
static void compute_bnd_ubox(cell *pc,bnd_allowed *bnd)
610
bnd->ew=(pc->r_col+pc->w);
611
bnd->eh=(pc->r_row+pc->h);
612
} /*------------------------------------------------------------------*/
614
static void compute_bnd_lbox(cell *pc,bnd_allowed *bnd)
618
bnd->ew=(pc->r_col+pc->w);
619
bnd->eh=(pc->r_row+pc->h);
620
} /*------------------------------------------------------------------*/
622
static int16_t test_O0(cell *pc)
627
uchar saveV[VERS_IN_CELL*sizeof(version)];
631
save_c_flg=pc->flg; /* save flag of the cell */
634
memcpy(saveV,pc->vers,VERS_IN_CELL*sizeof(version));
635
/* the flag storing is necessary because of short_recog_cell may change
636
this flag but doas not correct the lists of the cells */
637
memset(pc->vers,0,4*sizeof(version));
639
pc->vers[0].let='0'; pc->vers[1].let=(uchar)'�'; pc->vers[2].let='O';
641
for (v=pc->vers; v->let; v++)
644
if( db_status && snap_activity('h') ){
653
memcpy(pc->vers,saveV,VERS_IN_CELL*sizeof(version));
658
//------------------------------------------------
660
static int16_t rec_O0(cell *pc)
665
uchar saveV[VERS_IN_CELL*sizeof(version)];
668
save_c_flg=pc->flg; /* save flag of the cell */
671
memcpy(saveV,pc->vers,VERS_IN_CELL*sizeof(version));
672
/* the flag storing is necessary because of short_recog_cell may change
673
this flag but doas not correct the lists of the cells */
674
short_recog_cell(pc);
675
for (wi=0; wi < pc->nvers; wi++)
678
(pc->vers[wi].let == 'O') ||
679
(pc->vers[wi].let == 'o') ||
680
(language==LANG_RUSSIAN && ((pc->vers[wi].let == (uchar)'�') ||
681
(pc->vers[wi].let == (uchar)'�')))||
682
(pc->vers[wi].let == '0')
684
{ rc=pc->vers[wi].prob;goto Rexit;}
688
if( db_status && snap_activity('h') ){
696
memcpy(pc->vers,saveV,VERS_IN_CELL*sizeof(version));
698
} /*------------------------------------------------------------------*/
700
static int16_t search_underline_dust()
705
while (prd->next && prd->r_col<=gpt->lew)
707
if (prd != gpt->BC && prd->w<<1 > prd->h*3 && prd->w > gpt->BC->w>>2 &&
708
compare_bound(prd,'R'))
711
prd->complist=NULL; //single
712
if (prd->w > prd->h<<1)
719
if (weak) gpt->like_O=0;
723
static cell *rest_composition(cell *cmplx)
725
cell *c=(cell *)cmplx->complist,*cl=c;
727
if (c==NULL) return cl; // cmplx is single
730
cl=rest_cell(c,cmplx);
731
c=(cell *)cl->complist;
738
static void improve_proN()
740
cell *BC=gpt->BC,*cl=BC->prev,*cr=BC->next;
741
int16_t p=BC->vers[gpt->n_ver_perc].prob;
742
int16_t w3=(5*BC->w+6)/12,h8=BC->h/8;
743
int16_t bot=BC->r_row+BC->h,right=BC->r_col+BC->w;
745
BC->complist=NULL; //single
746
while (cl->flg & c_f_dust &&
747
cl->r_col>=BC->r_col-w3 && cl->r_row>BC->r_row && cl->r_row+cl->h<bot+h8)
749
BC=collect_cell_save(BC,cl);
753
while (cr->next && middle(cr)<=right) cr=cr->next;
754
while (cr->flg & c_f_dust &&
755
cr->r_col+cr->w<=right+w3 &&
756
cr->r_row>BC->r_row-h8 && cr->r_row+cr->h<bot)
758
BC=collect_cell_save(BC,cr);
762
if (BC->complist != NULL)
765
if (BC->vers[0].let != (uchar)PRO_NUMBER || BC->vers[0].prob<=p)
766
BC=rest_composition(BC);
769
gpt->rcps = PRO_NUMBER; gpt->n_ver_perc=0;
775
static RecRaster workRaster;
777
/* swapbytes takes a 32 bit value and does an endianness change.
778
* Since it was only used on Windows (not Mac) I'm assuming it means
779
* "swap 32 bytes between big endian and current byte order".
781
#if defined(WIN32) && defined(_MSC_VER) && (_MSC_VER > 800)
782
#define swapbytes(a) __asm { \
787
#elif defined(__GNUC__) /* FIXME: also check that we are on x86. And little-endian. */
788
#define swapbytes(a) asm ("bswap %0;" :"=r"(a) :"0"(a));
790
#error You must define swapbytes for your platform
793
Bool makeRasterC( c_comp* comp, RecRaster** rast )
795
int i,cInter,beg,end,beg31,end31,beg32,end32,width32;
801
memset(&workRaster.Raster[0],0,REC_MAX_RASTER_SIZE);
802
workRaster.lnPixWidth = comp->w;
803
workRaster.lnPixHeight = comp->h;
804
workRaster.lnRasterBufSize = REC_MAX_RASTER_SIZE;
805
width32 = REC_GW_WORD32(workRaster.lnPixWidth);
806
rast32 = (uint32_t*)&workRaster.Raster[0];
808
// assert(4*width32*workRaster.lnPixHeight <= REC_MAX_RASTER_SIZE); Paul 10-6-97
809
if (4*width32*workRaster.lnPixHeight > REC_MAX_RASTER_SIZE)
812
plnhead = (lnhead*)((char*)comp + sizeof(c_comp) + sizeof(uint16_t));
813
while( plnhead->lth ){
814
cInter = plnhead->row;
815
inter = (interval*)(plnhead+1);
817
beg = inter->e - inter->l;
819
beg32 = cInter*width32 + beg/32;
820
end32 = cInter*width32 + end/32;
824
for(i = beg32+1; i < end32; i++)
825
rast32[i] = 0xFFFFFFFF;
826
if( beg32 == end32 ){
827
tmp = ( (uint32_t)0xFFFFFFFF >> beg31 ) &
828
( (uint32_t)0xFFFFFFFF << (31-end31) );
830
rast32[beg32] |= tmp;
833
tmp = (uint32_t)0xFFFFFFFF >> beg31;
835
rast32[beg32] |= tmp;
836
tmp = (uint32_t)0xFFFFFFFF << (31-end31);
838
rast32[end32] |= tmp;
844
plnhead = (lnhead*)((char*)plnhead+plnhead->lth);
851
Bool test_cell(cell *c)
860
c_comp* comp = c->env;
863
// Oleg : 26-07-1995 : TCell without env can't recog
867
memset(&recobj,0,sizeof(recobj));
868
if (!makeRasterC(comp,&rst))
870
memcpy(&recobj.recData.recRaster,rst,sizeof(RecRaster));
871
recobj.recData.lwCompCnt = 1;
872
if (c->broken_II) recobj.recData.lwStatus |= REC_STATUS_BROKEN_II;
876
r.left = comp->left -1;// + 8*(fieldRect.left/8);
877
r.top = comp->upper-1;// + fieldRect.top ;
878
r.right = comp->left + comp->w;
879
r.bottom= comp->upper + comp->h;
880
recobj.recData.rect = r;
882
result = &recobj.recResults;
883
result->lnAltCnt=c->nvers;
884
assert(REC_MAX_VERS==VERS_IN_CELL);
885
for (i=0,alt=result->Alt,v=c->vers; i<c->nvers; i++,alt++,v++)
886
alt->Code=stdAsciiToAnsi(v->let);
887
// memcpy(result->Alt,c->vers,sizeof(version)*c->nvers);
888
if (!LEORecogCharPRN_expert(&recobj)) return FALSE;
889
c->nvers=(int16_t)result->lnAltCnt;
890
for (i=0,alt=result->Alt,v=c->vers; i<c->nvers; i++,alt++,v++)
892
v->let=stdAnsiToAscii(alt->Code);
896
// memcpy(c->vers,result->Alt,sizeof(version)*c->nvers);