/usr/include/yacas/lisperror.h is in yacas 1.3.6-2+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | #ifndef YACAS_LISPERROR_H
#define YACAS_LISPERROR_H
#include "lisptype.h"
#include "lispstring.h"
#include "choices.h"
#include <string>
class LispError {
public:
LispError(const std::string& msg);
const char* what() const;
private:
const std::string _what;
};
inline
LispError::LispError(const std::string& what):
_what(what)
{
}
inline
const char* LispError::what() const
{
return _what.c_str();
}
class LispErrInvalidArg: public LispError {
public:
LispErrInvalidArg():
LispError("Invalid argument") {}
};
class LispErrWrongNumberOfArgs: public LispError {
public:
LispErrWrongNumberOfArgs():
LispError("Wrong number of arguments") {}
};
class LispErrNotList: public LispError {
public:
LispErrNotList():
LispError("Argument is not a list") {}
};
class LispErrListNotLongEnough: public LispError {
public:
LispErrListNotLongEnough():
LispError("List not long enough") {}
};
class LispErrInvalidStack: public LispError {
public:
LispErrInvalidStack():
LispError("Invalid stack") {}
};
class Quitting: public LispError {
public:
Quitting():
LispError("Quitting...") {}
};
class LispErrNotEnoughMemory: public LispError {
public:
LispErrNotEnoughMemory():
LispError("Not enough memory") {}
};
class InvalidToken: public LispError {
public:
InvalidToken():
LispError("Empty token during parsing") {}
};
class LispErrInvalidExpression: public LispError {
public:
LispErrInvalidExpression():
LispError("Error parsing expression") {}
};
class LispErrUnprintableToken: public LispError {
public:
LispErrUnprintableToken():
LispError("Unprintable atom") {}
};
class LispErrFileNotFound: public LispError {
public:
LispErrFileNotFound():
LispError("File not found") {}
};
class LispErrReadingFile: public LispError {
public:
LispErrReadingFile():
LispError("Error reading file") {}
};
class LispErrCreatingUserFunction: public LispError {
public:
LispErrCreatingUserFunction():
LispError("Could not create user function") {}
};
class LispErrCreatingRule: public LispError {
public:
LispErrCreatingRule():
LispError("Could not create rule") {}
};
class LispErrArityAlreadyDefined: public LispError {
public:
LispErrArityAlreadyDefined():
LispError("Rule base with this arity already defined") {}
};
class LispErrCommentToEndOfFile: public LispError {
public:
LispErrCommentToEndOfFile():
LispError("Reaching end of file within a comment block") {}
};
class LispErrNotString: public LispError {
public:
LispErrNotString():
LispError("Argument is not a string") {}
};
class LispErrNotInteger: public LispError {
public:
LispErrNotInteger():
LispError("Argument is not an integer") {}
};
class LispErrParsingInput: public LispError {
public:
LispErrParsingInput():
LispError("Error while parsing input") {}
};
class LispErrMaxRecurseDepthReached: public LispError {
public:
LispErrMaxRecurseDepthReached():
LispError("Max evaluation stack depth reached.\nPlease use MaxEvalDepth to increase the stack size as needed.") {}
};
class LispErrDefFileAlreadyChosen: public LispError {
public:
LispErrDefFileAlreadyChosen():
LispError("DefFile already chosen for function") {}
};
class LispErrDivideByZero: public LispError {
public:
LispErrDivideByZero():
LispError("Divide by zero") {}
};
class LispErrNotAnInFixOperator: public LispError {
public:
LispErrNotAnInFixOperator():
LispError("Trying to make a non-infix operator right-associative") {}
};
class LispErrUser: public LispError {
public:
LispErrUser(const std::string& msg):
LispError(msg) {}
};
class LispErrIsNotInFix: public LispError {
public:
LispErrIsNotInFix():
LispError("Trying to get precedence of non-infix operator") {}
};
class LispErrSecurityBreach: public LispError {
public:
LispErrSecurityBreach():
LispError("Trying to perform an insecure action") {}
};
class LispErrLibraryNotFound: public LispError {
public:
LispErrLibraryNotFound():
LispError("Could not find library") {}
};
class LispErrUserInterrupt: public LispError {
public:
LispErrUserInterrupt():
LispError("User interrupted calculation") {}
};
class LispErrNonBooleanPredicateInPattern: public LispError {
public:
LispErrNonBooleanPredicateInPattern():
LispError("Predicate doesn't evaluate to a boolean in pattern") {}
};
class LispErrProtectedSymbol: public LispError {
public:
LispErrProtectedSymbol():
LispError("Attempt to override a protected symbol") {}
};
class LispErrGeneric: public LispError {
public:
LispErrGeneric(const std::string& what):
LispError(what) {}
};
class LispEnvironment;
class LispOutput;
void HandleError(const LispError&, LispEnvironment& aEnvironment, std::ostream& aOutput);
#ifdef YACAS_DEBUG
#define DBG_printf printf
#define DBG_(xxx) xxx
#else
namespace{void inline noop(...) {}}
// could change 'noop' to 'sizeof' below, but we get 'left-hand operand of comma has no effect' from g++
#define DBG_printf while (0) noop
#define DBG_(xxx) /*xxx*/
#endif
#endif
|