~ubuntu-branches/debian/wheezy/cuneiform/wheezy

« back to all changes in this revision

Viewing changes to cuneiform_src/Kern/rstr/src/embbox.c

  • Committer: Bazaar Package Importer
  • Author(s): Jakub Wilk, c-assert.diff, slovenian-slv.diff
  • Date: 2011-01-26 21:53:07 UTC
  • mfrom: (5.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20110126215307-62x61mcesr607qb7
Tags: 1.0.0+dfsg-2
* Upload to unstable.
* Explicitly build-depend on pkg-config. Thanks to Stefano Rivera for the
  bug report.
* Add Vcs-* fields.
* Use the standard C assert() macro, rather than custom Cuneiform one.
  [c-assert.diff]
* Pass CFLAGS, CXXFLAGS and LDFLAGS (get from dpkg-buildflags) to cmake
  (closes: #608345). Thanks to Sami Liedes for the bug report.
  + Build depend on dpkg-dev (>= 1.15.7).
* Pass --parallel to dh.
  + Bump debhelper minimum version to 7.4.10.
* Update debian/copyright to the latest DEP-5 version.
* Bump year in debian/copyright.
* Explicitly link to GraphicsMagick (rather than via the ImageMagick
  compatibility layer).
* Don't ship /usr/lib/cuneiform/*.so symlinks. These libraries are
  considered private, at least until #598616 is fixed.
* Rename some private variables in debian/rules to make them lowercase.
* Update patch headers.
* Provide proper ‘build-arch’ and ‘build-indep’ targets in debian/rules.
* Document input format in the manual page (closes: #572061). Thanks to
  Janusz S. Bień for the bug report.
* Use ‘slv’ (rather than ‘slo’) as language code for Slovenian.
  [slovenian-slv.diff]
* Fix package description: Slovenian is supported, Slovak is not.
* Improve documentation of the language (-l) option (closes: #602512).
  Thanks to Jari Aalto for the bug report.
* Install reasons file for vrms.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
Copyright (c) 1993-2008, Cognitive Technologies
3
3
All rights reserved.
4
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
 
�������� ��� ������ ���� ���� �������� � ����������� ����� ������� � ������.
 
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
32
 
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:
55
55
*/
56
56
 
57
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
 
  ������������������������������������������������������������������
 
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
65
*/
66
66
 
67
67
/*********************************************************************/
74
74
#include <stdlib.h>
75
75
#include <stdio.h>
76
76
#include <string.h>
77
 
#include "nt_types.h"
78
77
#include "struct.h"
79
78
#include "cuthdr.h"
80
79
#include "dmconst.h"
86
85
 
87
86
#include "tuner.h"
88
87
#ifdef UFA
89
 
  BOOL test_alphabet_elem(BYTE let);
 
88
  Bool test_alphabet_elem(uchar let);
90
89
#endif
91
90
 
92
91
double koeK=1.;                            //AK 30.04.97 It's need?
94
93
 
95
94
 
96
95
struct res_recog RR;
97
 
extern CHAR *tableBOX;
98
 
extern PBYTE fontBOX/*,auto_pool*/;    /* BOX table for font  */
99
 
PBYTE  omniBOX;    /* BOX save table for omni  */
 
96
extern char *tableBOX;
 
97
extern puchar fontBOX/*,auto_pool*/;    /* BOX table for font  */
 
98
puchar  omniBOX;    /* BOX save table for omni  */
100
99
 
101
 
INT best_answer_BOX;
102
 
static void store_bests(INT);
103
 
static void store_all_bests(INT);
 
100
int16_t best_answer_BOX;
 
101
static void store_bests(int16_t);
 
102
static void store_all_bests(int16_t);
104
103
static indBOX *wiptr, *indp;
105
 
static BYTE curlet;
106
 
 
107
 
CHAR forbidBOX[]={"&#@!-."};
108
 
CHAR *db_m1[]={"3x3 tab","3x7 tbl", "5x11 t","7x13 march","16x16 cell"};
109
 
 
110
 
static PBYTE full_list[512];
111
 
static PBYTE font_full_list[512];
112
 
static PBYTE omni_full_list[512];
 
104
static uchar curlet;
 
105
 
 
106
char forbidBOX[]={"&#@!-."};
 
107
char *db_m1[]={"3x3 tab","3x7 tbl", "5x11 t","7x13 march","16x16 cell"};
 
108
 
 
109
static puchar full_list[512];
 
110
static puchar font_full_list[512];
 
111
static puchar omni_full_list[512];
113
112
 
114
113
struct list_BOX
115
114
 {
116
 
  BYTE let;
117
 
  BYTE flag;
118
 
  WORD res;
 
115
  uchar let;
 
116
  uchar flag;
 
117
  uint16_t res;
119
118
 };
120
119
typedef struct list_BOX LST;
121
 
static void store_new_bests(WORD ibcos, CHAR pl, CHAR ff,CHAR n_rsn);
122
 
 
123
 
 
124
 
INT  isKlasterFull( INT typl )
 
120
static void store_new_bests(uint16_t ibcos, char pl, char ff,char n_rsn);
 
121
 
 
122
 
 
123
int16_t  isKlasterFull( int16_t typl )
125
124
{
126
125
   if( ((LST *)(full_list[typl]))->let )     // yes such letter in table
127
126
      return  1;
129
128
   return  0;
130
129
}/*isWideLetter*/
131
130
 
132
 
static void store_many(WORD ibcos, CHAR let, CHAR ff, INT typl)
 
131
static void store_many(uint16_t ibcos, char let, char ff, int16_t typl)
133
132
{
134
133
     if(language==LANG_RUSSIAN) return;
135
134
  switch (let)
137
136
    case 'x': case 'c': case 'v':
138
137
    case 's': case 'w':
139
138
     if (typl & 1) store_new_bests(ibcos,let,ff,-1);               // small
140
 
     if (typl & 2) store_new_bests(ibcos,(CHAR)(let +'A' -'a'),ff,-1);     // capital
 
139
     if (typl & 2) store_new_bests(ibcos,(char)(let +'A' -'a'),ff,-1);     // capital
141
140
     break;
142
141
 
143
142
    case 'X': case 'C': case 'V':
144
143
    case 'S': case 'W':
145
 
     if (typl & 1) store_new_bests(ibcos,(CHAR)(let +'a' -'A'),ff,-1);     // small
 
144
     if (typl & 1) store_new_bests(ibcos,(char)(let +'a' -'A'),ff,-1);     // small
146
145
     if (typl & 2) store_new_bests(ibcos,let,ff,-1);               // capital
147
146
     break;
148
147
 
174
173
    case c_bottom_accent :
175
174
        case CC_bottom_accent :
176
175
 
177
 
                // ����������� ���� 17.07.2001 E.P.
 
176
                // йНМТКХЙРМШЕ ЙНДШ 17.07.2001 E.P.
178
177
                if (is_baltic_language(language))
179
178
                        break;
180
179
 
181
 
     if (typl & 4) store_new_bests(ibcos,(CHAR)c_bottom_accent,ff,-1);
182
 
     if (typl & (2+8)) store_new_bests(ibcos,(CHAR)CC_bottom_accent,ff,-1);
 
180
     if (typl & 4) store_new_bests(ibcos,(char)c_bottom_accent,ff,-1);
 
181
     if (typl & (2+8)) store_new_bests(ibcos,(char)CC_bottom_accent,ff,-1);
183
182
     break;
184
183
   }
185
184
}
186
185
 
187
186
 
188
 
static void store_new_bests(WORD ibcos, CHAR pl, CHAR ff,CHAR n_rsn)
 
187
static void store_new_bests(uint16_t ibcos, char pl, char ff,char n_rsn)
189
188
//
190
189
//      This procedure stores best NBEST answers in rec_recog.
191
190
//
217
216
  RR.n_rsn[0]    =n_rsn;
218
217
 }
219
218
 
220
 
static CHAR rbfo, rbfc, rbfv, rbfw, rbfx, rbfs, rbfp, rbfz, rbil;
 
219
static char rbfo, rbfc, rbfv, rbfw, rbfx, rbfs, rbfp, rbfz, rbil;
221
220
 
222
 
static INT letagain(CHAR curleta,INT fl)
 
221
static int16_t letagain(char curleta,int16_t fl)
223
222
{
224
 
   INT fl1, fl2, fl4;
 
223
   int16_t fl1, fl2, fl4;
225
224
   fl1 = fl;
226
225
   fl2 = fl*2;
227
226
   fl4 = fl*4;
314
313
      break;
315
314
     case c_bottom_accent:
316
315
 
317
 
                // ����������� ��� 17.07.2001 E.P.
 
316
                // йНМТКХЙРМШИ ЙНД 17.07.2001 E.P.
318
317
                if (is_baltic_language(language))
319
318
                        return 0;
320
319
 
322
321
      goto c_bottom;
323
322
 
324
323
     case CC_bottom_accent:
325
 
                // ����������� ��� 17.07.2001 E.P.
 
324
                // йНМТКХЙРМШИ ЙНД 17.07.2001 E.P.
326
325
                if (is_baltic_language(language))
327
326
                        return 0;
328
327
 
338
337
 return 1;
339
338
}
340
339
 
341
 
void embBOX(servBOX *SBOX, SVERS *tvers, BOOL erection)
 
340
void embBOX(servBOX *SBOX, SVERS *tvers, Bool erection)
342
341
//
343
342
//      This procedure checks r_raster against compressed images from
344
343
//  table BOX of letters given by tgrhyp.
347
346
//      ON EXIT : ans - sequence of best choices that finishes with ltr=0.
348
347
//
349
348
{
350
 
INT i, hyp,  fll,cnt;
 
349
int16_t i, hyp,  fll,cnt;
351
350
version *hypa;
352
 
WORD probest;
353
 
BYTE ocurlet;
354
 
WORD vect[16];
 
351
uint16_t probest;
 
352
uchar ocurlet;
 
353
uint16_t vect[16];
355
354
elmBOX  *matr,  *wmatr;
356
 
PBYTE klist;
 
355
puchar klist;
357
356
 
358
357
t_answer *ans_ptr;
359
358
Z=&string;
362
361
indp = (indBOX *) tableBOX;
363
362
matr = (elmBOX *) (tableBOX+1024);
364
363
for(i=0;i<15;i++)
365
 
    vect[i] = (((LONG)SBOX->matrBOX.vect[i])<<15)/SBOX->matrBOX.isq_rt;
 
364
    vect[i] = (((int32_t)SBOX->matrBOX.vect[i])<<15)/SBOX->matrBOX.isq_rt;
366
365
 
367
366
fll=0;                                // all hypotesa not in BOX tab
368
367
best_answer_BOX=0;
390
389
        {
391
390
        while( (wmatr = *(elmBOX **)klist) != NULL )
392
391
            {
393
 
            probest=(WORD)((*scalar)(wmatr->vect,vect)>>15);
394
 
            if (probest > (WORD) (ans_ptr->iprob))
 
392
            probest=(uint16_t)((*scalar)(wmatr->vect,vect)>>15);
 
393
            if (probest > (uint16_t) (ans_ptr->iprob))
395
394
               {
396
 
               if (probest > (WORD) best_answer_BOX) best_answer_BOX=probest;
 
395
               if (probest > (uint16_t) best_answer_BOX) best_answer_BOX=probest;
397
396
               ans_ptr->fnt=wmatr->fnt;
398
397
               ans_ptr->iprob=probest;
399
 
               ans_ptr->n_rsn=(CHAR)cnt;
 
398
               ans_ptr->n_rsn=(char)cnt;
400
399
               }
401
400
            cnt++;
402
 
            klist += sizeof(PBYTE *);
 
401
            klist += sizeof(puchar *);
403
402
            }// while end  (all versions of one letter)
404
403
        }
405
404
    else
408
407
            {
409
408
            if( !(wmatr->bnd&0x200) )
410
409
                {
411
 
                probest=(WORD)((*scalar)(wmatr->vect,vect)>>15);
412
 
                if (probest > (WORD) (ans_ptr->iprob))
 
410
                probest=(uint16_t)((*scalar)(wmatr->vect,vect)>>15);
 
411
                if (probest > (uint16_t) (ans_ptr->iprob))
413
412
                    {
414
 
                    if (probest > (WORD) best_answer_BOX)
 
413
                    if (probest > (uint16_t) best_answer_BOX)
415
414
                        best_answer_BOX=probest;
416
415
                    ans_ptr->fnt=wmatr->fnt;
417
416
                    ans_ptr->iprob=probest;
418
 
                    ans_ptr->n_rsn=(CHAR)cnt;
 
417
                    ans_ptr->n_rsn=(char)cnt;
419
418
                    }
420
419
                }
421
420
            cnt++;
422
 
            klist += sizeof(PBYTE *);
 
421
            klist += sizeof(puchar *);
423
422
            }// while end  (all versions of one letter)
424
423
        }
425
424
 
439
438
return;
440
439
}
441
440
 
442
 
BOOL pidx_skip(INT h, INT w,BYTE t_let);
443
 
void embBOXF(servBOX *SBOX, INT typl, BOOL erection)
 
441
Bool pidx_skip(int16_t h, int16_t w,uchar t_let);
 
442
void embBOXF(servBOX *SBOX, int16_t typl, Bool erection)
444
443
//
445
444
//      This procedure checks r_raster against compressed images from
446
445
//  table BOX of letters given by tgrhyp.
449
448
//      ON EXIT : ans - sequence of best choices that finishes with ltr=0.
450
449
//
451
450
{
452
 
INT i, flp, flprop;
453
 
BYTE curr_font;
454
 
WORD curr_cosinus;
 
451
int16_t i, flp, flprop;
 
452
uchar curr_font;
 
453
uint16_t curr_cosinus;
455
454
PWORD vectp;
456
 
DWORD norm;
457
 
PBYTE list;
458
 
CHAR cnt,n_rsn;
 
455
uint32_t norm;
 
456
puchar list;
 
457
char cnt,n_rsn;
459
458
elmBOX *wmatr;
460
459
t_answer *ans_ptr;
461
 
WORD vect[16];
462
 
WORD  nAll;
 
460
uint16_t vect[16];
 
461
uint16_t  nAll;
463
462
 
464
463
Z=&string;
465
464
 
467
466
vectp=SBOX->matrBOX.vect;
468
467
norm=SBOX->matrBOX.isq_rt;
469
468
for(i=0;i<15;i++)
470
 
    vect[i] = (WORD)((((LONG)vectp[i])<<15)/norm);
 
469
    vect[i] = (uint16_t)((((int32_t)vectp[i])<<15)/norm);
471
470
list = full_list[typl];
472
471
nAll = 0;
473
472
 
485
484
            if (flprop)
486
485
                {
487
486
                nAll++;
488
 
                i = (INT)((*scalar)(wmatr->vect,vect)>>15);
 
487
                i = (int16_t)((*scalar)(wmatr->vect,vect)>>15);
489
488
 
490
 
                if ((WORD)i > (WORD)curr_cosinus)
 
489
                if ((uint16_t)i > (uint16_t)curr_cosinus)
491
490
                    {
492
 
                    if ((WORD)i == 32767)
 
491
                    if ((uint16_t)i == 32767)
493
492
                        i=32766;
494
 
                    if ((WORD)i > 32767)
 
493
                    if ((uint16_t)i > 32767)
495
494
                        i=32767;
496
 
                    *(PBYTE)(&curr_font)=wmatr->fnt;
 
495
                    *(puchar)(&curr_font)=wmatr->fnt;
497
496
                    *(PWORD)(&curr_cosinus)=i;
498
497
                    n_rsn=cnt;
499
498
                    }
500
499
                }
501
500
            cnt++;
502
 
            list += sizeof(PBYTE *);
 
501
            list += sizeof(puchar *);
503
502
            }  // while all letter's list entries
504
503
        }
505
504
    else
509
508
            if (flprop && !(wmatr->bnd&0x200) )
510
509
                {
511
510
                nAll++;
512
 
                i = (INT)((*scalar)(wmatr->vect,vect)>>15);
 
511
                i = (int16_t)((*scalar)(wmatr->vect,vect)>>15);
513
512
 
514
 
                if ((WORD)i > (WORD)curr_cosinus)
 
513
                if ((uint16_t)i > (uint16_t)curr_cosinus)
515
514
                    {
516
 
                    if ((WORD)i == 32767)i=32766;
517
 
                    if ((WORD)i > 32767) i=32767;
518
 
                    *(PBYTE)(&curr_font)=wmatr->fnt;
 
515
                    if ((uint16_t)i == 32767)i=32766;
 
516
                    if ((uint16_t)i > 32767) i=32767;
 
517
                    *(puchar)(&curr_font)=wmatr->fnt;
519
518
                    *(PWORD)(&curr_cosinus)=i;
520
519
                    n_rsn=cnt;
521
520
                    }
522
521
                }
523
522
            cnt++;
524
 
            list += sizeof(PBYTE *);
 
523
            list += sizeof(puchar *);
525
524
            }  // while all letter's list entries
526
525
    }
527
526
        if (flprop)
531
530
            else
532
531
                store_new_bests(curr_cosinus,curlet,curr_font,n_rsn);
533
532
            }
534
 
    list += sizeof(PBYTE *);
 
533
    list += sizeof(puchar *);
535
534
    }   // while all list elements
536
535
 
537
536
// RR_answers to user's answer field
550
549
//----------------- Sorting events by BOX -------------------------------
551
550
void wcomp_to_box(PWORD vector);
552
551
 
553
 
void sort_events_box (PWORD list, INT nl)
 
552
void sort_events_box (PWORD list, int16_t nl)
554
553
{
555
554
 PWORD lend, lcur, lcp;
556
555
 PWORD ncur, ncp;
557
 
 WORD ev_marks[100], probest;
558
 
 WORD vector[15], norm;
559
 
 BYTE ocurlet;
 
556
 uint16_t ev_marks[100], probest;
 
557
 uint16_t vector[15], norm;
 
558
 uchar ocurlet;
560
559
 elmBOX  *matr,  *wmatr;
561
560
 
562
561
 memset (vector,0,sizeof(vector));
567
566
 indp = (indBOX *) tableBOX;    matr = (elmBOX *) (tableBOX+1024);
568
567
 do
569
568
  {
570
 
     *ncur = 327;       ocurlet = *(PBYTE)lcur;
 
569
     *ncur = 327;       ocurlet = *(puchar)lcur;
571
570
     wiptr=&indp[ocurlet];
572
571
     if ((!wiptr->ltr) ||                 // no such letter in table
573
572
      (strchr(forbidBOX,ocurlet)))      // forbidden in BOX
574
573
         continue;
575
 
     //wmatr=(elmBOX *)((PBYTE)matr+wiptr->numel);
 
574
     //wmatr=(elmBOX *)((puchar)matr+wiptr->numel);
576
575
     wmatr=matr+wiptr->numel;
577
576
     while(1)
578
577
      {
584
583
        }
585
584
       probest = wmatr->list;
586
585
       if (!probest) break;
587
 
       //wmatr=(elmBOX *)((PBYTE)matr+probest);
 
586
       //wmatr=(elmBOX *)((puchar)matr+probest);
588
587
       wmatr=matr+wiptr->numel;
589
588
      }
590
589
 
592
591
    while (ncp != ev_marks)
593
592
     {
594
593
      if (*ncp <= *(ncp-1)) break;
595
 
      if (*(((PBYTE)lcp)+1) < *(((PBYTE)lcp)-1)) break;
 
594
      if (*(((puchar)lcp)+1) < *(((puchar)lcp)-1)) break;
596
595
      probest = *ncp; *ncp = *(ncp-1); ncp--; *ncp = probest;
597
596
      probest = *lcp; *lcp = *(lcp-1); lcp--; *lcp = probest;
598
597
     }
603
602
 
604
603
//--------------------- Load BOX tables ----------------------------------
605
604
 
606
 
static void straight_BOX(PBYTE free)
 
605
static void straight_BOX(puchar free)
607
606
{
608
607
 indBOX *o;
609
608
 elmBOX *m;
610
609
 o=(indBOX  *)tableBOX;
611
610
 m=(elmBOX  *)(tableBOX+1024);
612
611
 //while (++o != (indBOX *) m)    o->numel *= sizeof (elmBOX);
613
 
 //while (free -(PBYTE)m > 0) { m->list *= sizeof(elmBOX); m++; }
 
612
 //while (free -(puchar)m > 0) { m->list *= sizeof(elmBOX); m++; }
614
613
}
615
614
 
616
 
static PBYTE list_BOX(PBYTE free, INT typl)
 
615
static puchar list_BOX(puchar free, int16_t typl)
617
616
{
618
 
 INT flp;
619
 
 BYTE tlw;
 
617
 int16_t flp;
 
618
 uchar tlw;
620
619
 register unsigned ocurlet;
621
 
 WORD list;
 
620
 uint16_t list;
622
621
 indBOX *owiptr;
623
622
 elmBOX *matr, *wmatr;
624
623
 
627
626
 full_list[typl] = free;
628
627
 
629
628
   if( typl >= 32 ){
630
 
      BYTE  bnd=0;
 
629
      uchar  bnd=0;
631
630
      if( typl >= 256 )
632
631
        bnd = 1;
633
632
      indp = owiptr = (indBOX  *)tableBOX;
638
637
      if( owiptr->ltr ){
639
638
         curlet = ocurlet = owiptr->ltr;
640
639
         tlw = 0;
641
 
         //wmatr=(elmBOX *)((PBYTE)matr+owiptr->numel);
 
640
         //wmatr=(elmBOX *)((puchar)matr+owiptr->numel);
642
641
         wmatr=matr+owiptr->numel;
643
642
         ((LST *)free)->let = curlet;
644
643
         ((LST *)free)->flag = 0;
646
645
         while(1){
647
646
            if( ( (wmatr->bnd/256) & 0x01 ) == bnd ){
648
647
               tlw++;
649
 
               *(PBYTE *)free = (PBYTE) wmatr;   free += sizeof(PBYTE *);
 
648
               *(puchar *)free = (puchar) wmatr;   free += sizeof(puchar *);
650
649
            }
651
650
            list = wmatr->list;
652
651
            if (!list) break;
653
 
            //wmatr=(elmBOX *)((PBYTE)matr+list);
 
652
            //wmatr=(elmBOX *)((puchar)matr+list);
654
653
            wmatr=(elmBOX *)matr+list;
655
654
         }
656
655
         if( tlw ){
657
 
            *((PBYTE *)free) = NULL; free += sizeof (PBYTE *);
 
656
            *((puchar *)free) = NULL; free += sizeof (puchar *);
658
657
         }
659
658
         else{
660
659
            free -= sizeof (LST);
691
690
  if ((tlw = typl & 0x0f) != 0)
692
691
    if ((let_lincomp[ocurlet] & tlw) == 0)   // size incompatible to letter
693
692
      continue;
694
 
  //wmatr=(elmBOX *)((PBYTE)matr+owiptr->numel);
 
693
  //wmatr=(elmBOX *)((puchar)matr+owiptr->numel);
695
694
  wmatr=matr+owiptr->numel;
696
695
  if ((flp=letagain(curlet,0))==0)
697
696
   {
707
706
  free += sizeof(LST);
708
707
 
709
708
rwrk:;
710
 
  //wmatr=(elmBOX *)((PBYTE)matr+wiptr->numel);
 
709
  //wmatr=(elmBOX *)((puchar)matr+wiptr->numel);
711
710
  wmatr=matr+wiptr->numel;
712
711
lwrk:;
713
712
  while(1)
714
713
   {
715
714
   if( ( (wmatr->bnd/256) & 0x01 ) == 0 ){
716
 
      *(PBYTE *)free = (PBYTE) wmatr;   free += sizeof(PBYTE *);
 
715
      *(puchar *)free = (puchar) wmatr;   free += sizeof(puchar *);
717
716
   }
718
717
   list = wmatr->list;
719
718
   if (!list) break;
720
 
   //wmatr=(elmBOX *)((PBYTE)matr+list);
 
719
   //wmatr=(elmBOX *)((puchar)matr+list);
721
720
   wmatr=(elmBOX *)matr+list;
722
721
   }
723
722
 
724
723
  if (flp == 0) goto lwrs;  // not a paired letter
725
724
  if  (letagain(curlet,1) && wiptr) goto rwrk;
726
725
lwrs:;
727
 
  *((PBYTE *)free) = NULL; free += sizeof (PBYTE *);
 
726
  *((puchar *)free) = NULL; free += sizeof (puchar *);
728
727
  }
729
728
 if ((typl & 256) == 0)
730
729
  {
740
739
void correct_let_tables(void);
741
740
void correct_letters_pidx_table(void);
742
741
 
743
 
PBYTE load_BOX(PBYTE free)
 
742
puchar load_BOX(puchar free)
744
743
{
745
 
 INT i;
746
 
 correct_let_tables(); // overload lang depending tables �. 䠩� ACC_TABS.c
 
744
 int16_t i;
 
745
 correct_let_tables(); // overload lang depending tables А╛. Д═╘╚ ACC_TABS.c
747
746
 correct_letters_pidx_table(); // overload proportinal tab
748
747
 straight_BOX(free);
749
748
 for (i=0; i<16; i++)
752
751
   free = list_BOX(free,i);
753
752
 
754
753
//for  two  tables  3x5
755
 
 memcpy(omni_full_list,full_list,512*sizeof(PBYTE));
 
754
 memcpy(omni_full_list,full_list,512*sizeof(puchar));
756
755
 omniBOX = tableBOX;
757
756
 
758
757
 return free;
759
758
}
760
759
 
761
760
 
762
 
void load_font( INT  font )
 
761
void load_font( int16_t  font )
763
762
{
764
763
 
765
764
 if( font ){
766
 
    memcpy(full_list,font_full_list,512*sizeof(PBYTE));
 
765
    memcpy(full_list,font_full_list,512*sizeof(puchar));
767
766
    tableBOX = fontBOX;
768
767
 }
769
768
 else{
770
 
    memcpy(full_list,omni_full_list,512*sizeof(PBYTE));
 
769
    memcpy(full_list,omni_full_list,512*sizeof(puchar));
771
770
    tableBOX = omniBOX;
772
771
 }
773
772
 
775
774
}/*load_font*/
776
775
 
777
776
 
778
 
PBYTE  preload_font_BOX( PBYTE free )
 
777
puchar  preload_font_BOX( puchar free )
779
778
{
780
 
 INT   i;
781
 
// LONG  l;
782
 
// BYTE  workLetter;
 
779
 int16_t   i;
 
780
// int32_t  l;
 
781
// uchar  workLetter;
783
782
// StructTree *tmp=(StructTree *)auto_pool;               //AK
784
783
 
785
784
 /*
799
798
   }
800
799
 
801
800
*/
802
 
 correct_let_tables(); // overload lang depending tables �. 䠩� ACC_TABS.c
 
801
 correct_let_tables(); // overload lang depending tables А╛. Д═╘╚ ACC_TABS.c
803
802
 correct_letters_pidx_table(); // overload proportinal tab
804
803
 
805
804
 {
815
814
/*
816
815
  while (++o != (indBOX *) m)
817
816
     o->numel *= size_m;      //AK 29.04.97
818
 
  while (free-(PBYTE)m > 0)
 
817
  while (free-(puchar)m > 0)
819
818
    {
820
819
     m->list *= size_m;        //AK 29.04.97
821
820
     m++;
829
828
   free = list_BOX(free,i);
830
829
 for (i=32; i<512; i++)
831
830
   free = list_BOX(free,i);
832
 
 memcpy(font_full_list,full_list,512*sizeof(PBYTE));
 
831
 memcpy(font_full_list,full_list,512*sizeof(puchar));
833
832
 
834
833
 return  free;
835
834
}/*preload_font_BOX*/