melder_warning.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /* melder_warning.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. int MelderWarning::_depth = 0;
  20. void MelderWarning::_defaultProc (conststring32 message) {
  21. MelderConsole::write (U"Warning: ", true);
  22. MelderConsole::write (message, true);
  23. MelderConsole::write (U"\n", true);
  24. }
  25. MelderWarning::Proc MelderWarning::_p_currentProc = & MelderWarning::_defaultProc;
  26. MelderString MelderWarning::_buffer = { 0, 0, nullptr };
  27. void Melder_warningOff () { MelderWarning::_depth --; }
  28. void Melder_warningOn () { MelderWarning::_depth ++; }
  29. void Melder_setWarningProc (MelderWarning::Proc p_proc) {
  30. MelderWarning::_p_currentProc = ( p_proc ? p_proc : & MelderWarning::_defaultProc );
  31. }
  32. /* End of file melder_warning.cpp */