Line data Source code
1 : /* ***** BEGIN LICENSE BLOCK *****
2 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 : *
4 : * Copyright (C) 2002-2017 Németh László
5 : *
6 : * The contents of this file are subject to the Mozilla Public License Version
7 : * 1.1 (the "License"); you may not use this file except in compliance with
8 : * the License. You may obtain a copy of the License at
9 : * http://www.mozilla.org/MPL/
10 : *
11 : * Software distributed under the License is distributed on an "AS IS" basis,
12 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 : * for the specific language governing rights and limitations under the
14 : * License.
15 : *
16 : * Hunspell is based on MySpell which is Copyright (C) 2002 Kevin Hendricks.
17 : *
18 : * Contributor(s): David Einstein, Davide Prina, Giuseppe Modugno,
19 : * Gianluca Turconi, Simon Brouwer, Noll János, Bíró Árpád,
20 : * Goldman Eleonóra, Sarlós Tamás, Bencsáth Boldizsár, Halácsy Péter,
21 : * Dvornik László, Gefferth András, Nagy Viktor, Varga Dániel, Chris Halls,
22 : * Rene Engelhard, Bram Moolenaar, Dafydd Jones, Harri Pitkänen
23 : *
24 : * Alternatively, the contents of this file may be used under the terms of
25 : * either the GNU General Public License Version 2 or later (the "GPL"), or
26 : * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 : * in which case the provisions of the GPL or the LGPL are applicable instead
28 : * of those above. If you wish to allow use of your version of this file only
29 : * under the terms of either the GPL or the LGPL, and not to allow others to
30 : * use your version of this file under the terms of the MPL, indicate your
31 : * decision by deleting the provisions above and replace them with the notice
32 : * and other provisions required by the GPL or the LGPL. If you do not delete
33 : * the provisions above, a recipient may use your version of this file under
34 : * the terms of any one of the MPL, the GPL or the LGPL.
35 : *
36 : * ***** END LICENSE BLOCK ***** */
37 :
38 : #ifndef ATYPES_HXX_
39 : #define ATYPES_HXX_
40 :
41 : #ifndef HUNSPELL_WARNING
42 : #include <stdio.h>
43 : #ifdef HUNSPELL_WARNING_ON
44 : #define HUNSPELL_WARNING fprintf
45 : #else
46 : // empty inline function to switch off warnings (instead of the C99 standard
47 : // variadic macros)
48 0 : static inline void HUNSPELL_WARNING(FILE*, const char*, ...) {}
49 : #endif
50 : #endif
51 :
52 : // HUNSTEM def.
53 : #define HUNSTEM
54 :
55 : #include "w_char.hxx"
56 : #include <algorithm>
57 : #include <string>
58 : #include <vector>
59 :
60 : #define SETSIZE 256
61 : #define CONTSIZE 65536
62 :
63 : // AffEntry options
64 : #define aeXPRODUCT (1 << 0)
65 : #define aeUTF8 (1 << 1)
66 : #define aeALIASF (1 << 2)
67 : #define aeALIASM (1 << 3)
68 : #define aeLONGCOND (1 << 4)
69 :
70 : // compound options
71 : #define IN_CPD_NOT 0
72 : #define IN_CPD_BEGIN 1
73 : #define IN_CPD_END 2
74 : #define IN_CPD_OTHER 3
75 :
76 : // info options
77 : #define SPELL_COMPOUND (1 << 0)
78 : #define SPELL_FORBIDDEN (1 << 1)
79 : #define SPELL_ALLCAP (1 << 2)
80 : #define SPELL_NOCAP (1 << 3)
81 : #define SPELL_INITCAP (1 << 4)
82 : #define SPELL_ORIGCAP (1 << 5)
83 : #define SPELL_WARN (1 << 6)
84 :
85 : #define MINCPDLEN 3
86 : #define MAXCOMPOUND 10
87 : #define MAXCONDLEN 20
88 : #define MAXCONDLEN_1 (MAXCONDLEN - sizeof(char*))
89 :
90 : #define MAXACC 1000
91 :
92 : #define FLAG unsigned short
93 : #define FLAG_NULL 0x00
94 : #define FREE_FLAG(a) a = 0
95 :
96 : #define TESTAFF(a, b, c) (std::binary_search(a, a + c, b))
97 :
98 : struct guessword {
99 : char* word;
100 : bool allow;
101 : char* orig;
102 : };
103 :
104 : typedef std::vector<std::string> mapentry;
105 : typedef std::vector<FLAG> flagentry;
106 :
107 0 : struct patentry {
108 : std::string pattern;
109 : std::string pattern2;
110 : std::string pattern3;
111 : FLAG cond;
112 : FLAG cond2;
113 0 : patentry()
114 0 : : cond(FLAG_NULL)
115 0 : , cond2(FLAG_NULL) {
116 0 : }
117 : };
118 :
119 : #endif
|