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

« back to all changes in this revision

Viewing changes to cuneiform_src/Kern/rling/sources/c/spel2dic.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
 
 
58
/* FINDWORD.C  */
 
59
 
 
60
 
 
61
 
 
62
 
 
63
/*************************************************************************/
 
64
/*      access to dictionary from program "edconv"                       */
 
65
/*************************************************************************/
 
66
 
 
67
#include "spelmode.h"
 
68
 
 
69
#if defined(TURBO_C)
 
70
  #include "tc_types.h"
 
71
#elif defined(WATCOM)
 
72
  #include "spelwatc.h"
 
73
#else
 
74
  #error   NO TOOOL SPECIFIED
 
75
#endif
 
76
#include "speldefs.h"
 
77
#include "spelfunc.h"
 
78
 
 
79
extern  BYTE alphabet[][ABCSIZE];
 
80
 
 
81
 
 
82
extern KEYTYPE codetable[256];
 
83
extern KEYTYPE codepermit[256];
 
84
/*************************************************************************/
 
85
/*              decoding & search word in dictionary                     */
 
86
/*************************************************************************/
 
87
INT findstat(INT * currw,LTIMG * wrddef[],
 
88
             struct dict_state * dict)
 
89
{ KEYTYPE wordin[MAX_WORD_SIZE],c;
 
90
  register INT i;
 
91
 
 
92
  /* ---------- decoding input word -----------------------------------*/
 
93
  for (i=0; i<=*currw ;i++)
 
94
   {
 
95
    c=wrddef[i]->lt->code;
 
96
    if (codepermit[c])
 
97
      wordin[i]=codetable[c];
 
98
    else
 
99
    { *currw=i;
 
100
     return 0;                  /* symbol is not in codetable */
 
101
     }
 
102
   }
 
103
  /* ---------- search word in dictionary -----------------------------*/
 
104
  return (search(wordin,currw,wrddef,dict));
 
105
}
 
106
 
 
107
/*************************************************************************/
 
108
/*              decoding & search text word in dictionary                */
 
109
/*      WARRNING !!! Only for 32-bits mode because load_dict points to   */
 
110
/*                      far memory                                       */
 
111
/*************************************************************************/
 
112
extern struct dict_state  * load_dict;
 
113
extern INT vocs_NOK;   // 0 - vocs found at load
 
114
 
 
115
INT text_findstat_rling(CHAR * word)
 
116
{ KEYTYPE wordin[MAX_WORD_SIZE],c;
 
117
  LTIMG * wrddef[MAX_WORD_SIZE+1], *p;
 
118
  LTIMG wrdim[MAX_WORD_SIZE];
 
119
  struct letter lt[MAX_WORD_SIZE];
 
120
  INT i;
 
121
  if (vocs_NOK) return 0;
 
122
  /* ---------- decoding input word -----------------------------------*/
 
123
  for (i=0; *word ;i++, word++)
 
124
   {
 
125
    if (i >= MAX_WORD_SIZE) return 0;
 
126
    c=*word;            if (c == 0) break;
 
127
    lt[i].code = c;     lt[i].attr = 255;
 
128
    p=&wrdim[i];
 
129
    wrddef[i] = p;
 
130
    p->lt = lt + i;     p->blank = 0;
 
131
 
 
132
    if (codepermit[c])  wordin[i]=codetable[c];
 
133
    else                return 0;       /* symbol is not in codetable */
 
134
   }
 
135
  /* ---------- search word in dictionary -----------------------------*/
 
136
  wrddef[i] = 0;
 
137
  i--;
 
138
  return (search(wordin,&i,wrddef,load_dict));
 
139
}
 
140
 
 
141
/*************************************************************************/
 
142
/*                           end of file                                 */
 
143
/*************************************************************************/