[Next]
[Up]
[Previous]
[Contents]
Next: 5. International Support
Up: Aspell .27.2 alpha A
Previous: 3. The Aspell utility
  Contents
Subsections
The new C++ library makes heavy use of modern C++ features and the STL. All
functions unless otherwise stated my though somehing inherated from aspell_object
so you should be prepered to catch them. Documenation should be completed soon.
For right now please see the header files installed with the distribution (usually
under /usr/local/include/aspell/). For exampels of how to use the C++ please
see the source for the aspell utility (located under src/aspell.cc)
I am also providing a C interface so that C programmers can use my library without
a lot of hassle. Unfortunately because my actually library is C++ code there
are several cravats to linking C to C++ code according to the C++FAQ Lite:
- Your must use your C++ compiler when compiling main() (e.g., for static initialization)
- Your C++ compiler should direct the linking process (e.g., so it can get its
special libraries)
- Your C and C++ compilers probably need to come from same vendor and have compatible
versions (e.g., so they have the same calling conventions)
However depending on the compiler and/or linker you are using you may be able
to get away with not doing one or more of these things. Your mileage may vary.
Unfortally due to a major rewrite of the C++ library the C library is
currently unavailable. I hope to have it back in a release or two.
The C interface library is still not 100 percent finished yet so for now here
is the header file aspell-c.h which should give you a rough idea of
how to use it. Link your code with libaspell to use.
- #include <stdlib.h>
typedef struct aspell aspell;
typedef struct SC_Error aspellError;
typedef enum aspellProblem {
as_none, as_nonexistent, as_bad_format,
as_cant_write, as_duplicates,
as_unknown_lang, as_mismatched_lang
} aspellProblem;
typedef const char * aspellString;
typedef struct aspellSuggestions {
size_t size;
aspellString * data; /* an array of size elements */
void *internal_obj;
} aspellSuggestions;
typedef struct aspellWordList {
size_t size;
aspellString * data;
void *internal_obj;
} aspellWordList;
#ifdef __cplusplus
extern "C" {
#endif
aspell * aspell_new(const char *master, const char *personal);
void aspell_free(aspell *sc);
const aspellError * aspell_error(aspell *sc);
const char * aspell_lang_name(aspell *sc);
aspellSuggestions * aspell_suggest(aspell *sc, const char *word);
int aspell_check(aspell *sc, const char *word);
int aspell_check_raw(aspell *sc, const char *word);
void aspell_add_personal(aspell *sc, const char *word);
void aspell_add_session(aspell *sc, const char *word);
void aspell_save_personal(aspell *sc);
void aspell_clear_session(aspell *sc);
void aspell_change_personal(aspell *sc, const char *base);
aspellWordList * get_personal(aspell *sc); /* not implemented yet */
aspellWordList * get_session(aspell *sc); /* not implemented yet */
void aspell_free_suggestions(aspellSuggestions *wl);
void aspell_free_word_list(aspellWordList *wl);
const char * aspell_error_file(const aspellError *error);
const char * aspell_error_addinfo(const aspellError *error);
aspellProblem aspell_error_problem(const aspellError *error);
const char * aspell_error_message(const aspellError *error);
#ifdef __cplusplus
};
#endif
Read only Aspell methods and functions are thread safe as long as new, delete,
delete[], and STL allocators are thread safe. To the best of my knowledge
gcc and egcs meet these requirements. It is up to the programmer to make sure
multiple threads do not do thing such as change the dictionaries and add or
delete items from the personal or session dictionaries.
[Next]
[Up]
[Previous]
[Contents]
Next: 5. International Support
Up: Aspell .27.2 alpha A
Previous: 3. The Aspell utility
  Contents
1999-03-01