~ubuntu-branches/debian/wheezy/cuneiform/wheezy

« back to all changes in this revision

Viewing changes to cuneiform_src/Kern/hhh/tigerh/h/edp.h

  • 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
#ifndef __EDP__
58
58
#define __EDP__
59
59
 
60
 
 
61
60
#define RTF_DEBUG 0             // 0-off, 1-print, 2-additional lines to ED
62
 
#include "c_types.h"
 
61
#include "cttypes.h"
63
62
#include "edfile.h"
64
63
#include "msgerr.h"
65
64
#include <stdlib.h>
66
 
//#include <bios.h>
67
 
//#include <time.h>
 
65
 
68
66
//*****************************************************************************
69
 
#define NATURAL unsigned INT
70
 
#define BYTE    unsigned char
 
67
#define NATURAL uint
71
68
#define GOOD_PROB       70
72
69
 
73
70
/* Scan codes for keyboard */
86
83
#define F5         0x3f
87
84
#define ALT_X      0x2d
88
85
 
89
 
typedef struct sheet_disk_descr SDD;    // Header of ED-file
90
 
typedef struct fragm_disk_descr FDD;    // Fragment descriptor in header of file
91
 
typedef struct fragm_disk       FD;     // Begin-of-fragment record
92
 
typedef struct line_beg         LB;     // Begin_of_line record
93
 
typedef struct bit_map_ref      BMR;    // Bitmap reference record
 
86
typedef struct sheet_disk_descr SDD; // Header of ED-file
 
87
typedef struct fragm_disk_descr FDD; // Fragment descriptor in header of file
 
88
typedef struct fragm_disk FD; // Begin-of-fragment record
 
89
typedef struct line_beg LB; // Begin_of_line record
 
90
typedef struct bit_map_ref BMR; // Bitmap reference record
94
91
 
95
92
//*****************************************************************************
96
93
// Part descriptor
97
 
typedef struct d_dp
98
 
 {
99
 
 BYTE type;
 
94
typedef struct d_dp {
 
95
        uchar type;
100
96
#define VERT     0x01    // vertical splitting
101
97
#define HOR      0x02    // horisontal splitting
102
98
#define NONSP    0x04    // nonsplittable part
103
99
#define TERM     0x08    // terminal part
104
100
#define NEW      0x20    // not yet splitted
105
101
#define NONREST  0x40    // not yet restructed
106
 
 INT x,w,y,h;         // coordinates and sizes
107
 
 struct d_dp *parent; // encompassing part
108
 
 struct d_dp *next;   // next and previsious parts
109
 
 struct d_dp *prev;   //   of the same level
110
 
 struct d_dp *first;  // first and last subparts
111
 
 struct d_dp *last;   //  (if not terminal)
112
 
 INT npart;           // number of subparts
113
 
 struct d_df *fr1;    // first fragment
114
 
 struct d_df *fr2;    // next of last fragment
115
 
 INT nfrag;           // number of fragments;
116
 
 } DP;
 
102
        int16_t x, w, y, h; // coordinates and sizes
 
103
        struct d_dp *parent; // encompassing part
 
104
        struct d_dp *next; // next and previsious parts
 
105
        struct d_dp *prev; //   of the same level
 
106
        struct d_dp *first; // first and last subparts
 
107
        struct d_dp *last; //  (if not terminal)
 
108
        int16_t npart; // number of subparts
 
109
        struct d_df *fr1; // first fragment
 
110
        struct d_df *fr2; // next of last fragment
 
111
        int16_t nfrag; // number of fragments;
 
112
} DP;
117
113
 
118
114
//*****************************************************************************
119
115
// Fragment descriptor in memory
120
 
typedef struct d_df
121
 
    {
122
 
    struct d_df* next;      // Next fragment in the chain
123
 
    struct d_df* prev;      // Prev fragment in the chain
124
 
    INT          x,w;       // Horizontal position of alignement borders in TIF
125
 
    INT          y,h;       // Vertical position
126
 
    FDD*         fdd;       // FDD address
127
 
    struct d_dl* line1;     // First line address
128
 
    struct d_dl* line2;     // Last  line address
129
 
    struct d_dp* part;      // Terminal part adress
130
 
    INT          num;       // Number of fragment givet automatically
131
 
    INT          user_num;  // Number of fragment given by user
132
 
    INT          lplain;    // Width of fragment in ED text mode
133
 
    WORD         type;
 
116
typedef struct d_df {
 
117
        struct d_df* next; // Next fragment in the chain
 
118
        struct d_df* prev; // Prev fragment in the chain
 
119
        int16_t x, w; // Horizontal position of alignement borders in TIF
 
120
        int16_t y, h; // Vertical position
 
121
        FDD* fdd; // FDD address
 
122
        struct d_dl* line1; // First line address
 
123
        struct d_dl* line2; // Last  line address
 
124
        struct d_dp* part; // Terminal part adress
 
125
        int16_t num; // Number of fragment givet automatically
 
126
        int16_t user_num; // Number of fragment given by user
 
127
        int16_t lplain; // Width of fragment in ED text mode
 
128
        uint16_t type;
134
129
#define ONE_LINE      0x0001
135
130
#define LEFT_ALLIGN   0x0002
136
131
#define RIGHT_ALLIGN  0x0004
151
146
#define DEL           (NOT_RECOG|BORDER)
152
147
#define FICT_FR_FLAGS (BORDER|BRACKET)
153
148
 
154
 
    INT          base;      // Regular margin from 'x'
155
 
    INT          xmin;      // Calculated minimum x-coord for fragment
156
 
    struct d_df *rel_fr;    // for centered fragment - centered parent
157
 
                            // TAB_BEG - list of cells sizes (x,w)
158
 
    INT          pnum;      // if TAB_BEG | MCOL_BEG - number of cells/columns
159
 
    } DF;
 
149
        int16_t base; // Regular margin from 'x'
 
150
        int16_t xmin; // Calculated minimum x-coord for fragment
 
151
        struct d_df *rel_fr; // for centered fragment - centered parent
 
152
        // TAB_BEG - list of cells sizes (x,w)
 
153
        int16_t pnum; // if TAB_BEG | MCOL_BEG - number of cells/columns
 
154
} DF;
160
155
 
161
156
#define fict_fr(a) (a->type & (FICT_FR_FLAGS))
162
157
 
163
158
// Line descriptor
164
 
typedef struct d_dl
165
 
        {
166
 
    struct d_dl*next;       // Adress of the next line in the column
167
 
    struct d_dl*prev;       // Adress of the prev line in the column
168
 
    INT         baseline;   // 3d baseline position (ideal)
169
 
    INT         upper;      // Upper boundary of the line
170
 
    BYTE        height;     // Height beetween 2nd and 3rd baselines
171
 
    BYTE        pitch;      // Pitch - number of plain characters per inch or 0.
172
 
    INT         x,w;        // Horizontal position
173
 
    BYTE        paragraph;
 
159
typedef struct d_dl {
 
160
        struct d_dl*next; // Adress of the next line in the column
 
161
        struct d_dl*prev; // Adress of the prev line in the column
 
162
        int16_t baseline; // 3d baseline position (ideal)
 
163
        int16_t upper; // Upper boundary of the line
 
164
        uchar height; // Height beetween 2nd and 3rd baselines
 
165
        uchar pitch; // Pitch - number of plain characters per inch or 0.
 
166
        int16_t x, w; // Horizontal position
 
167
        uchar paragraph;
174
168
#define ORD_LN   0
175
169
#define NEW_PAR  0x1        // new paragraph
176
170
#define BUL_PAR  0x2        // paragraph with bullet
177
 
    INT         indent;     // size of indent (only if paragraph)
178
 
    INT         bulind;     // size of bullet indent (only if bullet)
179
 
    WORD        type;       // 0 for deleted line
 
171
        int16_t indent; // size of indent (only if paragraph)
 
172
        int16_t bulind; // size of bullet indent (only if bullet)
 
173
        uint16_t type; // 0 for deleted line
180
174
#define DL_HUGE_XW   0x1      // XW changed due to huge letter
181
175
#define DL_HUGE      0x2      // Huge letter
182
176
#define DL_ASSEMBLY  0x4      // Line assembled from pieces
183
177
#define DL_SINGLE    0x8      // Single-letter line
184
 
 
185
 
    BYTE*       edbeg;      // Address of the ED-text
186
 
    INT         edlth;      // It's length
187
 
    INT         npieces;    // Number of original pieces within line - 1
188
 
    INT         lplain;     // Number of print characters including spaces
189
 
    } DL;
 
178
        uchar* edbeg; // Address of the ED-text
 
179
        int16_t edlth; // It's length
 
180
        int16_t npieces; // Number of original pieces within line - 1
 
181
        int16_t lplain; // Number of print characters including spaces
 
182
} DL;
190
183
 
191
184
// RTF segment header
192
185
// typedef struct d_seg
194
187
//    void*   next;           // Next segment
195
188
//    void*   begtext;        // Begin of used space in the segment
196
189
//    void*   endtext;        // End of used space in the segment
197
 
//    INT     flag;
 
190
//    int16_t     flag;
198
191
// #define SEG_MALLOC 1        // Segment was created by malloc
199
192
//    } SEG;
200
193
 
201
 
struct line_ref
202
 
 {
203
 
  struct line_ref * next;
204
 
  struct line_ref * prev;
205
 
  DF * frag;
206
 
  DL * line;
207
 
  INT finy;
208
 
  INT x;
209
 
  WORD width;
210
 
  WORD indent;
211
 
  WORD base;
212
 
  BYTE flag;
213
 
  WORD type;            // Copy of fragment's type
214
 
  BYTE paragraph;
215
 
  BYTE res[3];
216
 
 };
 
194
struct line_ref {
 
195
        struct line_ref * next;
 
196
        struct line_ref * prev;
 
197
        DF * frag;
 
198
        DL * line;
 
199
        int16_t finy;
 
200
        int16_t x;
 
201
        uint16_t width;
 
202
        uint16_t indent;
 
203
        uint16_t base;
 
204
        uchar flag;
 
205
        uint16_t type; // Copy of fragment's type
 
206
        uchar paragraph;
 
207
        uchar res[3];
 
208
};
217
209
typedef struct line_ref LREF;
218
210
 
219
 
 
220
211
//*****************************************************************************
221
 
typedef struct
222
 
    {
223
 
    INT     dpi;            // Resolution of scanner in dots per inch
224
 
    INT     turn;           // Turn of page: turn=(xideal-xreal)/yreal*2048=
225
 
                            //                   =(yreal-yideal)/xreal*2048
226
 
    // Symbol substitutions
227
 
    CHAR    subst_bad;      // Subst. for not recognized character
228
 
    CHAR    subst_dash[3];  // Subst. for dash
 
212
typedef struct {
 
213
        int16_t dpi; // Resolution of scanner in dots per inch
 
214
        int16_t turn; // Turn of page: turn=(xideal-xreal)/yreal*2048=
 
215
        //                   =(yreal-yideal)/xreal*2048
 
216
        // Symbol substitutions
 
217
        char subst_bad; // Subst. for not recognized character
 
218
        char subst_dash[3]; // Subst. for dash
229
219
 
230
 
    // E        D
231
 
    INT     edfile;         // ED-file handle
232
 
    BYTE   *edbeg;          // Begin address of the ED file
233
 
    BYTE   *edcur;          // Current address in the ED-file
234
 
    BYTE   *edfree;         // End ptr to ED-file
235
 
    SDD*    psdd;           // ED header
236
 
    INT     font;           // Font properties as in ED struct font_kegle
 
220
        // E    D
 
221
        int16_t edfile; // ED-file handle
 
222
        uchar *edbeg; // Begin address of the ED file
 
223
        uchar *edcur; // Current address in the ED-file
 
224
        uchar *edfree; // End ptr to ED-file
 
225
        SDD* psdd; // ED header
 
226
        int16_t font; // Font properties as in ED struct font_kegle
237
227
 
238
228
#define FONT_SERIFIC       1
239
229
#define FONT_HELVETIC      2
243
233
#define FONT_STRAIGHT     32
244
234
#define FONT_UNDERLINE    64
245
235
 
246
 
    // Parts
247
 
    DP*     part;               // Table of parts
248
 
 
249
 
    // Fragments
250
 
    DF*     frag;               // Table of fragments
251
 
    DF*     pf;                 // Current frag address
252
 
    INT     nf;                 // It's number
253
 
    INT     nfrag;              // No of fragments
254
 
 
255
 
    // Lines
256
 
    DL*     line;               // Table of lines
257
 
    DL*     pl;                 // Current line desc address
258
 
    INT     nl;                 // It's number
259
 
    INT     qlines;             // No of lines
260
 
 
261
 
    // Graph of fragments
262
 
    INT*    graph;              // Array of exits
263
 
    INT     qgr;                // No of used elements in array
264
 
 
265
 
 
266
 
    // Debug
267
 
    INT     debug;              // 1-debug activated
268
 
    FILE   *prt;                // Debug print file
269
 
 
270
 
    //  External memory pool
271
 
    BYTE   *begfree;
272
 
    BYTE   *endfree;
273
 
 
274
 
    // Control of dynamic memory taken by malloc's
275
 
    DWORD   dynmem_size;                // Total count of dynamic memory size
276
 
    INT     tables_in_dynamic_memory;   // Flag =1 if tables are in dynamic mem
277
 
    INT     ed_in_dynamic_memory;       // Flag =1 if ED is in dynalic memory
278
 
 
279
 
 
280
 
    // Follow coordinates in TIFF
281
 
    WORD page_pix_width;                // page width in pixels
282
 
    WORD page_width;                    // page width in twips
283
 
    WORD column_width;                  // current column width
284
 
    WORD column_width_save;             // column width saved
285
 
    WORD columns_quant;                 // number of columns
286
 
 
287
 
    // Tables support
288
 
    PWORD cells_w;                      // cell widthes array
289
 
    PWORD cells_x;                      // x of cells
290
 
    PWORD cells_g;                      // gaps of cells
291
 
    WORD cells_quant;                   // number of cells
292
 
    WORD current_cell;                  // current cell number
293
 
    BYTE section_fill;                  // non empty section flag
294
 
    BYTE table_flag;                    // table flag
295
 
 
296
 
    // ED save working area
297
 
    INT Xmin;           // Minimal left coordinate of all fragments
298
 
    INT Xmax;           // Maximal right coordinate of all fragments
299
 
    PWORD char_tab;     // Tabulation table pointer
300
 
    DF ** sort_frag;    // List of sorted by upper fragment
301
 
    WORD cn;            // Local fragment counter for sortlist
302
 
    INT cy;             // Current 'y' for plank
303
 
    INT finy;           // Minimal of rows to finish active lines
304
 
    LREF * cfirst;      // First fictive element in lines chain
305
 
    LREF * clast;       // Last fictive element in lines chain
306
 
    LREF * cfree;       // Free lines reference chain start
307
 
    LREF * collect;     // Pointer to collect line
308
 
 
309
 
    // Line RTF buffer uses memory for graph during scan of ED file
310
 
    BYTE   *rtfbeg;            // Address of buffer= address of graph
311
 
    BYTE   *rtfcur;            // Pointer to free space in the buffer
312
 
    LONG    rtflth;            // Length of text in buffer
313
 
    BYTE   *rtffree;
314
 
    BYTE   *rtfend;
315
 
    BYTE   rtfspec;
316
 
    BYTE   rtflchar;
317
 
    PBYTE  rtf_hugep;
318
 
    BYTE   rtf_hugelist[2];
 
236
        // Parts
 
237
        DP* part; // Table of parts
 
238
 
 
239
        // Fragments
 
240
        DF* frag; // Table of fragments
 
241
        DF* pf; // Current frag address
 
242
        int16_t nf; // It's number
 
243
        int16_t nfrag; // No of fragments
 
244
 
 
245
        // Lines
 
246
        DL* line; // Table of lines
 
247
        DL* pl; // Current line desc address
 
248
        int16_t nl; // It's number
 
249
        int16_t qlines; // No of lines
 
250
 
 
251
        // Graph of fragments
 
252
        int16_t* graph; // Array of exits
 
253
        int16_t qgr; // No of used elements in array
 
254
 
 
255
 
 
256
        // Debug
 
257
        int16_t debug; // 1-debug activated
 
258
        FILE *prt; // Debug print file
 
259
 
 
260
        //  External memory pool
 
261
        uchar *begfree;
 
262
        uchar *endfree;
 
263
 
 
264
        // Control of dynamic memory taken by malloc's
 
265
        uint32_t dynmem_size; // Total count of dynamic memory size
 
266
        int16_t tables_in_dynamic_memory; // Flag =1 if tables are in dynamic mem
 
267
        int16_t ed_in_dynamic_memory; // Flag =1 if ED is in dynalic memory
 
268
 
 
269
 
 
270
        // Follow coordinates in TIFF
 
271
        uint16_t page_pix_width; // page width in pixels
 
272
        uint16_t page_width; // page width in twips
 
273
        uint16_t column_width; // current column width
 
274
        uint16_t column_width_save; // column width saved
 
275
        uint16_t columns_quant; // number of columns
 
276
 
 
277
        // Tables support
 
278
        PWORD cells_w; // cell widthes array
 
279
        PWORD cells_x; // x of cells
 
280
        PWORD cells_g; // gaps of cells
 
281
        uint16_t cells_quant; // number of cells
 
282
        uint16_t current_cell; // current cell number
 
283
        uchar section_fill; // non empty section flag
 
284
        uchar table_flag; // table flag
 
285
 
 
286
        // ED save working area
 
287
        int16_t Xmin; // Minimal left coordinate of all fragments
 
288
        int16_t Xmax; // Maximal right coordinate of all fragments
 
289
        PWORD char_tab; // Tabulation table pointer
 
290
        DF ** sort_frag; // List of sorted by upper fragment
 
291
        uint16_t cn; // Local fragment counter for sortlist
 
292
        int16_t cy; // Current 'y' for plank
 
293
        int16_t finy; // Minimal of rows to finish active lines
 
294
        LREF * cfirst; // First fictive element in lines chain
 
295
        LREF * clast; // Last fictive element in lines chain
 
296
        LREF * cfree; // Free lines reference chain start
 
297
        LREF * collect; // Pointer to collect line
 
298
 
 
299
        // Line RTF buffer uses memory for graph during scan of ED file
 
300
        uchar *rtfbeg; // Address of buffer= address of graph
 
301
        uchar *rtfcur; // Pointer to free space in the buffer
 
302
        int32_t rtflth; // Length of text in buffer
 
303
        uchar *rtffree;
 
304
        uchar *rtfend;
 
305
        uchar rtfspec;
 
306
        uchar rtflchar;
 
307
        puchar rtf_hugep;
 
308
        uchar rtf_hugelist[2];
319
309
#define RTF_LINE_BUF_SIZE sizeof(L.graph)
320
310
 
321
 
    PBYTE  hyp_buff;            // Pointer to hyphination buffer start
322
 
    PBYTE  hyp_ptr;             // Pointer to current place in that buffer
323
 
    PBYTE  hyp_in_rtf;          // Pointer to defis in RTF file if it is last in a string
324
 
    PBYTE  hyp_last;            // Pointer to last defis in RTF file
325
 
    PBYTE  hyp_line_start;      // Pointer to first character of a line in RTF file
326
 
 
327
 
 
328
 
    } dL;
 
311
        puchar hyp_buff; // Pointer to hyphination buffer start
 
312
        puchar hyp_ptr; // Pointer to current place in that buffer
 
313
        puchar hyp_in_rtf; // Pointer to defis in RTF file if it is last in a string
 
314
        puchar hyp_last; // Pointer to last defis in RTF file
 
315
        puchar hyp_line_start; // Pointer to first character of a line in RTF file
 
316
 
 
317
 
 
318
} dL;
329
319
//*****************************************************************************
330
320
 
331
 
INT ed_scan(
332
 
      BOOL (*func_spec)(PBYTE p, INT lth),
333
 
      BOOL (*func_char)(PBYTE p, INT lth),
334
 
      PBYTE start, PBYTE end);
335
 
 
 
321
int16_t ed_scan(Bool(*func_spec)(puchar p, int16_t lth), Bool(*func_char)(puchar p,
 
322
                int16_t lth), puchar start, puchar end);
336
323
 
337
324
#if RTF_DEBUG!=0
338
325
#define PGM " "