~ubuntu-branches/ubuntu/precise/cuneiform/precise

« back to all changes in this revision

Viewing changes to cuneiform_src/Kern/rstr/src/passe.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:
63
63
#include <stdlib.h>
64
64
#include <stdio.h>
65
65
#include <string.h>
66
 
#include "nt_types.h"
 
66
 
67
67
#include "struct.h"
68
68
#include "func.h"
69
69
#include "status.h"
76
76
#include "user_voc.h"
77
77
#include "minmax.h"
78
78
 
79
 
extern BYTE db_trace_flag;
80
 
extern BYTE decode_ASCII_to_[256][4];
81
 
extern BYTE valid_word_number;
82
 
extern INT  text_findstat(CHAR * w);
83
 
extern INT  text_findstat_aux(CHAR * w);
84
 
extern INT  text_findstat_agressive(CHAR * w);
85
 
static INT  get_right_coord(cell *c);
86
 
static INT  get_left_coord(cell *c);
87
 
static BYTE is_english_word(cell *c,cell *e);
88
 
static BYTE change_Il1(cell *b, cell *e);
89
 
static BYTE eng_recognize(cell *b, cell *e);
90
 
static BYTE english_cell_recognize(cell *cc);
 
79
extern uchar db_trace_flag;
 
80
extern uchar decode_ASCII_to_[256][4];
 
81
extern uchar valid_word_number;
 
82
extern int16_t  text_findstat(char * w);
 
83
extern int16_t  text_findstat_aux(char * w);
 
84
extern int16_t  text_findstat_agressive(char * w);
 
85
static int16_t  get_right_coord(cell *c);
 
86
static int16_t  get_left_coord(cell *c);
 
87
static uchar is_english_word(cell *c,cell *e);
 
88
static uchar change_Il1(cell *b, cell *e);
 
89
static uchar eng_recognize(cell *b, cell *e);
 
90
static uchar english_cell_recognize(cell *cc);
91
91
static void filtrate_language(cell *b,cell *e);
92
 
static void mark_two_lang_word(cell *b, cell *e, BYTE val);
93
 
static BOOL bad_chars_in_word(cell *b,cell *e);
94
 
static BOOL small_prob_in_word(cell *b,cell *e) ;
95
 
static BOOL more_alt(cell *b,cell *e);
96
 
static BOOL II_place(cell *c);
97
 
static BOOL II_config(cell *c);
98
 
BOOL russian_word(BYTE *wrd);
99
 
BOOL english_word(BYTE *wrd);
100
 
BOOL russian_word_all(BYTE *wrd,BYTE language,BYTE nextlet);
101
 
BOOL english_word_all(BYTE *wrd,BYTE language);
102
 
static BOOL exist_symbol(cell *b,cell *e,BYTE ch) ;
103
 
static BOOL left_over(cell *b,INT limit);
 
92
static void mark_two_lang_word(cell *b, cell *e, uchar val);
 
93
static Bool bad_chars_in_word(cell *b,cell *e);
 
94
static Bool small_prob_in_word(cell *b,cell *e) ;
 
95
static Bool more_alt(cell *b,cell *e);
 
96
static Bool II_place(cell *c);
 
97
static Bool II_config(cell *c);
 
98
Bool russian_word(uchar *wrd);
 
99
Bool english_word(uchar *wrd);
 
100
Bool russian_word_all(uchar *wrd,uchar language,uchar nextlet);
 
101
Bool english_word_all(uchar *wrd,uchar language);
 
102
static Bool exist_symbol(cell *b,cell *e,uchar ch) ;
 
103
static Bool left_over(cell *b,int16_t limit);
104
104
 
105
105
//Alik 04-25-96 06:53pm
106
106
//============== Import func ===========
107
 
//INT text_findstat(CHAR * word);
 
107
//int16_t text_findstat(char * word);
108
108
//============== Local func =================
109
 
static BOOL russian_dictionary_word(cell * first, cell * last,PBYTE);
110
 
BOOL _spell(PCHAR s,BYTE lang);
111
 
BOOL _spell_agressive(PCHAR s,BYTE lang);
112
 
BOOL short_spell(BYTE *wrd,BYTE language, BYTE nextlet );
 
109
static Bool russian_dictionary_word(cell * first, cell * last,puchar);
 
110
Bool _spell(pchar s,uchar lang);
 
111
Bool _spell_agressive(pchar s,uchar lang);
 
112
Bool short_spell(uchar *wrd,uchar language, uchar nextlet );
113
113
extern void final_descriminate(cell *b, cell *e);
114
 
extern void del_word_for2lang(INT left_limit,INT right_limit);
115
 
extern INT line_number;         // number of line in ed_file
 
114
extern void del_word_for2lang(int16_t left_limit,int16_t right_limit);
 
115
extern int16_t line_number;         // number of line in ed_file
116
116
 
117
117
#define MAX_LEN_WORD  48
118
118
#define GOOD_PROB     200
119
119
 
120
 
BOOL short_spell(BYTE *wrd,BYTE language, BYTE nextlet )
 
120
Bool short_spell(uchar *wrd,uchar language, uchar nextlet )
121
121
{
122
 
BOOL    short_word_solid;
 
122
Bool    short_word_solid;
123
123
switch( language )
124
124
    {
125
125
    case    LANG_RUSSIAN:
135
135
return short_word_solid;
136
136
}
137
137
 
138
 
BOOL short_spell_re(BYTE *wrd,BYTE language )
 
138
Bool short_spell_re(uchar *wrd,uchar language )
139
139
{
140
 
BOOL    short_word_solid;
 
140
Bool    short_word_solid;
141
141
switch( language )
142
142
    {
143
143
    case    LANG_RUSSIAN:
153
153
return short_word_solid;
154
154
}
155
155
 
156
 
static BYTE  cells_get_language(cell * c,cell * e)
 
156
static uchar  cells_get_language(cell * c,cell * e)
157
157
{
158
158
cell *  r;
159
 
BYTE    lang=c->language;
 
159
uchar    lang=c->language;
160
160
for(r=c->next;r && r!=e;r=r->next)
161
161
    {
162
162
    if( r->language!=lang )
165
165
return lang;
166
166
}
167
167
 
168
 
static BOOL  cells_get_solid(cell * rus, cell * ruse)
 
168
static Bool  cells_get_solid(cell * rus, cell * ruse)
169
169
{
170
170
cell *r;
171
171
 
177
177
return TRUE;
178
178
}
179
179
 
180
 
BOOL cells_left_solid(cell *c)
 
180
Bool cells_left_solid(cell *c)
181
181
{
182
 
INT sol=0;
 
182
int16_t sol=0;
183
183
for(c=c->prev;(c->flg&(c_f_punct));c=c->prev);
184
184
if( c->flg&c_f_fict )
185
185
    return TRUE;
194
194
}
195
195
 
196
196
 
197
 
BOOL cells_right_solid(cell *c)
 
197
Bool cells_right_solid(cell *c)
198
198
{
199
 
INT sol=0;
 
199
int16_t sol=0;
200
200
for(c=c->next;(c->flg&(c_f_punct));c=c->next);
201
201
if( c->flg&c_f_fict )
202
202
    return TRUE;
215
215
void   set_spell_solid(void)
216
216
{
217
217
cell   *c, *e, *cc, *ce, *ee, *t;
218
 
BYTE    word_len,buf[MAX_LEN_WORD+40], *wrd, *pwrd,
 
218
uchar    word_len,buf[MAX_LEN_WORD+40], *wrd, *pwrd,
219
219
        buff[MAX_LEN_WORD+40], llanguage,
220
220
//      left_terms[]="<(�\"\'/[",
221
221
        left_terms[]="//<(\"\'/[",
222
222
//      right_terms[]="/)>�ؼ\"!\';?\x1e\x1f",
223
223
        right_terms[]="///)>�\"!\';?\x1e\x1f",  // 31.05.2001 E.P.
224
224
                nextlet;
225
 
INT             l,n=sizeof(buf)-1;
 
225
int16_t         l,n=sizeof(buf)-1;
226
226
 
227
227
// ���� �������� ��������� � ������� �� �����. 31.05.2001 E.P.
228
228
left_terms[0] = low_quotes;
275
275
 
276
276
  if( llanguage!=255 )
277
277
      {
278
 
      INT   u, d;
 
278
      int16_t   u, d;
279
279
      cell  *cu, *cd;
280
280
      if ( !cells_get_solid(c,e) &&
281
281
            (short_spell(wrd,llanguage,nextlet ) ||
406
406
return c;
407
407
}
408
408
 
409
 
BOOL    nonpunct_interval(cell *b,cell *e)
 
409
Bool    nonpunct_interval(cell *b,cell *e)
410
410
{
411
411
cell *c;
412
412
for(c=b;c!=e;c=c->next)
417
417
return FALSE;
418
418
}
419
419
 
420
 
BYTE   english_word_recognize(void)
 
420
uchar   english_word_recognize(void)
421
421
{
422
422
cell *c, *e;
423
 
BYTE buf[MAX_LEN_WORD+40],is_eng,word_len,eng,r1,r2,val,BadWord;
424
 
BYTE wrd[MAX_LEN_WORD+40];
425
 
INT  left_limit, right_limit, last_wrd;
 
423
uchar buf[MAX_LEN_WORD+40],is_eng,word_len,eng,r1,r2,val,BadWord;
 
424
uchar wrd[MAX_LEN_WORD+40];
 
425
int16_t  left_limit, right_limit, last_wrd;
426
426
cell    *right_cell, *left_cell  ;
427
427
 
428
428
if( db_status && snap_activity('c') )
505
505
    e=get_nonpunct_cell(e);
506
506
    left_limit = get_right_coord(e);
507
507
    left_cell  = e;
508
 
    if( e->prev->save_stick_inc!=NO_INCLINE && !left_over(e,(INT)(left_limit+1)) )
 
508
    if( e->prev->save_stick_inc!=NO_INCLINE && !left_over(e,(int16_t)(left_limit+1)) )
509
509
      left_limit++;
510
510
    e=get_nonlet_cell(e);
511
511
    }
537
537
  {
538
538
   // nonenglish word - auxilary methodes
539
539
 
540
 
  if( c->vers[0].let==(BYTE)'�' && II_place(c) && II_config(c) )
 
540
  if( c->vers[0].let==(uchar)'�' && II_place(c) && II_config(c) )
541
541
    { // ࠧ�ࢠ���� �㪢� �
542
542
    eng++;
543
543
    down_all_versions(c, 22);
552
552
    e=get_nonpunct_cell(e);
553
553
    left_limit = get_left_coord(e);
554
554
    left_cell  = e;
555
 
    if( e->prev->save_stick_inc!=NO_INCLINE && !left_over(e,(INT)(left_limit+1)) )
 
555
    if( e->prev->save_stick_inc!=NO_INCLINE && !left_over(e,(int16_t)(left_limit+1)) )
556
556
      left_limit++;
557
557
    e=get_nonlet_cell(e);
558
558
    is_eng=1; // for SNAP
583
583
return( eng!=0 );
584
584
}
585
585
 
586
 
BOOL russian_dictionary_word(cell * first, cell * last,PBYTE BadWord)
 
586
Bool russian_dictionary_word(cell * first, cell * last,puchar BadWord)
587
587
{
588
588
#define DELTA            80
589
589
#define MINI_PROB       150
590
590
#define FINE_LET        200
591
591
 
592
 
CHAR word[76],*pw;
593
 
INT  cl;
 
592
char word[76],*pw;
 
593
int16_t  cl;
594
594
cell *c,*roll;
595
595
 
596
596
 for(; first != last; first=first->next)               // skip head punct
650
650
 return FALSE;
651
651
}
652
652
 
653
 
BOOL _spell(PCHAR s,BYTE lang)
 
653
Bool _spell(pchar s,uchar lang)
654
654
{
655
655
 
656
 
CHAR        w[76]="",*pw; BYTE ss;
657
 
INT         ret;
 
656
char        w[76]="",*pw; uchar ss;
 
657
int16_t         ret;
658
658
 
659
659
for(pw=w; *s; s++)
660
660
 {
663
663
     {
664
664
     //                ..  ..
665
665
     // recode russian E   e
666
 
     if( ss==r_e_2dot )   ss=(BYTE)'�';
667
 
     if( ss==r_EE_2dot )  ss=(BYTE)'�';
 
666
     if( ss==r_e_2dot )   ss=(uchar)'�';
 
667
     if( ss==r_EE_2dot )  ss=(uchar)'�';
668
668
 
669
669
     }
670
670
 if( ss==liga_i ) ss='i';
684
684
return  ret > 0;
685
685
}
686
686
 
687
 
BOOL _spell_agressive(PCHAR s,BYTE lang)
 
687
Bool _spell_agressive(pchar s,uchar lang)
688
688
{
689
689
 
690
 
CHAR        w[76]="",*pw; BYTE ss;
691
 
INT         ret;
 
690
char        w[76]="",*pw; uchar ss;
 
691
int16_t         ret;
692
692
 
693
693
if( lang!=LANG_RUSSIAN )
694
694
    return FALSE;
708
708
return  ret > 0;
709
709
}
710
710
 
711
 
static BYTE russian_letters[] ="������뢫���ﬨ�졉����������������������";
712
 
static BYTE english_letters[] ="Ili";
713
 
static BYTE two_lang_letters[]="�234567890㓪�������啂��������ᑌ���";
714
 
//static BYTE eng_lang_letters[]="�234567890yYkKeEHr33xXBaAnpPoOvcCMTbm";
715
 
static BYTE punct_letters[]   ="(){}[]!�,.\"':?\\/-_";
716
 
static BYTE russian_prepositions[]="��᮪。������";
717
 
static BYTE critical_digitals[]="183";
 
711
static uchar russian_letters[] ="������뢫���ﬨ�졉����������������������";
 
712
static uchar english_letters[] ="Ili";
 
713
static uchar two_lang_letters[]="�234567890㓪�������啂��������ᑌ���";
 
714
//static uchar eng_lang_letters[]="�234567890yYkKeEHr33xXBaAnpPoOvcCMTbm";
 
715
static uchar punct_letters[]   ="(){}[]!�,.\"':?\\/-_";
 
716
static uchar russian_prepositions[]="��᮪。������";
 
717
static uchar critical_digitals[]="183";
718
718
 
719
719
 
720
720
 
721
721
// return : 0 - russian, 1 - english, 2 - russian or english
722
 
BYTE is_english_word(cell *b,cell *e)
 
722
uchar is_english_word(cell *b,cell *e)
723
723
{
724
724
cell *c;
725
 
INT n,r,re,r1,rd,rp;
726
 
BYTE ch,pr;
 
725
int16_t n,r,re,r1,rd,rp;
 
726
uchar ch,pr;
727
727
 
728
728
if( b==e->prev )
729
729
  { // one letter in word
731
731
  pr = b->vers[0].prob;
732
732
  if( strchr(punct_letters,ch) ) //,sizeof(punct_letters)) )
733
733
    return 0;
734
 
  if( ch==(BYTE)'�' )
 
734
  if( ch==(uchar)'�' )
735
735
        return 0;
736
736
  if( is_digit(ch) )
737
737
        return 0;
766
766
  if( memchr(critical_digitals,ch,sizeof(critical_digitals)) &&
767
767
      pr<GOOD_PROB+20 )  // Oleg : 28.12.94 : '1','8' too similar to 'I','S'
768
768
      r1++;
769
 
  if( ch==(BYTE)'�' && pr<GOOD_PROB && c!=e->prev )
 
769
  if( ch==(uchar)'�' && pr<GOOD_PROB && c!=e->prev )
770
770
      r1++;              // ! whith glued . too similar 'I'
771
771
  }
772
772
if( n==1 && rp==1 ) return 0;
775
775
return r<1 || r==1 && r1;
776
776
}
777
777
 
778
 
BYTE change_Il1(cell *b, cell *e)
 
778
uchar change_Il1(cell *b, cell *e)
779
779
{
780
780
cell *c;
781
 
INT  upper,n,digit,ret = FALSE, rc;
782
 
BYTE let;
783
 
BYTE saveN, saveV[VERS_IN_CELL*sizeof(version)];
 
781
int16_t  upper,n,digit,ret = FALSE, rc;
 
782
uchar let;
 
783
uchar saveN, saveV[VERS_IN_CELL*sizeof(version)];
784
784
 
785
785
for(n=digit=upper=0,c=b;c!=e;c=c->next,n++)
786
786
  {
791
791
if( digit==n )  return FALSE;
792
792
upper += digit;
793
793
upper = (upper==n);
794
 
if( n==3 && b->vers[0].let==(BYTE)'�' ) upper=0;
 
794
if( n==3 && b->vers[0].let==(uchar)'�' ) upper=0;
795
795
for(c=b;c!=e;c=c->next)
796
796
  if( (c->flg&c_f_let) && c->nvers>0 && memchr("1!�",c->vers[0].let,3) )
797
797
    {
798
 
    saveN = (BYTE)c->nvers;
 
798
    saveN = (uchar)c->nvers;
799
799
    memcpy(saveV,c->vers,VERS_IN_CELL*sizeof(version));
800
800
    if( upper || c==b ) let='I';
801
801
    else                let='l';
808
808
    if( rc>254-30 )
809
809
      ret = TRUE;
810
810
    }
811
 
return (BYTE)ret;
 
811
return (uchar)ret;
812
812
}
813
813
 
814
 
BYTE eng_recognize(cell *b, cell *e)
 
814
uchar eng_recognize(cell *b, cell *e)
815
815
{
816
816
cell *c,cc;
817
 
INT n;
818
 
BYTE let,two_l,eng_l,bad_l;
 
817
int16_t n;
 
818
uchar let,two_l,eng_l,bad_l;
819
819
 
820
820
for(bad_l=eng_l=two_l=0,n=0,c=b;c!=e;c=c->next,n++)
821
821
  {
863
863
return ( two_l+bad_l==n ? 1 : 2);
864
864
}
865
865
 
866
 
BYTE english_cell_recognize(cell *cc)
 
866
uchar english_cell_recognize(cell *cc)
867
867
{
868
868
s_glue GL={0};
869
 
BYTE prob=cc->vers[0].prob, ccflg=(BYTE)cc->flg;
 
869
uchar prob=cc->vers[0].prob, ccflg=(uchar)cc->flg;
870
870
 
871
871
if( !(cc->flg&(c_f_let|c_f_bad)) )
872
872
  return 0;
900
900
        (cc->vers[0].prob>prob && cc->vers[0].prob>GOOD_PROB-30) ;
901
901
}
902
902
 
903
 
void mark_two_lang_word(cell *b, cell *e, BYTE val)
 
903
void mark_two_lang_word(cell *b, cell *e, uchar val)
904
904
{
905
905
cell *c;
906
906
for(c=b;c!=e;c=c->next)
909
909
}
910
910
 
911
911
 
912
 
BOOL bad_chars_in_word(cell *b,cell *e)
 
912
Bool bad_chars_in_word(cell *b,cell *e)
913
913
{
914
914
cell *c;
915
915
for(c=b;c!=e;c=c->next)
917
917
return FALSE;
918
918
}
919
919
 
920
 
BOOL small_prob_in_word(cell *b,cell *e)
 
920
Bool small_prob_in_word(cell *b,cell *e)
921
921
{
922
922
cell *c;
923
923
for(c=b;c!=e;c=c->next)
925
925
return FALSE;
926
926
}
927
927
 
928
 
BYTE   small_english_str(void)
 
928
uchar   small_english_str(void)
929
929
{
930
930
cell *c;
931
 
BYTE non_base_define_letters[]="TYUuOoSsKZzXxCcVvHB3Ii1�0";
932
 
INT n,m;
 
931
uchar non_base_define_letters[]="TYUuOoSsKZzXxCcVvHB3Ii1�0";
 
932
int16_t n,m;
933
933
 
934
934
for(c=cell_f()->nextl,n=0;c!=cell_l();c=c->nextl,n++);
935
935
for(c=cell_f()->nextl,m=0;c!=cell_l();c=c->nextl)
944
944
}
945
945
 
946
946
/* ��������⭮� �����ᯮ������� ��� ���� II */
947
 
BOOL II_place(cell *c)
 
947
Bool II_place(cell *c)
948
948
{
949
949
if( c->prev  && (c->prev->flg & c_f_space) &&
950
950
    c->next  && (c->next->flg & c_f_space) &&
957
957
return FALSE;
958
958
}
959
959
 
960
 
BOOL II_config(cell *c)
 
960
Bool II_config(cell *c)
961
961
{
962
962
return c->broken_II;
963
963
}
964
964
 
965
 
BOOL more_alt(cell *b,cell *e)
 
965
Bool more_alt(cell *b,cell *e)
966
966
{
967
967
cell *c;
968
 
INT min_prob=1000;
969
 
INT flag_nvers=0;
970
 
INT flag_big_nvers=0;
 
968
int16_t min_prob=1000;
 
969
int16_t flag_nvers=0;
 
970
int16_t flag_big_nvers=0;
971
971
for(c=b;c!=e;c=c->next)
972
972
 {
973
973
  if( c->nvers<1 )continue;
986
986
 
987
987
 
988
988
 
989
 
static BYTE russian_ligas[] ="��������";
990
 
static BYTE russian_ligas_recode[] ="��⨣���";
991
 
BOOL russian_word(BYTE *wrd)
 
989
static uchar russian_ligas[] ="��������";
 
990
static uchar russian_ligas_recode[] ="��⨣���";
 
991
Bool russian_word(uchar *wrd)
992
992
{
993
 
INT i,ii,iv;
994
 
BYTE w[MAX_LEN_WORD],c,*oc;
 
993
int16_t i,ii,iv;
 
994
uchar w[MAX_LEN_WORD],c,*oc;
995
995
 
996
996
for(ii=i=0;wrd[i]!='\0'&&i<MAX_LEN_WORD-1;i++)
997
997
  if( !memchr(punct_letters,wrd[i],sizeof(punct_letters)) )
1015
1015
return FALSE;
1016
1016
}
1017
1017
 
1018
 
BOOL russian_word_all(BYTE *wrd,BYTE language,BYTE nextlet)
 
1018
Bool russian_word_all(uchar *wrd,uchar language,uchar nextlet)
1019
1019
{
1020
 
INT i,ii,iv;
1021
 
BYTE ww[MAX_LEN_WORD],*w=&ww[0],c;
 
1020
int16_t i,ii,iv;
 
1021
uchar ww[MAX_LEN_WORD],*w=&ww[0],c;
1022
1022
 
1023
1023
if( language!=LANG_RUSSIAN )
1024
1024
    return FALSE;
1058
1058
}
1059
1059
 
1060
1060
 
1061
 
BOOL english_word(BYTE *wrd)
 
1061
Bool english_word(uchar *wrd)
1062
1062
{
1063
 
INT i,ii,iv;
1064
 
BYTE w[MAX_LEN_WORD];
 
1063
int16_t i,ii,iv;
 
1064
uchar w[MAX_LEN_WORD];
1065
1065
 
1066
1066
for(ii=i=0;wrd[i]!='\0'&&i<MAX_LEN_WORD-1;i++)
1067
1067
  if( !memchr(punct_letters,wrd[i],sizeof(punct_letters)) )
1078
1078
return FALSE;
1079
1079
}
1080
1080
 
1081
 
BOOL english_word_all(BYTE *wrd,BYTE language)
 
1081
Bool english_word_all(uchar *wrd,uchar language)
1082
1082
{
1083
 
INT i,ii,iv;
1084
 
BYTE w[MAX_LEN_WORD];
 
1083
int16_t i,ii,iv;
 
1084
uchar w[MAX_LEN_WORD];
1085
1085
if( language!=LANG_ENGLISH )
1086
1086
    return FALSE;
1087
1087
for(ii=i=0;wrd[i]!='\0'&&i<MAX_LEN_WORD-1;i++)
1099
1099
return FALSE;
1100
1100
}
1101
1101
 
1102
 
static BYTE rus_two_lang_letters[]="�������������㨮���1234567890,���!._<>;";
1103
 
static BYTE eng_two_lang_letters[]="ETYOPAHKXCBMeyuopaxcn1234567890,���!._<>;";
1104
 
static BYTE rus_two_lang_letters1[]="�������������㨮���";
1105
 
static BYTE eng_two_lang_letters1[]="ETYOPAHKXCBMeyuopaxcn";
1106
 
 
1107
 
static BOOL mixed_eng_rus_word(cell *b, cell *e);
1108
 
static BOOL mixed_rus_eng_word(cell *b, cell *e);
1109
 
static BOOL eng_word_to_rus_word(cell *b, cell *e);
1110
 
static BOOL rus_word_to_eng_word(cell *b, cell *e);
1111
 
static BOOL russian_letter(cell *b,cell *e);
1112
 
static BOOL english_letter(cell *b,cell *e);
1113
 
 
1114
 
BOOL mixed_eng_rus_word(cell *b, cell *e)
 
1102
static uchar rus_two_lang_letters[]="�������������㨮���1234567890,���!._<>;";
 
1103
static uchar eng_two_lang_letters[]="ETYOPAHKXCBMeyuopaxcn1234567890,���!._<>;";
 
1104
static uchar rus_two_lang_letters1[]="�������������㨮���";
 
1105
static uchar eng_two_lang_letters1[]="ETYOPAHKXCBMeyuopaxcn";
 
1106
 
 
1107
static Bool mixed_eng_rus_word(cell *b, cell *e);
 
1108
static Bool mixed_rus_eng_word(cell *b, cell *e);
 
1109
static Bool eng_word_to_rus_word(cell *b, cell *e);
 
1110
static Bool rus_word_to_eng_word(cell *b, cell *e);
 
1111
static Bool russian_letter(cell *b,cell *e);
 
1112
static Bool english_letter(cell *b,cell *e);
 
1113
 
 
1114
Bool mixed_eng_rus_word(cell *b, cell *e)
1115
1115
{
1116
1116
  cell *c;
1117
 
  BYTE *p;
1118
 
  INT n,u,d;
1119
 
  BYTE wrd[MAX_LEN_WORD];
 
1117
  uchar *p;
 
1118
  int16_t n,u,d;
 
1119
  uchar wrd[MAX_LEN_WORD];
1120
1120
 
1121
1121
  for(c=b;c!=e;c=c->next)
1122
1122
    if( c->language!=LANG_RUSSIAN )
1141
1141
return ( u!=n && d!=n && !english_word(wrd) );
1142
1142
}
1143
1143
 
1144
 
BOOL mixed_rus_eng_word(cell *b, cell *e)
 
1144
Bool mixed_rus_eng_word(cell *b, cell *e)
1145
1145
{
1146
1146
  cell *c;
1147
 
  BYTE *p;
1148
 
  INT n,u,d;
1149
 
  BYTE wrd[MAX_LEN_WORD];
 
1147
  uchar *p;
 
1148
  int16_t n,u,d;
 
1149
  uchar wrd[MAX_LEN_WORD];
1150
1150
 
1151
1151
  for(c=b;c!=e;c=c->next)
1152
1152
    if( c->language!=LANG_ENGLISH )
1172
1172
}
1173
1173
 
1174
1174
 
1175
 
BOOL eng_word_to_rus_word(cell *b, cell *e)
 
1175
Bool eng_word_to_rus_word(cell *b, cell *e)
1176
1176
{
1177
1177
  cell *c;
1178
 
  BYTE *p,ch,pp;
1179
 
//  BYTE rot=0;
 
1178
  uchar *p,ch,pp;
 
1179
//  uchar rot=0;
1180
1180
  for(c=b;c!=e;c=c->next)
1181
1181
    if( c->nvers>0 )
1182
1182
      {
1196
1196
return TRUE;
1197
1197
}
1198
1198
 
1199
 
BOOL rus_word_to_eng_word(cell *b, cell *e)
 
1199
Bool rus_word_to_eng_word(cell *b, cell *e)
1200
1200
{
1201
1201
  cell *c;
1202
 
  BYTE *p,ch,pp;
1203
 
//  BYTE rot=0;
 
1202
  uchar *p,ch,pp;
 
1203
//  uchar rot=0;
1204
1204
  for(c=b;c!=e;c=c->next)
1205
1205
    if( c->nvers>0 )
1206
1206
      {
1220
1220
return TRUE;
1221
1221
}
1222
1222
 
1223
 
BOOL russian_letter(cell *b,cell *e)
 
1223
Bool russian_letter(cell *b,cell *e)
1224
1224
{
1225
1225
cell *c;
1226
1226
for(c=b;c!=e;c=c->next)
1234
1234
return FALSE;
1235
1235
}
1236
1236
 
1237
 
BOOL russian_letter_context(cell *b,cell *e)
 
1237
Bool russian_letter_context(cell *b,cell *e)
1238
1238
{
1239
1239
cell *c;
1240
1240
for(c=b;c!=e;c=c->next)
1245
1245
return FALSE;
1246
1246
}
1247
1247
 
1248
 
BOOL english_letter(cell *b,cell *e)
 
1248
Bool english_letter(cell *b,cell *e)
1249
1249
{
1250
1250
cell *c;
1251
1251
for(c=b;c!=e;c=c->next)
1257
1257
return TRUE;
1258
1258
}
1259
1259
 
1260
 
BOOL    special_eng_to_rus(cell *b,cell *e)
 
1260
Bool    special_eng_to_rus(cell *b,cell *e)
1261
1261
{
1262
 
BOOL ret=FALSE;
 
1262
Bool ret=FALSE;
1263
1263
 
1264
1264
if( b->flg&c_f_fict )
1265
1265
    return ret;
1284
1284
void   russian_english_context(void)
1285
1285
{
1286
1286
cell *c, *e, *c1, *e1;
1287
 
BYTE buf[MAX_LEN_WORD+40],word_len,word_len1;
1288
 
BYTE wrd1[MAX_LEN_WORD+40];
1289
 
INT  prev_wrd, next_wrd, curr_wrd;
 
1287
uchar buf[MAX_LEN_WORD+40],word_len,word_len1;
 
1288
uchar wrd1[MAX_LEN_WORD+40];
 
1289
int16_t  prev_wrd, next_wrd, curr_wrd;
1290
1290
 
1291
1291
 
1292
1292
if( db_status && snap_activity('c') )
1407
1407
return;
1408
1408
}
1409
1409
 
1410
 
BOOL exist_symbol(cell *b,cell *e,BYTE ch)
 
1410
Bool exist_symbol(cell *b,cell *e,uchar ch)
1411
1411
{
1412
1412
cell *c;
1413
1413
for(c=b;c!=e;c=c->next)
1417
1417
}
1418
1418
 
1419
1419
 
1420
 
//static BYTE left_limit_word[] =" .";
1421
 
//static BYTE right_limit_word[]=" -.���.";
1422
 
static BYTE left_limit_word[] =" \x1f";
1423
 
static BYTE right_limit_word[]=" -\x1f\x2e"; // 31.05.2001 E.P.
 
1420
//static uchar left_limit_word[] =" .";
 
1421
//static uchar right_limit_word[]=" -.���.";
 
1422
static uchar left_limit_word[] =" \x1f";
 
1423
static uchar right_limit_word[]=" -\x1f\x2e"; // 31.05.2001 E.P.
1424
1424
 
1425
1425
cell * next_word(cell *cs)
1426
1426
{
1436
1436
}
1437
1437
 
1438
1438
 
1439
 
cell * end_word(cell *cs,BYTE *str,BYTE *word_len,BYTE *add_letters)
 
1439
cell * end_word(cell *cs,uchar *str,uchar *word_len,uchar *add_letters)
1440
1440
{
1441
1441
cell *c=cs;
1442
 
INT i=0;
1443
 
INT let;
 
1442
int16_t i=0;
 
1443
int16_t let;
1444
1444
 
1445
1445
do{
1446
1446
  *str++  = c->vers[0].let;
1459
1459
          !strchr(add_letters,c->vers[0].let)) &&
1460
1460
          !(c->flg&c_f_fict) && i<MAX_LEN_WORD-1);
1461
1461
*str='\0';
1462
 
*word_len = (BYTE)i;
 
1462
*word_len = (uchar)i;
1463
1463
return c;
1464
1464
}
1465
1465
 
1466
 
BOOL left_over(cell *b,INT limit)
 
1466
Bool left_over(cell *b,int16_t limit)
1467
1467
{
1468
1468
cell *c,*e=cell_l()->prev;
1469
1469
for(c=b;c!=e;c=c->next )
1474
1474
return c->r_col<=limit;
1475
1475
}
1476
1476
 
1477
 
INT  get_left_coord(cell *b)
 
1477
int16_t  get_left_coord(cell *b)
1478
1478
{
1479
1479
cell *c=b;
1480
1480
while( !(c->flg&(c_f_let|c_f_bad|c_f_fict|c_f_dust|c_f_punct)) )c=c->next;
1481
1481
return c->r_col;
1482
1482
}
1483
1483
 
1484
 
INT  get_right_coord(cell *b)
 
1484
int16_t  get_right_coord(cell *b)
1485
1485
{
1486
1486
cell *c=b->prev;
1487
1487
while( !(c->flg&(c_f_let|c_f_bad|c_f_fict|c_f_dust|c_f_punct)) )c=c->prev;