]> git.lyx.org Git - features.git/blob - src/3rdparty/hunspell/1.3.3/src/parsers/firstparser.cxx
add stripped down hunspell 1.3.3
[features.git] / src / 3rdparty / hunspell / 1.3.3 / src / parsers / firstparser.cxx
1 #include <cstdlib>
2 #include <cstring>
3 #include <cstdio>
4 #include <ctype.h>
5
6 #include "../hunspell/csutil.hxx"
7 #include "firstparser.hxx"
8
9 #ifndef W32
10 using namespace std;
11 #endif
12
13 FirstParser::FirstParser(const char * wordchars)
14 {
15         init(wordchars);
16 }
17
18 FirstParser::~FirstParser() 
19 {
20 }
21
22 char * FirstParser::next_token()
23 {
24         char * tabpos = strchr(line[actual],'\t');
25         if ((tabpos) && (tabpos - line[actual]>token))
26         {
27                 char * t = (char *) malloc(tabpos - line[actual] + 1);
28                 if (!t)
29                 {
30                     fprintf(stderr,"Error - Insufficient Memory\n");
31                     return NULL;
32                 }
33                 t[tabpos - line[actual]] = '\0';
34                 token = tabpos - line[actual] +1;
35                 return strncpy(t, line[actual], tabpos - line[actual]);
36         }
37         return NULL;
38 }