VAOS Spellchecker API

The VAOS Spellchecker API is intended to be a standard API that can be provided by any DLL intended to provide spellchecking functionality for VAOS.

The API is defined by the file vaspeller.h, which can be found in the VA6/core/common directory. This is the only standard VA file that the spellchecker should need.

Note that this API is a C language API and not an object-oriented C++ API. It is written this way to simplify the process of dynamically loading the spellchecker DLL and resolving the function entrypoints (VA wraps this API with a C++ object interface internally).

Once VA has loaded the spellchecker DLL all that needs to be done to obtain a spellchecker object is to call the OpenSpeller function. OpenSpeller returns an opaque HSPELLER handle that identifies an instance of a spellcheker in the DLL. Other functions must pass a valid HSPELLER handle as a parameter.

These are the items defined in the file:

Session Management


typedef long HSPELLER;

HSPELLER is the opaque handle type sed to identify a spellchecker instance.


bool IsAvailable( HSPELLER handle );

Determines whether the spellchecker is available. Returns false if the VA spellchecker DLL is loaded but not initialized. VA must determine that the VA spellchecker DLL is itself loaded before calling this!


HSPELLER OpenSpeller( const char * inipath, int length, DWORD options, const char * language, int langlength );

Gets a handle to a new spellchecker object Each document should have its own spellchecker


void CloseSpeller( HSPELLER speller );

Closes the specified spellchecker. Frees resources in the library.



bool CheckSpelling( HSPELLER speller, const char * pWord, int length );

Check the spelling of a given word. Returns true if the word is in the current dictionary, otherwise false


void AddWord( HSPELLER speller, const char * pWord, int length );

Adds a word to the user's personal dictionary (for the current language)


void AddSessionWord( HSPELLER speller, const char * pWord, int length );

Adds a word to the current session dictionary (as for "ignore all")


void AddReplacement( HSPELLER speller, const char *pBad, int lBad, const char *pGood, int lGood );

Adds a word and its correct spelling to the replacement dictionary

WORDLIST functions

When the spellchecker is asked to form a list of suggestions it constructs a list of words and returns them one at a time. An opaque handle type WORDLIST identifies the current list of words.


HSPELLER GetSuggestionList( HSPELLER speller, const char *pBad, int length );

Generates a list of suggested correct spellings for a misspelt word, and returns a handle to that list.


const char * GetNextWord( HSPELLER list );

Gets the next word from the list, NULL if none are left.

Configuration interface


const char * GetSpellerName();

Gets a string representing the name (and version, if possible) of the spellchecker module


int Configure( HSPELLER handle, const char * inipath, int inilength );

Configure the spellchecker - receives the path to the VA configuration files so it can update ashmount.ini. This typically causes a dialog box to be displayed directly by the DLL, and may be used to set options that apply only to that specific spellchecker.


DWORD getOptions( HSPELLER handle );

Get the options bitmask configured in the spellchecker


void setOptions( HSPELLER handle, DWORD options );

Configure the spellchecker with the desired options


DWORD getOptionsMask( HSPELLER handle );

Get the options supported by the spellchecker (not currently used)


const char * getCurrLanguage( HSPELLER handle );

Get the currently configured spellchecker language.


bool setCurrLanguage( HSPELLER handle, const char * lang );

Set the spellchecker language.

This should return false if the language cannot be selected (isn't supported) but this is not guaranteed to work. The language name will be in some format acceptable to the DLL (as returned by getLanguageList).


const char * getLanguageList( HSPELLER handle );

get the languages supported by the spellchecker.

These are returned as a list of names in a buffer spearated by '|' characters, and terminated by a NUL.

For GNU ASpell the language are identified by ISO 639-2 names, possibly with qualifications, these are the names of ASpell's ".multi" dictionary files.

E.g. "en_GB" or "en_GB-w-accents"

devinfo/spellcheckerapi.txt · Last modified: 01.09.2011 16:42 by daniel
Recent changes RSS feed Driven by DokuWiki