Fixed Issue #138: "Format patch" in "Show log" dialog doesn't work
[TortoiseGit.git] / ext / hunspell / mythes.hxx
blob10ae4331f622c65acf60d327952d84001a831be7
1 #ifndef _MYTHES_HXX_
2 #define _MYTHES_HXX_
4 // some maximum sizes for buffers
5 #define MAX_WD_LEN 200
6 #define MAX_LN_LEN 16384
9 // a meaning with definition, count of synonyms and synonym list
10 struct mentry {
11 char* defn;
12 int count;
13 char** psyns;
17 class MyThes
20 int nw; /* number of entries in thesaurus */
21 char** list; /* stores word list */
22 unsigned int* offst; /* stores offset list */
23 char * encoding; /* stores text encoding; */
25 FILE *pdfile;
27 // disallow copy-constructor and assignment-operator for now
28 MyThes();
29 MyThes(const MyThes &);
30 MyThes & operator = (const MyThes &);
32 public:
33 MyThes(const char* idxpath, const char* datpath);
34 ~MyThes();
36 // lookup text in index and return number of meanings
37 // each meaning entry has a defintion, synonym count and pointer
38 // when complete return the *original* meaning entry and count via
39 // CleanUpAfterLookup to properly handle memory deallocation
41 int Lookup(const char * pText, int len, mentry** pme);
43 void CleanUpAfterLookup(mentry** pme, int nmean);
45 char* get_th_encoding();
47 private:
48 // Open index and dat files and load list array
49 int thInitialize (const char* indxpath, const char* datpath);
51 // internal close and cleanup dat and idx files
52 int thCleanup ();
54 // read a text line (\n terminated) stripping off line terminator
55 int readLine(FILE * pf, char * buf, int nc);
57 // binary search on null terminated character strings
58 int binsearch(char * wrd, char* list[], int nlst);
60 // string duplication routine
61 char * mystrdup(const char * p);
63 // remove cross-platform text line end characters
64 void mychomp(char * s);
66 // return index of char in string
67 int mystr_indexOfChar(const char * d, int c);
71 #endif