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

« back to all changes in this revision

Viewing changes to cuneiform_src/Kern/rfrmt/sources/main/util.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:
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:
88
88
    case _HEAPBADNODE:  // bad node in heap
89
89
         n = 3; break;
90
90
 
91
 
    default:            // ���ᯮ������� �訡��
 
91
    default:            // ЌҐа бЇ®§­ ­­ п ®иЁЎЄ 
92
92
         n = -1;
93
93
  }
94
94
 
172
172
        heapstat("halloc_m aft");
173
173
        return p;
174
174
      #else
175
 
       return (char*) malloc((Int32)n * size);
 
175
       return (char*) malloc((int32_t)n * size);
176
176
      #endif
177
177
    #endif
178
178
  #else
254
254
}
255
255
#endif /* defined (WIN_MOD) || defined (DEBUG_MEM) */
256
256
 
257
 
//�᢮�������� � �।����. �஢�મ� �� NULL
 
257
//®бў®Ў®¦¤Ґ­ЁҐ б ЇаҐ¤ў аЁв. Їа®ўҐаЄ®© ­  NULL
258
258
void free_c(void *ptr)
259
259
{
260
260
  if(ptr)
284
284
  #ifdef DEBUG_MEM
285
285
    ERR(1,"realloc_m");
286
286
  #else
287
 
    /* ��� �ॡ�� �⠭���� realloc'� */
 
287
    /* ’ Є вॡгҐв бв ­¤ ав realloc'  */
288
288
    return malloc(size_new);
289
289
  #endif
290
290
 
316
316
//  return ptr_new;
317
317
//}
318
318
 
319
 
//== ��������� �� ������� ==
 
319
//== ‘ЋЋЃ™…Ќ€џ ЋЃ Ћ�€ЃЉЂ• ==
320
320
void ERR(int num, const char  *str)
321
321
{ char str1[60];
322
322
  WAR(num,str);
323
323
  #ifdef WIN_MOD
324
324
    wsprintf(str1,"\nERR=%d %s",num,str);
325
 
    //MessageBox((HWND) 0,str1,(LPSTR) "ERROR",MB_ICONHAND|MB_OK);
 
325
    //MessageBox((HWND) 0,str1,(char*) "ERROR",MB_ICONHAND|MB_OK);
326
326
    #ifndef DLL_MOD
327
327
      FatalExit(num);
328
328
    #endif
335
335
  WAR(num,str);
336
336
  #ifdef WIN_MOD
337
337
    wsprintf(str1,"\nERR=%d %s",num,str);
338
 
    MessageBox((HWND) 0,str1,(LPSTR) "ERROR",MB_ICONHAND|MB_OK);
 
338
    MessageBox((HWND) 0,str1,(char*) "ERROR",MB_ICONHAND|MB_OK);
339
339
    #ifndef DLL_MOD
340
340
      FatalExit(num);
341
341
    #endif
362
362
  #else
363
363
    char str1[160];
364
364
    wsprintf(str1,"\n%s %d",str,num);
365
 
    MessageBox((HWND) 0,str1,(LPSTR) "MESS",MB_ICONHAND|MB_OK);
 
365
    MessageBox((HWND) 0,str1,(char*) "MESS",MB_ICONHAND|MB_OK);
366
366
  #endif
367
367
}
368
368
 
377
377
//==
378
378
void ProjectPoint(Point16 *r,float tg_ang)
379
379
//==
380
 
{ Int16 xa,ya;
 
380
{ int16_t xa,ya;
381
381
  float fi=(float)atan(tg_ang);
382
382
  float si=(float)sin(fi),co=(float)cos(fi);
383
 
  xa=r->x; ya=r->y; r->x=(Int16)(xa*co+ya*si); r->y=(Int16)(-xa*si+ya*co);
 
383
  xa=r->x; ya=r->y; r->x=(int16_t)(xa*co+ya*si); r->y=(int16_t)(-xa*si+ya*co);
384
384
}
385
385
*/
386
386
//#undef CT_SKEW
390
390
#endif
391
391
 
392
392
//==
393
 
void ProjectRect1024(Rect16 *r,Int32 Skew1024)
 
393
void ProjectRect1024(Rect16 *r,int32_t Skew1024)
394
394
//==
395
395
{ int xa,ya,
396
396
  #ifndef CT_SKEW
401
401
  {
402
402
                xa=(r->right + r->left)>>1; ya=(r->top + r->bottom)>>1;
403
403
                #ifndef CT_SKEW
404
 
            xc=xa + (int)(((Int32)ya*Skew1024)/1024);
405
 
            yc=ya - (int)(((Int32)xa*Skew1024)/1024);
 
404
            xc=xa + (int)(((int32_t)ya*Skew1024)/1024);
 
405
            yc=ya - (int)(((int32_t)xa*Skew1024)/1024);
406
406
            dx=xc-xa; dy=yc-ya;
407
407
                #else
408
408
                        Point16 pt;
410
410
                        Deskew(pt,-Skew1024);
411
411
            dx=pt.x-xa; dy=pt.y-ya;
412
412
                #endif
413
 
        r->left+=(Int16)dx; r->right+=(Int16)dx; r->bottom+=(Int16)dy; r->top+=(Int16)dy;
 
413
        r->left+=(int16_t)dx; r->right+=(int16_t)dx; r->bottom+=(int16_t)dy; r->top+=(int16_t)dy;
414
414
  }
415
415
}
416
416
 
417
417
//==
418
 
void ProjectPoint1024(Point16 *r,Int32 Skew1024)
 
418
void ProjectPoint1024(Point16 *r,int32_t Skew1024)
419
419
//==
420
420
{
421
421
        #ifndef CT_SKEW
422
 
                Int16 xa,ya;
 
422
                int16_t xa,ya;
423
423
          xa=r->x; ya=r->y;
424
 
          r->x=xa + (Int16)(((Int32)ya*Skew1024)/1024);
425
 
          r->y=ya - (Int16)(((Int32)xa*Skew1024)/1024);
 
424
          r->x=xa + (int16_t)(((int32_t)ya*Skew1024)/1024);
 
425
          r->y=ya - (int16_t)(((int32_t)xa*Skew1024)/1024);
426
426
        #else
427
427
                Deskew(*r,-Skew1024);
428
428
        #endif
430
430
 
431
431
#if defined (FIND_NDX) || defined (FIND_BOX) || defined (FIND_DOT)
432
432
        extern MemFunc mem;
433
 
        void* malloc_t(Word32 size)         { return (*mem.alloc)(size); }
434
 
        void free_t(void *ptr, Word32 size) { (*mem.free)(ptr,size); }
435
 
        void* malloc_u(Word32 size)         {return malloc_m((WORD)size);}
436
 
        void free_u(void *ptr, Word32 size) {free_m(ptr);}
 
433
        void* malloc_t(uint32_t size)         { return (*mem.alloc)(size); }
 
434
        void free_t(void *ptr, uint32_t size) { (*mem.free)(ptr,size); }
 
435
        void* malloc_u(uint32_t size)         {return malloc_m((uint16_t)size);}
 
436
        void free_u(void *ptr, uint32_t size) {free_m(ptr);}
437
437
#endif
438
438
 
439
439
#ifndef WIN_MOD
440
440
 
441
 
/* // !!! Art - ��������
 
441
/* // !!! Art - устарело
442
442
        #include <stdio.h>
443
443
        #include <string.h>
444
444
 
454
454
        static int findname(char *sect, char *key, char *res, char *name)
455
455
        {
456
456
                FILE *File;
457
 
                BYTE buf03[255];
458
 
                Int16 ret=0;
 
457
                uchar buf03[255];
 
458
                int16_t ret=0;
459
459
 
460
460
                if((File=fopen(name,"rt")) == NULL) {
461
461
                        return 0;
510
510
                strcpy(result, Default);
511
511
          return findname(section, key, result, name) ? 1:0;
512
512
        }
513
 
*/ // !!! Art - ��������
 
513
*/ // !!! Art - устарело
514
514
#endif /*WIN_MOD*/
515
515
 
516
516