
   #[1]next [2]previous [3]up [4]next
   
   [5][Next] [6][Up] [7][Previous] [8][Contents]
   Next: [9]5. International Support Up: [10]Aspell .27.2 alpha A
   Previous: [11]3. The Aspell utility   [12]Contents
   Subsections
     * [13]4.1 The C++ Library
     * [14]4.2 The C Library Interface
     * [15]4.3 Notes About Thread Safety
     _________________________________________________________________
   
                             4. Library Interface
                                       
                              4.1 The C++ Library
                                       
   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)
   
                          4.2 The C Library Interface
                                       
   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 *wo
          rd);
            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
          
                         4.3 Notes About Thread Safety
                                       
   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.
     _________________________________________________________________
   
   [16][Next] [17][Up] [18][Previous] [19][Contents]
   Next: [20]5. International Support Up: [21]Aspell .27.2 alpha A
   Previous: [22]3. The Aspell utility   [23]Contents
   
   
    1999-03-01

References

   1. file://localhost/home/kevina/devel/aspell/manual/man-html/5_International.html
   2. file://localhost/home/kevina/devel/aspell/manual/man-html/3_Aspell.html
   3. file://localhost/home/kevina/devel/aspell/manual/man-html/manual.html
   4. file://localhost/home/kevina/devel/aspell/manual/man-html/5_International.html
   5. file://localhost/home/kevina/devel/aspell/manual/man-html/5_International.html
   6. file://localhost/home/kevina/devel/aspell/manual/man-html/manual.html
   7. file://localhost/home/kevina/devel/aspell/manual/man-html/3_Aspell.html
   8. file://localhost/home/kevina/devel/aspell/manual/man-html/Contents.html
   9. file://localhost/home/kevina/devel/aspell/manual/man-html/5_International.html
  10. file://localhost/home/kevina/devel/aspell/manual/man-html/manual.html
  11. file://localhost/home/kevina/devel/aspell/manual/man-html/3_Aspell.html
  12. file://localhost/home/kevina/devel/aspell/manual/man-html/Contents.html
  13. file://localhost/home/kevina/devel/aspell/manual/man-html/4_Library.html#SECTION00510000000000000000
  14. file://localhost/home/kevina/devel/aspell/manual/man-html/4_Library.html#SECTION00520000000000000000
  15. file://localhost/home/kevina/devel/aspell/manual/man-html/4_Library.html#SECTION00530000000000000000
  16. file://localhost/home/kevina/devel/aspell/manual/man-html/5_International.html
  17. file://localhost/home/kevina/devel/aspell/manual/man-html/manual.html
  18. file://localhost/home/kevina/devel/aspell/manual/man-html/3_Aspell.html
  19. file://localhost/home/kevina/devel/aspell/manual/man-html/Contents.html
  20. file://localhost/home/kevina/devel/aspell/manual/man-html/5_International.html
  21. file://localhost/home/kevina/devel/aspell/manual/man-html/manual.html
  22. file://localhost/home/kevina/devel/aspell/manual/man-html/3_Aspell.html
  23. file://localhost/home/kevina/devel/aspell/manual/man-html/Contents.html
