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

« back to all changes in this revision

Viewing changes to cuneiform_src/Kern/exc/src/compkit.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:
63
63
extern c_comp wcomp;
64
64
extern MN * main_number_ptr;
65
65
extern BOX * boxchain, *dl_last_in_chain;
66
 
extern Word8 lpool[];
67
 
extern Word16 lpool_lth;
68
 
extern Word8 work_raster[];
 
66
extern uchar lpool[];
 
67
extern uint16_t lpool_lth;
 
68
extern uchar work_raster[];
69
69
extern version * start_rec, * rec_ptr;
70
 
extern Word8 records_change;
71
 
extern Word16 comp_max_h, comp_max_w, comp_min_h, comp_min_w; // defined in extrcomp.c
 
70
extern uchar records_change;
 
71
extern uint16_t comp_max_h, comp_max_w, comp_min_h, comp_min_w; // defined in extrcomp.c
72
72
 
73
73
static void boxes_to_line();
74
74
 
87
87
{
88
88
 MN *mn;
89
89
 BOX *bp;
90
 
 Int16 left, right, n;
 
90
 int16_t left, right, n;
91
91
 memset (&wcomp,0,sizeof(wcomp));
92
92
 mn = main_number_ptr; bp = mn->mnfirstbox;
93
93
 left = bp->boxleft; right = bp->boxright; boxchain = bp;
135
135
 LNSTRT *lsp;
136
136
 interval * ip;
137
137
 BOXINT * bip;
138
 
 Int16 x, n;
 
138
 int16_t x, n;
139
139
 
140
140
 bp = boxchain; lnp = (lnhead *)lpool; goto enter_loop;
141
141
next_line:
143
143
enter_loop:
144
144
 lsp = (LNSTRT *)(bp+1); lnp->row = lsp->y - wcomp.upper;
145
145
 lnp->flg = bp->boxflag; ip = (interval *) (lnp+1);
146
 
 ip->l = (Word8)lsp->l; x = lsp->x - wcomp.left; (ip++)->e = (Word8)x;
 
146
 ip->l = (uchar)lsp->l; x = lsp->x - wcomp.left; (ip++)->e = (uchar)x;
147
147
 bip = (BOXINT *)(lsp+1);
148
148
 n = (bp->boxptr - sizeof(BOX) - sizeof(LNSTRT))/sizeof(BOXINT);
149
149
cont_box:
150
 
 while (n--) { ip->l = (Word8)bip->l; x += (bip++)->d, (ip++)->e = (Word8)x; }
 
150
 while (n--) { ip->l = (uchar)bip->l; x += (bip++)->d, (ip++)->e = (uchar)x; }
151
151
 if ((bp->boxflag & BOXEND) == 0)
152
152
  {
153
153
   bp = bp->boxnext; bip = (BOXINT *)(bp+1);
155
155
  }
156
156
  ip->e = 0; // Vald for compability with asm prototype
157
157
 (ip++)->l = 0;
158
 
 lnp->lth = (Word8*)ip - (Word8*)lnp;
 
158
 lnp->lth = (uchar*)ip - (uchar*)lnp;
159
159
 lnp->h = (lnp->lth - sizeof(*lnp) - sizeof(*ip))/sizeof(*ip);
160
160
 lnp->flg |= bp->boxflag; lnp = (lnhead *)ip;
161
161
 if (bp != dl_last_in_chain) goto next_line;
162
162
 lnp->lth = 0;
163
 
 lpool_lth = (Word8*)lnp - lpool + sizeof (lnp->lth);
 
163
 lpool_lth = (uchar*)lnp - lpool + sizeof (lnp->lth);
164
164
}
165
165
 
166
166
 
167
 
static Word8 make_fill[] = {0, 1, 3, 7, 15, 31, 63, 127, 255};
168
 
void WriteInterval ( Word8 *p, int end , int len)
 
167
static uchar make_fill[] = {0, 1, 3, 7, 15, 31, 63, 127, 255};
 
168
void WriteInterval ( uchar *p, int end , int len)
169
169
{
170
 
Int16     sh;
171
 
Word16    w;
 
170
int16_t     sh;
 
171
uint16_t    w;
172
172
p = p + (end>>3);
173
173
sh = end & 7;
174
174
while (len > 8)   { w = 0xff00 >> sh;*p |= w & 0xff; *(--p) |= w>>8; len-=8; }
176
176
return;
177
177
}
178
178
 
179
 
Word8* make_raster()
 
179
uchar* make_raster()
180
180
{
181
181
 lnhead * lp;
182
182
 interval *ip;
183
 
 Word8 *p, *pp;
184
 
 Int16 x, l, sh;
185
 
 Word16 w;
 
183
 uchar *p, *pp;
 
184
 int16_t x, l, sh;
 
185
 uint16_t w;
186
186
 
187
187
 memset (work_raster,0,wcomp.rw*wcomp.h);
188
188
 lp = (lnhead *)lpool;
202
202
}
203
203
 
204
204
 
205
 
Word8* make_extended_raster(c_comp *cp)
 
205
uchar* make_extended_raster(c_comp *cp)
206
206
{
207
207
 lnhead * lp;
208
208
 large_interval *ip;
209
 
 Word8 *p, *pp;
210
 
 Int16 x, l, sh;
211
 
 Word16 wd,w;
 
209
 uchar *p, *pp;
 
210
 int16_t x, l, sh;
 
211
 uint16_t wd,w;
212
212
 
213
213
 memset (work_raster,0,cp->rw * cp->h); wd = cp->rw;
214
 
 lp = (lnhead *)((Word8*)cp + cp->lines + sizeof(Word32));
 
214
 lp = (lnhead *)((uchar*)cp + cp->lines + sizeof(uint32_t));
215
215
 while (lp->lth)
216
216
  {
217
217
   pp = work_raster + lp->row * wd; ip = (large_interval *) (lp+1);
222
222
     w = make_fill[l]; w = w << (8-sh); *p |= w & 0xff; *(p-1) |= w >> 8;
223
223
     pp += wd;
224
224
    }
225
 
   lp = (lnhead *)((Word8*)ip - sizeof(Word16));
 
225
   lp = (lnhead *)((uchar*)ip - sizeof(uint16_t));
226
226
  }
227
227
 return work_raster;
228
228
}
235
235
 return (lnhead *)lpool;
236
236
}
237
237
 
238
 
Int16 MN_to_line(MN * mn)
 
238
int16_t MN_to_line(MN * mn)
239
239
{
240
240
 if( !mn )
241
241
    return 0;
246
246
 return 0;
247
247
}
248
248
 
249
 
void save_component(c_comp *,version *,version *,Word8*,Word16);
 
249
void save_component(c_comp *,version *,version *,uchar*,uint16_t);
250
250
void save_wcomp()
251
251
{
252
252
 save_component(&wcomp,start_rec,rec_ptr,lpool,lpool_lth);
253
253
}
254
254
 
255
 
Word16 length_table[] = {0x100, 0x300, 0x700,0xf00,0x1f00,0x3f00,0x7f00,0xff00};
 
255
uint16_t length_table[] = {0x100, 0x300, 0x700,0xf00,0x1f00,0x3f00,0x7f00,0xff00};
256
256
 
257
 
void save_dust_comp (dust_comp * dp, c_comp *cp, Word8 *lp)
 
257
void save_dust_comp (dust_comp * dp, c_comp *cp, uchar *lp)
258
258
{
259
259
 interval * ip;
260
 
 Word8 *p;
 
260
 uchar *p;
261
261
 dp->size = 1; dp->upper = cp->upper; dp->left = cp->left;
262
 
 dp->h = (Word8)cp->h; dp->w = (Word8)cp->w;
 
262
 dp->h = (uchar)cp->h; dp->w = (uchar)cp->w;
263
263
 memset ((p=dp->raster),0,sizeof(dp->raster));
264
264
 ip =(interval *)(lp + sizeof(lnhead));
265
265
 while (ip->l) { *p++ = (length_table [ip->l - 1]) >> (ip->e); ip++; }
266
266
}
267
267
 
268
 
Word8 byte_seg_size[256] = {
 
268
uchar byte_seg_size[256] = {
269
269
// 0   1    2    3    4    5    6    7    8    9    a    b    c    d    e    f
270
270
0x00,0x18,0x17,0x28,0x16,0x00,0x27,0x38,0x15,0x00,0x00,0x00,0x26,0x00,0x37,0x48,        // 0
271
271
0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x25,0x00,0x00,0x00,0x36,0x00,0x47,0x58,        // 1
285
285
0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x55,0x00,0x00,0x00,0x66,0x00,0x77,0x88         // f
286
286
};
287
287
 
288
 
Int16 read_dust_comp (dust_comp *cp, Word8 *p)
 
288
int16_t read_dust_comp (dust_comp *cp, uchar *p)
289
289
{
290
290
 lnhead * lp;
291
291
 interval * ip;
292
 
 Int16 n, lth;
293
 
 Word8 *pp;
294
 
 Word8 b;
 
292
 int16_t n, lth;
 
293
 uchar *pp;
 
294
 uchar b;
295
295
 lp = (lnhead *)p;
296
296
 lp->row = 0; lp->flg = l_fbeg+l_fend;
297
297
 n = lp->h = cp->h; lp->lth = lth = sizeof(lnhead) + (n+1) * sizeof(interval);
303
303
 return lth + sizeof(lp->lth);
304
304
}
305
305
 
306
 
Word16 sort_events_vers()
 
306
uint16_t sort_events_vers()
307
307
{
308
308
 version * v, *a;
309
 
 Word16 n;
310
 
 Word8 let, prob;
 
309
 uint16_t n;
 
310
 uchar let, prob;
311
311
 
312
312
 if (records_change == 0) goto ret;
313
313
 for (n=1, v = start_rec + 1; n < wcomp.nvers; n++, v++)