| 1 | /* melder_help.cpp |
| 2 | * |
| 3 | * Copyright (C) 1992-2018,2023 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 | |
| 19 | #include "melder.h" |
| 20 | |
| 21 | static void defaultHelp (conststring32 query) { |
| 22 | Melder_flushError (U"Don’t know how to find help on “", query, U"”."); |
| 23 | } |
| 24 | |
| 25 | static void defaultSearch () { |
| 26 | Melder_flushError (U"Do not know how to search."); |
| 27 | } |
| 28 | |
| 29 | static void (*p_theHelpProc) (conststring32 query) = & defaultHelp; |
| 30 | static void (*p_theSearchProc) () = & defaultSearch; |
| 31 | |
| 32 | void Melder_help (conststring32 query) { |
| 33 | (*p_theHelpProc) (query); |
| 34 | } |
| 35 | |
| 36 | void Melder_search () { |
| 37 | (*p_theSearchProc) (); |
| 38 | } |
| 39 | |
| 40 | void Melder_setHelpProc (void (*p_helpProc) (conststring32 query)) |
| 41 | { p_theHelpProc = p_helpProc ? p_helpProc : & defaultHelp; } |
| 42 | |
| 43 | void Melder_setSearchProc (void (*p_searchProc) (void)) |
| 44 | { p_theSearchProc = p_searchProc ? p_searchProc : & defaultSearch; } |
| 45 | |
| 46 | /* End of file melder_help.cpp */ |