3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 1995 Matthias Ettrich
8 * Copyright 1995-1998 The LyX Team
10 * ======================================================
16 #pragma implementation
25 #include <sys/types.h>
27 #include FORMS_H_LOCATION
29 #if TIME_WITH_SYS_TIME
30 # include <sys/time.h>
34 # include <sys/time.h>
40 #ifdef HAVE_SYS_SELECT_H
41 # ifdef HAVE_STRINGS_H
42 // <strings.h> is needed at least on AIX because FD_ZERO uses bzero().
45 #include <sys/select.h>
52 #include "spellchecker.h"
56 #include "BufferView.h"
58 #include "lyx_gui_misc.h"
60 #include "support/lstrings.h"
63 //#define USE_PSPELL 1
65 #include <pspell/pspell.h>
71 // Spellchecker status
81 static bool RunSpellChecker(BufferView * bv);
85 static FILE * in, * out; /* streams to communicate with ispell */
86 pid_t isp_pid = -1; // pid for the `ispell' process. Also used (RO) in
89 // the true spell checker program being used
90 enum ActualSpellChecker {ASC_ISPELL, ASC_ASPELL};
91 static ActualSpellChecker actual_spell_checker;
101 static FD_form_spell_options *fd_form_spell_options = 0;
102 FD_form_spell_check *fd_form_spell_check = 0;
104 //void sigchldhandler(int sig);
105 void sigchldhandler(pid_t pid, int *status);
107 //extern void sigchldchecker(int sig);
108 extern void sigchldchecker(pid_t pid, int *status);
120 misses = static_cast<char**>(0);
131 PspellStringEmulation * els;
133 const char * next_miss();
139 delete_pspell_string_emulation(els);
143 const char * isp_result::next_miss()
145 return pspell_string_emulation_next(els);
150 const char * spell_error;
154 /***** Spellchecker options *****/
156 // Rewritten to use ordinary LyX xforms loop and OK, Apply and Cancel set,
157 // now also string. Amazing, eh? (Asger)
159 // Set (sane) values in form to current spellchecker options
160 void SpellOptionsUpdate()
162 // Alternate language
163 if (lyxrc.isp_alt_lang.empty()) {
164 lyxrc.isp_use_alt_lang = false;
166 fl_set_input(fd_form_spell_options->altlang_input,
167 lyxrc.isp_alt_lang.c_str());
169 if (lyxrc.isp_use_alt_lang) {
170 fl_set_button(fd_form_spell_options->buflang, 0);
171 fl_set_button(fd_form_spell_options->altlang, 1);
173 fl_set_button(fd_form_spell_options->buflang, 1);
174 fl_set_button(fd_form_spell_options->altlang, 0);
177 // Personal dictionary
178 if (lyxrc.isp_pers_dict.empty()) {
179 lyxrc.isp_use_pers_dict = false;
181 fl_set_input(fd_form_spell_options->perdict_input,
182 lyxrc.isp_pers_dict.c_str());
184 fl_set_button(fd_form_spell_options->perdict,
185 lyxrc.isp_use_pers_dict ? 1:0);
188 if (lyxrc.isp_esc_chars.empty()) {
189 lyxrc.isp_use_esc_chars = false;
191 fl_set_input(fd_form_spell_options->esc_chars_input,
192 lyxrc.isp_esc_chars.c_str());
194 fl_set_button(fd_form_spell_options->esc_chars,
195 lyxrc.isp_use_esc_chars ? 1:0);
198 fl_set_button(fd_form_spell_options->compounds,
199 lyxrc.isp_accept_compound ? 1 : 0);
200 fl_set_button(fd_form_spell_options->inpenc,
201 lyxrc.isp_use_input_encoding ? 1 : 0);
204 // Update spellchecker options
205 void SpellOptionsApplyCB(FL_OBJECT *, long)
207 // Build new status from form data
208 lyxrc.isp_use_alt_lang =
209 fl_get_button(fd_form_spell_options->altlang);
210 lyxrc.isp_use_pers_dict =
211 fl_get_button(fd_form_spell_options->perdict);
212 lyxrc.isp_accept_compound =
213 fl_get_button(fd_form_spell_options->compounds);
214 lyxrc.isp_use_esc_chars =
215 fl_get_button(fd_form_spell_options->esc_chars);
216 lyxrc.isp_use_input_encoding =
217 fl_get_button(fd_form_spell_options->inpenc);
219 // Update strings with data from input fields
221 fl_get_input(fd_form_spell_options->altlang_input);
222 lyxrc.isp_pers_dict =
223 fl_get_input(fd_form_spell_options->perdict_input);
224 lyxrc.isp_esc_chars =
225 fl_get_input(fd_form_spell_options->esc_chars_input);
228 SpellOptionsUpdate();
232 void SpellOptionsCancelCB(FL_OBJECT *, long)
234 fl_hide_form(fd_form_spell_options->form_spell_options);
238 void SpellOptionsOKCB(FL_OBJECT * ob, long data)
240 SpellOptionsApplyCB(ob, data);
241 SpellOptionsCancelCB(ob, data);
245 // Show spellchecker options form
246 void SpellCheckerOptions()
248 // Create form if nescessary
249 if (fd_form_spell_options == 0) {
250 fd_form_spell_options = create_form_form_spell_options();
251 // Make sure pressing the close box does not kill LyX. (RvdK)
252 fl_set_form_atclose(fd_form_spell_options->form_spell_options,
253 CancelCloseBoxCB, 0);
256 // Update form to current options
257 SpellOptionsUpdate();
259 // Focus in alternate language field
260 fl_set_focus_object(fd_form_spell_options->form_spell_options,
261 fd_form_spell_options->altlang_input);
264 if (fd_form_spell_options->form_spell_options->visible) {
265 fl_raise_form(fd_form_spell_options->form_spell_options);
267 fl_show_form(fd_form_spell_options->form_spell_options,
268 FL_PLACE_MOUSE, FL_FULLBORDER,
269 _("Spellchecker Options"));
276 /***** Spellchecker *****/
278 // Could also use a clean up. (Asger Alstrup)
281 void create_ispell_pipe(BufferParams const & params, string const & lang)
283 static char o_buf[BUFSIZ]; // jc: it could be smaller
284 int pipein[2], pipeout[2];
290 if(pipe(pipein) == -1 || pipe(pipeout) == -1) {
291 lyxerr << "LyX: Can't create pipe for spellchecker!" << endl;
295 if ((out = fdopen(pipein[1], "w")) == 0) {
296 lyxerr << "LyX: Can't create stream for pipe for spellchecker!"
301 if ((in = fdopen(pipeout[0], "r")) == 0) {
302 lyxerr <<"LyX: Can't create stream for pipe for spellchecker!"
307 setvbuf(out, o_buf, _IOLBF, BUFSIZ);
314 lyxerr << "LyX: Can't create child process for spellchecker!"
321 dup2(pipein[0], STDIN_FILENO);
322 dup2(pipeout[1], STDOUT_FILENO);
329 char * tmp = new char[lyxrc.isp_command.length() + 1];
330 lyxrc.isp_command.copy(tmp, lyxrc.isp_command.length());
331 tmp[lyxrc.isp_command.length()] = '\0';
334 string("-a").copy(tmp, 2); tmp[2] = '\0'; // pipe mode
337 if (lang != "default") {
339 string("-d").copy(tmp, 2); tmp[2] = '\0'; // Dictionary file
341 tmp = new char[lang.length() + 1];
342 lang.copy(tmp, lang.length()); tmp[lang.length()] = '\0';
346 if (lyxrc.isp_accept_compound) {
347 // Consider run-together words as legal compounds
349 string("-C").copy(tmp, 2); tmp[2] = '\0';
352 // Report run-together words with
353 // missing blanks as errors
355 string("-B").copy(tmp, 2); tmp[2] = '\0';
358 if (lyxrc.isp_use_esc_chars) {
359 // Specify additional characters that
360 // can be part of a word
362 string("-w").copy(tmp, 2); tmp[2] = '\0';
364 // Put the escape chars in ""s
365 string tms = "\"" + lyxrc.isp_esc_chars + "\"";
366 tmp = new char[tms.length() + 1];
367 tms.copy(tmp, tms.length()); tmp[tms.length()] = '\0';
370 if (lyxrc.isp_use_pers_dict) {
371 // Specify an alternate personal dictionary
373 string("-p").copy(tmp, 2);
376 tmp = new char[lyxrc.isp_pers_dict.length() + 1];
377 lyxrc.isp_pers_dict.copy(tmp, lyxrc.isp_pers_dict.length());
378 tmp[lyxrc.isp_pers_dict.length()] = '\0';
381 if (lyxrc.isp_use_input_encoding &&
382 params.inputenc != "default") {
383 string enc = (params.inputenc == "auto")
384 ? params.language_info->encoding()->LatexName()
386 string::size_type n = enc.length();
388 string("-T").copy(tmp, 2); tmp[2] = '\0';
389 argv[argc++] = tmp; // Input encoding
390 tmp = new char[n + 1];
398 execvp(argv[0], const_cast<char * const *>(argv));
400 // free the memory used by string::copy in the
402 for (int i= 0; i < argc -1; ++i)
405 lyxerr << "LyX: Failed to start ispell!" << endl;
409 /* Parent process: Read ispells identification message */
410 // Hmm...what are we using this id msg for? Nothing? (Lgb)
411 // Actually I used it to tell if it's truly Ispell or if it's
412 // aspell -- (kevinatk@home.com)
418 FD_SET(pipeout[0], &infds);
419 tv.tv_sec = 15; // fifteen second timeout. Probably too much,
420 // but it can't really hurt.
423 // Configure provides us with macros which are supposed to do
424 // the right typecast.
425 retval = select(SELECT_TYPE_ARG1 (pipeout[0]+1),
426 SELECT_TYPE_ARG234 (&infds),
429 SELECT_TYPE_ARG5 (&tv));
432 // Ok, do the reading. We don't have to FD_ISSET since
433 // there is only one fd in infds.
434 fgets(buf, 2048, in);
436 // determine if the spell checker is really Aspell
437 if (strstr(buf, "Aspell"))
438 actual_spell_checker = ASC_ASPELL;
440 actual_spell_checker = ASC_ISPELL;
442 } else if (retval == 0) {
443 // timeout. Give nice message to user.
444 lyxerr << "Ispell read timed out, what now?" << endl;
445 // This probably works but could need some thought
447 close(pipeout[0]); close(pipeout[1]);
448 close(pipein[0]); close(pipein[1]);
451 // Select returned error
452 lyxerr << "Select on ispell returned error, what now?" << endl;
457 // Send word to ispell and get reply
459 isp_result *ispell_check_word(char *word)
461 //Please rewrite to use string.
469 fgets(buf, 1024, in);
471 /* I think we have to check if ispell is still alive here because
472 the signal-handler could have disabled blocking on the fd */
473 if (isp_pid == -1) return 0;
475 result = new isp_result;
478 case '*': // Word found
479 result->flag = ISP_OK;
481 case '+': // Word found through affix removal
482 result->flag = ISP_ROOT;
484 case '-': // Word found through compound formation
485 result->flag = ISP_COMPOUNDWORD;
487 case '\n': // Number or when in terse mode: no problems
488 result->flag = ISP_IGNORE;
490 case '#': // Not found, no near misses and guesses
491 result->flag = ISP_UNKNOWN;
493 case '?': // Not found, and no near misses, but guesses (guesses are ignored)
494 case '&': // Not found, but we have near misses
496 result->flag = ISP_MISSED;
498 // nb is leaked! where should it be freed? I have to
499 // admit I do not understand the intent of the code :(
501 char * nb = new char[result->str.length() + 1];
502 result->str.copy(nb, result->str.length());
503 nb[result->str.length()]= '\0';
504 p = strpbrk(nb+2, " ");
505 sscanf(p, "%d", &count); // Get near misses count
506 result->count = count;
507 if (count) result->misses = new char*[count];
508 p = strpbrk(nb, ":");
510 for (i = 0; i < count; ++i) {
511 result->misses[i] = p;
512 p = strpbrk(p, ",\n");
518 default: // This shouldn't happend, but you know Murphy
519 result->flag = ISP_UNKNOWN;
523 if (result->flag!= ISP_IGNORE) {
524 while (*buf!= '\n') fgets(buf, 255, in); /* wait for ispell to finish */
531 void ispell_terminate()
533 // Note: If you decide to optimize this out when it is not
534 // needed please note that when Aspell is used this command
535 // is also needed to save the replacement dictionary.
536 // -- Kevin Atkinson (kevinatk@home.com)
538 fputs("#\n", out); // Save personal dictionary
546 void ispell_terse_mode()
548 fputs("!\n", out); // Set terse mode (silently accept correct words)
553 void ispell_insert_word(char const *word)
555 fputc('*', out); // Insert word in personal dictionary
562 void ispell_accept_word(char const *word)
564 fputc('@', out); // Accept in this session
570 void ispell_store_replacement(char const *mis, string const & cor) {
571 if(actual_spell_checker == ASC_ASPELL) {
575 fputs(cor.c_str(), out);
582 PspellCanHaveError * spell_error_object;
585 void init_spell_checker(string const & /* lang */)
587 PspellConfig * config = new_pspell_config();
588 spell_error_object = new_pspell_manager(config);
589 if (pspell_error_number(spell_error_object) != 0) {
590 spell_error = pspell_error_message(spell_error_object);
593 sc = to_pspell_manager(spell_error_object);
594 spell_error_object = 0;
599 bool sc_still_alive() {
604 void sc_clean_up_after_error()
606 delete_pspell_can_have_error(spell_error_object);
611 // Send word to ispell and get reply
613 isp_result * sc_check_word(char *word)
615 isp_result * result = new isp_result;
616 int word_ok = pspell_manager_check(sc, word);
617 assert(word_ok != -1);
621 result->flag = ISP_OK;
625 const PspellWordList * sugs = pspell_manager_suggest(sc, word);
627 result->els = pspell_word_list_elements(sugs);
628 if (pspell_word_list_empty(sugs))
629 result->flag = ISP_UNKNOWN;
631 result->flag = ISP_MISSED;
639 inline void close_spell_checker()
641 pspell_manager_save_all_word_lists(sc);
646 inline void sc_insert_word(char const *word)
648 pspell_manager_add_to_personal(sc, word);
653 inline void sc_accept_word(char const *word)
655 pspell_manager_add_to_personal(sc, word);
659 inline void sc_store_replacement(char const *mis, string const & cor) {
660 pspell_manager_store_replacement(sc, mis, cor.c_str());
665 void ShowSpellChecker(BufferView * bv)
670 // Exit if we don't have a document open
671 if (!bv->available())
674 if (fd_form_spell_check == 0) {
675 fd_form_spell_check = create_form_form_spell_check();
676 // Make sure pressing the close box does not kill LyX. (RvdK)
677 fl_set_form_atclose(fd_form_spell_check->form_spell_check,
678 CancelCloseBoxCB, 0);
682 fl_set_slider_value(fd_form_spell_check->slider, 0);
683 fl_set_slider_bounds(fd_form_spell_check->slider, 0, 100);
684 fl_set_object_label(fd_form_spell_check->text, "");
685 fl_set_input(fd_form_spell_check->input, "");
686 fl_clear_browser(fd_form_spell_check->browser);
689 if (fd_form_spell_check->form_spell_check->visible) {
690 fl_raise_form(fd_form_spell_check->form_spell_check);
692 fl_show_form(fd_form_spell_check->form_spell_check,
693 FL_PLACE_MOUSE, FL_FULLBORDER,
696 fl_deactivate_object(fd_form_spell_check->slider);
698 // deactivate insert, accept, replace, and stop
699 fl_deactivate_object(fd_form_spell_check->insert);
700 fl_deactivate_object(fd_form_spell_check->accept);
701 fl_deactivate_object(fd_form_spell_check->ignore);
702 fl_deactivate_object(fd_form_spell_check->replace);
703 fl_deactivate_object(fd_form_spell_check->stop);
704 fl_deactivate_object(fd_form_spell_check->input);
705 fl_deactivate_object(fd_form_spell_check->browser);
706 fl_set_object_lcol(fd_form_spell_check->insert, FL_INACTIVE);
707 fl_set_object_lcol(fd_form_spell_check->accept, FL_INACTIVE);
708 fl_set_object_lcol(fd_form_spell_check->ignore, FL_INACTIVE);
709 fl_set_object_lcol(fd_form_spell_check->replace, FL_INACTIVE);
710 fl_set_object_lcol(fd_form_spell_check->stop, FL_INACTIVE);
711 fl_set_object_lcol(fd_form_spell_check->input, FL_INACTIVE);
712 fl_set_object_lcol(fd_form_spell_check->browser, FL_INACTIVE);
716 if (obj == fd_form_spell_check->options){
717 SpellCheckerOptions();
719 if (obj == fd_form_spell_check->start){
720 // activate insert, accept, and stop
721 fl_activate_object(fd_form_spell_check->insert);
722 fl_activate_object(fd_form_spell_check->accept);
723 fl_activate_object(fd_form_spell_check->ignore);
724 fl_activate_object(fd_form_spell_check->stop);
725 fl_activate_object(fd_form_spell_check->input);
726 fl_activate_object(fd_form_spell_check->browser);
727 fl_set_object_lcol(fd_form_spell_check->insert, FL_BLACK);
728 fl_set_object_lcol(fd_form_spell_check->accept, FL_BLACK);
729 fl_set_object_lcol(fd_form_spell_check->ignore, FL_BLACK);
730 fl_set_object_lcol(fd_form_spell_check->stop, FL_BLACK);
731 fl_set_object_lcol(fd_form_spell_check->input, FL_BLACK);
732 fl_set_object_lcol(fd_form_spell_check->browser, FL_BLACK);
733 // activate replace only if the file is not read-only
734 if (!bv->buffer()->isReadonly()) {
735 fl_activate_object(fd_form_spell_check->replace);
736 fl_set_object_lcol(fd_form_spell_check->replace, FL_BLACK);
739 // deactivate options and start
740 fl_deactivate_object(fd_form_spell_check->options);
741 fl_deactivate_object(fd_form_spell_check->start);
742 fl_set_object_lcol(fd_form_spell_check->options, FL_INACTIVE);
743 fl_set_object_lcol(fd_form_spell_check->start, FL_INACTIVE);
745 ret = RunSpellChecker(bv);
747 // deactivate insert, accept, replace, and stop
748 fl_deactivate_object(fd_form_spell_check->insert);
749 fl_deactivate_object(fd_form_spell_check->accept);
750 fl_deactivate_object(fd_form_spell_check->ignore);
751 fl_deactivate_object(fd_form_spell_check->replace);
752 fl_deactivate_object(fd_form_spell_check->stop);
753 fl_deactivate_object(fd_form_spell_check->input);
754 fl_deactivate_object(fd_form_spell_check->browser);
755 fl_set_object_lcol(fd_form_spell_check->insert, FL_INACTIVE);
756 fl_set_object_lcol(fd_form_spell_check->accept, FL_INACTIVE);
757 fl_set_object_lcol(fd_form_spell_check->ignore, FL_INACTIVE);
758 fl_set_object_lcol(fd_form_spell_check->replace, FL_INACTIVE);
759 fl_set_object_lcol(fd_form_spell_check->stop, FL_INACTIVE);
760 fl_set_object_lcol(fd_form_spell_check->input, FL_INACTIVE);
761 fl_set_object_lcol(fd_form_spell_check->browser, FL_INACTIVE);
763 // activate options and start
764 fl_activate_object(fd_form_spell_check->options);
765 fl_activate_object(fd_form_spell_check->start);
766 fl_set_object_lcol(fd_form_spell_check->options, FL_BLACK);
767 fl_set_object_lcol(fd_form_spell_check->start, FL_BLACK);
769 // if RunSpellChecker returns false quit spellchecker
772 if (obj == fd_form_spell_check->done) break;
774 fl_hide_form(fd_form_spell_check->form_spell_check);
775 bv->endOfSpellCheck();
780 // Perform an ispell session
782 bool RunSpellChecker(BufferView * bv)
788 string tmp = (lyxrc.isp_use_alt_lang) ? lyxrc.isp_alt_lang : bv->buffer()->GetLanguage();
789 bool rtl = tmp == "hebrew" || tmp == "arabic";
791 int oldval = 0; /* used for updating slider only when needed */
794 /* create ispell process */
798 create_ispell_pipe(bv->buffer()->params, tmp);
802 "The ispell-process has died for some reason. *One* possible reason\n"
803 "could be that you do not have a dictionary file\n"
804 "for the language of this document installed.\n"
805 "Check /usr/lib/ispell or set another\n"
806 "dictionary in the Spellchecker Options menu."), "", "");
810 // Put ispell in terse mode to improve speed
813 init_spell_checker(tmp);
814 if (spell_error != 0) {
815 fl_show_message(_(spell_error), "", "");
816 sc_clean_up_after_error();
821 unsigned int word_count = 0;
823 char * word = bv->nextWord(newval);
824 if (word == 0) break;
827 // Update slider if and only if value has changed
828 newvalue = int(100.0*newval);
829 if(newvalue!= oldval) {
831 fl_set_slider_value(fd_form_spell_check->slider, oldval);
834 if (word_count%1000 == 0) {
835 obj = fl_check_forms();
836 if (obj == fd_form_spell_check->stop) {
841 close_spell_checker();
845 if (obj == fd_form_spell_check->done) {
850 close_spell_checker();
857 result = ispell_check_word(word);
860 result = sc_check_word(word);
861 if (!sc_still_alive())
870 switch (result->flag) {
874 bv->selectLastWord();
877 reverse(tmp.begin(),tmp.end());
878 fl_set_object_label(fd_form_spell_check->text, tmp.c_str());
880 fl_set_object_label(fd_form_spell_check->text, word);
881 fl_set_input(fd_form_spell_check->input, word);
882 fl_clear_browser(fd_form_spell_check->browser);
885 for (i = 0; i < result->count; ++i) {
887 string tmp = result->misses[i];
888 reverse(tmp.begin(),tmp.end());
889 fl_add_browser_line(fd_form_spell_check->browser, tmp.c_str());
891 fl_add_browser_line(fd_form_spell_check->browser, result->misses[i]);
895 while ((w = result->next_miss()) != 0) {
896 fl_add_browser_line(fd_form_spell_check->browser, w);
903 if (obj == fd_form_spell_check->insert) {
905 ispell_insert_word(word);
907 sc_insert_word(word);
911 if (obj == fd_form_spell_check->accept) {
913 ispell_accept_word(word);
915 sc_accept_word(word);
919 if (obj == fd_form_spell_check->ignore) {
922 if (obj == fd_form_spell_check->replace ||
923 obj == fd_form_spell_check->input) {
925 ispell_store_replacement(word, fl_get_input(fd_form_spell_check->input));
927 sc_store_replacement(word, fl_get_input(fd_form_spell_check->input));
929 bv->replaceWord(fl_get_input(fd_form_spell_check->input));
932 if (obj == fd_form_spell_check->browser) {
933 // implements double click in the browser window.
934 // sent to lyx@via by Mark Burton <mark@cbl.leeds.ac.uk>
936 fl_get_browser(fd_form_spell_check->browser)) {
938 ispell_store_replacement(word, fl_get_input(fd_form_spell_check->input));
940 sc_store_replacement(word, fl_get_input(fd_form_spell_check->input));
942 bv->replaceWord(fl_get_input(fd_form_spell_check->input));
945 clickline = fl_get_browser(fd_form_spell_check->browser);
947 /// fl_set_input(fd_form_spell_check->input, result->misses[clickline-1]); ?
949 string tmp = fl_get_browser_line(fd_form_spell_check->browser,
951 reverse(tmp.begin(),tmp.end());
952 fl_set_input(fd_form_spell_check->input, tmp.c_str());
954 fl_set_input(fd_form_spell_check->input,
955 fl_get_browser_line(fd_form_spell_check->browser,
958 if (obj == fd_form_spell_check->stop) {
964 close_spell_checker();
969 if (obj == fd_form_spell_check->done) {
975 close_spell_checker();
991 if(sc_still_alive()) {
992 close_spell_checker();
994 string word_msg(tostr(word_count));
995 if (word_count != 1) {
996 word_msg += _(" words checked.");
998 word_msg += _(" word checked.");
1000 fl_show_message("", _("Spellchecking completed!"),
1005 fl_show_message(_("The ispell-process has died for some reason.\n"
1006 "Maybe it has been killed."), "", "");
1009 fl_show_message(_("The spell checker has died for some reason.\n"
1010 "Maybe it has been killed."), "", "");
1011 sc_clean_up_after_error();
1020 void sigchldhandler(pid_t pid, int * status)
1023 if (pid == isp_pid) {
1025 fcntl(isp_fd, F_SETFL, O_NONBLOCK); /* set the file descriptor
1026 to nonblocking so we can
1029 sigchldchecker(pid, status);
1034 void sigchldhandler(pid_t /* pid */, int * /* status */)