~ubuntu-branches/ubuntu/trusty/cuneiform/trusty

« back to all changes in this revision

Viewing changes to cuneiform_src/Kern/rstr/src/cg_tools.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:
59
59
#include <string.h>
60
60
 
61
61
 
62
 
#ifndef __MAC__
63
 
//#include <bios.h>
64
 
#endif
65
 
#include "nt_types.h"
66
62
#include "struct.h"
67
63
#include "func.h"
68
64
#include "lang.h"
73
69
 
74
70
#include "compat_defs.h"
75
71
 
76
 
extern BOOL pass4_in;   //䫠�: ��ன ��室 �� ��࠭��
 
72
extern Bool pass4_in;   //䫠�: ��ன ��室 �� ��࠭��
77
73
 
78
74
 
79
75
/*-----------------03-14-95 02:23pm----------------------------------
81
77
                �����頥� 㪠��⥫� �� ����
82
78
  NB! �� ������� ��������� ����� ���������� ����!
83
79
-------------------------------------------------------------------*/
84
 
cell *comp_to_cell(cell *C, c_comp **list, INT N, CHAR bdiff, BYTE dflag)
 
80
cell *comp_to_cell(cell *C, c_comp **list, int16_t N, char bdiff, uchar dflag)
85
81
{
86
 
  INT i,top,bot,left,right;
 
82
  int16_t i,top,bot,left,right;
87
83
  cell *B;                       //⥪�騩 cell
88
84
 
89
85
  if ( N==0 ) return NULL;
105
101
  B->h=bot-top;
106
102
  B->r_col=left;
107
103
  B->w=right-left;
108
 
  B->row=B->r_row-(INT)((LONG)nIncline*B->r_col/2048);
109
 
  B->col=B->r_col+(INT)((LONG)nIncline*B->r_row/2048);
 
104
  B->row=B->r_row-(int16_t)((int32_t)nIncline*B->r_col/2048);
 
105
  B->col=B->r_col+(int16_t)((int32_t)nIncline*B->r_row/2048);
110
106
  B->env=compose_comp(i,list);
111
107
  if ( N>1 ) B->cg_flag=c_cg_comp;
112
108
  if ( if_dust(B) & 0x0c )  set_dust(B);
121
117
  col_to_one ��ந� ᮢ��㯭� cell �� n cell'�� ᯨ᪠ list;
122
118
             �����頥� 㪠��⥫� �� ����
123
119
-------------------------------------------------------------------*/
124
 
cell *col_to_one(cell **clist, INT n)
 
120
cell *col_to_one(cell **clist, int16_t n)
125
121
 {
126
 
 INT i,top,bot,left,right;
 
122
 int16_t i,top,bot,left,right;
127
123
 cell *c;
128
124
 c_comp *elist[MAX_SECT];
129
125
 
147
143
 c->h=bot-top;
148
144
 c->r_col=left;
149
145
 c->w=right-left;
150
 
 c->row=c->r_row-(INT)((LONG)nIncline*c->r_col/2048);
151
 
 c->col=c->r_col+(INT)((LONG)nIncline*c->r_row/2048);
 
146
 c->row=c->r_row-(int16_t)((int32_t)nIncline*c->r_col/2048);
 
147
 c->col=c->r_col+(int16_t)((int32_t)nIncline*c->r_row/2048);
152
148
  if ( if_dust(c) & 0x0c )  set_dust(c);
153
149
  else                      set_bad(c);
154
150
  set_bad_cell(c);
172
168
static cell *overlap_cell( cell *C, cell *D )
173
169
{
174
170
  cell *list[2],*P;
175
 
  BYTE *r;
 
171
  uchar *r;
176
172
  MN *mn1;
177
173
 
178
174
  if (C->r_col+C->w < D->r_col)  return NULL;
179
175
  list[0]=C; list[1]=D;
180
176
  if (!(P=col_to_one(list,2)))   return NULL;
181
 
  r=(BYTE*)save_raster(P);
182
 
  mn1=c_locomp(r,(INT)((P->w+7)>>3),P->h,P->r_row,P->r_col);
 
177
  r=(uchar*)save_raster(P);
 
178
  mn1=c_locomp(r,(int16_t)((P->w+7)>>3),P->h,P->r_row,P->r_col);
183
179
  del_cell(P);
184
180
  if (mn1)
185
181
    if (!mn1->mnnext)            //᪫������
191
187
  return NULL;
192
188
}
193
189
 
194
 
BOOL glue_overlap(cell *LC, cell *E)
 
190
Bool glue_overlap(cell *LC, cell *E)
195
191
//᪫������ �������騥�� ��� �� ��㣠 cell'�
196
192
{
197
193
  cell *B=LC->next,*C;
226
222
              ������� vers_list; �����頥� 㪠��⥫� �� ���ᨨ, �᫨
227
223
              �������, � NULL, �᫨ ���
228
224
---------------------------------------------------------------------*/
229
 
seg_vers *find_vers( INT i1, INT i0, seg_vers **vers_list )
 
225
seg_vers *find_vers( int16_t i1, int16_t i0, seg_vers **vers_list )
230
226
{
231
227
  seg_vers *cur_vers;
232
228
 
244
240
               㪠��⥫� �� ���������� ���ᨨ
245
241
---------------------------------------------------------------------*/
246
242
seg_vers *store_vers(seg_vers *cur_vers, seg_vers **vers_list,
247
 
         INT i1, INT i0, SVERS *vers, INT ro, INT width, CHAR gvar)
 
243
         int16_t i1, int16_t i0, SVERS *vers, int16_t ro, int16_t width, char gvar)
248
244
{
249
245
  if (!cur_vers && (*vers_list))           //-R��c //AK! crash //����
250
246
  {
260
256
  }
261
257
  if (cur_vers)              //��࠭塞
262
258
  {
263
 
    cur_vers->px=(CHAR)i1;
 
259
    cur_vers->px=(char)i1;
264
260
    cur_vers->ro=ro;
265
261
    cur_vers->width=width;
266
262
    cur_vers->gvar=gvar;
273
269
  not_connect_sect  �஢���� ���吝���� ᥪ樨 ����� i1-� � i0-�
274
270
                    �祭�ﬨ; �����頥� ����� �祭��-ࠧ����
275
271
---------------------------------------------------------------------*/
276
 
BYTE not_connect_sect(INT i1, INT i0, struct cut_elm *cut_list)
 
272
uchar not_connect_sect(int16_t i1, int16_t i0, struct cut_elm *cut_list)
277
273
{
278
274
  struct cut_elm *cur=&cut_list[i0],*last=&cut_list[i1];
279
275
 
287
283
          ie, �����頥� ����� ᫥���饩 ���設�, ���� - 0;
288
284
          cut_list - ᯨ᮪ �祭��
289
285
--------------------------------------------------------------*/
290
 
INT on_path(INT i, INT ie, struct cut_elm *cut_list)
 
286
int16_t on_path(int16_t i, int16_t ie, struct cut_elm *cut_list)
291
287
{
292
 
  INT next=0;
 
288
  int16_t next=0;
293
289
  while (ie>i)
294
290
  {
295
291
    next=ie;
301
297
/*------------------------------------------------------------------------
302
298
  quote - �஢����, B � B->prevl �� ">>"
303
299
------------------------------------------------------------------------*/
304
 
static CHAR quote(cell *B)
 
300
static char quote(cell *B)
305
301
{
306
302
  cell *P;
307
303
 
308
304
  if ( !dust(B) && B->nvers && !fict(P=B->prevl) && P->nvers )
309
305
  {
310
 
    BYTE let1=B->vers[0].let,let2=P->vers[0].let;
 
306
    uchar let1=B->vers[0].let,let2=P->vers[0].let;
311
307
    if ( ( let1=='>' && let2=='>' || let1=='<' && let2=='<' )
312
308
          && P->col+P->w > B->col )
313
309
    {
314
 
      BYTE p1=B->vers[0].prob,p2=P->vers[0].prob;
 
310
      uchar p1=B->vers[0].prob,p2=P->vers[0].prob;
315
311
      if ( MAX(p1,p2) >= MINlet )
316
312
      {
317
313
        glsnap('a',B,"quotation");  return 1;
323
319
 
324
320
/*--------------------------------------------------------------
325
321
--------------------------------------------------------------*/
326
 
static INT up_dust_mon(cell *B1)
 
322
static int16_t up_dust_mon(cell *B1)
327
323
 {
328
 
 INT h, w, row, dust_monus;
 
324
 int16_t h, w, row, dust_monus;
329
325
 long cellsz, dustsz;
330
326
 cell * wc;
331
327
 
359
355
 cellsz = (h=B1->h) * (w=B1->w);
360
356
 dustsz = wc->h * wc->w;
361
357
 if (w < h)       // doubtful as multi_letter cell
362
 
   dust_monus = (INT)(dustsz * MONdust * 32 / cellsz);
 
358
   dust_monus = (int16_t)(dustsz * MONdust * 32 / cellsz);
363
359
 else
364
 
   dust_monus = (INT)(dustsz * MONdust * 256 / cellsz);
 
360
   dust_monus = (int16_t)(dustsz * MONdust * 256 / cellsz);
365
361
 if (dust_monus > MONdust) dust_monus = MONdust;
366
362
 return dust_monus & 0xfe;
367
363
 }
371
367
-----------------------------------------------------------------*/
372
368
static void mark_own_dust(cell *B)
373
369
{
374
 
  INT rc=B->r_col+B->w;
 
370
  int16_t rc=B->r_col+B->w;
375
371
  cell *C=B->prev;
376
372
 
377
373
  while (dust(C))
389
385
 
390
386
/*--------------------------------------------------------------
391
387
--------------------------------------------------------------*/
392
 
static INT discr_vers(cell *B1, INT mon, CHAR all_vers)
 
388
static int16_t discr_vers(cell *B1, int16_t mon, char all_vers)
393
389
 {
394
 
 version *v;  BYTE c,chg=0;
 
390
 version *v;  uchar c,chg=0;
395
391
 if (B1->nvers==0) return 0;
396
392
 for (v=B1->vers; ((c=v->let) != 0) && (v->prob != 0); v++)
397
393
   if (language == LANG_RUSSIAN || accent_tab[c]==0 || all_vers)
406
402
 
407
403
/*--------------------------------------------------------------
408
404
--------------------------------------------------------------*/
409
 
void adjust_3x5(BOOL prerecog)
 
405
void adjust_3x5(Bool prerecog)
410
406
{
411
407
 cell *B=cell_f()->nextl;
412
408
 while ( !fict(B) )
414
410
   if (!pass4_in)  glsnap('a',B,"");
415
411
   if ( B->w <= 3*B->h )
416
412
   {
417
 
     INT dust_monus;
 
413
     int16_t dust_monus;
418
414
 
419
415
     if (pass4_in)
420
416
     {
421
 
       BYTE let;
 
417
       uchar let;
422
418
       B->pr_vers=B->vers[0];
423
419
       if (prerecog)  set_bad_cell(B);
424
420
       if (may_glue(B))
425
421
       {
426
 
         if (prerecog)  full_recog(B,NULL,(INT)(-((INT)trs2)),trs2);
 
422
         if (prerecog)  full_recog(B,NULL,(int16_t)(-((int16_t)trs2)),trs2);
427
423
         if ( let(B) &&
428
424
              ((let=B->vers[0].let)=='m' || let=='n' || let==liga_rt) )
429
425
           if ( dust_monus=up_dust_mon(B) )
445
441
       }
446
442
       if ( let(B) && B->vers[0].prob<trs2 )  //��������� - ��� ���娥
447
443
         set_bad(B);
448
 
       full_recog(B,NULL,(INT)(-((INT)trs2)),trs2);
 
444
       full_recog(B,NULL,(int16_t)(-((int16_t)trs2)),trs2);
449
445
       if ( let(B) && language != LANG_RUSSIAN ||
450
446
            B->nvers && memchr("�����",B->vers[0].let,5) &&
451
447
                    !is_russian_baltic_conflict(B->vers[0].let) // 17.07.2001 E.P.
468
464
       }
469
465
     }
470
466
     if (let(B))
471
 
     { CHAR c = B->vers[0].let;
 
467
     { char c = B->vers[0].let;
472
468
       cell *DOT = NULL;
473
469
       c = B->vers[0].let;
474
470
       if ((c == 'i') || (c == 'j'))
487
483
/*-----------------02-28-95 03:51pm----------------------------------
488
484
  cg_show_rast  �뢮��� �� ��࠭ ����ࠦ���� ���� r � ᮮ�饭�� msg
489
485
--------------------------------------------------------------------*/
490
 
void cg_show_rast(cell *C, raster *r, CHAR *msg, struct cut_elm *cut_list)
 
486
void cg_show_rast(cell *C, raster *r, char *msg, struct cut_elm *cut_list)
491
487
{
492
 
  INT   i,n;
 
488
  int16_t   i,n;
493
489
  MN *mn1;
494
490
  cell *B,*CI[MAX_SECT];
495
491
  void *KIT;
498
494
 
499
495
  KIT=give_kit_addr();     //�����誠 �⥪�
500
496
 
501
 
  if (!(mn1=c_locomp(r->pict,(INT)((r->w+7)>>3),r->h,r->top,r->left)))
 
497
  if (!(mn1=c_locomp(r->pict,(int16_t)((r->w+7)>>3),r->h,r->top,r->left)))
502
498
  {
503
499
    glsnap('a',C,"locomp error"); return;
504
500
  }
526
522
/*-----------------06-27-95 01:28pm------------------------------
527
523
  cg_show_list  �뢮��� �� ��࠭ ����ࠦ���� ᯨ᪠  N cell'�� cells
528
524
---------------------------------------------------------------*/
529
 
void cg_show_list(cell **cells, INT N, BYTE *msg)
 
525
void cg_show_list(cell **cells, int16_t N, uchar *msg)
530
526
{
531
 
  INT i;
 
527
  int16_t i;
532
528
  cell *B;
533
529
  c_comp *complist[MAX_SECT];
534
530
  void *KIT;
550
546
/*------------------------------------------------------------------
551
547
  show_dp  �뢮��� �� ��࠭ ���ﭨ� ��� ��
552
548
------------------------------------------------------------------*/
553
 
CHAR *show_dp( PBYTE s, struct cut_elm *cut_list, INT i0)
 
549
char *show_dp( puchar s, struct cut_elm *cut_list, int16_t i0)
554
550
{
555
551
  SVERS  *vers;
556
 
  CHAR c;
557
 
  INT x,i,i1 = (i0>15) ? i0-14 : 1;  //�� ��࠭ - ��᫥���� 15 ���設
 
552
  char c;
 
553
  int16_t x,i,i1 = (i0>15) ? i0-14 : 1;  //�� ��࠭ - ��᫥���� 15 ���設
558
554
 
559
555
  *s++='\n';
560
556
  for (i=i1; i<=i0; i++)  s += sprintf(s,"%5d",i);
588
584
  return s;
589
585
}
590
586
 
591
 
void det_snap(cell *C, CHAR *txt)
 
587
void det_snap(cell *C, char *txt)
592
588
{
593
589
  if (db_status)
594
590
#ifndef MY_DEBUG
603
599
  snap=snap_text; *snap=0;  //�᢮�������� ����
604
600
}
605
601
 
606
 
void show_and_wait(CHAR *txt)
 
602
void show_and_wait(char *txt)
607
603
{
608
604
  snap_show_text(txt);
609
605
#ifdef MY_DEBUG