]> git.lyx.org Git - lyx.git/blobdiff - src/spellchecker.C
fix "make dist" target
[lyx.git] / src / spellchecker.C
index f986e556ff5ffbc0ef960921b75a2c179da14515..030cbc4aca68433c49e657f1a8f955e21bad3871 100644 (file)
@@ -72,6 +72,8 @@
 using std::reverse;
 using std::endl;
 
+namespace {
+
 // Spellchecker status
 enum {
        ISP_OK = 1,
@@ -82,19 +84,20 @@ enum {
        ISP_IGNORE
 };
 
-static bool RunSpellChecker(BufferView * bv);
+bool RunSpellChecker(BufferView * bv);
 
 #ifndef USE_PSPELL
 
-static FILE * in, * out;  /* streams to communicate with ispell */
+FILE * in;
+FILE * out;  /* streams to communicate with ispell */
 pid_t isp_pid = -1; // pid for the `ispell' process. Also used (RO) in
                     // lyx_cb.C
 
 // the true spell checker program being used
 enum ActualSpellChecker {ASC_ISPELL, ASC_ASPELL};
-static ActualSpellChecker actual_spell_checker;
+ActualSpellChecker actual_spell_checker;
 
-static int isp_fd;
+int isp_fd;
 
 #else
 
@@ -102,6 +105,9 @@ PspellManager * sc;
 
 #endif
 
+} // namespace anon
+
+
 // Non-static so that it can be redrawn if the xforms colors are re-mapped
 FD_form_spell_options *fd_form_spell_options = 0;
 FD_form_spell_check *fd_form_spell_check = 0;
@@ -280,13 +286,14 @@ void SpellCheckerOptions()
        }
 }
 
+namespace {
+
 #ifndef USE_PSPELL
 
 /***** Spellchecker *****/
 
 // Could also use a clean up. (Asger Alstrup)
 
-static
 void init_spell_checker(BufferParams const & params, string const & lang)
 {
        static char o_buf[BUFSIZ];  // jc: it could be smaller
@@ -478,19 +485,19 @@ void init_spell_checker(BufferParams const & params, string const & lang)
        }
 }
 
-static
+
 bool sc_still_alive() {
        return isp_pid != -1;
 }
 
-static
+
 void sc_clean_up_after_error() 
 {
        ::fclose(out);
 }
 
+
 // Send word to ispell and get reply
-static
 isp_result * sc_check_word(string const & word)
 {
        //Please rewrite to use string.
@@ -545,7 +552,7 @@ isp_result * sc_check_word(string const & word)
 }
 
 
-static inline 
+inline 
 void close_spell_checker()
 {
         // Note: If you decide to optimize this out when it is not 
@@ -560,7 +567,7 @@ void close_spell_checker()
 }
 
 
-static inline 
+inline 
 void sc_insert_word(string const & word)
 {
        ::fputc('*', out); // Insert word in personal dictionary
@@ -569,7 +576,7 @@ void sc_insert_word(string const & word)
 }
 
 
-static inline 
+inline 
 void sc_accept_word(string const & word) 
 {
        ::fputc('@', out); // Accept in this session
@@ -577,7 +584,8 @@ void sc_accept_word(string const & word)
        ::fputc('\n', out);
 }
 
-static inline
+
+inline
 void sc_store_replacement(string const & mis, string const & cor) {
         if (actual_spell_checker == ASC_ASPELL) {
                 ::fputs("$$ra ", out);
@@ -592,7 +600,6 @@ void sc_store_replacement(string const & mis, string const & cor) {
 
 PspellCanHaveError * spell_error_object;
 
-static
 void init_spell_checker(BufferParams const &, string const & lang)
 {
        PspellConfig * config = new_pspell_config();
@@ -609,12 +616,12 @@ void init_spell_checker(BufferParams const &, string const & lang)
        }
 }
 
-static 
+
 bool sc_still_alive() {
        return true;
 }
 
-static
+
 void sc_clean_up_after_error() 
 {
        delete_pspell_can_have_error(spell_error_object);
@@ -623,20 +630,21 @@ void sc_clean_up_after_error()
 
 
 // Send word to pspell and get reply
-static
 isp_result * sc_check_word(string const & word)
 {
        isp_result * result = new isp_result;
+#ifdef WITH_WARNINGS
 #warning Why isnt word_ok a bool? (Lgb)
+#endif
        int word_ok = pspell_manager_check(sc, word.c_str());
-       Assert(word_ok != -1);
+       lyx::Assert(word_ok != -1);
 
        if (word_ok) {
                result->flag = ISP_OK;
        } else {
                PspellWordList const * sugs =
                        pspell_manager_suggest(sc, word.c_str());
-               Assert(sugs != 0);
+               lyx::Assert(sugs != 0);
                result->els = pspell_word_list_elements(sugs);
                if (pspell_word_list_empty(sugs)) 
                        result->flag = ISP_UNKNOWN;
@@ -647,28 +655,28 @@ isp_result * sc_check_word(string const & word)
 }
 
 
-static inline 
+inline 
 void close_spell_checker()
 {
        pspell_manager_save_all_word_lists(sc);
 }
 
 
-static inline 
+inline 
 void sc_insert_word(string const & word)
 {
        pspell_manager_add_to_personal(sc, word.c_str());
 }
 
 
-static inline 
+inline 
 void sc_accept_word(string const & word) 
 {
        pspell_manager_add_to_session(sc, word.c_str());
 }
 
 
-static inline 
+inline 
 void sc_store_replacement(string const & mis, string const & cor)
 {
        pspell_manager_store_replacement(sc, mis.c_str(), cor.c_str());
@@ -676,6 +684,9 @@ void sc_store_replacement(string const & mis, string const & cor)
 
 #endif
 
+} // namespace anon
+
+
 void ShowSpellChecker(BufferView * bv)
 {
        FL_OBJECT * obj;
@@ -792,19 +803,14 @@ void ShowSpellChecker(BufferView * bv)
 
 
 // Perform a spell session
-static
+namespace {
+
 bool RunSpellChecker(BufferView * bv)
 {
        isp_result * result;
        int newvalue;
        FL_OBJECT * obj;
 
-#ifndef NEW_INSETS
-       // Open all floats
-        bv->allFloats(1, 0);
-        bv->allFloats(1, 1);
-#endif
-
 #ifdef USE_PSPELL
        string tmp = (lyxrc.isp_use_alt_lang) ?
            lyxrc.isp_alt_lang : bv->buffer()->params.language->code();
@@ -966,6 +972,8 @@ bool RunSpellChecker(BufferView * bv)
        }
 }
 
+} // namespace anon
+
 #ifdef WITH_WARNINGS
 #warning should go somewhere more sensible
 #endif
@@ -982,3 +990,5 @@ void sigchldhandler(pid_t pid, int * status)
 #endif
        sigchldchecker(pid, status);
 }
+
+