~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): Daniel Baumann
  • Date: 2009-07-10 17:58:10 UTC
  • Revision ID: james.westby@ubuntu.com-20090710175810-rqc89d2i3tki9m89
Tags: upstream-0.7.0+dfsg
ImportĀ upstreamĀ versionĀ 0.7.0+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 __EDP__
 
58
#define __EDP__
 
59
 
 
60
 
 
61
#define RTF_DEBUG 0             // 0-off, 1-print, 2-additional lines to ED
 
62
#include "c_types.h"
 
63
#include "edfile.h"
 
64
#include "msgerr.h"
 
65
#include <stdlib.h>
 
66
//#include <bios.h>
 
67
//#include <time.h>
 
68
//*****************************************************************************
 
69
#define NATURAL unsigned INT
 
70
#define BYTE    unsigned char
 
71
#define GOOD_PROB       70
 
72
 
 
73
/* Scan codes for keyboard */
 
74
#define BACK_SPACE 0x0e
 
75
#define ENTER      0x1c
 
76
#define ESCAPE     0x01
 
77
#define UP_ARROW   0x48
 
78
#define LEFT_ARROW 0x4b
 
79
#define RIGHT_ARROW 0x4d
 
80
#define DOWN_ARROW 0x50
 
81
#define INS        0x52
 
82
#define F1         0x3b
 
83
#define F2         0x3c
 
84
#define F3         0x3d
 
85
#define F4         0x3e
 
86
#define F5         0x3f
 
87
#define ALT_X      0x2d
 
88
 
 
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
 
94
 
 
95
//*****************************************************************************
 
96
// Part descriptor
 
97
typedef struct d_dp
 
98
 {
 
99
 BYTE type;
 
100
#define VERT     0x01    // vertical splitting
 
101
#define HOR      0x02    // horisontal splitting
 
102
#define NONSP    0x04    // nonsplittable part
 
103
#define TERM     0x08    // terminal part
 
104
#define NEW      0x20    // not yet splitted
 
105
#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;
 
117
 
 
118
//*****************************************************************************
 
119
// 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;
 
134
#define ONE_LINE      0x0001
 
135
#define LEFT_ALLIGN   0x0002
 
136
#define RIGHT_ALLIGN  0x0004
 
137
#define CENTER        0x0008
 
138
#define POS_INDENT    0x0010
 
139
#define NEG_INDENT    0x0020
 
140
#define BULLET        0x0040
 
141
#define POESY         0x0080
 
142
#define LN_SPACE      0x0100
 
143
#define NOT_RECOG     0x0200
 
144
#define BORDER        0x0400
 
145
#define BRACKET       0x8000
 
146
#define MCOL_BEG      (BRACKET|0x1000)
 
147
#define NEW_COL       (BRACKET|0x2000)
 
148
#define MCOL_END      (BRACKET|0x3000)
 
149
#define TAB_BEG       (BRACKET|0x4000)
 
150
#define NEW_ROW       (BRACKET|0x5000)
 
151
#define DEL           (NOT_RECOG|BORDER)
 
152
#define FICT_FR_FLAGS (BORDER|BRACKET)
 
153
 
 
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;
 
160
 
 
161
#define fict_fr(a) (a->type & (FICT_FR_FLAGS))
 
162
 
 
163
// 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;
 
174
#define ORD_LN   0
 
175
#define NEW_PAR  0x1        // new paragraph
 
176
#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
 
180
#define DL_HUGE_XW   0x1      // XW changed due to huge letter
 
181
#define DL_HUGE      0x2      // Huge letter
 
182
#define DL_ASSEMBLY  0x4      // Line assembled from pieces
 
183
#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;
 
190
 
 
191
// RTF segment header
 
192
// typedef struct d_seg
 
193
//    {
 
194
//    void*   next;           // Next segment
 
195
//    void*   begtext;        // Begin of used space in the segment
 
196
//    void*   endtext;        // End of used space in the segment
 
197
//    INT     flag;
 
198
// #define SEG_MALLOC 1        // Segment was created by malloc
 
199
//    } SEG;
 
200
 
 
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
 };
 
217
typedef struct line_ref LREF;
 
218
 
 
219
 
 
220
//*****************************************************************************
 
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
 
229
 
 
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
 
237
 
 
238
#define FONT_SERIFIC       1
 
239
#define FONT_HELVETIC      2
 
240
#define FONT_BOLD          4
 
241
#define FONT_LIGHT         8
 
242
#define FONT_ITALIC       16
 
243
#define FONT_STRAIGHT     32
 
244
#define FONT_UNDERLINE    64
 
245
 
 
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];
 
319
#define RTF_LINE_BUF_SIZE sizeof(L.graph)
 
320
 
 
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;
 
329
//*****************************************************************************
 
330
 
 
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
 
 
336
 
 
337
#if RTF_DEBUG!=0
 
338
#define PGM " "
 
339
#define MSG(s)               if(L.debug)fprintf(L.prt,"\n" PGM s)
 
340
#define MSG2(s1,s2)          if(L.debug)fprintf(L.prt,"\n" PGM s1,s2)
 
341
#define MSG3(s1,s2,s3)       if(L.debug)fprintf(L.prt,"\n" PGM s1,s2,s3)
 
342
#define MSG4(s1,s2,s3,s4)    if(L.debug)fprintf(L.prt,"\n" PGM s1,s2,s3,s4)
 
343
#define MSG5(s1,s2,s3,s4,s5) if(L.debug)fprintf(L.prt,"\n" PGM s1,s2,s3,s4,s5)
 
344
#else
 
345
#define MSG(s)               /* */
 
346
#define MSG2(s1,s2)          /* */
 
347
#define MSG3(s1,s2,s3)       /* */
 
348
#define MSG4(s1,s2,s3,s4)    /* */
 
349
#define MSG5(s1,s2,s3,s4,s5) /* */
 
350
#endif
 
351
//*****************************************************************************
 
352
#define msg_6_1 "RTF: Open error in RTF-file."
 
353
#define msg_6_2 "RTF: Write error in RTF-file."
 
354
#define msg_6_3 "RTF: Out of memory."                   /**/
 
355
#define msg_6_4 ""
 
356
#define msg_6_5 "RTF: Open error in ED-file."
 
357
#define msg_6_6 "RTF: Read error in ED-file."           /**/
 
358
#define msg_6_7 "RTF: Incorect length of ED-file header."
 
359
#define msg_6_8 "RTF: Too many lines."
 
360
#define msg_6_9 "RTF: ED-file is corrupted."
 
361
#define msg_6_10 "RTF: Too long line."
 
362
#define msg_6_11 "RTF: Write error in ED-file."
 
363
#define msg_6_12 "RTF: Too many fragments."
 
364
#define msg_6_13 "RTF: More fragments in ED-file than shown in header."
 
365
#define msg_6_14 "RTF: Duplicated fragment in table."
 
366
 
 
367
#endif