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

« back to all changes in this revision

Viewing changes to cuneiform_src/Kern/rselstr/sources/src/win_c/_adaptive.cpp

  • 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:
1
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
 
*/
 
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
56
 
57
57
#include <stdlib.h>
58
58
#include <stdio.h>
74
74
 
75
75
#include "new_c.h" /* FIXME: to compile in MS VC++, Handle exthCCOM */
76
76
 
77
 
extern INT nIncline;
 
77
extern int16_t nIncline;
78
78
 
79
79
PROOT root_file = NULL;
80
 
WORD run_options = 0;
81
 
 
82
 
 
83
 
DWORD progress_set_percent (DWORD volume)
84
 
{
85
 
        DWORD rc = 0;
86
 
        if(fnProgressStep_rsel)
87
 
                rc  = !fnProgressStep_rsel(volume);
 
80
uint16_t run_options = 0;
 
81
 
 
82
uint32_t progress_set_percent(uint32_t volume) {
 
83
        uint32_t rc = 0;
 
84
        if (fnProgressStep_rsel)
 
85
                rc = !fnProgressStep_rsel(volume);
88
86
        return rc;
89
87
}
90
88
 
91
 
void progress_finish(void)
92
 
{
93
 
        if(fnProgressFinish_rsel)
 
89
void progress_finish(void) {
 
90
        if (fnProgressFinish_rsel)
94
91
                fnProgressFinish_rsel();
95
92
}
96
93
 
98
95
#undef realloc
99
96
#undef free
100
97
 
101
 
void * DebugMalloc(size_t size)
102
 
{
103
 
        char * buf = (char*)malloc(size);
104
 
        return buf;
105
 
}
106
 
 
107
 
void * DebugRealloc(void * old_blk,size_t size)
108
 
{
109
 
        char *buf = (char*)realloc(old_blk,size);
110
 
        return buf;
111
 
}
112
 
 
113
 
void   DebugFree(void * p)
114
 
{
 
98
void * DebugMalloc(size_t size) {
 
99
        char * buf = (char*) malloc(size);
 
100
        return buf;
 
101
}
 
102
 
 
103
void * DebugRealloc(void * old_blk, size_t size) {
 
104
        char *buf = (char*) realloc(old_blk, size);
 
105
        return buf;
 
106
}
 
107
 
 
108
void DebugFree(void * p) {
115
109
        free(p);
116
110
}
117
111
 
118
 
void * TigerAllocateMemory(DWORD size)
119
 
{
 
112
void * TigerAllocateMemory(uint32_t size) {
120
113
        return DebugMalloc(size);
121
114
}
122
115
 
123
 
void TigerFreeMemory(void * mem)
124
 
{
 
116
void TigerFreeMemory(void * mem) {
125
117
        DebugFree(mem);
126
118
}
127
119
 
128
 
void * TigerReallocateMemory(void * mem,DWORD size)
129
 
{
130
 
        return DebugRealloc(mem,size);
131
 
}
132
 
 
133
 
 
134
 
extern BYTE work_raster[], work_raster_1[];
135
 
extern WORD lpool_lth;
136
 
extern BYTE lpool[];
137
 
static BYTE make_fill[] = {0, 1, 3, 7, 15, 31, 63, 127, 255};
138
 
static  INT comp_max_w=128,comp_min_w=0, comp_max_h=64,comp_min_h=0;
139
 
MN * c_locomp (PBYTE raster, INT bw, INT h, INT upper, INT left)
140
 
{
141
 
return LOC_CLocomp (raster, bw, h, upper, left);
142
 
}
143
 
 
144
 
 
145
 
PBYTE make_raster_CCOM(CCOM_comp *cmp)
146
 
{
147
 
INT    h,d,dd,k,i,ii;
148
 
RecRaster  rs;
149
 
 
150
 
memset(work_raster,0,cmp->rw*cmp->h);
151
 
CCOM_GetRaster(cmp, &rs);
152
 
h  = rs.lnPixHeight;
153
 
d  = REC_GW_WORD8(rs.lnPixWidth); // align to 8 bytes in RecRaster
154
 
dd = (rs.lnPixWidth+7)/8;         // aling to 1 byte  in standart
155
 
for(k=ii=i=0;k<h;k++,i+=d,ii+=dd)
156
 
    {
157
 
    memcpy( &work_raster[ii],&rs.Raster[i],dd);
158
 
    }
159
 
 
160
 
return work_raster;
161
 
}
162
 
 
163
 
 
164
 
PBYTE make_extended_raster_CCOM(CCOM_comp *cmp)
165
 
{
166
 
INT    h,d,dd,k,i,ii;
167
 
RecRaster  rs;
168
 
 
169
 
memset(work_raster,0,cmp->rw*cmp->h);
170
 
CCOM_GetExtRaster(cmp, &rs);
171
 
h  = rs.lnPixHeight;
172
 
d  = REC_GW_WORD8(rs.lnPixWidth); // align to 8 bytes in RecRaster
173
 
dd = (rs.lnPixWidth+7)/8;         // aling to 1 byte  in standart
174
 
for(k=ii=i=0;k<h;k++,i+=d,ii+=dd)
175
 
    {
176
 
    memcpy( &work_raster[ii],&rs.Raster[i],dd);
177
 
    }
178
 
 
179
 
return work_raster;
 
120
void * TigerReallocateMemory(void * mem, uint32_t size) {
 
121
        return DebugRealloc(mem, size);
 
122
}
 
123
 
 
124
extern uchar work_raster[], work_raster_1[];
 
125
extern uint16_t lpool_lth;
 
126
extern uchar lpool[];
 
127
static uchar make_fill[] = { 0, 1, 3, 7, 15, 31, 63, 127, 255 };
 
128
static int16_t comp_max_w = 128, comp_min_w = 0, comp_max_h = 64, comp_min_h = 0;
 
129
MN * c_locomp(puchar raster, int16_t bw, int16_t h, int16_t upper, int16_t left) {
 
130
        return LOC_CLocomp(raster, bw, h, upper, left);
 
131
}
 
132
 
 
133
puchar make_raster_CCOM(CCOM_comp *cmp) {
 
134
        int16_t h, d, dd, k, i, ii;
 
135
        RecRaster rs;
 
136
 
 
137
        memset(work_raster, 0, cmp->rw * cmp->h);
 
138
        CCOM_GetRaster(cmp, &rs);
 
139
        h = rs.lnPixHeight;
 
140
        d = REC_GW_WORD8(rs.lnPixWidth); // align to 8 bytes in RecRaster
 
141
        dd = (rs.lnPixWidth + 7) / 8; // aling to 1 byte  in standart
 
142
        for (k = ii = i = 0; k < h; k++, i += d, ii += dd) {
 
143
                memcpy(&work_raster[ii], &rs.Raster[i], dd);
 
144
        }
 
145
 
 
146
        return work_raster;
 
147
}
 
148
 
 
149
puchar make_extended_raster_CCOM(CCOM_comp *cmp) {
 
150
        int16_t h, d, dd, k, i, ii;
 
151
        RecRaster rs;
 
152
 
 
153
        memset(work_raster, 0, cmp->rw * cmp->h);
 
154
        CCOM_GetExtRaster(cmp, &rs);
 
155
        h = rs.lnPixHeight;
 
156
        d = REC_GW_WORD8(rs.lnPixWidth); // align to 8 bytes in RecRaster
 
157
        dd = (rs.lnPixWidth + 7) / 8; // aling to 1 byte  in standart
 
158
        for (k = ii = i = 0; k < h; k++, i += d, ii += dd) {
 
159
                memcpy(&work_raster[ii], &rs.Raster[i], dd);
 
160
        }
 
161
 
 
162
        return work_raster;
180
163
}
181
164
 
182
165
CCOM_comp *get_CCOM_comp(PROOT r) {
183
 
        return (CCOM_comp *)r->pComp;
 
166
        return (CCOM_comp *) r->pComp;
184
167
}
185
168
 
186
 
BOOL save_MN(MN *mn)
187
 
{
188
 
CCOM_comp * p=REXC_MN2CCOM((Handle)exthCCOM,(Handle)mn);
189
 
if( !p )
190
 
    return FALSE;
191
 
 
192
 
if(!AddRoot(p, FALSE))
193
 
    return FALSE;
194
 
 
195
 
BlockAccountRoot(pCurrentBlock, &pRoots[nRoots-1]);
196
 
return TRUE;
 
169
Bool save_MN(MN *mn) {
 
170
        CCOM_comp * p = REXC_MN2CCOM((Handle) exthCCOM, (Handle) mn);
 
171
        if (!p)
 
172
                return FALSE;
 
173
 
 
174
        if (!AddRoot(p, FALSE))
 
175
                return FALSE;
 
176
 
 
177
        BlockAccountRoot(pCurrentBlock, &pRoots[nRoots - 1]);
 
178
        return TRUE;
197
179
}