gcsx_exception.cpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* GCSx
  2. ** EXCEPTION.CPP
  3. **
  4. ** GCSx exception classes
  5. */
  6. /*****************************************************************************
  7. ** Copyright (C) 2003-2006 Janson
  8. **
  9. ** This program is free software; you can redistribute it and/or modify
  10. ** it under the terms of the GNU General Public License as published by
  11. ** the Free Software Foundation; either version 2 of the License, or
  12. ** (at your option) any later version.
  13. **
  14. ** This program is distributed in the hope that it will be useful,
  15. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. ** GNU General Public License for more details.
  18. **
  19. ** You should have received a copy of the GNU General Public License
  20. ** along with this program; if not, write to the Free Software
  21. ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
  22. *****************************************************************************/
  23. #include "all.h"
  24. BaseException::BaseException() {
  25. }
  26. void BaseException::setDetails(const char* base, va_list arglist) {
  27. assert(base);
  28. vsnprintf(details, DETAILS_SIZE, base, arglist);
  29. }
  30. VideoException::VideoException(const char* base, ...) : BaseException() {
  31. va_list arglist;
  32. va_start(arglist, base);
  33. setDetails(base, arglist);
  34. va_end(arglist);
  35. }
  36. #ifdef COMPILEASSERT
  37. CompileException::CompileException(const char* base, ...) : BaseException() {
  38. va_list arglist;
  39. va_start(arglist, base);
  40. setDetails(base, arglist);
  41. va_end(arglist);
  42. }
  43. #endif
  44. #ifdef INTERPRETASSERT
  45. InterpretException::InterpretException(const char* base, ...) : BaseException() {
  46. va_list arglist;
  47. va_start(arglist, base);
  48. setDetails(base, arglist);
  49. va_end(arglist);
  50. }
  51. #endif
  52. FileException::FileException(const char* base, ...) : BaseException() {
  53. va_list arglist;
  54. va_start(arglist, base);
  55. setDetails(base, arglist);
  56. va_end(arglist);
  57. }
  58. UndoException::UndoException() : BaseException() {
  59. strcpy(details, "Unable to store undo");
  60. }