To use these functions you must #include "rspell.h" and link using -lrspell.
(eg gcc -lrspell myprog.o myotherfiles.o -o progname)
"filename" must be the path to the word list you wish to use as the dictionary. It reads in the words and creates the online dictionary for fast lookup. It returns FAIL(0) on failure, OK(1) on success, and will print any problems to stderr.
The word list is a file in byte format (eg ASCII, UTF-8) with one word per line. The end of line character (EOL) must be in Unix format, and the last word must have an EOL after it, or it will not be included in the dictionary.
The path can be full or relative, but the full path is recommended so the program can be run from any location.
If you call this function a second time before removing the first dictionary, the function will return zero (FAIL) and leave the current dictionary in memory. An error message will be printed to stderr.
"filename" is the path to the word list that a user can both read and write. It adds words to the online dictionary. It returns FAIL(0) on failure, OK(1) on success, and will print any problems to stderr.
It is recommended that the full path be used, though relative paths are allowed.
If you call this function a second time before removing the dictionary, it will return FAIL(0) and leave the current dictionary in place. An error message will be printed to stderr.
This function frees the memory taken up by the last dictionary initialised. This is useful if you wish to load more than one dictionary in your code, or are limited on memory.
If called before the dictionary is initialised, it does nothing.
"word" is a pointer to a null terminated word. The return value is 0 if the word is NOT in the dictionary, 1 if it is. The check is case insensitive for languages using the standard ASCII format.
If you have not initialised a dictionary before calling this function, or have called remove_dictionary, the function will always return 0.
"new_word" is a pointer to a null terminated word. The word is added to the dictionary in memory for the current session only. It will remain until "remove_dictionary" is called, or the program terminates.
It returns OK(1) for success, FAIL(0) for failure, and prints any problems to stderr.
"filename" is the path to the word list that a user can both read and write. "word" is the word you wish to add to the permanent user dictionary. The word will be appended to the file, but NOT added to the current online dictionary. (Use add_new_word_temp() to perform this action.) The word wil be in dictionary every subsequent time the user word list is added to the dictionary.
If the filename given does not exist, it will be created. The filename does not need to be the same as the user word list read in using add_user_dictionary(), though this is the most likely scenario.
The function returns FAIL(0) for failure or OK(1) for success, and prints any problems to stderr.
The system does not check to see if a word is already in the userlist-it is perfectly possible to add it twice. This will not cause errors in the program, but will simply use more memory as the word will exist twice in the dictionary.