[libvoikko] VoikkoGrammarError and voikkoGetGrammarErrorShortDescription
Francis Tyers
ftyers at prompsit.com
Wed Nov 6 17:18:18 EET 2013
El dl 04 de 11 de 2013 a les 18:14 +0200, en/na Harri Pitkänen va
escriure:
> On Monday 04 November 2013 15:20:36 Francis Tyers wrote:
> > At the moment VoikkoGrammarError is typedeffed as voikko_grammar_error.
> >
> > I would like to add 'char *title' to voikko_grammar_error, would this be
> > ok ?
>
> The exact layout of voikko_grammar_error is visible to client code through
> deprecated API and thus it cannot be changed. But you can change
> VoikkoGrammarError:
>
> typedef struct {
> voikko_grammar_error legacyError;
> char * title;
> GrammarChecker * checker;
> } VoikkoGrammarError;
>
> (Actually VoikkoGrammarError could just as well be turned into a class.)
> You need the reference to the grammar checker that created the error so that
> in voikkoGetGrammarErrorShortDescription you can do something like
>
> error->checker->translateErrorTitle(error->title, language);
Hey, I tried doing this (adding VoikkoGrammarError as a class), but I
keep getting stuck with "does not name a type" errors. For both
"GrammarChecker" and "VoikkoGrammarError".
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -g -O2
-fvisibility=hidden -I/home/fran/local/include
-I/home/fran/local/include/ -Wall -Werror -pedantic -MT
spellchecker/spell.lo -MD -MP -MF spellchecker/.deps/spell.Tpo -c
spellchecker/spell.cpp -fPIC -DPIC -o spellchecker/.libs/spell.o
In file included from ./grammar/CacheEntry.hpp:32:0,
from ./grammar/GcCache.hpp:32,
from ./grammar/RuleEngine.hpp:32,
from ./grammar/GrammarChecker.hpp:32,
from ./setup/setup.hpp:39,
from spellchecker/spell.cpp:34:
./grammar/VoikkoGrammarError.hpp:46:2: error: 'GrammarChecker' does not
name a type
make[3]: *** [spellchecker/spell.lo] Error 1
and if I comment out GrammarChecker in VoikkoGrammarError:
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -g -O2
-fvisibility=hidden -I/home/fran/local/include
-I/home/fran/local/include/ -Wall -Werror -pedantic -MT grammar/error.lo
-MD -MP -MF grammar/.deps/error.Tpo -c grammar/error.cpp -fPIC -DPIC -o
grammar/.libs/error.o
In file included from ./grammar/GcCache.hpp:32:0,
from ./grammar/RuleEngine.hpp:32,
from ./grammar/GrammarChecker.hpp:32,
from ./grammar/VoikkoGrammarError.hpp:32,
from ./grammar/error.hpp:33,
from grammar/error.cpp:29:
./grammar/CacheEntry.hpp:48:3: error: 'VoikkoGrammarError' does not name
a type
grammar/error.cpp:123:71: error: 'VoikkoGrammarError' does not name a
type
grammar/error.cpp:123:92: error: ISO C++ forbids declaration of 'error'
with no type [-fpermissive]
make[3]: *** [grammar/error.lo] Error 1
If you get a moment could you take a look and see what I'm doing wrong ?
In the worst case I can hack around it, but I'd like to see if the
"proper" way will work first... :)
Fran
More information about the Libvoikko
mailing list