melder_help.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* melder_help.cpp
  2. *
  3. * Copyright (C) 1992-2018 Paul Boersma
  4. *
  5. * This code is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * This code is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. * See the GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this work. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #include "melder.h"
  19. static void defaultHelp (conststring32 query) {
  20. Melder_flushError (U"Don't know how to find help on \"", query, U"\".");
  21. }
  22. static void defaultSearch () {
  23. Melder_flushError (U"Do not know how to search.");
  24. }
  25. static void (*p_theHelpProc) (conststring32 query) = & defaultHelp;
  26. static void (*p_theSearchProc) () = & defaultSearch;
  27. void Melder_help (conststring32 query) {
  28. (*p_theHelpProc) (query);
  29. }
  30. void Melder_search () {
  31. (*p_theSearchProc) ();
  32. }
  33. void Melder_setHelpProc (void (*p_helpProc) (conststring32 query))
  34. { p_theHelpProc = p_helpProc ? p_helpProc : & defaultHelp; }
  35. void Melder_setSearchProc (void (*p_searchProc) (void))
  36. { p_theSearchProc = p_searchProc ? p_searchProc : & defaultSearch; }
  37. /* End of file melder_help.cpp */