Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1.  
  2. #ifndef __lisperror_h__
  3. #define __lisperror_h__
  4.  
  5. #include "lisptype.h"
  6. #include "lispstring.h"
  7.  
  8. #include "choices.h"
  9.  
  10.  
  11. enum ErrorCodes
  12. {
  13.     KLispErrNone = 0,
  14.     KLispErrInvalidArg        ,
  15.     KLispErrWrongNumberOfArgs ,
  16.     KLispErrNotList           ,
  17.     KLispErrListNotLongEnough ,
  18.     KLispErrInvalidStack      ,
  19.     KQuitting                 ,
  20.     KLispErrNotEnoughMemory   ,
  21.     KInvalidToken             ,
  22.     KLispErrInvalidExpression ,
  23.     KLispErrUnprintableToken  ,
  24.     KLispErrFileNotFound      ,
  25.     KLispErrReadingFile       ,
  26.     KLispErrCreatingUserFunction,
  27.     KLispErrCreatingRule        ,
  28.     KLispErrArityAlreadyDefined ,
  29.     KLispErrCommentToEndOfFile  ,
  30.     KLispErrNotString           ,
  31.     KLispErrNotInteger          ,
  32.     KLispErrParsingInput        ,
  33.     KLispErrMaxRecurseDepthReached,
  34.     KLispErrDefFileAlreadyChosen  ,
  35.     KLispErrDivideByZero          ,
  36.     KLispErrNotAnInFixOperator    ,
  37.     KLispErrUser                  ,
  38.     KLispErrIsNotInFix            ,
  39.     KLispErrSecurityBreach        ,
  40.     KLispErrLibraryNotFound       ,
  41.     KLispErrUserInterrupt         ,
  42.     KLispErrNonBooleanPredicateInPattern,
  43.     KLispErrGenericFormat,
  44.     KLispNrErrors
  45. };
  46.  
  47.  
  48. template<typename T>
  49. inline void Check(T hastobetrue, LispInt aError)
  50. {
  51.     if (!hastobetrue)
  52.         LispThrow(aError);
  53. }
  54.  
  55.  
  56. #ifdef YACAS_DEBUG
  57. #define DBG_printf printf
  58. #define DBG_(xxx) xxx
  59. #else
  60. namespace{void inline noop(...) {}}
  61. // could change 'noop' to 'sizeof' below, but we get 'left-hand operand of comma has no effect' from g++
  62. #define DBG_printf while (0) noop
  63. #define DBG_(xxx) /*xxx*/
  64. #endif
  65.  
  66.  
  67. #endif
  68.  
  69.