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

« back to all changes in this revision

Viewing changes to cuneiform_src/Kern/rstr/src/shevron.c

  • 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 <stdio.h>
 
58
#include <stdlib.h>
 
59
#include <string.h>
 
60
#include "nt_types.h"
 
61
#include "func.h"
 
62
#include "struct.h"
 
63
#include "status.h"             // 31.08.2000 E.P.
 
64
#include "lang_def.h"   // 31.08.2000 E.P.
 
65
#include "ligas.h"
 
66
#include "linutil.h"
 
67
 
 
68
#include "compat_defs.h"
 
69
 
 
70
extern BYTE db_trace_flag   ;    // snap-detail presence byte
 
71
extern BYTE  db_status;
 
72
extern BYTE *MemForCutPointsTwo;
 
73
 
 
74
static cell *clbeg,*clend;
 
75
static void analysis_words(void);
 
76
 
 
77
BYTE Alik_find_black_interval(PBYTE str,BYTE len,PBYTE intrvl);
 
78
void shevron(cell* );
 
79
void check_contekst_shevron(void);
 
80
INT  find_word(void);
 
81
INT  check_shevron(cell *c,INT flag_qual);
 
82
 
 
83
void shevron(cell* WB)
 
84
{
 
85
 clbeg=clend=WB;
 
86
 while(find_word())
 
87
   {
 
88
    analysis_words();
 
89
    clbeg=clend->nextl;
 
90
   }
 
91
 clbeg=clend=WB;
 
92
 check_contekst_shevron();
 
93
}
 
94
 
 
95
#define MAX_PROB 235
 
96
void check_contekst_shevron()
 
97
{
 
98
cell *nextc,*clist[2];
 
99
 
 
100
 while((clend->nextl!=0) && (clend->nextl)->flg & c_f_let)
 
101
  {
 
102
   nextc=clend->nextl;
 
103
   if(clend->vers[0].let=='<' && clend->vers[0].prob>MAX_PROB &&
 
104
      nextc->vers[0].let=='<' && nextc->vers[0].prob>MAX_PROB)
 
105
    {
 
106
 
 
107
     if(db_status && snap_activity('e') )
 
108
      {
 
109
       snap_show_text("<< ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ č„¢ą®­");
 
110
       snap_monitor();
 
111
      }
 
112
     clist[0]=clend;
 
113
     clist[1]=nextc;
 
114
     compose_cell(2,clist,clend);
 
115
 
 
116
     clend->vers[0].let=left_quocket;
 
117
     clend->vers[0].prob=254;
 
118
     clend->vers[1].let=0;
 
119
     clend->nvers=1;
 
120
    }
 
121
   else
 
122
    if(clend->vers[0].let=='>' && clend->vers[0].prob>MAX_PROB &&
 
123
       nextc->vers[0].let=='>' && nextc->vers[0].prob>MAX_PROB)
 
124
    {
 
125
     if(db_status && snap_activity('e') )
 
126
      {
 
127
       snap_show_text(">> ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ č„¢ą®­");
 
128
       snap_monitor();
 
129
      }
 
130
     clist[0]=clend;
 
131
     clist[1]=nextc;
 
132
     compose_cell(2,clist,clend);
 
133
 
 
134
     clend->vers[0].let=right_quocket;
 
135
     clend->vers[0].prob=254;
 
136
     clend->vers[1].let=0;
 
137
     clend->nvers=1;
 
138
    }
 
139
   clend=clend->nextl;
 
140
  }
 
141
}
 
142
 
 
143
INT find_word()
 
144
{
 
145
   if(clbeg->nextl==NULL) return 0;
 
146
   clend=clbeg;
 
147
   while(1)
 
148
      {
 
149
       if((clend->next==NULL) || ((clend->next)->next==NULL) ||
 
150
          (((clend->next)->flg & c_f_space) &&
 
151
          ((clend->next)->vers[0].let==0x20)))  break;
 
152
       clend=clend->next;
 
153
      }
 
154
 
 
155
   while(1)
 
156
      {
 
157
       if( (clend->flg & c_f_let) || (clend->flg & c_f_bad) ||
 
158
           (clend->next==NULL) )  break;
 
159
 
 
160
           // Nick
 
161
           if( clend==clbeg) return 0;
 
162
 
 
163
       clend=clend->prev;
 
164
      }
 
165
return 1;
 
166
}
 
167
 
 
168
#define SMAX_PROB 240
 
169
#define PROB_OK   170
 
170
#define MIN_PROB  150
 
171
#define MID_PROB  200
 
172
#define ok_K_hgt  10
 
173
static BYTE ruslet[]  ="ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ė ®ļæ½ļæ½";
 
174
//                                         "ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½"
 
175
/***************************************************************/
 
176
void analysis_words(void)
 
177
{
 
178
        INT   left,right,flag=0,flag_qual;
 
179
        cell  *WB,*WE,*cl;
 
180
        CHAR  snap[380],*buf=snap;
 
181
 
 
182
        left=right=0;
 
183
        WB=clbeg;
 
184
        WE=clend;
 
185
 
 
186
        //AK! add crashguard
 
187
        while( (WB->flg & c_f_dust) || (WB->flg & c_f_fict) ||
 
188
                   (WB->flg & c_f_punct) )
 
189
        {
 
190
                if ((WB->next == cell_l() || WB->next == NULL) )
 
191
                        return;
 
192
                WB=WB->next;
 
193
        }
 
194
 
 
195
        //AK! add c/g
 
196
        while( (WE->flg & c_f_dust) || (WB->flg & c_f_fict) ||
 
197
                   (WB->flg & c_f_punct))
 
198
        {
 
199
                if ((WE->prev == cell_f() || WE->prev == NULL))
 
200
                        return;
 
201
                WE=WE->prev;
 
202
        }
 
203
 
 
204
  if(WB==WE) return;
 
205
     /*  ---------------- LEFT -----------------------------*/
 
206
  if(WB->vers[0].let==left_quocket) left=100;
 
207
  else
 
208
   if((WB->flg & c_f_bad)                                                 ||
 
209
      (memchr("ļ „ļæ½ļæ½ļæ½",WB->vers[0].let,6) &&
 
210
                !is_russian_baltic_conflict(WB->vers[0].let) && // 17.07.2001 E.P.
 
211
                !is_russian_turkish_conflict(WB->vers[0].let)&& // 21.05.2002 E.P.
 
212
                WB->vers[0].prob < MAX_PROB) ||
 
213
      (memchr("Cc",WB->vers[0].let,2)     && WB->vers[0].prob < MIN_PROB) ||
 
214
      (memchr("u",WB->vers[0].let,1)      && WB->vers[0].prob <=SMAX_PROB &&
 
215
       WB->h <= ok_K_hgt)                                                 ||
 
216
      (WB->vers[0].let== r_cu_u           && WB->vers[0].prob < MID_PROB) ||
 
217
      (memchr("ae",WB->vers[0].let,2)     && WB->vers[0].prob < MAX_PROB)
 
218
     )
 
219
      {
 
220
       if(WB->vers[0].prob<MIN_PROB && (WB->h>>1)*3 <= (WB->nextl)->h)
 
221
             flag_qual=1;
 
222
       else  flag_qual=0;
 
223
       if(WB->vers[0].let=='1') flag_qual=0;
 
224
       left=check_shevron(WB,flag_qual);
 
225
      }
 
226
 
 
227
     /*  ---------------- RIGHT -----------------------------*/
 
228
  if(WE->vers[0].let==right_quocket)
 
229
         right=100;
 
230
   else
 
231
   if((WE->flg & c_f_bad)                                                 ||
 
232
      (memchr("ļ¢ ļæ½ļæ½ļæ½",WE->vers[0].let,6) &&
 
233
                !is_russian_baltic_conflict(WE->vers[0].let) && // 17.07.2001 E.P.
 
234
                WE->vers[0].prob < MAX_PROB) ||
 
235
      (memchr("sļæ½",WE->vers[0].let,2)     && WE->vers[0].prob < MIN_PROB) ||
 
236
      (memchr("ļæ½",WE->vers[0].let,1)      &&
 
237
                !is_russian_baltic_conflict(WE->vers[0].let) && // 17.07.2001 E.P.
 
238
                WE->vers[0].prob < PROB_OK)  ||
 
239
      (WE->vers[0].let== r_cu_u           && WE->vers[0].prob <= MIN_PROB &&
 
240
       WE->h <= ok_K_hgt)                                                 ||
 
241
      (memchr("e",WE->vers[0].let,1)      && WE->vers[0].prob < MAX_PROB)
 
242
     )
 
243
      {
 
244
       if((WE->vers[0].prob<MIN_PROB && (WE->h>>1)*3 <= (WE->prevl)->h)   ||
 
245
          (WE->vers[0].let==(BYTE)'ļæ½' &&
 
246
                        !is_russian_baltic_conflict(WE->vers[0].let) && // 17.07.2001 E.P.
 
247
                        WE->vers[0].prob<MIN_PROB        &&
 
248
              (WE->prevl)->vers[0].prob>=230)                                 ||
 
249
          (WE->vers[0].let==(BYTE)'ļæ½' &&
 
250
                        !is_russian_baltic_conflict(WE->vers[0].let) && // 17.07.2001 E.P.
 
251
                        WE->vers[0].prob-5<PROB_OK       &&
 
252
              memchr(ruslet,(WE->prevl)->vers[0].let,sizeof(ruslet) ) &&
 
253
                        !is_russian_baltic_conflict((WE->prevl)->vers[0].let)   // 17.07.2001 E.P.
 
254
                        )         ||
 
255
          (WE->vers[0].let==(BYTE)'ļæ½' &&
 
256
                        !is_russian_baltic_conflict(WE->vers[0].let) && // 17.07.2001 E.P.
 
257
                        WE->vers[0].prob<MAX_PROB        &&
 
258
              memchr(ruslet,(WE->prevl)->vers[0].let,sizeof(ruslet)) &&
 
259
                        !is_russian_baltic_conflict((WE->prevl)->vers[0].let) &&        // 17.07.2001 E.P.
 
260
                        left>=3)
 
261
             )
 
262
         flag_qual=1;
 
263
        else
 
264
                  flag_qual=0;
 
265
       if(WE->vers[0].let=='1') flag_qual=0;
 
266
       right=check_shevron(WE,flag_qual);
 
267
      }
 
268
 
 
269
  if(left>0 || right>0 && db_status && snap_activity('e') )
 
270
     {
 
271
      buf+=sprintf(buf,"Shevron: Word: ");
 
272
      cl=WB;
 
273
      while(1)
 
274
       {
 
275
        *buf++ = cl->vers[0].let;
 
276
        if(cl==WE) break;
 
277
        cl=cl->next;
 
278
       }
 
279
      *buf++ = '\n';
 
280
     }
 
281
 
 
282
  if(left!=100 &&
 
283
     ((right>=3 && left>=2 && WB->vers[0].prob<PROB_OK) || left>=3))
 
284
   {
 
285
    flag=1;
 
286
    if( db_status && snap_activity('e') )
 
287
     {
 
288
      *buf++ = WB->vers[0].let;
 
289
       buf+=sprintf(buf,"--> ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ << ļæ½ąØ§ļæ½ļæ½ļæ½ č„¢ą®­ļæ½=%d \n",left);
 
290
     }
 
291
    WB->vers[0].let=left_quocket;
 
292
    WB->vers[0].prob=254;
 
293
    WB->vers[1].let=0;
 
294
    WB->nvers=1;
 
295
    WB->flg=c_f_let;
 
296
   }
 
297
 
 
298
  if(right!=100 &&
 
299
     ((left>=3 && right>=2 && WE->vers[0].prob<PROB_OK) || right>=3))
 
300
   {
 
301
    flag=1;
 
302
    if( db_status && snap_activity('e') )
 
303
     {
 
304
      *buf++ = WE->vers[0].let;
 
305
       buf+=sprintf(buf,"--> ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ >> ļæ½ąØ§ļæ½ļæ½ļæ½ č„¢ą®­ļæ½=%d \n",right);
 
306
     }
 
307
    WE->vers[0].let=right_quocket;
 
308
    WE->vers[0].prob=254;
 
309
    WE->vers[1].let=0;
 
310
    WE->nvers=1;
 
311
    WE->flg=c_f_let;
 
312
   }
 
313
 
 
314
  if(flag && db_status && snap_activity('e') )
 
315
   {
 
316
    snap_show_text(snap);
 
317
    snap_monitor();
 
318
   }
 
319
}
 
320
/*************************************************************/
 
321
#define  AlikSevron ON
 
322
#define  otkritost  3
 
323
INT check_shevron(cell *c,INT flag_qual)
 
324
{
 
325
INT   i,i1,i2,penalty,hor_byte,sum,priznak,width,hgt,hgt2,hgt3,hgt23,l_priz;
 
326
BYTE  Col,*CurPos,*I,bound[2],prev_b[4],povedenie,max_interval,priz2,
 
327
      inter1,inter2,priz_12,prev_col,up_max,dw_max,priz_seredini,tmp_max,
 
328
      l_min[3],r_min[3],l_m[2],r_m[2],priz_k,prev_left_dist;
 
329
PBYTE raster;
 
330
 
 
331
#ifdef AlikSevron
 
332
INT   b1,b2,b3,b4,r1,r2;
 
333
CHAR  snap[380],*buf=snap;
 
334
  buf+=sprintf(buf,"step0: let=%c,w=%d,h=%d \n ",c->vers[0].let,c->w,c->h);
 
335
#endif
 
336
#ifdef _bc_
 
337
CHAR  snap[380],*buf=snap;
 
338
#endif
 
339
 
 
340
 width=c->w; hgt=c->h;
 
341
 if(width<=5 || hgt<=5)  return 0;
 
342
 hgt2 =(hgt>>1);
 
343
 hgt3 =hgt/3;
 
344
 hgt23=(hgt<<1)/3;
 
345
 
 
346
 raster=save_raster(c);
 
347
 hor_byte=(width+7)>>3;
 
348
 I=MemForCutPointsTwo;
 
349
 sum=0; povedenie=0; priznak=0; max_interval=0; priz2=0; l_priz=0;
 
350
 inter1=0; inter2=0; up_max=0;  dw_max=0; priz_seredini=0;
 
351
 priz_k=1; prev_left_dist=(BYTE)width;
 
352
 for(i=0;i<3;i++)
 
353
   {
 
354
    l_min[i]=0; r_min[i]=0;
 
355
    if(i<2) { l_m[i]=0; r_m[i]=0;}
 
356
   }
 
357
 CurPos=raster;
 
358
 
 
359
//-------------------------step1--------------------------------------------
 
360
 for(i=0; i<hgt; i++)
 
361
  {
 
362
   Col=Alik_find_black_interval(CurPos,(BYTE)hor_byte,I);
 
363
   CurPos+=hor_byte;
 
364
   switch(Col)
 
365
    {
 
366
     case  0: break;
 
367
     case  1: if(povedenie<=1)
 
368
               {povedenie=1; sum++; bound[0]=I[0]; bound[1]=I[1];}
 
369
              break;
 
370
     case  2:
 
371
             prev_b[0]=I[1];
 
372
             prev_b[1]=I[2];
 
373
             if(I[2]-I[1]-1==1) inter1=1;
 
374
             if(Alik_find_black_interval(CurPos,(BYTE)hor_byte,I)==1 && i==0 && hgt>ok_K_hgt)
 
375
                goto step2;
 
376
             if(!povedenie)
 
377
              {
 
378
               if(i < hgt3) {sum+=10; priznak++;}
 
379
               goto step2;
 
380
              }
 
381
             else
 
382
              {
 
383
               if(prev_b[0]+1>=bound[0] && prev_b[1]-1<=bound[1]) goto step2;
 
384
               else
 
385
                {
 
386
                 if(i < hgt3) {sum+=10; priznak++;}
 
387
                 goto step2;
 
388
                }
 
389
              }
 
390
     default: sum-=5;
 
391
    }
 
392
  }
 
393
 
 
394
//-------------------------step2--------------------------------------------
 
395
step2:
 
396
#ifdef AlikSevron
 
397
  buf+=sprintf(buf,"step1: priznak=%d,sum=%d,flag_qual=%d\n ",priznak,sum,
 
398
               flag_qual);
 
399
#endif
 
400
 
 
401
#ifdef _bc_
 
402
 if(flag_qual)
 
403
  {
 
404
   sprintf(snap,"step1: priznak=%d,sum=%d ",priznak,sum);
 
405
   outtextxy(10,20,snap);
 
406
  }
 
407
#endif
 
408
 
 
409
 if(sum<0) return -1;
 
410
 povedenie=0;
 
411
 CurPos=raster+(hgt-1)*hor_byte;
 
412
 for(i=0; i<hgt; i++)
 
413
  {
 
414
   Col=Alik_find_black_interval(CurPos,(BYTE)hor_byte,I);
 
415
   CurPos-=hor_byte;
 
416
   switch(Col)
 
417
    {
 
418
     case  0: break;
 
419
     case  1: if(povedenie<=1)
 
420
               {povedenie=1; sum++; bound[0]=I[0]; bound[1]=I[1];}
 
421
              break;
 
422
     case  2:
 
423
             prev_b[0]=I[1];
 
424
             prev_b[1]=I[2];
 
425
             if(I[2]-I[1]-1==1) inter2=1;
 
426
             if(Alik_find_black_interval(CurPos,(BYTE)hor_byte,I)==1 && i==0 && hgt>ok_K_hgt)
 
427
                goto step3;
 
428
             if(!povedenie)
 
429
              {
 
430
               if(i < hgt3) {sum+=10; priznak++;}
 
431
               goto step3;
 
432
              }
 
433
             else
 
434
              {
 
435
               if(prev_b[0]+1>=bound[0] && prev_b[1]-1<=bound[1]) goto step3;
 
436
               else
 
437
                {
 
438
                 if(i < hgt3) {sum+=10; priznak++;}
 
439
                 goto step3;
 
440
                }
 
441
              }
 
442
     default: sum-=5;
 
443
    }
 
444
  }
 
445
 
 
446
//-------------------------step3--------------------------------------------
 
447
step3:
 
448
#ifdef AlikSevron
 
449
  buf+=sprintf(buf,"step2: priznak=%d,sum=%d,inter1=%d,inter2=%d ",
 
450
                    priznak,sum,inter1,inter2);
 
451
#endif
 
452
#ifdef _bc_
 
453
  if(flag_qual)
 
454
  {
 
455
   sprintf(snap,"step2: priznak=%d,sum=%d,inter1=%d,inter2=%d ",priznak,sum,
 
456
                 inter1,inter2);
 
457
   outtextxy(10,30,snap);
 
458
  }
 
459
#endif
 
460
 
 
461
 if((sum<0 || !priznak) && !flag_qual)  priznak=-1;
 
462
 priz_12=1;
 
463
 prev_col=0;
 
464
 CurPos=raster;
 
465
 for(i=0; i<hgt; i++)
 
466
  {
 
467
   Col=Alik_find_black_interval(CurPos,(BYTE)hor_byte,I);
 
468
   CurPos+=hor_byte;
 
469
 
 
470
   switch(Col)
 
471
    {
 
472
     case  0:  prev_col=0;
 
473
               break;
 
474
     case  1:  if(i>0 && prev_col==2 &&
 
475
                  prev_b[1]+1>=I[0] && prev_b[2]-1<=I[1])
 
476
                                 {priz_12=0; goto step4;}
 
477
               prev_b[0]=I[0]; prev_b[1]=I[1];
 
478
               prev_col=1;
 
479
               break;
 
480
     case  2:  if(prev_col==1 &&
 
481
                  I[1]+1>=prev_b[0] && I[2]-1<=prev_b[1])
 
482
                                 {priz_12=0; goto step4;}
 
483
               if(prev_col==2 &&
 
484
                  (I[2]-1<=prev_b[1] || I[1]+1>=prev_b[2]))
 
485
                                 {priz_12=0; goto step4;}
 
486
               prev_b[0]=I[0]; prev_b[1]=I[1];
 
487
               prev_b[2]=I[2]; prev_b[3]=I[3];
 
488
               prev_col=2;
 
489
               break;
 
490
     default:
 
491
               priz_12=0; goto step4;
 
492
    }
 
493
  }
 
494
 
 
495
//-------------------------step4--------------------------------------------
 
496
step4:
 
497
#ifdef AlikSevron
 
498
  buf+=sprintf(buf,"step3: priz_12=%d\n ",priz_12);
 
499
#endif
 
500
#ifdef _bc_
 
501
  if(flag_qual)
 
502
  {
 
503
   sprintf(snap,"step3: priz_12=%d ",priz_12);
 
504
   outtextxy(10,40,snap);
 
505
  }
 
506
#endif
 
507
 
 
508
 sum=0;
 
509
 CurPos=raster;
 
510
 for(i=0; i<hgt; i++)
 
511
  {
 
512
   Col=Alik_find_black_interval(CurPos,(BYTE)hor_byte,I);
 
513
   CurPos+=hor_byte;
 
514
   if(Col)
 
515
    {
 
516
     if(priz_k)
 
517
      {
 
518
       if(I[0]>prev_left_dist) priz_k=0;
 
519
       prev_left_dist=I[0];
 
520
      }
 
521
 
 
522
     if(I[0]<=2)
 
523
      {
 
524
       if(i<=2)     l_m[0]=1;
 
525
       if(i>=hgt-3) l_m[1]=1;
 
526
      }
 
527
 
 
528
     if(I[0]<=1)            {if(hgt>ok_K_hgt) l_priz+=2;  else l_priz++;}
 
529
     else if(I[0]<=3)       {if(hgt>ok_K_hgt) l_priz++; }
 
530
          else  if(I[0]==4) {if(hgt>ok_K_hgt) l_priz--; else l_priz-=2;}
 
531
                else         l_priz-=2;
 
532
    }
 
533
   switch(Col)
 
534
    {
 
535
     case  0: break;
 
536
     case  1:
 
537
              if(i+1 < hgt2)   up_max=MAX(up_max,I[1]-I[0]+1);
 
538
              else
 
539
               if(i+1 > hgt2)  dw_max=MAX(dw_max,I[1]-I[0]+1);
 
540
               else
 
541
                   {
 
542
                     up_max=MAX(up_max,I[1]-I[0]+1);
 
543
                     dw_max=MAX(dw_max,I[1]-I[0]+1);
 
544
                   }
 
545
              sum++;
 
546
              if(I[0]==1)
 
547
                {
 
548
                 if(i<hgt2-2)   l_min[0]=1;
 
549
                 else
 
550
                  if(i>hgt2+1)  l_min[2]=1;
 
551
                  else          l_min[1]=1;
 
552
                }
 
553
 
 
554
              if(width-I[1]<=1)
 
555
                {
 
556
                 if(i<=2)     r_m[0]=1;
 
557
                 if(i>=hgt-3) r_m[1]=1;
 
558
                }
 
559
 
 
560
              if(width-I[1]==0)
 
561
                {
 
562
                 if(i<hgt2-2)   r_min[0]=1;
 
563
                 else
 
564
                  if(i>hgt2+1)  r_min[2]=1;
 
565
                  else          r_min[1]=1;
 
566
                }
 
567
              break;
 
568
     case  2:
 
569
#ifdef AlikSevron
 
570
             b1=I[0]; b2=I[1]; b3=I[2]; b4=I[3];
 
571
             r1=I[1]-I[0]+I[3]-I[2]+2; r2=I[2]-I[1]-1;
 
572
#endif
 
573
             if(width-I[3]<=1)
 
574
              {
 
575
               if(i<=2)     r_m[0]=1;
 
576
               if(i>=hgt-3) r_m[1]=1;
 
577
              }
 
578
 
 
579
             if(i<=hgt2)
 
580
                up_max  =MAX(up_max,MAX(I[1]-I[0]+1,I[3]-I[2]+1));
 
581
             else
 
582
                dw_max=MAX(dw_max,MAX(I[1]-I[0]+1,I[3]-I[2]+1));
 
583
 
 
584
             if(I[1]-I[0]+I[3]-I[2]+1>I[2]-I[1]) sum+=2;
 
585
             else
 
586
              if(!priz_12)                       sum-=2;
 
587
 
 
588
             if(!priz_12 && i>2 && i<hgt-2)
 
589
                       max_interval+=(I[2]-I[1]-1)/5;
 
590
 
 
591
             priz2++;
 
592
             break;
 
593
    default: sum-=5;
 
594
             max_interval+=2;
 
595
             if(i<3 || i>hgt-3)  --priznak;
 
596
    }
 
597
  }
 
598
tmp_max=MAX(up_max,dw_max);
 
599
if(priz2<=1 && !max_interval && abs(up_max-dw_max)<=3 && tmp_max>(width<<1)/3)
 
600
 {
 
601
  if((l_min[0] && !l_min[1] && l_min[2] && !r_min[0] && r_min[1] && !r_min[2])
 
602
                                ||
 
603
    (!l_min[0] && l_min[1] && !l_min[2] && r_min[0] && !r_min[1] && r_min[2]))
 
604
    { priznak=3;  goto end; }
 
605
  if(flag_qual)
 
606
  {
 
607
  if((l_min[0] && l_min[1] && l_min[2] && !r_min[0] && r_min[1] && !r_min[2])
 
608
                                ||
 
609
    (!l_min[0] && l_min[1] && !l_min[2] && r_min[0] && r_min[1] && r_min[2]))
 
610
    { priznak=3;  goto end; }
 
611
 
 
612
  }
 
613
 }
 
614
 
 
615
#ifdef AlikSevron
 
616
  buf+=sprintf(buf,"step4: priznak=%d,sum=%d,max_interval=%d,l_priz=%d,up_max=%d,dw_max=%d\n ",
 
617
                           priznak,sum,max_interval,l_priz,up_max,dw_max);
 
618
  buf+=sprintf(buf,"step4a: (%d %d %d %d %d %d) (%d %d %d %d) priz_k=%d \n ",
 
619
  l_min[0],l_min[1],l_min[2],r_min[0],r_min[1],r_min[2],l_m[0],l_m[1],r_m[0],r_m[1],priz_k);
 
620
 
 
621
#endif
 
622
#ifdef _bc_
 
623
 if(flag_qual)
 
624
  {
 
625
   sprintf(snap,"step4: priznak=%d,sum=%d,max_interval=%d,l_priz=%d,up_max=%d,dw_max=%d ",
 
626
                        priznak,sum,max_interval,l_priz,up_max,dw_max);
 
627
   outtextxy(10,50,snap);
 
628
  }
 
629
#endif
 
630
 
 
631
//-------------------------step5--------------------------------------------
 
632
/*step5:*/
 
633
if(!priz_12 && ((up_max>>1)>=dw_max || (dw_max>>1)>=up_max) && max_interval>2)
 
634
                                                                 --priznak;
 
635
if(((width-up_max<3 && width-dw_max>3) || (width-dw_max<3 && width-up_max>3))
 
636
   && priznak<2 && !flag_qual)                                                 --priznak;
 
637
if(((width==up_max || width==dw_max) && abs(dw_max-up_max)>2) && priznak<2)
 
638
                                                                 --priznak;
 
639
if((inter1 || inter2) && max_interval)                           --priznak;
 
640
if(!priz_12 && max_interval )                                    --priznak;
 
641
 
 
642
#ifdef AlikSevron
 
643
  buf+=sprintf(buf,"step5: priznak=%d,priz2=%d ",priznak,priz2);
 
644
#endif
 
645
#ifdef _bc_
 
646
 if(flag_qual)
 
647
  {
 
648
   sprintf(snap,"step5: priznak=%d,priz2=%d ",priznak,priz2);
 
649
   outtextxy(10,60,snap);
 
650
  }
 
651
#endif
 
652
 
 
653
//-------------------------step6--------------------------------------------
 
654
/*step6:*/
 
655
   penalty=0;
 
656
   i1=hgt3; i2=hgt23;
 
657
   CurPos=raster+i1*hor_byte;
 
658
   for(i=i1; i<i2; i++)
 
659
   {
 
660
    Col=Alik_find_black_interval(CurPos,(BYTE)hor_byte,I);
 
661
    CurPos+=hor_byte;
 
662
    switch(Col)
 
663
     {
 
664
      case 1:
 
665
#ifdef AlikSevron
 
666
             b1=I[0]; b2=I[1];
 
667
#endif
 
668
             if(max_interval &&
 
669
                 (I[1]-I[0]<3 || !priznak && I[1]-I[0]<(width>>1) ||
 
670
                 (priznak==1 && max_interval>2 && (I[1]-I[0])<width/3)))
 
671
                 penalty++;
 
672
             if(width-up_max<=3 && width-dw_max<=3 && (up_max/3)>=I[1]-I[0])
 
673
                priz_seredini++;
 
674
                break;
 
675
      case 2:
 
676
             if(width-up_max<=3 && width-dw_max<=3 && (up_max/3)>=I[3]-I[0])
 
677
                priz_seredini++;
 
678
                break;
 
679
      default : break;
 
680
     }
 
681
   }
 
682
 
 
683
 if(priz2 && priz_k)  priznak--;
 
684
 if(priz_seredini>3)  priznak--;
 
685
 if(max_interval==4 && (sum<0 || priznak<2))     priznak-=2;
 
686
 if(max_interval>4) priznak-=2;
 
687
 if(penalty>1) priznak-=2;
 
688
 if(flag_qual && priznak>=2 && sum<0) sum=0;
 
689
 if(sum<0 ) --priznak;
 
690
 else       ++priznak;
 
691
 
 
692
 if(priz2<=1 && !flag_qual) priznak-=2;
 
693
// if(hgt && (l_priz+3)/hgt && priznak<2)  priznak-=2;
 
694
 if(((l_m[0] && l_m[1] && (r_m[0] || r_m[1]))  ||
 
695
     (r_m[0] && r_m[1] && (l_m[0] || l_m[1]))) && hgt>ok_K_hgt)   priznak--;
 
696
 if(!flag_qual && l_priz>hgt) priznak--;
 
697
 
 
698
#ifdef AlikSevron
 
699
  if(flag_qual && priznak>0) ++priznak;
 
700
  buf+=sprintf(buf,"step6: priznak=%d ",priznak);
 
701
#endif
 
702
#ifdef _bc_
 
703
if(flag_qual)
 
704
  {
 
705
   sprintf(snap,"step6: priznak=%d ",priznak);
 
706
   outtextxy(10,70,snap);
 
707
  }
 
708
#endif
 
709
 
 
710
end:
 
711
 
 
712
#ifdef AlikSevron
 
713
  buf+=sprintf(buf,"end: priznak=%d ",priznak);
 
714
  if(db_status && (db_trace_flag & 2) &&  snap_activity('e') )
 
715
   {
 
716
    snap_newcell(c);
 
717
    snap_show_text(snap);
 
718
    snap_monitor();
 
719
   }
 
720
#endif
 
721
 
 
722
 return priznak;
 
723
}
 
724