Debian Codegraph @

cuneiform_src/Kern/hhh/tigerh/h/struct.h

raw
1 /*
2 Copyright (c) 1993-2008, Cognitive Technologies
3 All rights reserved.
4
5 Разрешается повторное распространение и использование как в виде исходного кода,
6 так и в двоичной форме, с изменениями или без, при соблюдении следующих условий:
7
8 * При повторном распространении исходного кода должны оставаться указанное
9 выше уведомление об авторском праве, этот список условий и последующий
10 отказ от гарантий.
11 * При повторном распространении двоичного кода в документации и/или в
12 других материалах, поставляемых при распространении, должны сохраняться
13 указанная выше информация об авторском праве, этот список условий и
14 последующий отказ от гарантий.
15 * Ни название Cognitive Technologies, ни имена ее сотрудников не могут
16 быть использованы в качестве средства поддержки и/или продвижения
17 продуктов, основанных на этом ПО, без предварительного письменного
18 разрешения.
19
20 ЭТА ПРОГРАММА ПРЕДОСТАВЛЕНА ВЛАДЕЛЬЦАМИ АВТОРСКИХ ПРАВ И/ИЛИ ДРУГИМИ ЛИЦАМИ "КАК
21 ОНА ЕСТЬ" БЕЗ КАКОГО-ЛИБО ВИДА ГАРАНТИЙ, ВЫРАЖЕННЫХ ЯВНО ИЛИ ПОДРАЗУМЕВАЕМЫХ,
22 ВКЛЮЧАЯ ГАРАНТИИ КОММЕРЧЕСКОЙ ЦЕННОСТИ И ПРИГОДНОСТИ ДЛЯ КОНКРЕТНОЙ ЦЕЛИ, НО НЕ
23 ОГРАНИЧИВАЯСЬ ИМИ. НИ ВЛАДЕЛЕЦ АВТОРСКИХ ПРАВ И НИ ОДНО ДРУГОЕ ЛИЦО, КОТОРОЕ
24 МОЖЕТ ИЗМЕНЯТЬ И/ИЛИ ПОВТОРНО РАСПРОСТРАНЯТЬ ПРОГРАММУ, НИ В КОЕМ СЛУЧАЕ НЕ
25 НЕСЁТ ОТВЕТСТВЕННОСТИ, ВКЛЮЧАЯ ЛЮБЫЕ ОБЩИЕ, СЛУЧАЙНЫЕ, СПЕЦИАЛЬНЫЕ ИЛИ
26 ПОСЛЕДОВАВШИЕ УБЫТКИ, СВЯЗАННЫЕ С ИСПОЛЬЗОВАНИЕМ ИЛИ ПОНЕСЕННЫЕ ВСЛЕДСТВИЕ
27 НЕВОЗМОЖНОСТИ ИСПОЛЬЗОВАНИЯ ПРОГРАММЫ (ВКЛЮЧАЯ ПОТЕРИ ДАННЫХ, ИЛИ ДАННЫЕ,
28 СТАВШИЕ НЕГОДНЫМИ, ИЛИ УБЫТКИ И/ИЛИ ПОТЕРИ ДОХОДОВ, ПОНЕСЕННЫЕ ИЗ-ЗА ДЕЙСТВИЙ
29 ТРЕТЬИХ ЛИЦ И/ИЛИ ОТКАЗА ПРОГРАММЫ РАБОТАТЬ СОВМЕСТНО С ДРУГИМИ ПРОГРАММАМИ,
30 НО НЕ ОГРАНИЧИВАЯСЬ ЭТИМИ СЛУЧАЯМИ), НО НЕ ОГРАНИЧИВАЯСЬ ИМИ, ДАЖЕ ЕСЛИ ТАКОЙ
31 ВЛАДЕЛЕЦ ИЛИ ДРУГОЕ ЛИЦО БЫЛИ ИЗВЕЩЕНЫ О ВОЗМОЖНОСТИ ТАКИХ УБЫТКОВ И ПОТЕРЬ.
32
33 Redistribution and use in source and binary forms, with or without modification,
34 are permitted provided that the following conditions are met:
35
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.
44
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.
55 */
56
57 /*
58 ЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫ
59 ЫЫ ЫЫ
60 ЫЫ Copyright (C) 1990 Cognitive Technology Corporation. ЫЫ
61 ЫЫ All rights reserved. This program is proprietary and ЫЫ
62 ЫЫ a trade secret of Cognitive Technology Corporation. ЫЫ
63 ЫЫ ЫЫ
64 ЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫ
65 */
66
67 #ifndef H_struct_h
68 #define H_struct_h
69
70 #include "tuner.h"
71
72 #ifdef HUGE_IMAGE
73 #define WORLD_MAX_HEIGHT 10000
74 #define WORLD_MAX_WIDTH 10000 //7000
75 #define WORLD_MAX_RESOLUTION 800
76 #else
77 #define WORLD_MAX_HEIGHT 4096 // ordinary image
78 #define WORLD_MAX_WIDTH 4096
79 #define WORLD_MAX_RESOLUTION 400
80 #endif
81
82
83 #define RASTER_MAX_HEIGHT 63
84 #define RASTER_MAX_WIDTH 128
85 #define SMALL_SIZE 8
86 // AK! Atention!!!!//////////////////////////////////////////////////////
87 // имеет смысл при необходимости отловить глюки так как падает при попытке
88 // принять dust за letter
89 #define err_pnlet(c) //((c))->nextl=((c))->prevl=(cell*)(0xffff0000)
90 #define err_pnnextlet(c) //((c))->nextl= (cell*)(0xffff0000)
91 #define err_pnprevlet(c) //((c))->prevl= (cell*)(0xffff0000)
92 #define err_pncell(c) //((c))->next =((c))->prev =(cell*)(0xffff0000)
93 #define err_pnnextcell(c) //((c))->next = (cell*)(0xffff0000)
94 #define err_pnprevcell(c) //((c))->prev = (cell*)(0xffff0000)
95 // AK!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
96 //#define err_pnlet(c) ((c))->nextl=((c))->prevl=(cell*)(0xffff0000);
97 ///////////////////////////////////////////////////////////////////////AK
98 // AL 900318
99 //-------------------- conectivity component ---------------------
100
101 struct mn_struc
102 {
103 void *mnfirstbox; // address of the first box
104 int16_t mncounter; // (was int16_t) number of living lines in the component
105 #define mnfree mnfirstbox // reference to next free main number
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 #define usual_box_count 20 // heuristic of number of lines in a letter
110 #define great_box_count 200 // heuristic for number of boxes in a picture
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 #define mnpicture 1 // component is a picture
116 struct mn_struc *mnnext; // address of next dead component
117 };
118 typedef struct mn_struc MN;
119
120 //------------------- The box has a header ----------------------
121
122 struct box_struct
123 {
124 struct box_struct *boxnext; // chain address (zero if no next box)
125 MN * boxmain; // component main number pointer
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
130 // box)
131 int16_t boxel; // length of the last segment (if line ends
132 // within box)
133 int16_t boxex; // coordinate of last segment end (if line
134 // ends within box)
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)
138 };
139 typedef struct box_struct BOX;
140
141 // Values of boxflag:
142
143 #define BOXMARK 1 // flag for temporary box marking
144 #define BOXPICTURE 2 // the picture box - only header in the box is true
145 #define BOXFREEBEG 0x30 // line start type mask
146 #define BOXFREEEND 0xc0 // line end type mask
147 // The 'boxfreebeg' and 'boxfreeend' bites has following meaning:
148 // '11' - free begin/end of line
149 // '01' - not free begin/end
150 // '00' - no information about begin/end in this box
151 #define BOXBEG 0x10 // line start not free
152 #define BOXEND 0x40 // line end not free
153
154 // BOX size
155
156 #define BOXHLTH (sizeof(BOX)) // the box header length
157 #define BOXSIZE (BOXHLTH+32*4) // the length of box
158 #define BOXBOUNDARY (BOXSIZE-6) // the boundary control
159
160 struct ldescr_struct
161 {
162 int16_t y; // y coord. of the first interval
163 int16_t l; // first interval length
164 int16_t x; // x coord. of the end of the first interval
165 };
166 typedef struct ldescr_struct LNSTRT;
167
168 struct box_interval
169 {
170 int16_t l; // length of interval
171 int16_t d; // displacement of the end of the current interval relative
172 }; // to the previous
173 typedef struct box_interval BOXINT;
174
175 //-------------------- component in kit --------------------------
176
177 struct comp_struc
178 {
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 #define ch_perfect 1 // perfect type defined
187 #define ch_letter 2 // letter type
188 #define ch_dust 4 // dust type
189 #define ch_punct 8 // punctuation
190 #define ch_stick 16 // vertical bar component
191 #define ch_great 32 // great component
192 #define ch_merge 64 // merged components
193 #define ch_notltr 128 // not letter or punctuation
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 #define ch_underlined 1 // component was underlined
205 #define ch_taken 2 // taken to line at dust_ini
206 uchar scale; // scale of the component
207 // union {
208 // uchar stairs[4]; // bit_map for stairs_vector components
209 struct comp_struc * next;
210 // };
211 };
212 typedef struct comp_struc c_comp;
213
214 struct dust_comp_struc
215 {
216 uint16_t size; // =1
217 int16_t upper;
218 int16_t left;
219 uchar h; // >0
220 uchar w; // >0
221 uchar raster[8];
222 };
223 typedef struct dust_comp_struc dust_comp;
224
225 struct file_comp_struct
226 {
227 uint16_t size; // =1
228 int16_t upper;
229 int16_t left;
230 uchar h; // =0
231 uchar w; // =0
232 uint32_t offset;
233 uint16_t lth;
234 uchar scale;
235 uchar reserv;
236 };
237 typedef struct file_comp_struct file_comp;
238
239 //----------------------- cell ----------------------------------
240
241 #define VERS_IN_CELL 16 // Vald. 06-04-94
242
243 struct vers_struct // versions with probabilities
244 {
245 uchar let; // character
246 uchar prob; // probability
247 };
248 typedef struct vers_struct version;
249 //----------------------- stick -------------------------------
250
251 struct stick_struct
252 {
253 char x,y,l,w,top,bot;
254 int16_t incl;
255 };
256 typedef struct stick_struct STICK;
257
258 struct cell_struc
259 {
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 c_comp *env; // envelope and line representation ptr
265 struct cell_struc *next; // next in all string
266 struct cell_struc *prev; // prev in all string
267 struct cell_struc *nextl; // next letter ( only for letters )
268 struct cell_struc *prevl; // prev letter ( only for letters )
269 char bdiff; // local base line corrective displacement
270 uchar difflg; // local correction flg
271 // baseline defined by cell:
272 #define c_db_b1 1
273 #define c_db_b2 2
274 #define c_db_b3 4
275 #define c_db_b4 8
276 //
277 #define c_db_down 16 // base corrected 1 pixel down
278 #define c_db_up 32 // base corrected 1 pixel up
279 #define c_db_forbid 64 // don't take to calculate bases (abnormal pos)
280 #define c_db_solid 128 // BOX_solid letter not penalized
281 uchar basflg;
282 #define c_bs_b1a 1 // agrees to be at b1
283 #define c_bs_b2a 2 // b2
284 #define c_bs_bt 4 // 't' level
285 #define c_bs_t 8 // 't' only (letters)
286 #define c_bs_b1up 16 // may be above b1
287 #define c_bs_round 32
288 #define c_bs_cap 64 // capital shape
289 #define c_bs_done 128
290 char bas1;
291 char bas2;
292 char bas3;
293 char bas4;
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 version vers[VERS_IN_CELL];
298 uchar cg_flag; // cut-to-glue message
299 #define c_cg_noglue 1 // don't glue to ... ( just cut )
300 #define c_cg_noenv 2 // envelope address obsolete
301 #define tenv(c) ((c)->env && !((c)->cg_flag&c_cg_noenv))
302 #define c_cg_comp 4 // composed cell
303 #define tsimple(c) (tenv(c) && !((c)->cg_flag&c_cg_comp))
304 //#define c_cg_rqdot 4 // dot test needed (iIl1 in versions)
305 // 93.08.19 the flag uprazdnen
306 #define c_cg_cutdone 8 // verarbeitet by cut
307 #define c_cg_cutr 16 // cut at right side
308 #define c_cg_cutl 32 // cut at left side
309 #define c_cg_cut 16+32 // cut somewhere
310 #define c_cg_cutacc 8+16+32 // cutted accent
311 #define c_cg_just 64 // just created
312 #define c_cg_cutoff 128 // ignore "cutted" flags at glue attempt
313 uint16_t flg; // flag of cell
314 #define c_f_let 1 // letter component
315 #define c_f_bad 2 // badly recognized
316 #define c_f_dust 4 // dust
317 #define c_f_punct 8 // punctuation
318 #define c_f_space 16 // space
319 #define c_f_solid 32 // spelled letter
320 #define c_f_confirmed 64 // confirmed letter
321 #define c_f_fict 128 // fictive element
322 #define c_f_detouch 256 // fictive element
323 uchar cpos; // position of component
324 #define ce_p_small 1
325 #define ce_p_large 2
326 #define ce_p_low 4
327 #define ce_p_t 8
328 #define ce_p_Q 16
329 #define ce_p_Ql 32
330 #define ce_p_bra 64
331 #define ce_p_ex 128
332 #define ce_p_all 255 // all positions are possible
333 uchar reasno; // proportional criteria messages
334 #define c_rn_right 1 // right refuse by proportions
335 #define c_rn_left 2 // left refuse by proportions
336 #define c_rn_pi 4 // this is a dot of some 'i'
337 uchar keg; // kegel
338 uchar font; // font properties
339 #define c_fp_ser 1 // serific
340 #define c_fp_gelv 2 // helvetic
341 #define c_fp_bold 4 // bold
342 #define c_fp_light 8 // light
343 #define c_fp_it 16 // italic
344 #define c_fp_str 32 // stright
345 #define c_fp_undrln 64 // underlined
346 uchar dens; // BOX - calculated density
347 uchar recsource; // who and how recognized
348 #define c_rs_ev 1 // events brought versions
349 #define c_rs_BOX 2 // BOX done
350 #define c_rs_BOXs 4 // BOX > "29500"
351 #define c_rs_bitcmp 8 // bit compare takes versions
352 int16_t stick_inc; // inc of stick
353 #define NO_INCLINE 10000 // not init incline
354 c_comp *complist; // if no envelope - list of envelopes
355 uchar bas_acc; // cell's relations with bases
356 #define c_ba_b1 1 // accepted to b1
357 #define c_ba_b2 2 // accepted to b2
358 #define c_ba_killed 4 // temporary: all versions killed by linear
359 #define c_ba_chance 8 // one more chance for cut version
360 int16_t left; // left of main part (without accent)
361 int16_t right; // right of main part (without accent)
362 uchar shape;
363 #define c_shp_cap 1
364 #define c_shp_stick 2
365 #define c_shp_stb1 4
366 #define c_shp_small 8
367 #define c_shp_dbh 32
368 #define c_shp_b1up 16
369 uchar rus_eng_word; // information for RUS/ENG manipulations
370 #define ruseng_no 0 // russian
371 #define ruseng_rus 0 // russian
372 #define ruseng_re 1 // russian or english
373 #define ruseng_eng 2 // english
374 #define ruseng_alt 3 // many alternates
375 uchar broken_II; // II configuration
376 uchar language;
377 uchar pos_inc;
378 #define erect_no 0 // really envelop
379 #define erect_rot 1 // rotate image
380 #define erect_rest 2 // restore after rotating
381 #define erect_old 4 // rotate prototype images
382 #define erect_zero 8 // disable rotate and cursive study
383 #define set_erection( c, inc ) if( (inc)!=NO_INCLINE&&tenv(c) ) \
384 { (c)->stick_inc=inc; (c)->pos_inc=inc?erect_rot:erect_zero; }
385 int16_t save_stick_inc; // save_inc of stick
386 uchar cg_flag_fine; // type of cutting position
387 #define c_cg_cut_tl 0x01 // left top cutten
388 #define c_cg_cut_ml 0x02 // left middle cutten
389 #define c_cg_cut_bl 0x04 // left bottom cutten
390 #define c_cg_cut_fl 0x08 // left full cutten
391
392 #define c_cg_cut_tr 0x10 // right top cutten
393 #define c_cg_cut_mr 0x20 // right middle cutten
394 #define c_cg_cut_br 0x40 // right bottom cutten
395 #define c_cg_cut_fr 0x80 // right full cutten
396 int32_t clink; // Link to the cluster
397 struct cell_struc * dup; // ref to copy of this word; defined only in spaces
398 #define dup_default ((cell*)0xffffffff)
399 #define MAX_BATON 3
400 #define NO_BATONS 255
401 STICK save_baton[MAX_BATON];
402 uchar n_baton;
403 uchar accent_leader; // leader cell in farajev complex-cell
404 uchar bottom_accent; // was spare[1]; 16.10.97 E.P.
405 };
406 typedef struct cell_struc cell;
407
408 //-------------------- line representation ----------------------
409
410 // At the beginning of line representation - word of total length -
411 // not use it, simply skip
412 // At end of each line zero byte as mark of line end
413 // After last line zero word
414
415 // line header
416 struct ln_head
417 {
418 int16_t lth; // length of one line representation
419 int16_t h; // height of line
420 int16_t row; // relative row of line start
421 uchar flg; // flags of free beg and free end
422 #define l_fbeg 0x20
423 #define l_fend 0x80
424 #define l_cbeg 0x02
425 #define l_cend 0x08
426 };
427 typedef struct ln_head lnhead;
428
429 // one interval
430 struct int_s
431 {
432 uchar l; // length of interval
433 uchar e; // end of interval coordinates
434 };
435 typedef struct int_s interval;
436
437 struct large_int_s
438 {
439 uint16_t l; // length of interval
440 uint16_t e; // end of interval coordinates
441 };
442 typedef struct large_int_s large_interval;
443
444 //------------------- string of letters ------------------------
445
446 struct str_struc
447 {
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
454 uint16_t lth;
455 uint16_t first;
456 uint16_t last;
457 uint16_t scale; // scale of the string
458 int16_t fragment; // fragment of the string
459 uchar language; // language of the string
460 c_comp *c__comp[1]; // array of ptrs to components
461 };
462 typedef struct str_struc str;
463
464 //----------------------- base lines --------------------------
465
466 struct baseline_struct
467 {
468 int16_t b0,b1,b2,b3,b4,bm,ps; // four base lines, middle line, point size
469 int16_t n1,n2,n3,n4;
470 };
471 typedef struct baseline_struct B_LINES;
472
473 //------------------------- rules -----------------------------
474 //AK: without collision when snap.dll creating
475 #ifndef _SNAP_
476
477 struct POINT_S {int16_t row,col;} ;
478
479 struct rule_struct
480 {
481 struct POINT_S beg,end;
482 uchar width;
483 uchar type;
484 #define VERT_LN 0
485 #define HOR_LN 1
486 #define UNDRLN 2
487 #define FRM_LN 4
488 };
489 typedef struct rule_struct STRLN;
490
491 struct frame_struct
492 {struct POINT_S topleft,topright,botleft,botright;};
493 typedef struct frame_struct FRAME;
494
495
496 #endif // _SNAP_
497 //--------- Piter 08-17-95 06:58pm for Sheets -----------------
498
499 #define FDSIZE 1024 // Full number of fragments
500 #define TO_FDF(i) ((i)<FDSIZE ? (i):0)
501
502 struct FragmentDescriptor {
503 int16_t user_num; // Number of USER
504 uchar language; // Language of fragments
505 uchar reserv;
506 };
507 typedef struct FragmentDescriptor FragDesc;
508
509
510 //-------------------------------------------------------------
511 #include "cutstr.h"
512 #include "embbox.h"
513 #endif
514
515
516
517