aspell-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[aspell-devel] clear_session, store_replacement, and support


From: Bill Moseley
Subject: [aspell-devel] clear_session, store_replacement, and support
Date: Thu, 28 Jul 2005 14:24:21 -0700
User-agent: Mutt/1.5.9i

I'm going to try again, although I've not had much luck with support
here.  Type in "store_replacement" into google and you see two posts
to the Aspell lists that haven't had any response right at the top.
Should I be posting to the sf.net tracker, instead?

I'm the author of the Perl interface Text::Aspell, and as you might
imagine, I get quite a few emails about the module.  I'm no expert on
Aspell -- and the module is really a thin layer on top of the Aspell C
interface.  I'd like to help these people, but often I can't if I
cannot receive help from the Aspell developers.

The questions I referred to above are about store_replacement failing
to return a true value.  aspell.h has only this:

    int aspell_speller_store_replacement(struct AspellSpeller * ths, const char 
* mis, int mis_size, const char * cor, int cor_size);

And from my *brief* look at the code it seems as if it should return a
value indicating an error, although I didn't dig that deep:


extern "C" int aspell_speller_store_replacement(Speller * ths, const char * 
mis, int mis_size, const char * cor, int cor_size)
{
  ths->temp_str_0.clear();
  ths->to_internal_->convert(mis, mis_size, ths->temp_str_0);
  unsigned int s0 = ths->temp_str_0.size();
  ths->temp_str_1.clear();
  ths->to_internal_->convert(cor, cor_size, ths->temp_str_1);
  unsigned int s1 = ths->temp_str_1.size();
  PosibErr<bool> ret = 
ths->store_replacement(MutableString(ths->temp_str_0.mstr(), s0), 
MutableString(ths->temp_str_1.mstr(), s1));
  ths->err_.reset(ret.release_err());
  if (ths->err_ != 0) return -1;
  return ret.data;
}

Actually, I'm not clear what is expected as a return.  My Perl xs code
does this:

        RETVAL = aspell_speller_store_replacement(self->speller, word, -1, 
replacement, -1);
        if ( !RETVAL )
        {
            self->errnum = aspell_speller_error_number( (const AspellSpeller 
*)self->speller );
            strncpy(self->lastError, (char*) 
aspell_speller_error_message(self->speller), MAX_ERRSTR_LEN);
            XSRETURN_UNDEF;
        }

On linux that seems to run fine.  On some versions of BSD the
store_replacement code returns undefined back to Perl.  Oddly, when I
added a printf to print RETVAL before the if (!RETVAL) the problem
when away -- which made me think I cannot trust the return value.


Then today someone else emailed saying another test was failing.  When
running "make test" on the Perl module I add a new word to the
session, and then make sure that word is returned in the session.
Then I call clear_session() and then check if the word is then removed
from the session.  It's this last test that is failing -- the word is
still being returned from suggest().  The failure report is from
someone using OS X, and I've not been able to reproduce the problem in
other OS X machines.  And the word is not normally in their dictionary.

Am I not understanding clear_session()?  Or is there another reason the
word is not removed from the session?


Is there more than apsell.h and the page

  
http://aspell.sourceforge.net/man-html/Through-the-C-API.html#Through-the-C-API

to use as the API reference?


-- 
Bill Moseley
address@hidden





reply via email to

[Prev in Thread] Current Thread [Next in Thread]