2
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
�������� ��� ������ ���� ���� �������� � ����������� ����� ������� � ������.
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
33
Redistribution and use in source and binary forms, with or without modification,
34
34
are permitted provided that the following conditions are met:
103
103
void *mnfirstbox; // address of the first box
104
Int16 mncounter; // (was INT) number of living lines in the component
104
int16_t mncounter; // (was int16_t) number of living lines in the component
105
105
#define mnfree mnfirstbox // reference to next free main number
106
Int16 mnupper; // upper bound of component
107
Int16 mnlower; // lower bound of component
108
Int16 mnboxcnt; // number of boxes in component
106
int16_t mnupper; // upper bound of component
107
int16_t mnlower; // lower bound of component
108
int16_t mnboxcnt; // number of boxes in component
109
109
#define usual_box_count 20 // heuristic of number of lines in a letter
110
110
#define great_box_count 200 // heuristic for number of boxes in a picture
111
Word8 mnlines; // number of lines in the component
112
Word8 mnbegs; // number of free line begins
113
Word8 mnends; // number of free line ends
114
Word8 mnflag; // flag byte for main number
111
uchar mnlines; // number of lines in the component
112
uchar mnbegs; // number of free line begins
113
uchar mnends; // number of free line ends
114
uchar mnflag; // flag byte for main number
115
115
#define mnpicture 1 // component is a picture
116
116
struct mn_struc *mnnext; // address of next dead component
124
124
struct box_struct *boxnext; // chain address (zero if no next box)
125
125
MN * boxmain; // component main number pointer
126
Word16 boxptr; // ptr to the empty place in the box
127
Int16 boxleft; // left boundary for line envelope
128
Int16 boxright; // right boundary for line envelope
129
Int16 boxey; // row of line end+1 ( if line ends within
126
uint16_t boxptr; // ptr to the empty place in the box
127
int16_t boxleft; // left boundary for line envelope
128
int16_t boxright; // right boundary for line envelope
129
int16_t boxey; // row of line end+1 ( if line ends within
131
Int16 boxel; // length of the last segment (if line ends
131
int16_t boxel; // length of the last segment (if line ends
133
Int16 boxex; // coordinate of last segment end (if line
133
int16_t boxex; // coordinate of last segment end (if line
134
134
// ends within box)
135
Word8 boxflag; // byte for box attributes flags
136
Word8 boxwf; // working flag (for picture compress)
137
Word16 boxresw; // reserved word (for *4 arround)
135
uchar boxflag; // byte for box attributes flags
136
uchar boxwf; // working flag (for picture compress)
137
uint16_t boxresw; // reserved word (for *4 arround)
139
139
typedef struct box_struct BOX;
177
177
struct comp_struc
179
WORD size; // size of component in paragraphs >=3
180
INT upper; // upper boundary of component
181
INT left; // left boundary of component
182
INT h; // height of component
183
INT w; // width of component
184
BYTE rw; // raster width in bytes
185
BYTE type; // recognition type
179
uint16_t size; // size of component in paragraphs >=3
180
int16_t upper; // upper boundary of component
181
int16_t left; // left boundary of component
182
int16_t h; // height of component
183
int16_t w; // width of component
184
uchar rw; // raster width in bytes
185
uchar type; // recognition type
186
186
#define ch_perfect 1 // perfect type defined
187
187
#define ch_letter 2 // letter type
188
188
#define ch_dust 4 // dust type
191
191
#define ch_great 32 // great component
192
192
#define ch_merge 64 // merged components
193
193
#define ch_notltr 128 // not letter or punctuation
194
BYTE cs; // recognition case (see bellow)
195
BYTE pidx; // proportional index (ref.)
196
INT nvers; // number of alternative versions
197
INT records; // recognition records offset
198
INT lines; // ptr to line representation
199
INT nl; // number of lines
200
BYTE begs; // number of free begins
201
BYTE ends; // number of free ends
202
BYTE reasno; // proportional criteria messages
203
BYTE large; // large type
194
uchar cs; // recognition case (see bellow)
195
uchar pidx; // proportional index (ref.)
196
int16_t nvers; // number of alternative versions
197
int16_t records; // recognition records offset
198
int16_t lines; // ptr to line representation
199
int16_t nl; // number of lines
200
uchar begs; // number of free begins
201
uchar ends; // number of free ends
202
uchar reasno; // proportional criteria messages
203
uchar large; // large type
204
204
#define ch_underlined 1 // component was underlined
205
205
#define ch_taken 2 // taken to line at dust_ini
206
BYTE scale; // scale of the component
206
uchar scale; // scale of the component
208
// BYTE stairs[4]; // bit_map for stairs_vector components
208
// uchar stairs[4]; // bit_map for stairs_vector components
209
209
struct comp_struc * next;
243
243
struct vers_struct // versions with probabilities
245
BYTE let; // character
246
BYTE prob; // probability
245
uchar let; // character
246
uchar prob; // probability
248
248
typedef struct vers_struct version;
249
249
//----------------------- stick -------------------------------
251
251
struct stick_struct
253
CHAR x,y,l,w,top,bot;
253
char x,y,l,w,top,bot;
256
256
typedef struct stick_struct STICK;
258
258
struct cell_struc
260
INT row; // ideal row of cell
261
INT col; // ideal collumn of cell
262
INT h; // height of cell
263
INT w; // width of cell
260
int16_t row; // ideal row of cell
261
int16_t col; // ideal collumn of cell
262
int16_t h; // height of cell
263
int16_t w; // width of cell
264
264
c_comp *env; // envelope and line representation ptr
265
265
struct cell_struc *next; // next in all string
266
266
struct cell_struc *prev; // prev in all string
267
267
struct cell_struc *nextl; // next letter ( only for letters )
268
268
struct cell_struc *prevl; // prev letter ( only for letters )
269
CHAR bdiff; // local base line corrective displacement
270
BYTE difflg; // local correction flg
269
char bdiff; // local base line corrective displacement
270
uchar difflg; // local correction flg
271
271
// baseline defined by cell:
272
272
#define c_db_b1 1
273
273
#define c_db_b2 2
287
287
#define c_bs_round 32
288
288
#define c_bs_cap 64 // capital shape
289
289
#define c_bs_done 128
294
INT r_row; // real row of cell
295
INT r_col; // real collumn of cell
296
INT nvers; // number of versions
294
int16_t r_row; // real row of cell
295
int16_t r_col; // real collumn of cell
296
int16_t nvers; // number of versions
297
297
version vers[VERS_IN_CELL];
298
BYTE cg_flag; // cut-to-glue message
298
uchar cg_flag; // cut-to-glue message
299
299
#define c_cg_noglue 1 // don't glue to ... ( just cut )
300
300
#define c_cg_noenv 2 // envelope address obsolete
301
301
#define tenv(c) ((c)->env && !((c)->cg_flag&c_cg_noenv))
343
343
#define c_fp_it 16 // italic
344
344
#define c_fp_str 32 // stright
345
345
#define c_fp_undrln 64 // underlined
346
BYTE dens; // BOX - calculated density
347
BYTE recsource; // who and how recognized
346
uchar dens; // BOX - calculated density
347
uchar recsource; // who and how recognized
348
348
#define c_rs_ev 1 // events brought versions
349
349
#define c_rs_BOX 2 // BOX done
350
350
#define c_rs_BOXs 4 // BOX > "29500"
351
351
#define c_rs_bitcmp 8 // bit compare takes versions
352
INT stick_inc; // inc of stick
352
int16_t stick_inc; // inc of stick
353
353
#define NO_INCLINE 10000 // not init incline
354
354
c_comp *complist; // if no envelope - list of envelopes
355
BYTE bas_acc; // cell's relations with bases
355
uchar bas_acc; // cell's relations with bases
356
356
#define c_ba_b1 1 // accepted to b1
357
357
#define c_ba_b2 2 // accepted to b2
358
358
#define c_ba_killed 4 // temporary: all versions killed by linear
359
359
#define c_ba_chance 8 // one more chance for cut version
360
INT left; // left of main part (without accent)
361
INT right; // right of main part (without accent)
360
int16_t left; // left of main part (without accent)
361
int16_t right; // right of main part (without accent)
363
363
#define c_shp_cap 1
364
364
#define c_shp_stick 2
365
365
#define c_shp_stb1 4
366
366
#define c_shp_small 8
367
367
#define c_shp_dbh 32
368
368
#define c_shp_b1up 16
369
BYTE rus_eng_word; // information for RUS/ENG manipulations
369
uchar rus_eng_word; // information for RUS/ENG manipulations
370
370
#define ruseng_no 0 // russian
371
371
#define ruseng_rus 0 // russian
372
372
#define ruseng_re 1 // russian or english
373
373
#define ruseng_eng 2 // english
374
374
#define ruseng_alt 3 // many alternates
375
BYTE broken_II; // II configuration
375
uchar broken_II; // II configuration
378
378
#define erect_no 0 // really envelop
379
379
#define erect_rot 1 // rotate image
380
380
#define erect_rest 2 // restore after rotating
393
393
#define c_cg_cut_mr 0x20 // right middle cutten
394
394
#define c_cg_cut_br 0x40 // right bottom cutten
395
395
#define c_cg_cut_fr 0x80 // right full cutten
396
LONG clink; // Link to the cluster
396
int32_t clink; // Link to the cluster
397
397
struct cell_struc * dup; // ref to copy of this word; defined only in spaces
398
398
#define dup_default ((cell*)0xffffffff)
399
399
#define MAX_BATON 3
400
400
#define NO_BATONS 255
401
401
STICK save_baton[MAX_BATON];
403
BYTE accent_leader; // leader cell in farajev complex-cell
404
BYTE bottom_accent; // was spare[1]; 16.10.97 E.P.
403
uchar accent_leader; // leader cell in farajev complex-cell
404
uchar bottom_accent; // was spare[1]; 16.10.97 E.P.
406
406
typedef struct cell_struc cell;
448
INT row; // upper of line
449
INT col; // left of line
450
INT lower; // lower of line
451
INT right; // right of line
452
WORD dust; // end of letter ptrs
453
WORD end; // end of dust ptrs
457
WORD scale; // scale of the string
458
INT fragment; // fragment of the string
459
BYTE language; // language of the string
448
int16_t row; // upper of line
449
int16_t col; // left of line
450
int16_t lower; // lower of line
451
int16_t right; // right of line
452
uint16_t dust; // end of letter ptrs
453
uint16_t end; // end of dust ptrs
457
uint16_t scale; // scale of the string
458
int16_t fragment; // fragment of the string
459
uchar language; // language of the string
460
460
c_comp *c__comp[1]; // array of ptrs to components
462
462
typedef struct str_struc str;