Debian Codegraph @

cuneiform_src/Kern/rling/sources/h/speldefs.h

raw symbols SCIP
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 // 08-13-93 08:41pm, Mike
59 //
60 // Updating: Command < #include "speltab.h" > has been added at the
61 // bottom of the file.
62 //
63 // Additional updating: see 08-13-93
64 #ifndef __SPEL__DEFS__
65 #define __SPEL__DEFS__
66
67 #if _MSC_VER > 1000
68 #pragma once
69 #endif // _MSC_VER > 1000
70
71
72 #include "ligas.h"
73
74 // AK removing this stupid macros!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
75 //#define Q SPQ
76 //////////////////////////////////////////////////////////////////////////////
77 // ED tegs
78 #define SS_BITMAP_REF 0x00
79 #define SS_TEXT_REF 0x01
80 #define SS_FONT_KEGL 0x02
81 #define SS_KEGL 0x03
82 #define SS_SHIFT 0x04
83 #define SS_RETR_LEVEL 0x05
84 #define SS_UNDERLINE 0x06
85 #define SS_DENS_PRINT 0x07
86 #define SS_TABUL 0x08
87 #define SS_TABL_TABUL 0x09
88 #define SS_SHEET_DESCR 0x0a
89 #define SS_FRAGMENT 0x0b
90 #define SS_STEP_BACK 0x0c
91 #define SS_LINE_BEG 0x0d
92 #define SS_POSITION 0x0e
93 #define SS_LANGUAGE 0x0f
94 #define SS_TABL_CONFORM_SIZES 0x10
95 #define SS_GROUP_WORDS 0x11
96 #define SS_GROUP_SYMBOLS 0x12
97 #define SS_AKSANT 0x1d
98 #define SS_NEG_HALF_SPACE 0x1e
99 #define SS_POS_HALF_SPACE 0x1f
100 ///////////////////////////////////////////////////////////////////////////
101 #define MAX_SHEET 1
102 #define MAX_FRAGM 128
103 #define TOO_MANY_FRAGMS -2
104 #define MAX_LINE_LTH 1000
105 #define ALL 1
106 #define SIZE_NEW_SEGM 128
107 #define EXIST 1
108 #define NONEXIST 0
109 #define RIGHT 1
110 #define LEFT 0
111 #define FRAGM_EL_TYPE 3
112 #define NUM_ALLOC 10
113 #define HOME 0x47
114 #define END 0x4f
115 #define ESC 0x011B
116 #define BS 0x08
117 #define TAB 0x09
118 #define RETURN 0x0D
119 #define DEL 0x53
120 #define NEW_LINE 1
121 #define CONT_LINE 2
122 #define FRAGM 0
123 #define SHEET 1
124 #define LINE 2
125 #define YES 1
126 #define NO 0
127 #define MAX_DEFAULT_PROB 240
128 #define MARK_5 240
129 #define MARK_4 200
130 #define MARK_3 150
131 #define MARK_2 50
132 #define TIF_COL_COEFF 8
133 #define TIF_ROW_COEFF 14
134 #define LAST_LETTER -1
135 ///////#define BUFSIZE 8192
136 #define MAX_STRING_LTH 80
137 #define TEXT_ACTIVE 1
138 #define TIF_ACTIVE 0
139 #define BAD_LEVEL 241
140 #define BSPACE 0xE
141 #define DELTA_ATTR 60
142 #define ED_READ 0
143 #define ED_WRITE 1
144 #define SPACE 0x20
145 #define NONSPACE 0
146 #define ON 1
147 #define OFF 0
148 #define TINY 1
149 #define LARGE 0
150 #define UPPER 0
151 #define LOWER 1
152 #define LEFT_MOVE 1
153 #define RIGHT_MOVE 2
154 #define UP_MOVE 4
155 #define DOWN_MOVE 8
156 #define OFF 0
157 #define ON 1
158
159 #define DELTA 50
160 /////////////////////////////////////////////////////////////////////////////
161 #define MAX_PARTS 16 /* max basic parts of object stored*/
162 #define MAX_WORDS 32 /* max nmb of words to compare */
163 #define MAX_WORD_SIZE 32 /* max size of an inputing word */
164 #define OK 1 /* standart reply of a function */
165 #define FAIL 0 /* standart reply of a function */
166 //////////////////////////////////////////////////////////////////////////////
167 // E D C O N V C O N S T A N T S //
168 //////////////////////////////////////////////////////////////////////////////
169 #define EDBUFF 1024 /* edroot - ed */
170 #define RECLEV 0.6 /* num of BLANK / all length */
171 #define ATDBL 3
172 #define MAXWRDBUFF 38
173 #define BLANK (uchar)bad_char
174 #define CR (uchar)0xFF
175 #define TRADEMARK 0X7E
176 #define WRDDIV (uchar)'-'
177 #define EOLIST (uchar)0x01
178 #define User_dicts 4 /* word has to be checked only according
179 * user dictionaries. */
180 #define All_dicts 3 /* word has to be checked according all
181 * available dicts. */
182 #define Stop 2 /* proc reply: stop loop routine */
183 #define Ok 1 /* proc reply: OK (cond is satisfied)*/
184 #define No 0 /* proc reply: BAD (not satisfied) */
185 #define DIG_DEFAULT_FRC 7
186 #define MAX_DEFAULT_PROB 240
187 #define MIN_SURE_PROB 240
188 #define MARK_5 240
189 #define MARK_4 200
190 #define MARK_3 150
191 #define MARK_2 50
192 #define MARK_1 0
193 #define VRBD (DWORD)0x300
194 #define BADFORDIN MARK_4 /* level of "bad character" */
195 /**************************************************************************/
196 /* VOCABULARY: constant definitions. */
197 /**************************************************************************/
198 #define VOC_W 1 /* write in vocabulary */
199 #define VOC_R 2 /* read from vocabulary (search in voc)*/
200 #ifdef ENGLISH_L
201 #define MAX_VOC_SIZE 0xf000 /* */
202 #else
203 #define MAX_VOC_SIZE 0x6000 /* 24K */
204 #endif
205 #define VOC_MEM_OVERFLOW -2
206 #define VOC_WRONG_ACCESS -3
207 #define VOC_ACCNT_OVERFLOW -4
208 #define VOC_ACCNT_ZERO -5
209 #define VOC_TOO_SMALL -6 /* MAX_VOC_SIZE less then sizeof(vert) */
210 /**************************************************************************/
211 typedef uchar byte;
212
213 struct bit_map_ref
214 {
215 byte code;
216 byte reserv;
217 int16_t row;
218 int16_t col;
219 int16_t width;
220 int16_t height;
221 };
222
223 struct text_ref /*type 0- letter */
224 {
225 byte code;
226 byte type; /* 2- word */
227 int16_t object; /* 3-string */
228 };
229
230 struct font_kegl
231 {
232 byte code;
233 byte new_kegl;
234 int16_t new_font;
235 };
236
237 struct kegl
238 {
239 byte code;
240 byte new_kegl;
241 };
242
243 struct shift_struct
244 {
245 byte code;
246 byte kegl;
247 int16_t clearance; /*value of lift or descent */
248 }; /* lift positive */
249 /* descent negative*/
250 struct retrieve_level
251 {
252 byte code;
253 byte kegl;
254 };
255
256 /* 0 - thin straight */
257
258 /* 1- half thick straight */
259 /* 2- thick straight */
260 /* 3- thin cursive */
261 /* 4- half thick cursive */
262 /* 5- thick cursive */
263 /* 6- beg of underline */
264 /* 7- end of underline */
265
266 struct EdTagLanguage //for russian-english recognize
267 {
268 uchar code; // 0x0F
269 uchar language;
270 };
271
272 struct underline /* 0 - straight font */
273 { /* 1 - half fat or fat straight */
274 byte code; /* 2 - thin cursiv */
275 byte type; /* 3 - thick straight */
276 }; /* 4- beg of underline */
277 /* 5- end of underline */
278 struct dens_print
279 {
280 byte code;
281 byte dens_atr; /*attribute of print's
282 density*/
283 };
284
285 struct tabul
286 {
287 byte code;
288 byte numb_in_tab_tabul; /*number of position in*/
289 };
290 /* table of tabulation*/
291 struct tabl_tabul
292 {
293 byte code;
294 byte lth; /* lth- scale of arow*/
295 int16_t arow_pos[1] ; /* tabl_tabul->lth ????????*/
296 };
297
298 struct step_back
299 {
300 byte code; /* step_back-value of backstep*/
301 byte step_back;
302 };
303
304 struct line_beg
305 {
306 byte code;
307 byte store;
308 int16_t displacement; /*displacement -displ. for cur.*/
309 }; /* line to upper frame of fragm*/
310
311 struct position
312 {
313 byte code;
314 byte store;
315 int16_t pos; /* pos-position in line for*/
316 }; /* left frame of fragm*/
317
318 struct tabl_conform_sizes
319 {
320 byte code;
321 byte store;
322 char tab_val_A [9*2]; /*tab_val_A-table of sizes*/
323 }; /* of letter A for kegles */
324 /* from 4 to 12 */
325 struct fragm_disk
326 {
327 byte code;
328 byte fragm_numb;
329 int16_t depth; /*depth -displ. for cur. */
330 }; /*line to upper frame of fragm*/
331
332 struct group_words
333 {
334 byte code;
335 byte gr_wd_type; /*type-
336 0-beg of group
337 1-cur. word of group
338 2-end
339 3-partition between groups}*/
340 };
341
342 struct group_symbols
343 {
344 byte code;
345 byte gr_sb_type;
346 };
347
348 struct aksant
349 {
350 byte code1;
351 byte code;
352 };
353
354 struct neg_half_space
355 {
356 byte code;
357 byte authenticity_degree;
358 };
359
360 struct pos_half_space
361 {
362 byte code;
363 byte authenticity_degree;
364 };
365
366 struct segm
367 { /* dynamic memory segment's header */
368 char el_type; /* = 4 */
369 struct segm *next_in_fragm; /* next segment in fragment */
370 struct segm *prev_in_fragm; /* previous segment in fragment */
371 struct segm *next_in_sheet;
372 struct segm *prev_in_sheet;
373 int16_t busy_lth; /* busy length of string */
374 int16_t string_lth; /* length of string in segm */
375 int16_t q_vis_symb; /* quantity of visibal symbols*/
376 int16_t q_v_s_l; /* the same in line*/
377 char type; /* 1- tail of line in the next segm
378 2- that's tail of line */
379 int16_t font; /* font */
380 char kegl; /* kegl */
381 char font_type; /* type of font */
382 char density; /* printing density */
383 struct bit_map_ref map_ref; /* reference to bit-map */
384 int16_t line_ref; /* reference to the line of schedule */
385 char store[3]; /* expand */
386 uchar string[1]; /* text itself */
387 };
388
389 struct sheet_descr
390 { /* sheet header */
391 char el_type; /* = 2 */
392 int16_t sheet_numb; /* sheet number */
393 struct segm *first_segm; /* address of first segment of first
394 line in sheet */
395 struct sheet_descr *prev_sheet; /* address of previous sheet */
396 struct sheet_descr *next_sheet; /* address of next sheet */
397 struct sheet_descr *sheet; /* address of sheet */
398 uchar quant_fragm; /* quant. of fragments in sheet */
399 int16_t lth; /*length of descriptor with fragm*/
400 struct fragm_descr *fragm[256]; /* addresses of sheet's fragments */
401 };
402
403 struct file_descr
404 { /* file header */
405 char el_type; /* = 1 */
406 struct sheet_descr * first_sheet; /* address of first sheet of file */
407 int16_t file_handle; /* file handle */
408 char file_name[40]; /* file name */
409 char *pool_start; /* adrress of pool for page */
410 int32_t pool_lth; /* Q.w_lenth of pool (in bytes) */
411 int16_t n_free; /* number of free segments in pool */
412 char *pool_free; /* address of first free block in pool */
413 };
414
415 struct sheet_disk_descr
416 {
417 byte code;
418 uchar quant_fragm;
419 int16_t sheet_numb;
420 int16_t descr_lth;
421 uchar byte_flag;
422 char tabl[17];
423 };
424
425 #define FD_TYPE_TEXT 0
426 #define FD_TYPE_PICT 1
427 #define FD_TYPE_TABLE 2
428 #define FD_TYPE_EMPTY 3
429
430 struct fragm_descr
431 { /* fragment header */
432 char el_type; /* = 3 */
433 int16_t row; /* coordinates of left upper */
434 int16_t col; /* angle of fragment's frame */
435 int16_t height; /* height of fragment */
436 int16_t w_width; /* Q.w_width of fragment */
437 char type; /* fragment's type */
438 byte kegl;
439 byte font;
440 byte font_type;
441 struct segm *first_segm; /* address of first segm (line) */
442 struct segm *last_segm; /* address of last segm */
443 };
444
445 struct fragm_disk_descr
446 {
447 byte code;
448 int16_t row; /* coordinates of left upper */
449 int16_t col; /* angle of fragment's frame */
450 int16_t height; /* height of fragment */
451 int16_t w_width; /* Q.w_width of fragment */
452 char type;
453 byte kegl; /*kegl for following fragm*/
454 byte font; /*font name number~~~~~~~~*/
455 byte language; // 03-29-94 02:42pm,Pit
456 byte font_type; /*type specifications of font
457 for additional information
458 look at underline */
459 };
460
461 struct int_row_col
462 {
463 int16_t row;
464 int16_t col;
465 };
466
467 struct state_stack_elem
468 { /* element of state_stack */
469 char stack_type; /* ??????? */
470 int16_t line_row; /* ??????? */
471 int16_t position;
472 byte font; /* font */
473 byte language; // language for fragment
474 char kegl; /* kegl */
475 char font_type; /* font type */
476 char density; /* printing density */
477 char underline; /* presence of underline */
478 struct bit_map_ref map_ref; /* address of cur_symb in bit_map */
479 uchar *ns_ref_ptr; /*address of current map_ref*/
480 int16_t letter_ref; /* ??????? */
481 int16_t halo_ref; /* ??????? */
482 int16_t word_ref; /* */
483 int16_t line_ref; /* numb of symb incl. all symb */
484 struct state_stack_elem *next; /*addres of stack next level*/
485 };
486
487 struct letter
488 {
489 byte code;
490 byte attr;
491 };
492
493 typedef struct state
494 { /* description of state characteristics */
495 struct segm *cur_segm; /* address of current segm */
496 uchar *cur_symb; /* address of current non control symbol */
497 char stack_level; /* level of state stack */
498 char size_tab[18]; /* values of tabulation */
499 int16_t position; /* ?????? */
500 int16_t pos_line; /* number of symb including all symb. */
501 struct file_descr *file; /* ?????? */
502 struct sheet_descr *sheet; /* ?????? */
503
504 } dst;
505
506 typedef struct tab
507 {
508 struct sheet_descr tab_sheet_descr[MAX_SHEET];
509 struct fragm_descr tab_fragm[MAX_SHEET][MAX_FRAGM];
510 } dt;
511
512 /* 21-02-93 10:55pm, Mike */
513 /* I have exclude static dictionary internal structures from this file */
514 /* and have create new header file SPELLDICT.H. */
515
516 #include "speldict.h"
517
518 /***************************************************************************/
519 /* data types & definitions for edconv() */
520 /***************************************************************************/
521
522 typedef struct letter LT; /* code & probability of letter */
523
524 #define POS 0
525
526 typedef struct stdhlt {
527 /* POS stdh; */ /*header */
528 struct letter stdlt[ABCSIZE]; /*standard alphabetic list (const)*/
529 } STD;
530
531 struct ltimg {
532 struct letter *lt; /* ref to curr LT in list */
533 uchar *source; /* reference to header & list */
534 STD std; /* ref to standard header & list */
535 int16_t blank; /* =1, if alternatives are not set */
536 /* alt indices in respective pos (obj->pos[i].alt[]): */
537 uchar altn[ABCSIZE];
538 /* all pos[] for the wrdimg are in obj->part->pos */
539 /* if blank=1, altn[]={0,1,2,...,ABCSIZE} */
540 } ;
541 typedef struct ltimg LTIMG;
542 /***************************************************************************/
543 /* */
544 /***************************************************************************/
545
546 /* VSTRUCT.H */
547 /**************************************************************************/
548 /* DYNAMIC VOCABULARY : data structure */
549 /**************************************************************************/
550
551 /***************************************************************************/
552 /******** Word description in voc structure **********/
553 /***************************************************************************/
554 typedef struct word_descr_in_voc
555 { uint16_t next;
556 int16_t nmb;
557 struct segm *segm;
558 char *symb;
559 uchar type;
560 uchar type_sp;
561 uchar voc;
562 uchar l_cont;
563 uchar r_cont;
564 } WTOKEN;
565 /********************* CONTEXT FLAGS *****************************/
566
567 #define C_UNREC 0x01 /* Left/right word has unrecognized context */
568 #define C_STBEG 0x02 /* Word is the first in statement */
569 #define C_STEND 0x02 /* Word is the last in statement */
570 #define C_FIRST 0x04 /* Left word is the first in statement */
571 #define C_LOW 0x08 /* Left/right word consists of low letters */
572 #define C_CAP 0x10 /* Left/right word consists of Cap letters */
573 #define C_NAME 0x20 /* Left/right word is name */
574 #define C_MIXED 0x40 /* Left/right word consists of Cap,low,digits*/
575 #define C_DIG 0x80 /* Left/right word is pure digital */
576
577 /*********************** uint16_t FLAGS *****************************/
578
579 #define W_BAD 0x01 /* Word has unrecognized symbols */
580 #define W_DELIM 0x02 /* Word has delimeters */
581 #define W_CHECK 0x04 /* Means that it is worth to process this wrd*/
582 /* during the second pass */
583 #define W_LOW 0x08 /* Word consists of totally low letters */
584 #define W_CAP 0x10 /* Word consists of totally capital letters */
585 #define W_NAME 0x20 /* Word has first Cap & other low letters and*/
586 /* there is no statm terminators before it */
587 #define W_MIXED 0x40 /* Word consists of Cap,low digit and it is */
588 /* not name or first word in statement */
589 #define W_DIG 0x80 /* Word consists of totally digits. */
590
591 /***************************************************************************/
592 /* Vocabulary vertex structure ( 8 bytes , near pointers ) */
593 /***************************************************************************/
594
595 struct v {
596 uchar key; /* key of vertex */
597 uchar wrdterm :1; /* flag of word termination */
598 uchar accnt :7; /* statistics account */
599 uint16_t left; /* pointer to left brother */
600 uint16_t right; /* pointer to right brother */
601 uint16_t down; /* pointer to down brother ( son ) */
602 uint16_t wtoken;
603 };
604
605 typedef struct v vert; /* type of vocabulary vertexes */
606
607 /***************************************************************************/
608 /* Vocabulary gobal var's structure ( MAX_WORD_SIZE*2+6 bytes ) */
609 /***************************************************************************/
610
611 #define DYN_DICT_HEADER "CTC USD"
612
613 struct vstate
614 {
615 int16_t lev; /* current level in voc. 0 : M_W_S-1 */
616 uint16_t path [MAX_WORD_SIZE]; /* path from root to current vertex */
617 /* uint16_t vocseg; */ /* base register of vocabulary */
618
619 uchar * vocseg;
620 uint16_t vocfree; /* size of unused space in voc. */
621 uchar state;
622 };
623 /* Voc states definitions */
624 #define VOC_CHANGED 0x01
625
626 typedef struct vstate voc_state;
627 /**************************************************************************/
628
629 #define MAX_VOC_NUMBER 2
630
631 typedef struct
632 {
633 char voc_name[1];
634 voc_state voc;
635 int16_t type;
636
637 } user_voc;
638
639
640 /***************************************************************************/
641 /* */
642 /***************************************************************************/
643 /* CONDDEF>H */ /* Constants for dictionary sgueeze */
644 /*
645 #define MAX_WORD_SIZE 32
646 */
647 #define VOC_DOWN 1
648 #define VOC_RIGHT 2
649 #define VOC_UP 3
650 #define NO 0
651 #define MAX_PAGE (long)(MAX_VOC_SIZE/3*2)
652 #define NPCDEF 60
653 /*======================================================================*/
654
655 struct super_ed
656 {
657 int16_t x;
658 int16_t y;
659 int16_t x_a;
660 int16_t y_a;
661 int16_t miss;
662 int16_t f_e;
663 int16_t flag;
664 int16_t col;
665 };
666
667 struct super_next
668 {
669 uint16_t rec;
670 uint16_t beg_next;
671 uint16_t last_altern;
672 uint16_t end_altern;
673 uint16_t st;
674 };
675
676
677
678 typedef struct super
679 {
680 uint16_t tif_top_y;
681 uint16_t tif_small_top_y;
682 struct int_row_col tif_pos;
683 uint16_t active_window;
684 uint16_t beg_sheet;
685 uint16_t beg_next;
686 uint16_t real_num;
687 uint16_t move;
688 int16_t add_row;
689 int16_t add_col;
690 int16_t add_width;
691 int16_t add_height;
692 uint16_t corner;
693 uint16_t end_altern;
694 uint16_t last_altern;
695 uchar text_line[sizeof(struct letter)*MAX_STRING_LTH]; // 2 * 80
696 dt *tab_ptr;
697 char * text_buff;
698 //////// char text_buff_pool[BUFSIZE]; // 8192
699 char ins_status;
700 char *beg_alloc_mem;
701 char *end_alloc_mem;
702 char *free_alloc_mem;
703 char *ptr_tab;
704 uint16_t cur_fragm;
705 uint16_t qt_fm;
706 uint16_t cur_sheet;
707 uint16_t cur_sheet_number;
708 uint16_t stack_level;
709 struct segm * last_del_line;
710 struct segm *ptr_cur_segm;
711 struct segm *ptr_next_segm;
712 uchar *buff_ptr;
713 struct segm *new_segm;
714 char atr;
715 char bgc;
716 int32_t buff_l;
717 int32_t l; /*length of done way in next_symb*/
718 uint16_t new_s; /*sign of new segm of curr line*/
719 char ed_fname[6];
720 int16_t ed_file;
721 int32_t file_lth;
722 int16_t start_sheet_number;
723 char *str_ptr;
724 uint16_t ram_change_status;
725 uint16_t end_l;
726 uint16_t end_s;
727 uint16_t curs_x_a;
728 uint16_t curs_y_a;
729 uint16_t curs_x_w;
730 uint16_t curs_y_w;
731 uint16_t w_x;
732 uint16_t w_y;
733 uint16_t w_width;
734 uint16_t w_height;
735 uint16_t tif_x; /*coordinates of tif window */
736 uint16_t tif_y;
737 uint16_t tif_width;
738 uint16_t tif_height;
739 int16_t tif_file;
740 char tif_file_name[40];
741 int16_t tif_line_lth;
742 int16_t tif_n_lines;
743 uint16_t large_height;
744 uint16_t small_height;
745 int16_t q_pg_right; /* quantity of pages that we have passed moving right */
746 uint16_t sw_symb;/* sw_symb = 1 shows that was recurs. call of next_symb()*/
747 uint16_t esc_n_s;
748 char fragm_flag[MAX_FRAGM];
749 char sheet_flag[MAX_SHEET];
750 struct bit_map_ref *bit_map_ref_ptr;
751 struct bit_map_ref *h_bit_map_ref_ptr;
752 struct text_ref *text_ref_ptr;
753 struct text_ref *h_text_ref_ptr;
754 struct font_kegl *font_kegl_ptr;
755 struct font_kegl *h_font_kegl_ptr;
756 struct kegl *kegl_ptr;
757 struct kegl *h_kegl_ptr;
758 struct shift_struct *shift_ptr;
759 struct shift_struct *h_shift_ptr;
760 struct underline *underline_ptr;
761 struct underline *h_underline_ptr;
762 struct dens_print *dens_print_ptr;
763 struct dens_print *h_dens_print_ptr;
764 struct position *position_ptr;
765 struct position *h_position_ptr;
766 struct fragm_disk *fragm_disk_ptr;
767 struct fragm_disk *h_fragm_disk_ptr;
768 struct fragm_disk_descr *fragm_disk_descr_ptr;
769 struct fragm_disk_descr *h_fragm_disk_descr_ptr;
770 struct sheet_disk_descr *sheet_disk_descr_ptr;
771 struct sheet_disk_descr *h_sheet_disk_descr_ptr;
772 struct state_stack_elem *stack;
773 int32_t alloc_size;
774 int16_t shift_status;
775 int16_t key;
776 struct segm *ns_segm; /* segm_ptr corresponding to next_symb() */
777 uchar *ns_symb; /* symbol corresponding to next_symb() */
778 int16_t skip_line_x;
779 int16_t flag_out;
780 char edit_file_name[40];
781 int16_t end_page_numb;
782 char stack_change_flag;
783 int16_t word_attr;
784 int16_t tiny_small_height;
785 int16_t tiny_w_x;
786 int16_t tiny_w_y;
787 int16_t tiny_w_width;
788 int16_t tiny_w_height;
789 int16_t tiny_large_height;
790 int16_t tiny_tif_x;
791 int16_t tiny_tif_small_top_y;
792 int16_t tiny_tif_top_y;
793 int16_t tiny_tif_width;
794 int16_t tiny_tif_height;
795 int16_t tiny_top_y;
796 int16_t w_status;
797 int16_t big_small_height;
798 int16_t big_w_x;
799 int16_t big_w_y;
800 int16_t big_w_width;
801 int16_t big_w_height;
802 int16_t big_large_height;
803 int16_t big_tif_x;
804 int16_t big_tif_small_top_y;
805 int16_t big_tif_top_y;
806 int16_t big_tif_width;
807 int16_t big_tif_height;
808 int16_t save_flag;
809 struct dict_state d_state;
810 /* voc_state v_state; */
811 /* char vocfile [40]; */
812 /* char temp_voc_file[40]; */
813 int16_t conv_call;
814 char *w_c;
815 char check_word[40];
816 char right_part[20];
817 char* r_p;
818 char *buff_out;
819 int16_t ed_out;
820 ////// char text_buff_out[BUFSIZE]; // 8192
821 char word_out[6][20];
822 char* w_out;
823 dst st;
824 dt t;
825 struct super_ed E;
826 struct super_next N;
827 } dQ;
828 //AK
829 //#define st Q.st
830 //#define E Q.E
831 //#define t Q.t
832 //#define N Q.N
833
834
835
836 /**************************************************************************/
837 /***************** defines & structures for spelling itself (tg_spell) ***/
838 /**************************************************************************/
839 struct tre_state
840 {
841 uint16_t font;
842 uint16_t kegl;
843 uint16_t font_type;
844 char file_name[40];
845 uchar * buf;
846 uint16_t buf_size;
847 uint16_t lth;
848 };
849 #define TRE_BUF_SIZE 0xA000
850 struct tif_state
851 {
852 uint16_t shift; /* shift (in tif lines ) */
853 uchar *buf;
854 uint16_t buf_size;
855 uint16_t lth;
856 } ;
857 #define TIF_BUF_SIZE 0x7000
858 #ifdef OVERVOC
859 #define CHECKVOC check_voc()
860 #define CHECKTRE check_tre()
861 #define CHECKTIF check_tif()
862 #else
863 #define CHECKVOC 0
864 #define CHECKTRE 0
865 #define CHECKTIF 0
866 #endif
867
868 #define TEMPVOCFILE "t:\\tmp.voc"
869 /*******************************************************************/
870
871 /* Constants for fill_raster() */
872
873 #define CONV_MAP 1 /* invert source raster */
874 #define NOCONV_MAP 0 /* not invert ---""--- */
875
876
877 #define FIR_CHECKED 1 /* spelling is done */
878
879 char *find_byte_flag(void);
880
881 /* ======================== */
882 /* max size of an object view field (max nmb of positions) : */
883
884 #define MAX_VIEW_SIZE 28
885 /*
886 #define MAX_VIEW_SIZE 16
887 */
888 /* special position number used for to store artificialy constructed alts:*/
889 #define SPEC_POS MAX_VIEW_SIZE
890 /* min difference in probabilities to consider alts to be similar: */
891 #define MIN_DIFF_PROB 8
892 /* min prob to consider alt, pos,... */
893 #define PROB_MIN 100
894 /* prob allowed to use the estimation of alt, pos,... */
895 #define PROB_ALLOWED 199
896 /* min prob to be sure in the back_recog result (BOX) */
897 #define PROB_SURE 200
898 /* ...... ?? */
899 #define PROB_BLUE 150
900 //////////////////////////////////////////////////////////////////////////////
901 // Diferences for correct words
902 // Allex 26.04.99 rise MD_for_not_name
903 #define PROB_TO_BRK 164 /* 152 */
904 #define MD_for_name 50 /* 40 */
905 #define MD_for_not_name 50 /*50 Lepik, 27 dec 93, 110 */
906 #define MD_for_one_char 25
907 #define MD_for_first_in_name 60
908 #define MD_for_first 50
909 //////////////////////////////////////////////////////////////////////////////
910 #define DIF_for_stat_repl 2 /* if difference between attributes of */
911 /* alternatives is less than this one, */
912 /* alternatives may be subsituted one by another*/
913 /* ======================== */
914
915 struct tifref
916 {
917 uint16_t row; /* envelope specification */
918 uint16_t col; /* ... */
919 uint16_t width; /* ... */
920 uint16_t height; /* ... */
921 uchar *env_ref; /* ref to envelope specification in tif */
922 struct segm * segm; /* Q.ns.segm */
923 char *symb; /* Q.ns.symb */
924 };
925
926 /* ===================================================================== */
927 /* defines for spelling checker's FLAGS : */
928 /* ===================================================================== */
929 /* ASCII-codes' identification (see all_lt in spellfun.c) : */
930 #define _BLK 2
931 #define _SPC 3
932 #define _WDV 4
933 #define _TRM 5
934 #define E_CP 6
935 #define E_OD 7
936 #define R_CP 8
937 #define R_OD 9
938 #define _APF 10
939 #define _DIG 11
940 #define _SP1 12
941 #define _SP2 13
942 #define E_DL 14
943
944 /* context flags (type): */
945 #define T_CHEESE 0x01 /* this means part might be a quantity */
946 #define T_ALPHA 0x02 /* all alphabetic */
947 #define T_DIG 0x04 /* all digital */
948 #define T_DELIM 0x08 /* an alt-delimiter */
949 #define T_CAP 0x10 /* all capitals must be or are */
950 #define T_LOW 0x20 /* all low case must be or are */
951 #define T_STMT 0x40 /* beg of sentence */
952 #define T_NAME 0x80 /* name */
953
954 /* newline, blank, alts, space, hyphen flags (type_sp): */
955 #define T_LINE 0x01 /* new line begins here */
956 #define T_BLANK 0x02 /* blank (originally) */
957 #define T_MYBLANK 0x04 /* there is a blank (T_BLANK) assigned by me */
958 #define T_SP1 0x08 /* suspected space&it's available */
959 #define T_SP2 0x10 /* suspected space&it's not avail */
960 #define T_HYPHEN 0x20 /* hyphen */
961 #define T_MIXED 0x40 /* mixed (alphabetic+digital) */
962
963 // 08-13-93 09:11pm, Mike
964 // Added after Lepik.
965 #define T_APF 0x80 /* apostrof ' occured */
966
967
968 /* change, spec repl, glue-cut, alts - flags (type_art): */
969 #define T_CHANGE 0x01 /* word change (only within dict intewrface) */
970 #define T_REPL 0x02 /* special replacement */
971 #define T_GC 0x04 /* glue-cut */
972 #define T_ALTS 0x08 /* alts available or not 1-st alts are considered*/
973 #define T_BRK 0x10 /* fall a badly recognized symbol into blank */
974 /* ===================================================================== */
975 /* Spelling Checker Data Structure Chart */
976 /* ===================================================================== */
977 /*
978 ROOTS: obj (objstr) part (partstr) word (wrdstr)
979 ------ --- [MAX_PARTS] (dynamic list,
980 -------------- see below)
981 obj info (blanks,...) [1] types info -------------
982 beg, end pos
983 pos_part [ 0,x,x,N ] pos[]: pos-list
984 | art[]: art-id-list
985 pos_part_nmb--->- wrd (wordstr *) ->--- |
986 part (current, ref)->-- [2] ..... |
987 part_nmb (curr,nmb)->--| ........ |
988 part_max (max nmb, M) | ........ |
989 | -->........ |
990 pos (posstr) | |
991 [MAX_VIEW_SIZE+MAX_ART_SIZE] --> [M] ..... |
992 [1] pos info : |
993 type |
994 orig_lt |
995 cur_alt |
996 tif_ref |
997 repl & glue-cut info |
998 ....... |
999 alt_nmb [K] |
1000 alt (altstr) |
1001 [ABCSIZE] |
1002 [1] alt info : |
1003 * lt ------------> { ltr, prob } |
1004 orig sequential nmb in alt-list |
1005 orig prob |
1006 type |
1007 [2] ........... |
1008 ............... |
1009 [K] ........... |
1010 |
1011 [2] pos info |
1012 ...... |
1013 [1] alt info |
1014 ............ |
1015 [K] ........ |
1016 |
1017 ..................................... |
1018 --> ..................................... |
1019 | ..................................... |
1020 | |
1021 | [N] pos info |
1022 | ...... |
1023 | [1] alt info |
1024 | ............ |
1025 | [k] ........ |
1026 | |
1027 | ********************************************************* |
1028 | |
1029 | word (wordstr) |
1030 | (dynamic list, pointers to imets are: part[i]->wrd) |
1031 | --------------- |
1032 | <1> next (wordstr *, --->-------------- |
1033 | NULL for the last item) | |
1034 | word info: | |
1035 | type | |
1036 | lth | |
1037 | voc prob | |
1038 | estimations | |
1039 | altn[]: alt-num-list | |
1040 | alt prob (descending order) | |
1041 | | |
1042 | pos (posstr *) | |
1043 | [MAX_WORD_SIZE] | |
1044 | [1] .......... | |
1045 -----------<--- .......... | |
1046 [P] .......... | |
1047 | |
1048 <2> ............... <-------------------- |
1049 .................... |
1050 <X> ............. <---------------------------------
1051 ....................
1052
1053 <Z> ...............
1054
1055
1056 Note: P = part.end-part.end+1;
1057
1058 */
1059 /* ===================================================================== */
1060 /* object (set of positions) & values (alternatives) management info */
1061 /* ===================================================================== */
1062
1063
1064 /* for each alternative: */
1065 /* --------------------------------------------------- */
1066
1067 typedef struct altstr {
1068
1069 struct letter orig; /* original code & probability */
1070 struct letter * lt; /* ref to alt & prob */
1071 uchar seqnum; /* sequential nmb in original alt list */
1072 /* 0, if was not available (then generated) */
1073 int16_t dif_wt; /* weight of discrepancy with orig alts */
1074 /* ???
1075 uint16_t prob_BOX;
1076 ??? */
1077 uchar type;
1078 /* T_ALPHA - alphabetic */
1079 /* T_DIG - digital */
1080 /* T_CAP - capital */
1081 /* T_LOW - low case */
1082 /* uchar type_sp;*/ /* T_DELIM */
1083 } SALT;
1084
1085
1086 /* ================================================= */
1087 /* for each position */
1088 /* ------------------------------------------------- */
1089
1090 typedef struct posstr {
1091
1092 struct letter orig; /* original ltr & prob */
1093 struct letter * lt; /* ref to current ltr & prob */
1094 int16_t dif_wt; /* weight of discrepancy with orig alts */
1095 /* ???
1096 struct matrBOX e_BOX;
1097 ??? */
1098 /* context info: */
1099 uchar type;
1100 /* T_ALPHA - all alts alphabetic */
1101 /* T_DIG - all alts digital */
1102 /* T_MIXED - mixed (alphabet+digit)*/
1103 /* T_CAP - all capitals */
1104 /* T_LOW - all low case */
1105 /* T_STMT - beg of sentence */
1106 /* T_NAME - name */
1107
1108 /* blank, alts, space, hyphen info: */
1109 uchar type_sp; /* T_LINE - new line begins here */
1110 /* T_BLANK - blank (originally) */
1111 /* T_MYBLANK - T_BLANK is assigned by me */
1112 /* T_ALTS - alternatives available */
1113 /* T_SP1 - suspected space&it's available*/
1114 /* T_SP2 - suspected space&it's not avail*/
1115 /* T_HYPHEN - hyphen */
1116 /* T_DELIM - an alt-delimiter takes place*/
1117
1118 uchar type_art; /* artificial change (repl & glue-cut) flags:*/
1119 /* T_REPL - special replacement */
1120 /* T_GC - glue-cut */
1121 uchar art; /* artificial change id */
1122
1123 float prop_ind; /* proportionality index */
1124 struct tifref tif_ref; /* tiff specifications */
1125 int16_t alt_nmb; /* nmb of alternatives */
1126 struct altstr alt[ABCSIZE]; /* list of alternatives' info */
1127
1128 } SPOS;
1129
1130 /* ================================================ */
1131
1132 /* for a set of positions (basic object): */
1133 /* --------------------------------------- */
1134
1135 typedef struct objstr {
1136 /* object's context specification: */
1137 uchar type;
1138 /* T_ALPHA - pure alphabetic */
1139 /* T_DIG - pure digital */
1140 /* T_MIXED - mixed (alphabetic+digital) */
1141 /* T_CAP - all capitals */
1142 /* T_LOW - all low case */
1143 /* T_STMT - beg of sentence */
1144 /* T_NAME - name */
1145
1146 /* blank, alts, space, hyphen info: */
1147 uchar type_sp; /* T_LINE - new line begins here */
1148 /* T_BLANK - blanks (originally) exist */
1149 /* T_MYBLANK - blank assigned by me exist */
1150 /* T_ALTS - alternatives available */
1151 /* T_SP1 - suspected space & it's available */
1152 /* T_SP2 - suspected space & it's not avail */
1153 /* T_HYPHEN - hyphen exists */
1154
1155 int16_t nmb; /* obj number in the input flow (read) */
1156 struct tifref tif_ref; /* tiff specification */
1157 int16_t pos_line; /* new line position (if type_sp|=T_LINE) */
1158 int16_t pos_hyphen; /* hyphen position */
1159 int16_t blank_nmb; /* nmb of blanks */
1160 int16_t pos_myblank; /* position of blank generated by me, if any*/
1161 int16_t dif_wt; /* weight of discrepancy with original alts */
1162 int16_t alt_nmb; /* nmb of alternatives */
1163
1164 struct posstr pos [MAX_VIEW_SIZE+1];/* positions: the last one is SPEC*/
1165
1166 int16_t pos_part [MAX_WORD_SIZE]; /* list of object partitioning positions:
1167 0,N - if no partitioning,
1168 0,x,x,x,N - if partitioning available
1169 (because of hyphens & suspected spaces) */
1170 int16_t pos_part_nmb; /* nmb of elements in the list above */
1171
1172
1173 /* current state of the object: */
1174 /* ---------------------------- */
1175
1176 struct partstr * part; /* ref to current item in part[] */
1177 int16_t part_nmb; /* current item number in part[] */
1178 int16_t part_max; /* max part number in part-array */
1179 int16_t part_beg; /* curr part beg pos */
1180 int16_t part_end; /* curr part end pos */
1181 int16_t part_begi; /* beg index in obj->pos_part[] */
1182 int16_t part_endi; /* end index in obj->pos_part[] */
1183 int16_t opt_part [MAX_WORD_SIZE]; /* list of best obj partitioning positions:
1184 it is the copy of pos_part[], but
1185 0,..x,0,x,0,x,..N - partitioning, so that
1186 0 => no end & beg of parts,
1187 x => end & beg of best parts chosen */
1188 int16_t opt_mark; /* mark of the best part chain, specified by opt_part*/
1189 int16_t opt_pen; /* penalty of the best part chain */
1190 int16_t opt_entire; /* nonzero, if the opt part-chain is entire */
1191 int16_t voc_kind; /* kind of voc where the word found: */
1192 /* 2 - dict (static) */
1193 /* 1 - voc (dynamic) */
1194 int16_t lthok; /* lth of curr word piece found in dict/voc */
1195 int16_t allowedlth;
1196
1197 uchar type_art; /* artificial change (repl & glue-cut) kind: */
1198 /* T_REPL - special replacement */
1199 /* T_GC - glue-cut */
1200 int16_t art [MAX_VIEW_SIZE]; /* artificial change identifiers */
1201 int16_t artn; /* curr index in art[artn] */
1202 int16_t min_art; /* curr min art id (left bound of artbase) */
1203 int16_t max_art; /* curr max art id (right bound of artbase) */
1204 int16_t art_minpos; /* min pos of obj->pos[] curr used for part-changes */
1205
1206 uchar type_orig; /* original type (context) of curr part */
1207 struct wordstr * word; /* ref to current word under treatment */
1208 uchar wordchar [MAX_WORD_SIZE]; /* word as a char-chain */
1209 int16_t nmb_wrdfound; /* a nmb of words found for a current part */
1210
1211 } SOBJ;
1212
1213 /* Reading object status */
1214 #define S_NEWOBJ 0
1215 #define S_OLDOBJ 1
1216
1217 /* ============================================================ */
1218 /* words to choose the best: */
1219 /* (word - a certain set of positions' representatives) */
1220 /* ============================================================ */
1221
1222 /* for a word: */
1223 /* ----------------------------------------------- */
1224
1225 typedef struct wordstr {
1226
1227 struct wordstr * next; /* ref to next word in part-word-list */
1228 struct posstr * pos[MAX_WORD_SIZE]; /* refs to obj pos-s */
1229 uchar altn [MAX_WORD_SIZE]; /* alt numbs for correspondent poss*/
1230 uchar alt_doubt [MAX_WORD_SIZE]; /* alt doubt values, received */
1231 /* by back_recog (for corresp pos-s */
1232 uchar type;
1233 /* T_ALPHA - all alts alphabetic */
1234 /* T_DIG - all alts digital */
1235 /* T_CAP - all capitals (in fact) */
1236 /* T_LOW - all low case (in fact) */
1237 uchar type_sp;
1238 /* T_BLANK - blank (originally) */
1239 /* T_DELIM - an alt-delimiter takes place*/
1240 int16_t lth; /* word length */
1241 int16_t voc_prob; /* voc (static or dynamic) probability */
1242 int16_t voc_kind; /* kind of voc where the word found: */
1243 /* 3 - pure digital word (consid.to be in voc) */
1244 /* 2 - dict (static) */
1245 /* 1 - voc (dynamic) */
1246 uchar type_art; /* artificial change (repl & glue-cut) kind:*/
1247 /* T_REPL - special replacement take place */
1248 /* T_GC - glue-cut take place */
1249 uchar art [MAX_WORD_SIZE]; /* artificial change identifiers */
1250
1251 int16_t dif_wt; /* weight of discrepancy with original alts */
1252 int16_t low_alt_nmb; /* nmb of alts with prob < PROB_ALLOWED */
1253 int16_t bad_alt_nmb; /* nmb of alts with prob < PROB_MIN */
1254 /*??? int16_t gen_alt_nmb;*/ /* nmb of alts generated from blanks */
1255 int16_t mark; /* generalized word estimation */
1256 int16_t mark_doubt; /* estimation of word's uncertainty : */
1257 /* is set by post-recog when the word */
1258 /* isn't the best by mark */
1259 } SWORD;
1260
1261 /* ============================================================ */
1262 /* best words within object parts: */
1263 /* (partitioning may be caused by hyphens & suspected spaces) */
1264 /* ============================================================ */
1265
1266 typedef struct partstr
1267 {
1268 int16_t beg; /* part id: beg position */
1269 int16_t end; /* part id: end position */
1270 int16_t begi; /* beg index in obj->pos_part[] */
1271 int16_t endi; /* end index in obj->pos_part[] */
1272 uchar posn[MAX_WORD_SIZE]; /* part positions - list */
1273 int16_t lth; /* nmb of elements in the list above */
1274 /* part context specification: */
1275 uchar type; /* T_CHEESE - quantity ( set of digits suspected.)*/
1276 /* T_ALPHA - pure alphabetic */
1277 /* T_DIG - pure digital */
1278 /* T_MIXED - mixed (alphabetic+digital) */
1279 /* T_CAP - all capitals */
1280 /* T_LOW - all low case */
1281 /* T_STMT - beg of sentence */
1282 /* T_NAME - name */
1283
1284 /* blank, alts, space, hyphen info: */
1285 /* only blanks are valuable for a part */
1286 uchar type_sp; /* T_LINE - new line begins here */
1287 /* T_BLANK - blanks (originally) exist */
1288 /* T_MYBLANK - blank assigned by me exist */
1289 /* T_ALTS - alternatives available */
1290 /* T_SP1 - suspected space & it's available */
1291 /* T_SP2 - suspected space & it's not avail */
1292 /* T_HYPHEN - hyphen exists */
1293
1294 int16_t blank_nmb; /* nmb of blanks */
1295 int16_t dif_wt; /* weight of discrepancy with original alts */
1296 int16_t alt_nmb; /* nmb of alternatives */
1297
1298 uchar type_art; /* artificial change (repl & glue-cut) kind:*/
1299 /* T_REPL - special replacement take place */
1300 /* T_GC - glue-cut take place */
1301 uchar art [MAX_WORD_SIZE]; /* artificial change identifiers */
1302
1303 struct wordstr * word; /* ref to curr word: last is 1-st in list */
1304 } SPART;
1305
1306 /* ============================================================ */
1307 /* struct of special replacements & glue-cut definition: */
1308 /* ============================================================ */
1309 // 08-13-93 08:50pm, Mike
1310 //
1311 //typedef struct artstr
1312 // {
1313 // uchar sr1; /* code1 of what replace */
1314 // uchar sr2; /* code2 of what replace */
1315 // uchar obj1; /* code1 by what replace */
1316 // uchar obj2; /* code2 by what replace */
1317 // uchar objt1; /* type of obj1 */
1318 // uchar objt2; /* type of obj2 */
1319 // uchar objts1; /* type_sp of obj1 */
1320 // uchar objts2; /* type_sp of obj2 */
1321 // uchar cond_sr1; /* cond1 for sr1 */
1322 // uchar cond_sr2; /* cond2 for sr2 */
1323 // uchar cond_sr12; /* cond12 for sr1&sr2 */
1324 // uchar cond_obj12x;/* cond12 for obj1&obj2 to check before */
1325 // uchar cond_obj12r;/* cond12 for obj1&obj2 to check after */
1326 // } ARTS;
1327
1328 #define MAX_ARTS 41
1329
1330 /* ====================================================================== */
1331 /* Multipliers for estimation of object, word, positions, letters */
1332 /* They are used both for object & words rejection and making best choice */
1333 /* ====================================================================== */
1334 /* Object rejection multipliers: */
1335 /* ====================================================================== */
1336 #define RMobj_no 67
1337 #define RMobj_max_blank 3
1338 #define RMobj_min_lth 2
1339
1340 #define MINlth_for_space 3 /* Min lth of part to convert appropriate */
1341 /* Susp space into space if another bounding*/
1342 /* part was not found. */
1343
1344
1345 #define RMobj_blank_pen 100
1346 #define RMobj_spsp_pen 40
1347 /* ====================================================================== */
1348 /* Part rejection multipliers: */
1349 /* ====================================================================== */
1350 #define RMpart_no 49
1351 #define RMpart_max_blank RMobj_max_blank
1352 #define RMpart_minlth_low RMobj_min_lth
1353
1354 #define RMpart_minlth_cap RMobj_min_lth+1
1355 #define RMpart_minlth_nam RMobj_min_lth+1
1356 /*
1357 #define RMpart_minlth_cap RMobj_min_lth
1358 #define RMpart_minlth_nam RMobj_min_lth
1359 */
1360 #define RMpart_blank_pen 80
1361
1362 #define RMpart_artno 45
1363 #define RMpart_art_max_blank 2
1364 #define RMpart_art_minlth_low RMobj_min_lth+1
1365 #define RMpart_art_minlth_cap RMobj_min_lth+2
1366 #define RMpart_art_minlth_nam RMobj_min_lth+2
1367 /* ====================================================================== */
1368 /* Word rejection multipliers: */
1369 /* ====================================================================== */
1370 #define RMwrd_stop 261
1371 #define RMwrd_no 241
1372 #define RMwrd_minlth_low RMobj_min_lth
1373
1374 #define RMwrd_minlth_cap RMobj_min_lth+1
1375 #define RMwrd_minlth_nam RMobj_min_lth+1
1376 /*
1377 #define RMwrd_minlth_cap RMobj_min_lth
1378 #define RMwrd_minlth_nam RMobj_min_lth
1379 */
1380 #define RMwrd_bad_alt_nmb 80
1381 #define RMwrd_low_alt_nmb 40
1382 #define RMwrd_dif_alt_wt 20
1383 #define RMwrd_repl_alt 10 /* negative: special replacement done */
1384 #define RMwrd_gc_alt 15 /* negative: glue-cut done */
1385 /* ====================================================================== */
1386 /* Object evaluation multipliers: */
1387 /* ====================================================================== */
1388 #define VMobj_blank 50 /* negative: blanks exist */
1389 #define VMobj_spsp 50 /* negative */
1390 #define VMobj_hyphen 50 /* negative */
1391 #define VMobj_gc 30 /* negative */
1392 #define VMobj_alt_nmb 1 /* negative: total nmb */
1393 /* ====================================================================== */
1394 /* Word evaluation multipliers: */
1395 /* ====================================================================== */
1396 #define VMwrd_stop 61 /* negative */
1397 #define VMwrd_no 35 /* negative */
1398 #define VMwrd_min 15 /* positive - negative (min to accept) */
1399 #define VMwrd_sure 25 /* positive - negative (mark+mark_doubt) */
1400 /* (min to be sure if no alternative words)*/
1401 #define VMwrd_bad_alt_nmb 10 /* negative */
1402 #define VMwrd_low_alt_nmb 5 /*8*/ /* negative */
1403 #define VMwrd_voc_prob 70 /* 60*/ /* positive -- Lepik set up to 60 from 50
1404 * due to stdc20-8 (INMOS */
1405 #define VMwrd_contxt_ok 9 /* positive: context of word = cont of obj */
1406 #define VMwrd_dif_alt_wt 6 /* negative */
1407 #define VMwrd_repl_alt 5 /* negative: special replacement done */
1408 #define VMwrd_gc_alt 7 /* negative: glue-cut done */
1409 #define VMwrd_change 5 /* negative: change of word done */
1410 #define VMwrd_propind_pen 10 /* negative: penalty by proportion-ty index*/
1411 #define VMwrd_doubt_pen 17 /* negative: default penalty for doubt */
1412 #define VMwrd_delim 30 /* negative: delimeter in a word chain */
1413 #define VMwrd_alts 2 /* negative: not first alts are presented */
1414 /* ====================================================================== */
1415 /* Position evaluation multipliers: */
1416 /* ====================================================================== */
1417 #define VMpos_max_prob 50 /* positive: max prob among alts */
1418 #define VMpos_blank 40 /* negative: it's blank */
1419 #define VMpos_spsp 30 /* negative: suspected space */
1420 #define VMpos_hyphen 30 /* negative */
1421 #define VMpos_gc 10 /* negative: glue-cut possible */
1422 #define VMpos_alt_nmb 5 /* negative */
1423 /* ====================================================================== */
1424 /* Letter evaluation multipliers: */
1425 /* ====================================================================== */
1426 #define VMalt_contxt_ok 9 /* positive: context of ltr = cont of pos */
1427 #define VMalt_dif 15 /* negative: distance from 1-st in alt-list*/
1428 #define VMalt_prob 40 /* positive: original probability */
1429 #define VMalt_probBOX 40 /* positive: probability by BOX */
1430 #define VMalt_repl 30 /* negative: special replacement done */
1431 /* ====================================================================== */
1432
1433 /*********************************************************/
1434 #define R_H 48 /* raster height */
1435 #define R_W 128 /* raster width (in dots) */
1436 #define R_WB R_W/8 /* raster width (in bytes) */
1437 #define R_S R_H*R_W/8 /* raster size */
1438
1439
1440 /* #define WIDE_LETTER 1.90 */ /* see spellart.c */
1441 /* #define WIDE1_LETTER 0.55 */ /* see spellart.c */
1442 /* #define NARROW_LETTER 0.2 */ /* see spellart.c */
1443
1444 #define WIDE_LET1 19
1445 #define WIDE_LET2 10
1446 #define WIDE1_LET1 55
1447 #define WIDE1_LET2 100
1448 #define NARROW_LET1 2
1449 #define NARROW_LET2 10
1450
1451 /**********************************************************/
1452 #define batch_run sp_batch_run
1453 //#define list sp_list
1454 #define tiger_dir sp_tiger_dir
1455 //#define tableBOX sp_tableBOX
1456
1457 #define STAT_ERR 0x1 /* no static vocabilary */
1458 #define DYN_ERR 0x2 /* cannot open a dynamic vocabilary */
1459 #define TWICE_ERR 0x3 /* spelling rerun on the page */
1460 #define MEM_ERROR 0x4 /* no enough memory */
1461 #define WRONG_FILE 0x5 /* incorrect ed-file */
1462 #define NO_PAGE 0x6 /* no ed-file */
1463 #define REREC_ERR 0x7 /* recognition error */
1464 #define VOC_NOTLOADED 0x8 /* can not load one of vocabulary from list file */
1465 #define VOC_TOOLARGELIST 0x9 /* too many vocs engaged ( more than 8) */
1466 /************************************************************/
1467 /**** STATISTIC COLLECTION ****/
1468 /************************************************************/
1469 typedef struct stat_of_replace
1470 { uchar was;
1471 uchar be;
1472 int16_t no;
1473 } RSTAT;
1474
1475 #define RST_BUFF_SIZE 12
1476
1477 typedef struct wordstack
1478 { WTOKEN * * last;
1479 int16_t depth;
1480 } WSTACK;
1481
1482 #define MAX_WSTACK_DTH 1000
1483
1484 //#include "msgerr.h"
1485
1486 // 08-13-93 08:41pm, Mike
1487 // 6-bit dictionary ...
1488 #include "speltab.h"
1489
1490 #endif //#ifndef __SPEL__DEFS__