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)
48static 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// timelimit: max. ~1/4 sec (process time on Linux) for
99// for a suggestion, including max. ~/10 sec for a case
100// sensitive plain or compound word suggestion, within
101// ~1/20 sec long time consuming suggestion functions
102#define TIMELIMIT_GLOBAL (CLOCKS_PER_SEC / 4)
103#define TIMELIMIT_SUGGESTION (CLOCKS_PER_SEC / 10)
104#define TIMELIMIT (CLOCKS_PER_SEC / 20)
105#define MINTIMER 100
106#define MAXPLUSTIMER 100
107
108struct guessword {
109 char* word;
110 bool allow;
111 char* orig;
112};
113
114typedef std::vector<std::string> mapentry;
115typedef std::vector<FLAG> flagentry;
116
117struct patentry {
118 std::string pattern;
119 std::string pattern2;
120 std::string pattern3;
121 FLAG cond;
122 FLAG cond2;
123 patentry()
124 : cond(FLAG_NULL)
125 , cond2(FLAG_NULL) {
126 }
127};
128
129#endif
130

source code of include/hunspell/atypes.hxx