I never yet converted a header or added .def's to CVS. Any advice would be welcome.
I could not properly unpack or run the fbswig.exe v1c posted in the /tmp dir a while back. So I only converted a portion of the header by hand. I can email the full C header, or give more detail on which package to get it from if someone wants to help convert the whole thing.
I am going to (try anyway) use this package to spell check the wiki documenation.
'' aspell.bi
Code: Select all
'' aspell.bi - minimal conversion only, by hand. Just to test that this works.
#ifndef ASPELL_ASPELL__BI
#define ASPELL_ASPELL__BI
#inclib "aspell-15"
extern "C"
type AspellConfig as AspellConfig_
type AspellErrorInfo
isa as AspellErrorInfo ptr
mesg as zstring ptr
num_parms as uinteger
parms(2) as zstring ptr
end type
type AspellError
mesg as zstring ptr
err as AspellErrorInfo ptr
end type
type AspellCanHaveError as AspellCanHaveError_
type AspellSpeller as AspellSpeller_
type AspellWordList as AspellWordList_
type AspellFilter as AspellFilter_
type AspellStringEnumeration as AspellStringEnumeration_
declare function new_aspell_config() as AspellConfig ptr
declare sub delete_aspell_config( byval ths as AspellConfig ptr )
declare function aspell_config_replace(byval ths as AspellConfig ptr, byval key as zstring ptr, byval value as zstring ptr ) as integer
declare function aspell_error_number(byval ths as AspellCanHaveError ptr) as uinteger
declare function aspell_error_message(byval ths as AspellCanHaveError ptr) as zstring ptr
declare function aspell_error(byval ths as AspellCanHaveError ptr) as AspellError ptr
declare sub delete_aspell_can_have_error(byval ths as AspellCanHaveError ptr)
declare function new_aspell_speller(byval config as AspellConfig ptr) as AspellCanHaveError ptr
declare function to_aspell_speller(byval obj as AspellCanHaveError ptr) as AspellSpeller ptr
declare sub delete_aspell_speller(byval ths as AspellSpeller ptr)
declare function aspell_speller_check(byval ths as AspellSpeller ptr, byval word as zstring ptr, byval word_size as integer) as integer
declare function aspell_speller_suggest(byval ths as AspellSpeller ptr, byval word as zstring ptr, byval word_size as integer) as AspellWordList ptr
declare function aspell_word_list_elements(byval ths as AspellWordList ptr) as AspellStringEnumeration ptr
declare sub delete_aspell_string_enumeration(byval ths as AspellStringEnumeration ptr)
declare function aspell_string_enumeration_next(byval ths as AspellStringEnumeration ptr) as zstring ptr
end extern
#endif
Code: Select all
'' aspell_test.bas
#include "aspell.bi"
''' http://aspell.net/win32/
public sub aspell_test()
dim as AspellConfig ptr spell_config = new_aspell_config()
aspell_config_replace(spell_config, "lang", "en_CA")
dim as AspellSpeller ptr spell_checker = 0
dim as AspellCanHaveError ptr possible_err = new_aspell_speller(spell_config)
if (aspell_error_number(possible_err) <> 0) then
print aspell_error_message(possible_err)
end 1
else
spell_checker = to_aspell_speller(possible_err)
end if
' *** Not sure about this block
'dim as AspellConfig ptr spell_config2 = aspell_config_clone(spell_config)
'aspell_config_replace(spell_config2, "lang","nl")
'possible_err = new_aspell_speller(spell_config2)
'delete_aspell_config(spell_config2)
dim as integer correct
dim as AspellWordList ptr suggestions
dim as AspellStringEnumeration ptr elements
dim as zstring ptr word
dim as string input_word
do
input "Enter a word: ", input_word
if( len(input_word) = 0 ) then
exit do
end if
correct = aspell_speller_check(spell_checker, strptr(input_word), len(input_word))
if( correct <> 0 ) then
print "Correct"
else
print "Suggestions:"
suggestions = aspell_speller_suggest(spell_checker, strptr(input_word), len(input_word))
elements = aspell_word_list_elements(suggestions)
do
word = aspell_string_enumeration_next(elements)
if word = 0 then
exit do
end if
print " "; *word
loop
delete_aspell_string_enumeration(elements)
end if
' - Report the replacement
'aspell_speller_store_repl(spell_checker, misspelled_word, size,
' correctly_spelled_word, size);
' - Add to session or personal dictionary
'aspell_speller_add_to_session|personal(spell_checker, word, size)
loop
delete_aspell_speller(spell_checker)
end sub
#ifdef __FB_MAIN__
aspell_test()
#endif
Enter a word: workng
Suggestions:
working
workings
Wong
woken
wonk
working's
wrong
wicking
wonky
waking
work
worn
corking