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

« back to all changes in this revision

Viewing changes to cuneiform_src/Kern/rselstr/sources/src/cpp/_loadroots.cpp

  • 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
# include <setjmp.h>
 
58
# include <string.h>
 
59
/*# include <crtdbg.h>*/
 
60
#include <assert.h>
 
61
#include "compat_defs.h"
 
62
 
 
63
# define __LOAD_ROOTS_C__
 
64
 
 
65
 
 
66
# include "new_c.h"
 
67
 
 
68
# undef __LOAD_ROOTS_C__
 
69
 
 
70
extern Handle hDebugCancelGreatComp;
 
71
extern Handle hDebugCancelPicturesAndTables;
 
72
extern Handle CutStrPrintFILE;
 
73
extern Handle DifferenCutToHistory;
 
74
extern Rect16 oldRoot;
 
75
extern Handle hDebugCutStr;
 
76
extern Handle CutCompPrintFILE;
 
77
extern Handle hCutComp;
 
78
extern Handle DifferenCutCompToHistory;
 
79
 
 
80
 
 
81
FILE* f_cut_str=NULL;
 
82
FILE* f_old_cut=NULL;
 
83
FILE* f_temp_cut=NULL;
 
84
FILE* f_cut_comp=NULL;
 
85
FILE* f_old_cut_comp=NULL;
 
86
FILE* f_temp_cut_comp=NULL;
 
87
 
 
88
#define POSSIBLE_PICTURES CPAGE_GetInternalType("possible pictures")
 
89
 
 
90
 
 
91
Bool32 Open_Res_Log( void )
 
92
{
 
93
 
 
94
        logFile_comp   = LDPUMA_FOpen(LOGFILENAME_COMP  ,"at");
 
95
        resFile_comp   = LDPUMA_FOpen(RESFILENAME_COMP  ,"at");
 
96
        logFile_pict   = LDPUMA_FOpen(LOGFILENAME_PICT  ,"at");
 
97
        resFile_pict   = LDPUMA_FOpen(RESFILENAME_PICT  ,"at");
 
98
        logFile_blocks = LDPUMA_FOpen(LOGFILENAME_BLOCKS,"at");
 
99
        resFile_blocks = LDPUMA_FOpen(RESFILENAME_BLOCKS,"at");
 
100
 
 
101
 
 
102
 char* name;
 
103
 if(!LDPUMA_Skip(CutStrPrintFILE)&&!LDPUMA_Skip(hDebugCutStr))
 
104
 {
 
105
  f_cut_str=fopen("cutstr.res","a");
 
106
  if(f_cut_str==NULL)
 
107
         f_cut_str=fopen("cutstr.res","w+");
 
108
  if(f_cut_str)
 
109
  {
 
110
   name=LDPUMA_GetFileName (NULL);
 
111
   fprintf(f_cut_str,"%s\n",name);
 
112
  }
 
113
 oldRoot.top=-1;
 
114
 oldRoot.bottom=-1;
 
115
 oldRoot.left=-1;
 
116
 oldRoot.right=-1;
 
117
 
 
118
 }
 
119
 
 
120
 if(!LDPUMA_Skip(DifferenCutToHistory))
 
121
 {
 
122
  f_old_cut=fopen("oldcutst.res","r");
 
123
  f_temp_cut=fopen("tempcut.res","w");
 
124
  name=LDPUMA_GetFileName (NULL);
 
125
  if(f_temp_cut)
 
126
       fprintf(f_temp_cut,"%s\n",name);
 
127
 
 
128
 }
 
129
 
 
130
 if(!LDPUMA_Skip(CutCompPrintFILE)&&LDPUMA_Skip(hCutComp))
 
131
 {
 
132
  f_cut_comp=fopen("cutcomp.res","a");
 
133
  if(f_cut_comp==NULL)
 
134
         f_cut_comp=fopen("cutcomp.res","w+");
 
135
  if(f_cut_comp)
 
136
  {
 
137
   name=LDPUMA_GetFileName (NULL);
 
138
   fprintf(f_cut_comp,"%s\n",name);
 
139
  }
 
140
 }
 
141
 
 
142
 if(!LDPUMA_Skip(DifferenCutCompToHistory))
 
143
 {
 
144
  f_old_cut_comp=fopen("oldcutco.res","r");
 
145
  f_temp_cut_comp=fopen("tempcutc.res","w");
 
146
  name=LDPUMA_GetFileName (NULL);
 
147
  if(f_temp_cut_comp)
 
148
       fprintf(f_temp_cut_comp,"%s\n",name);
 
149
 
 
150
 }
 
151
 
 
152
 
 
153
 
 
154
        return TRUE;
 
155
}
 
156
 
 
157
Bool32 Close_Res_Log( void )
 
158
{
 
159
 
 
160
        if (logFile_comp!=NULL)
 
161
        {
 
162
                LDPUMA_FClose(logFile_comp  );
 
163
                logFile_comp=NULL;
 
164
        }
 
165
        if (resFile_comp!=NULL)
 
166
        {
 
167
                LDPUMA_FClose(resFile_comp  );
 
168
                resFile_comp=NULL;
 
169
        }
 
170
        if (logFile_pict!=NULL)
 
171
        {
 
172
                LDPUMA_FClose(logFile_pict  );
 
173
                logFile_pict=NULL;
 
174
        }
 
175
        if (resFile_pict!=NULL)
 
176
        {
 
177
                LDPUMA_FClose(resFile_pict  );
 
178
                resFile_pict=NULL;
 
179
        }
 
180
        if (logFile_blocks!=NULL)
 
181
        {
 
182
                LDPUMA_FClose(logFile_blocks  );
 
183
                logFile_blocks=NULL;
 
184
        }
 
185
        if (resFile_blocks!=NULL)
 
186
        {
 
187
                LDPUMA_FClose(resFile_blocks  );
 
188
                resFile_blocks=NULL;
 
189
        }
 
190
 
 
191
        if(f_cut_str)
 
192
                fclose(f_cut_str);
 
193
 
 
194
        if(!LDPUMA_Skip(DifferenCutToHistory))
 
195
        {
 
196
     if(f_temp_cut)
 
197
         fclose(f_temp_cut);
 
198
         if(f_old_cut)
 
199
             fclose(f_old_cut);
 
200
        }
 
201
 
 
202
        if(f_cut_comp)
 
203
                fclose(f_cut_comp);
 
204
 
 
205
        if(!LDPUMA_Skip(DifferenCutToHistory))
 
206
        {
 
207
         if(f_temp_cut_comp)
 
208
         fclose(f_temp_cut_comp);
 
209
         if(f_old_cut_comp)
 
210
             fclose(f_old_cut_comp);
 
211
        }
 
212
 
 
213
 
 
214
 
 
215
        return TRUE;
 
216
}
 
217
 
 
218
 
 
219
Bool32 FillBigLetters (Handle hCCOM,Handle hCPAGE)
 
220
{
 
221
        Handle BlockType;
 
222
        Handle pBlock;
 
223
        RPIC_Comp_Rect CompRect;
 
224
 
 
225
        BlockType = CPAGE_GetInternalType("pic's to letters boxes");
 
226
 
 
227
        pBlock = CPAGE_GetBlockFirst(hCPAGE, BlockType);
 
228
        while(pBlock)
 
229
        {
 
230
                if (nBigLetters % BIG_LETTERS_QUANTUM == 0)
 
231
                {
 
232
                        pBigLetters = (RPIC_Comp_Rect*)realloc (pBigLetters,
 
233
                                (size_t) ((nBigLetters / BIG_LETTERS_QUANTUM + 1)
 
234
                                * BIG_LETTERS_QUANTUM * sizeof (RPIC_Comp_Rect)));
 
235
                }
 
236
 
 
237
                CPAGE_GetBlockData(hCPAGE, pBlock, BlockType, &CompRect, sizeof(CompRect));
 
238
                nBigLetters++;
 
239
                pBigLetters[nBigLetters-1] = CompRect;
 
240
 
 
241
                pBlock = CPAGE_GetBlockNext(hCPAGE, pBlock, BlockType);
 
242
        }
 
243
 
 
244
        return TRUE;
 
245
}
 
246
 
 
247
 
 
248
Bool32 FillPicsInTables(Handle hCCOM, Handle hCPAGE)
 
249
{
 
250
        POLY_   block;
 
251
        Handle h = NULL;
 
252
 
 
253
        CCOM_comp * comp;
 
254
 
 
255
        for(h = CPAGE_GetBlockFirst(hCPAGE,POSSIBLE_PICTURES);
 
256
        h!=NULL;
 
257
        h = CPAGE_GetBlockNext(hCPAGE,h,POSSIBLE_PICTURES))
 
258
        {
 
259
                CPAGE_GetBlockData(hCPAGE,h,POSSIBLE_PICTURES, &block, sizeof(block));
 
260
                CPAGE_DeleteBlock(hCPAGE, h);
 
261
 
 
262
                if (nPics % PICS_QUANTUM == 0)
 
263
                {
 
264
                        pPics = (CCOM_comp *) realloc (pPics,
 
265
                                (size_t) ((nPics / PICS_QUANTUM + 1)* PICS_QUANTUM * sizeof (CCOM_comp)));
 
266
                }
 
267
 
 
268
 
 
269
                comp = &pPics[nPics++];
 
270
                comp->upper = block.com.Vertex[0].y;
 
271
                comp->left  = block.com.Vertex[0].x;
 
272
                comp->w     = block.com.Vertex[1].x - block.com.Vertex[0].x;
 
273
                comp->h     = block.com.Vertex[2].y - block.com.Vertex[1].y;
 
274
        }
 
275
 
 
276
        return TRUE;
 
277
}
 
278
 
 
279
 
 
280
Bool32 IsNotBigLetter (CCOM_comp *comp)
 
281
{
 
282
        int i;
 
283
 
 
284
        if(comp->scale > 3) return TRUE;
 
285
        for(i=0; i<nBigLetters; i++)
 
286
        {
 
287
                if( (comp->upper >= pBigLetters[i].upper)&&
 
288
                        (comp->left >= pBigLetters[i].left)&&
 
289
                        (comp->upper + comp->h <= pBigLetters[i].upper + pBigLetters[i].h)&&
 
290
                        (comp->left + comp->w <= pBigLetters[i].left + pBigLetters[i].w))
 
291
                {
 
292
                        return FALSE;
 
293
                }
 
294
        }
 
295
 
 
296
        return TRUE;
 
297
}
 
298
 
 
299
 
 
300
/************************************************************************/
 
301
 
 
302
Bool32 ReadRoots(Handle hCCOM)
 
303
{
 
304
        CCOM_comp * comp = NULL;
 
305
        Handle          pPage;
 
306
        PAGEINFO        pInfo;
 
307
        Word32 i;
 
308
        int max_h=50;
 
309
 
 
310
        exthCCOM = hCCOM;
 
311
    RootsFreeData ();
 
312
        nRoots = 0;
 
313
 
 
314
 
 
315
        pPage = CPAGE_GetHandlePage(CPAGE_GetCurrentPage( ));
 
316
        CPAGE_GetPageData( pPage, PT_PAGEINFO, (void*)&pInfo, sizeof(pInfo));
 
317
 
 
318
        max_h=(max_h*(pInfo.DPIY+1))/300;
 
319
        nBigLetters = 0;
 
320
        pBigLetters = NULL;
 
321
        FillBigLetters(hCCOM, pPage);
 
322
        FillPicsInTables(hCCOM, pPage);
 
323
 
 
324
 
 
325
 
 
326
 
 
327
        //**************************************
 
328
 
 
329
        for(i=0;i<MaxHeightOfLetter;i++)
 
330
        {
 
331
                pBlockHystogram[i] = 0;
 
332
        }
 
333
 
 
334
 
 
335
        comp = CCOM_GetFirst(hCCOM,NULL);
 
336
        int h;
 
337
    while (comp)
 
338
    {
 
339
                h=comp->h;
 
340
                if((h > MinHeightOfLetter) && (h < MaxHeightOfLetter))
 
341
                {
 
342
                        nComps++;
 
343
                        pBlockHystogram[h]++;
 
344
                }
 
345
 
 
346
 
 
347
                if(comp->scale>1)
 
348
                {
 
349
                        if(comp->scale>2||h>max_h)
 
350
                        {
 
351
                         if(IsNotBigLetter(comp))
 
352
                                 goto lNextComp;
 
353
                        }
 
354
                }
 
355
 
 
356
        AddRoot(comp, TRUE)
 
357
                        ;
 
358
        lNextComp:
 
359
                        comp = CCOM_GetNext(comp,NULL);
 
360
    }
 
361
 
 
362
 
 
363
        //*********** Rom 08-02-99 *************
 
364
 
 
365
        nBigLetters = 0;
 
366
        if(pBigLetters!=NULL)
 
367
        {
 
368
                free(pBigLetters);
 
369
                pBigLetters = NULL;
 
370
        }
 
371
 
 
372
 
 
373
        //**************************************
 
374
 
 
375
 
 
376
    return (TRUE);
 
377
 
 
378
}
 
379
 
 
380
BOOL AddRoot(CCOM_comp * comp, Bool32 FirstTime)
 
381
{
 
382
ROOT   RootRecord = {0};
 
383
int h=comp->h;
 
384
int w=comp->w;
 
385
 
 
386
        _ASSERT(comp);
 
387
 
 
388
 
 
389
                //***************Rom********************
 
390
 
 
391
                if ( (h/w > 20) || (w/h > 20))
 
392
                        return FALSE;// Piter
 
393
 
 
394
                //**************************************
 
395
 
 
396
                //***************Rom********************
 
397
                if ( h*w < 6 )
 
398
                        return FALSE;// Piter
 
399
 
 
400
                //**************************************
 
401
 
 
402
        RootRecord.bReached   = FALSE;
 
403
                RootRecord.pComp = comp;
 
404
 
 
405
                RootRecord.yRow = comp->upper;
 
406
        RootRecord.xColumn = comp->left;
 
407
                RootRecord.u1.pNext = NULL;
 
408
        RootRecord.nHeight = h;
 
409
        RootRecord.nWidth = w;
 
410
        RootRecord.nBlock = 0;
 
411
                RootRecord.nUserNum = 0;
 
412
 
 
413
                RootRecord.bType = ROOT_DUST|ROOT_RECOGNIZED ;
 
414
                if(comp->type & CCOM_CH_LETTER)
 
415
                        RootRecord.bType = ROOT_DUST | ROOT_LETTER | ROOT_RECOGNIZED;
 
416
                if(comp->type & (CCOM_CH_DUST | CCOM_CH_PUNCT ))
 
417
                        RootRecord.bType = ROOT_DUST;
 
418
                if(comp->type & CCOM_CH_DUST && (comp->w+7)/8*comp->h<2 )
 
419
                        RootRecord.bType = 0 ;
 
420
                if(comp->type & CCOM_CH_GREAT )
 
421
                        RootRecord.bType = 0;
 
422
 
 
423
        if (nRoots % ROOTS_QUANTUM == 0 && FirstTime)
 
424
        {
 
425
            pRoots =(ROOT*) realloc (pRoots,
 
426
                              (size_t) ((nRoots / ROOTS_QUANTUM + 10)
 
427
                                * ROOTS_QUANTUM * sizeof (ROOT)));
 
428
 
 
429
        }
 
430
 
 
431
        nRoots++;
 
432
 
 
433
        if (pRoots == NULL)
 
434
        {
 
435
            ErrorNoEnoughMemory ((Word8*)"in LTROOTS.C, AddRoot");
 
436
            nRoots = 0;
 
437
            return FALSE;
 
438
        }
 
439
 
 
440
        pRoots [nRoots - 1] = RootRecord;
 
441
 
 
442
 
 
443
                if(nRoots>1&&FirstTime)
 
444
                        pRoots [nRoots - 2].u1.pNext = pRoots + nRoots - 1;
 
445
 
 
446
return TRUE;
 
447
}