optical cleanup
[TortoiseGit.git] / ext / hunspell / hunspell.hxx
blob14fbef2f53301d1b78925d5758a7f6c91f7c34d0
1 #include "license.hunspell"
2 #include "license.myspell"
4 #include "hashmgr.hxx"
5 #include "affixmgr.hxx"
6 #include "suggestmgr.hxx"
7 #include "csutil.hxx"
8 #include "langnum.hxx"
9 //#include "config.h"
11 #define SPELL_COMPOUND (1 << 0)
12 #define SPELL_FORBIDDEN (1 << 1)
14 #define NOCAP 0
15 #define INITCAP 1
16 #define ALLCAP 2
17 #define HUHCAP 3
18 #define HUHINITCAP 4
20 #define MAXSUGGESTION 15
21 #define MAXSHARPS 5
23 #ifdef W32
24 #define DLLTEST2_API __declspec(dllexport)
25 #endif
27 #ifndef _MYSPELLMGR_HXX_
28 #define _MYSPELLMGR_HXX_
30 #ifdef W32
31 class DLLTEST2_API Hunspell
32 #else
33 class Hunspell
34 #endif
36 AffixMgr* pAMgr;
37 HashMgr* pHMgr;
38 SuggestMgr* pSMgr;
39 char * encoding;
40 struct cs_info * csconv;
41 int langnum;
42 int utf8;
43 int complexprefixes;
44 char** wordbreak;
46 public:
48 /* Hunspell(aff, dic) - constructor of Hunspell class
49 * input: path of affix file and dictionary file
52 Hunspell(const char * affpath, const char * dpath);
54 ~Hunspell();
56 /* spell(word) - spellcheck word
57 * output: 0 = bad word, not 0 = good word
59 * plus output:
60 * info: information bit array, fields:
61 * SPELL_COMPOUND = a compound word
62 * SPELL_FORBIDDEN = an explicit forbidden word
63 * root: root (stem), when input is a word with affix(es)
66 int spell(const char * word, int * info = NULL, char ** root = NULL);
68 /* suggest(suggestions, word) - search suggestions
69 * input: pointer to an array of strings pointer and the (bad) word
70 * array of strings pointer (here *slst) may not be initialized
71 * output: number of suggestions in string array, and suggestions in
72 * a newly allocated array of strings (*slts will be NULL when number
73 * of suggestion equals 0.)
76 int suggest(char*** slst, const char * word);
77 char * get_dic_encoding();
79 /* handling custom dictionary */
81 int put_word(const char * word);
83 /* pattern is a sample dictionary word
84 * put word into custom dictionary with affix flags of pattern word
87 int put_word_pattern(const char * word, const char * pattern);
89 /* other */
91 /* get extra word characters definied in affix file for tokenization */
92 const char * get_wordchars();
93 unsigned short * get_wordchars_utf16(int * len);
95 struct cs_info * get_csconv();
96 const char * get_version();
98 /* experimental functions */
100 #ifdef HUNSPELL_EXPERIMENTAL
101 /* suffix is an affix flag string, similarly in dictionary files */
103 int put_word_suffix(const char * word, const char * suffix);
105 /* morphological analysis */
107 char * morph(const char * word);
108 int analyze(char*** out, const char *word);
110 char * morph_with_correction(const char * word);
112 /* stemmer function */
114 int stem(char*** slst, const char * word);
116 /* spec. suggestions */
117 int suggest_auto(char*** slst, const char * word);
118 int suggest_pos_stems(char*** slst, const char * word);
119 char * get_possible_root();
120 #endif
122 private:
123 int cleanword(char *, const char *, int * pcaptype, int * pabbrev);
124 int cleanword2(char *, const char *, w_char *, int * w_len, int * pcaptype, int * pabbrev);
125 void mkinitcap(char *);
126 int mkinitcap2(char * p, w_char * u, int nc);
127 int mkinitsmall2(char * p, w_char * u, int nc);
128 void mkallcap(char *);
129 int mkallcap2(char * p, w_char * u, int nc);
130 void mkallsmall(char *);
131 int mkallsmall2(char * p, w_char * u, int nc);
132 struct hentry * checkword(const char *, int * info, char **root);
133 char * sharps_u8_l1(char * dest, char * source);
134 hentry * spellsharps(char * base, char *, int, int, char * tmp, int * info, char **root);
135 int is_keepcase(const hentry * rv);
136 int insert_sug(char ***slst, char * word, int *ns);
140 #endif