Debian Codegraph @

cuneiform_src/Kern/rling/sources/h/tigeremulate.h

raw symbols SCIP
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 */
56
57 #ifndef __TIGER_EMULATION_H__
58 #define __TIGER_EMULATION_H__
59
60 #if _MSC_VER > 1000
61 #pragma once
62 #endif // _MSC_VER > 1000
63
64 #include <string.h>
65 #include <stdlib.h>
66 #include <sys/stat.h>
67 #include <fcntl.h>
68 #include <stdio.h>
69
70 #include "cttypes.h"
71 #include "crldefines.h"
72
73 #define MEMSET(a,b,c) memset(a,b,c)
74 #define MEMCHR(a,b,c) memchr(a,b,c)
75 #define MEMCPY(a,b,c) memcpy(a,b,c)
76
77 #define TG_STREAM 1
78 #define TB_STREAM 2
79 #define ED_STREAM 3
80 #define TX_STREAM 4
81 #define DB_STREAM 5
82 #define IM_STREAM 6
83 #define VC_STREAM 7
84 #define WK_STREAM 8
85
86 #define DIRSEP '\\'
87
88 int16_t TE_open(int16_t, char *, int16_t, int16_t); /* / stream, name, ... */
89 int16_t TE_write(int16_t, puchar, uint32_t); /* / stream, name, ... */
90 int16_t TE_table_op(int16_t, int16_t, int16_t, int16_t); /* / table #, ... */
91 int32_t TE_read(int16_t, pchar, int32_t); /* / handle, addr, lth */
92 int16_t TE_close(int16_t); /* / handle */
93 char * TE_handle_fgets(int16_t handle, char * s, int16_t len);
94 int32_t TE_file_length(int16_t);
95
96 #define TGOPEN(a,b,c,d) TE_open(a,b,c,d)
97 #define TBOPEN(a,b,c,d) TE_table_op(a,b,c,d)
98 #define TGREAD(a,b,c) TE_read(a,b,c)
99 #define TGWRITE(a,b,c) TE_write(a,b,c)
100 #define TGCLOSE(a) TE_close(a)
101 #define TGGETS(a,b,c) TE_handle_fgets(a,b,c)
102 #define TGFILELTH(a) TE_file_length(a)
103
104 #define BO_READ O_RDONLY|O_BINARY
105 #define BO_READ_TEXT O_RDONLY|O_TEXT
106
107 typedef struct {
108 uchar let;
109 int32_t tr1;
110 int32_t tr2;
111 } StructTree;
112 ////////////////////////////////////////////////////////////////////////////////////
113 typedef struct elidx {
114 uchar ltr; // the letter
115 uchar vnum; // the number of the classes
116 uint16_t numel; // the number of the first class
117 } indBOX;
118 ////////////////////////////////////////////////////////////////////////////////////
119 typedef struct eltab {
120 uchar ltr; // the letter
121 uchar fnt; // the font number
122 uint16_t list; // next of same letter
123 uint16_t bnd; // the bound of the typeface
124 uint16_t vect[15]; // the vector of the letter
125 } elmBOX;
126 ///////////////////////////////////////////////////////////////////////////////////
127 struct mn_struc {
128 void *mnfirstbox; // address of the first box
129 int16_t mncounter; // (was int16_t) number of living lines in the component
130 #define mnfree mnfirstbox // reference to next free main number
131 int16_t mnupper; // upper bound of component
132 int16_t mnlower; // lower bound of component
133 int16_t mnboxcnt; // number of boxes in component
134 #define usual_box_count 20 // heuristic of number of lines in a letter
135 #define great_box_count 200 // heuristic for number of boxes in a picture
136 uchar mnlines; // number of lines in the component
137 uchar mnbegs; // number of free line begins
138 uchar mnends; // number of free line ends
139 uchar mnflag; // flag byte for main number
140 #define mnpicture 1 // component is a picture
141 struct mn_struc *mnnext; // address of next dead component
142 };
143 typedef struct mn_struc MN;
144 /////////////////////////////////////////////////////////////////////////////////////
145 struct _Root;
146 typedef struct _Root ROOT;
147 typedef struct _Root *PROOT;
148 struct _Root {
149 int16_t yRow;
150 int16_t xColumn;
151
152 union {
153 struct {
154 uint16_t wSegmentPtr;
155 uint16_t wLength;
156 } u2;
157
158 ROOT *pNext;
159 } u1;
160
161 int16_t nHeight;
162 int16_t nWidth;
163 uchar bType;
164 uchar bReached;
165 int16_t nBlock;
166 int16_t nUserNum;
167 void *pComp;
168 };
169 ////////////////////////////////////////////////////////////////////////////////////
170 struct box_struct {
171 struct box_struct *boxnext; // chain address (zero if no next box)
172 MN * boxmain; // component main number pointer
173 uint16_t boxptr; // ptr to the empty place in the box
174 int16_t boxleft; // left boundary for line envelope
175 int16_t boxright; // right boundary for line envelope
176 int16_t boxey; // row of line end+1 ( if line ends within
177 // box)
178 int16_t boxel; // length of the last segment (if line ends
179 // within box)
180 int16_t boxex; // coordinate of last segment end (if line
181 // ends within box)
182 uchar boxflag; // byte for box attributes flags
183 uchar boxwf; // working flag (for picture compress)
184 uint16_t boxresw; // reserved word (for *4 arround)
185 };
186 typedef struct box_struct BOX;
187
188 #endif //#ifndef __TIGER_EMULATION_H__