Updating the changelog in the VERSION file, and version_sync.
[shapes.git] / source / shapesexceptions.h
blob4a76e8131b4c43596b92dc259537825c0c73d01e
1 /* This file is part of Shapes.
3 * Shapes is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * any later version.
8 * Shapes is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with Shapes. If not, see <http://www.gnu.org/licenses/>.
16 * Copyright 2008, 2009 Henrik Tidefelt
19 #pragma once
21 #include "Shapes_Ast_decls.h"
22 #include "Shapes_Lang_decls.h"
23 #include "Shapes_Kernel_decls.h"
24 #include "Shapes_Exceptions_decls.h"
26 #include "sourcelocation.h"
27 #include "exitcodes.h"
28 #include "methodid.h"
29 #include "simplepdfo.h"
30 #include "strrefdup.h" // this is not needed in this file, but it is convenient to get these declarations for users of this file.
31 #include "pdfversion.h"
33 #include <exception>
34 #include <iostream>
35 #include <sstream>
36 #include <list>
37 #include <set>
38 #include <map>
41 namespace Shapes
43 namespace Exceptions
45 extern const std::string additionalLinesPrefix;
47 class Exception
49 public:
50 Exception( );
51 virtual ~Exception( );
52 virtual void display( std::ostream & os ) const = 0;
53 virtual Interaction::ExitCode exitCode( ) const = 0;
54 static const char * locsep;
57 class NotImplemented : public Exception
59 const char * functionality;
60 public:
61 NotImplemented( const char * _functionality );
62 virtual ~NotImplemented( );
63 virtual void display( std::ostream & os ) const;
64 virtual Interaction::ExitCode exitCode( ) const { return Interaction::EXIT_NOT_IMPLEMENTED; }
67 class StaticInconsistency : public Exception
69 protected:
70 Ast::SourceLocation primaryLoc_;
71 public:
72 StaticInconsistency( Ast::SourceLocation primaryLoc ) : primaryLoc_( primaryLoc ) { }
73 virtual ~StaticInconsistency( ) { }
74 const Ast::SourceLocation & loc( ) const { return primaryLoc_; }
75 virtual Interaction::ExitCode exitCode( ) const { return Interaction::EXIT_USER_ERROR; }
78 class PostCondition : public Exception
80 protected:
81 Ast::SourceLocation primaryLoc_;
82 public:
83 PostCondition( Ast::SourceLocation primaryLoc ) : primaryLoc_( primaryLoc ) { }
84 virtual ~PostCondition( ) { }
85 const Ast::SourceLocation & loc( ) const { return primaryLoc_; }
86 virtual Interaction::ExitCode exitCode( ) const { return Interaction::EXIT_USER_ERROR; }
89 class MiscellaneousStaticInconsistency : public StaticInconsistency
91 RefCountPtr< const char > msg;
92 public:
93 MiscellaneousStaticInconsistency( const Ast::SourceLocation & _loc, RefCountPtr< const char > _msg );
94 virtual ~MiscellaneousStaticInconsistency( );
95 virtual void display( std::ostream & os ) const;
98 class ScannerError : public StaticInconsistency
100 RefCountPtr< const char > msg;
101 public:
102 ScannerError( const Ast::SourceLocation & _loc, RefCountPtr< const char > _msg );
103 virtual ~ScannerError( );
104 virtual void display( std::ostream & os ) const;
107 class ParserError : public StaticInconsistency
109 RefCountPtr< const char > msg;
110 public:
111 ParserError( const Ast::SourceLocation & _loc, RefCountPtr< const char > _msg );
112 virtual ~ParserError( );
113 virtual void display( std::ostream & os ) const;
116 class MemberAlsoAbstract : public StaticInconsistency
118 Ast::SourceLocation memberLoc;
119 const char * id;
120 Ast::SourceLocation abstractLoc;
121 public:
122 MemberAlsoAbstract( const Ast::SourceLocation & _memberLoc, const char * _id, const Ast::SourceLocation & _abstractLoc );
123 virtual ~MemberAlsoAbstract( );
124 virtual void display( std::ostream & os ) const;
127 class MemberAlreadyDeclared : public StaticInconsistency
129 Ast::SourceLocation memberLoc;
130 const char * id;
131 Ast::SourceLocation oldLoc;
132 public:
133 MemberAlreadyDeclared( const Ast::SourceLocation & _memberLoc, const char * _id, const Ast::SourceLocation & _oldLoc );
134 virtual ~MemberAlreadyDeclared( );
135 virtual void display( std::ostream & os ) const;
138 class PublicGetSetInNonfinalClass : public StaticInconsistency
140 Ast::SourceLocation memberLoc;
141 const char * id;
142 public:
143 PublicGetSetInNonfinalClass( const Ast::SourceLocation & _memberLoc, const char * _id );
144 virtual ~PublicGetSetInNonfinalClass( );
145 virtual void display( std::ostream & os ) const;
148 class TransformingMemberInNonfinalClass : public StaticInconsistency
150 Ast::SourceLocation memberLoc;
151 const char * id;
152 public:
153 TransformingMemberInNonfinalClass( const Ast::SourceLocation & _memberLoc, const char * _id );
154 virtual ~TransformingMemberInNonfinalClass( );
155 virtual void display( std::ostream & os ) const;
158 class RepeatedFormal : public StaticInconsistency
160 const char * id;
161 public:
162 RepeatedFormal( const Ast::SourceLocation & Loc, const char * _id );
163 virtual ~RepeatedFormal( );
164 virtual void display( std::ostream & os ) const;
167 class IllegalFreeStates : public StaticInconsistency
169 Ast::StateIDSet * freeStates_;
170 const char * reason_;
171 public:
172 IllegalFreeStates( const Ast::SourceLocation & loc, Ast::StateIDSet * freeStates, const char * reason );
173 virtual ~IllegalFreeStates( );
174 virtual void display( std::ostream & os ) const;
177 class FreeStateIsAlsoPassed : public StaticInconsistency
179 Ast::StateID stateID_;
180 public:
181 FreeStateIsAlsoPassed( const Ast::SourceLocation & loc, Ast::StateID stateID );
182 virtual ~FreeStateIsAlsoPassed( );
183 virtual void display( std::ostream & os ) const;
186 class RepeatedStateArgument : public StaticInconsistency
188 RefCountPtr< Ast::StateIDSet > passedStates_;
189 public:
190 RepeatedStateArgument( const Ast::SourceLocation & loc, const RefCountPtr< Ast::StateIDSet > & passedStates );
191 virtual ~RepeatedStateArgument( );
192 virtual void display( std::ostream & os ) const;
195 class PassingStateOut : public StaticInconsistency
197 const char * id_;
198 public:
199 PassingStateOut( const Ast::SourceLocation & loc, const char * id );
200 virtual ~PassingStateOut( );
201 virtual void display( std::ostream & os ) const;
204 class IntroducingExisting : public StaticInconsistency
206 Ast::SourceLocation loc;
207 const char * id;
208 public:
209 IntroducingExisting( const Ast::SourceLocation & _loc, const char * _id );
210 virtual ~IntroducingExisting( );
211 virtual void display( std::ostream & os ) const;
214 class FreezingUndefined : public StaticInconsistency
216 Ast::SourceLocation loc;
217 const char * id;
218 public:
219 FreezingUndefined( const Ast::SourceLocation & _loc, const char * _id );
220 virtual ~FreezingUndefined( );
221 virtual void display( std::ostream & os ) const;
224 class ExpectedImmediate : public StaticInconsistency
226 Ast::SourceLocation loc;
227 public:
228 ExpectedImmediate( const Ast::SourceLocation & _loc );
229 virtual ~ExpectedImmediate( );
230 virtual void display( std::ostream & os ) const;
233 class IllegalImperative : public StaticInconsistency
235 Ast::SourceLocation loc;
236 public:
237 IllegalImperative( const Ast::SourceLocation & _loc );
238 virtual ~IllegalImperative( );
239 virtual void display( std::ostream & os ) const;
242 class FileReadOpenError : public Exception
244 public:
245 enum Type{ OPEN, STAT };
246 private:
247 Ast::SourceLocation loc;
248 RefCountPtr< const char > filename;
249 Type type;
250 const std::string * sourceDir_;
251 const std::list< std::string > * searchPath_;
252 public:
253 FileReadOpenError( const Ast::SourceLocation & _loc, RefCountPtr< const char > _filename, const std::string * sourceDir, const std::list< std::string > * searchPath, Type _type = OPEN );
254 virtual ~FileReadOpenError( );
255 virtual void display( std::ostream & os ) const;
256 virtual Interaction::ExitCode exitCode( ) const { return Interaction::EXIT_INPUT_FILE_ERROR; }
259 class FileWriteOpenError : public Exception
261 private:
262 Ast::SourceLocation loc;
263 RefCountPtr< const char > filename;
264 const char * purpose_;
265 public:
266 FileWriteOpenError( const Ast::SourceLocation & _loc, RefCountPtr< const char > _filename, const char * purpose = 0 );
267 virtual ~FileWriteOpenError( );
268 virtual void display( std::ostream & os ) const;
269 virtual Interaction::ExitCode exitCode( ) const { return Interaction::EXIT_OUTPUT_FILE_ERROR; }
272 class TeXSetupTooLate : public Exception
274 Ast::SourceLocation loc;
275 public:
276 TeXSetupTooLate( const Ast::SourceLocation & _loc );
277 virtual ~TeXSetupTooLate( );
278 virtual void display( std::ostream & os ) const;
279 virtual Interaction::ExitCode exitCode( ) const { return Interaction::EXIT_USER_ERROR; }
282 class EmptyFinalPicture : public Exception
284 public:
285 EmptyFinalPicture( );
286 virtual ~EmptyFinalPicture( );
287 virtual void display( std::ostream & os ) const;
288 virtual Interaction::ExitCode exitCode( ) const { return Interaction::EXIT_USER_ERROR; }
291 class RuntimeError : public Exception
293 Ast::SourceLocation loc_;
294 public:
295 RuntimeError( const Ast::SourceLocation & loc );
296 RuntimeError( Ast::Expression * expr );
297 const Ast::SourceLocation & getLoc( ) const;
298 virtual ~RuntimeError( );
299 virtual Interaction::ExitCode exitCode( ) const { return Interaction::EXIT_USER_ERROR; } /* This should be overridden when apropriate! */
302 class CatchableError : public RuntimeError
304 public:
305 CatchableError( const Ast::SourceLocation & loc );
306 CatchableError( Ast::Expression * expr );
307 virtual ~CatchableError( );
308 virtual RefCountPtr< const Lang::Exception > clone( const Kernel::ContRef & cont ) const = 0;
311 class UncaughtError : public RuntimeError
313 RefCountPtr< const Lang::Exception > ball_;
314 public:
315 UncaughtError( const RefCountPtr< const Lang::Exception > & ball );
316 virtual ~UncaughtError( );
317 virtual void display( std::ostream & os ) const;
318 virtual Interaction::ExitCode exitCode( ) const;
319 const RefCountPtr< const Lang::Exception > & ball( ) const { return ball_; }
322 class UserError : public CatchableError
324 RefCountPtr< const Lang::Symbol > kind_;
325 RefCountPtr< const Lang::String > source_;
326 RefCountPtr< const Lang::Value > details_;
327 RefCountPtr< const char > message_;
328 public:
329 UserError( const RefCountPtr< const Lang::Symbol > & kind, const RefCountPtr< const Lang::String > & source, const RefCountPtr< const Lang::Value > & details, const RefCountPtr< const char > & message );
330 virtual ~UserError( );
331 virtual void display( std::ostream & os ) const;
332 virtual RefCountPtr< const Lang::Exception > clone( const Kernel::ContRef & cont ) const;
333 virtual Interaction::ExitCode exitCode( ) const { return Interaction::EXIT_USER_DETECTED_ERROR; }
336 class InternalError : public RuntimeError
338 const char * msg_;
339 RefCountPtr< const char > msgMem_;
340 public:
341 InternalError( const Ast::SourceLocation & loc, RefCountPtr< const char > msg );
342 InternalError( const Ast::SourceLocation & loc, const char * msg );
343 InternalError( RefCountPtr< const char > msg );
344 InternalError( const char * msg );
345 InternalError( const std::ostringstream & msg );
346 virtual ~InternalError( );
347 virtual void display( std::ostream & os ) const;
348 virtual Interaction::ExitCode exitCode( ) const { return Interaction::EXIT_INTERNAL_ERROR; }
351 class ExternalError : public CatchableError
353 const char * msg_;
354 RefCountPtr< const char > msgMem_;
355 public:
356 ExternalError( RefCountPtr< const char > msg );
357 ExternalError( const char * msg );
358 virtual ~ExternalError( );
359 virtual void display( std::ostream & os ) const;
360 virtual RefCountPtr< const Lang::Exception > clone( const Kernel::ContRef & cont ) const;
361 virtual Interaction::ExitCode exitCode( ) const { return Interaction::EXIT_EXTERNAL_ERROR; }
362 ExternalError * cloneTyped( ) const;
365 class TeXSetupHasChanged : public InternalError
367 public:
368 TeXSetupHasChanged( );
369 virtual ~TeXSetupHasChanged( );
372 class MiscellaneousRequirement : public CatchableError
374 const char * msg_;
375 RefCountPtr< const char > msgMem_;
376 public:
377 MiscellaneousRequirement( RefCountPtr< const char > msg );
378 MiscellaneousRequirement( const char * msg );
379 virtual ~MiscellaneousRequirement( );
380 virtual void display( std::ostream & os ) const;
381 virtual RefCountPtr< const Lang::Exception > clone( const Kernel::ContRef & cont ) const;
384 class HandlerError : public CatchableError
386 RefCountPtr< const char > msg;
387 public:
388 HandlerError( RefCountPtr< const char > _msg );
389 HandlerError( const char * _msg );
390 virtual ~HandlerError( );
391 virtual void display( std::ostream & os ) const;
392 virtual RefCountPtr< const Lang::Exception > clone( const Kernel::ContRef & cont ) const;
395 class PDFVersionError : public CatchableError
397 SimplePDF::PDF_Version::Version version_;
398 SimplePDF::PDF_Version::Version required_;
399 RefCountPtr< const char > msgMem_;
400 const char * msg_;
401 public:
402 PDFVersionError( SimplePDF::PDF_Version::Version version, SimplePDF::PDF_Version::Version required, const RefCountPtr< const char > & msg );
403 PDFVersionError( SimplePDF::PDF_Version::Version version, SimplePDF::PDF_Version::Version required, const char * msg );
404 virtual ~PDFVersionError( );
405 virtual void display( std::ostream & os ) const;
406 virtual RefCountPtr< const Lang::Exception > clone( const Kernel::ContRef & cont ) const;
409 class RedefiningLexical : public RuntimeError
411 const char * id;
412 public:
413 RedefiningLexical( const char * _id );
414 virtual ~RedefiningLexical( );
415 virtual void display( std::ostream & os ) const;
418 class RedefiningDynamic : public RuntimeError
420 const char * id;
421 public:
422 RedefiningDynamic( const char * _id );
423 virtual ~RedefiningDynamic( );
424 virtual void display( std::ostream & os ) const;
427 class TypeMismatch : public RuntimeError
429 const char * hint_;
430 RefCountPtr< const char > valueType;
431 RefCountPtr< const char > expectedType;
432 public:
433 TypeMismatch( const Ast::SourceLocation & loc, const char * hint, RefCountPtr< const char > _valueType, RefCountPtr< const char > _expectedType );
434 TypeMismatch( const Ast::SourceLocation & loc, RefCountPtr< const char > _valueType, RefCountPtr< const char > _expectedType );
435 virtual ~TypeMismatch( );
436 virtual void display( std::ostream & os ) const;
439 class NonObjectMemberAssignment : public RuntimeError
441 RefCountPtr< const char > valueType;
442 public:
443 NonObjectMemberAssignment( const Ast::SourceLocation & _loc, RefCountPtr< const char > _valueType );
444 virtual ~NonObjectMemberAssignment( );
445 virtual void display( std::ostream & os ) const;
448 class ElementaryWithout : public RuntimeError
450 public:
451 enum Kind{ VALUE, STATE };
452 enum Ref{ FIELD, MUTATOR };
453 private:
454 Kind kind_;
455 Ref ref_;
456 RefCountPtr< const char > valueType;
457 public:
458 ElementaryWithout( Kind kind, Ref ref, RefCountPtr< const char > _valueType );
459 virtual ~ElementaryWithout( );
460 virtual void display( std::ostream & os ) const;
463 class NonExistentMember : public RuntimeError
465 RefCountPtr< const char > valueType;
466 const char * fieldID;
467 public:
468 NonExistentMember( RefCountPtr< const char > _valueType, const char * _fieldID );
469 virtual ~NonExistentMember( );
470 virtual void display( std::ostream & os ) const;
473 class NonExistentMutator : public RuntimeError
475 RefCountPtr< const char > valueType;
476 const char * mutatorID;
477 public:
478 NonExistentMutator( RefCountPtr< const char > _valueType, const char * _mutatorID );
479 virtual ~NonExistentMutator( );
480 virtual void display( std::ostream & os ) const;
483 class NonExistentPosition : public RuntimeError
485 size_t pos_;
486 size_t maxPos_;
487 public:
488 NonExistentPosition( size_t pos, size_t maxPos );
489 virtual ~NonExistentPosition( );
490 virtual void display( std::ostream & os ) const;
493 class UnaryPrefixNotApplicable : public RuntimeError
495 const Ast::Expression * expr;
496 RefCountPtr< const char > valueType;
497 const char * operatorSymbol;
498 public:
499 UnaryPrefixNotApplicable( const Ast::SourceLocation & _loc, const Ast::Expression * _expr, RefCountPtr< const char > _valueType );
500 virtual ~UnaryPrefixNotApplicable( );
501 void setOperatorSymbol( const char * _operatorSymbol );
502 virtual void display( std::ostream & os ) const;
505 class UnaryPostfixNotApplicable : public RuntimeError
507 const Ast::Expression * expr;
508 RefCountPtr< const char > valueType;
509 const char * operatorSymbol;
510 public:
511 UnaryPostfixNotApplicable( const Ast::SourceLocation & _loc, const Ast::Expression * _expr, RefCountPtr< const char > _valueType );
512 virtual ~UnaryPostfixNotApplicable( );
513 void setOperatorSymbol( const char * _operatorSymbol );
514 virtual void display( std::ostream & os ) const;
517 class BinaryInfixNotApplicable : public RuntimeError
519 const Ast::Expression * expr1;
520 RefCountPtr< const char > valueType1;
521 const Ast::Expression * expr2;
522 RefCountPtr< const char > valueType2;
523 const char * operatorSymbol;
524 public:
525 BinaryInfixNotApplicable( const Ast::SourceLocation & _loc, const Ast::Expression * _expr1, RefCountPtr< const char > _valueType1, const Ast::Expression * _expr2, RefCountPtr< const char > _valueType2 );
526 virtual ~BinaryInfixNotApplicable( );
527 void setOperatorSymbol( const char * _operatorSymbol );
528 virtual void display( std::ostream & os ) const;
531 class LookupUnknown : public StaticInconsistency
533 public:
534 enum Type{ VARIABLE, STATE, DYNAMIC_VARIABLE, DYNAMIC_STATE, TYPE };
535 private:
536 RefCountPtr< const char > id;
537 Type type_;
538 public:
539 LookupUnknown( const Ast::SourceLocation & _loc, RefCountPtr< const char > _id, Type type );
540 virtual ~LookupUnknown( );
541 virtual void display( std::ostream & os ) const;
544 class StateBeyondFunctionBoundary : public StaticInconsistency
546 RefCountPtr< const char > id;
547 public:
548 StateBeyondFunctionBoundary( const Ast::SourceLocation & _loc, RefCountPtr< const char > _id );
549 virtual ~StateBeyondFunctionBoundary( );
550 virtual void display( std::ostream & os ) const;
553 class IntroducingExistingUnit : public StaticInconsistency
555 RefCountPtr< const char > id;
556 public:
557 IntroducingExistingUnit( const Ast::SourceLocation & _loc, RefCountPtr< const char > _id );
558 virtual ~IntroducingExistingUnit( );
559 virtual void display( std::ostream & os ) const;
562 class LookupUnknownUnit : public StaticInconsistency
564 RefCountPtr< const char > id;
565 public:
566 LookupUnknownUnit( const Ast::SourceLocation & _loc, RefCountPtr< const char > _id );
567 virtual ~LookupUnknownUnit( );
568 virtual void display( std::ostream & os ) const;
571 class OutOfRange : public CatchableError
573 const char * msg_;
574 RefCountPtr< const char > msgMem_;
575 public:
576 OutOfRange( RefCountPtr< const char > msg );
577 OutOfRange( const char * msg );
578 OutOfRange( const Ast::SourceLocation & _loc, RefCountPtr< const char > msg );
579 OutOfRange( const Ast::SourceLocation & _loc, const char * msg );
580 virtual ~OutOfRange( );
581 virtual void display( std::ostream & os ) const;
582 virtual RefCountPtr< const Lang::Exception > clone( const Kernel::ContRef & cont ) const;
585 class NonVoidStatement : public RuntimeError
587 RefCountPtr< const Lang::Value > val_;
588 public:
589 NonVoidStatement( const Ast::SourceLocation & loc, RefCountPtr< const Lang::Value > val );
590 virtual ~NonVoidStatement( );
591 virtual void display( std::ostream & os ) const;
594 class UserArityMismatch : public RuntimeError
596 public:
597 enum Type{ VARIABLE, STATE };
598 private:
599 const Ast::SourceLocation formalsLoc;
600 const size_t functionArity;
601 const size_t callArity;
602 const Type type_;
603 public:
604 UserArityMismatch( const Ast::SourceLocation _formalsLoc, size_t _functionArity, size_t _callArity, const Type type );
605 virtual ~UserArityMismatch( );
606 virtual void display( std::ostream & os ) const;
609 class SinkRequired : public RuntimeError
611 private:
612 const Ast::SourceLocation formalsLoc_;
613 const size_t formalsArity_;
614 const size_t callArity_;
615 public:
616 SinkRequired( const Ast::SourceLocation formalsLoc, size_t formalsArity, size_t callArity );
617 virtual ~SinkRequired( );
618 virtual void display( std::ostream & os ) const;
621 class NamedFormalMismatch : public RuntimeError
623 public:
624 enum Type{ VARIABLE, STATE };
625 private:
626 const Ast::SourceLocation formalsLoc;
627 RefCountPtr< const char > name;
628 Type type_;
629 public:
630 NamedFormalMismatch( const Ast::SourceLocation _formalsLoc, RefCountPtr< const char > _name, Type type );
631 virtual ~NamedFormalMismatch( );
632 virtual void display( std::ostream & os ) const;
635 class NamedFormalAlreadySpecified : public RuntimeError
637 public:
638 enum Type{ VARIABLE, STATE };
639 private:
640 const Ast::SourceLocation formalsLoc;
641 RefCountPtr< const char > name;
642 size_t pos;
643 Type type_;
644 public:
645 NamedFormalAlreadySpecified( const Ast::SourceLocation _formalsLoc, RefCountPtr< const char > _name, size_t _pos, Type type );
646 virtual ~NamedFormalAlreadySpecified( );
647 virtual void display( std::ostream & os ) const;
650 class MissingArguments : public RuntimeError
652 const Ast::SourceLocation formalsLoc_;
653 RefCountPtr< const std::map< size_t, RefCountPtr< const char > > > missingVariables_;
654 RefCountPtr< const std::map< size_t, RefCountPtr< const char > > > missingStates_;
655 public:
656 MissingArguments( const Ast::SourceLocation formalsLoc, std::map< size_t, RefCountPtr< const char > > * missingVariables, std::map< size_t, RefCountPtr< const char > > * missingStates );
657 ~MissingArguments( );
658 virtual void display( std::ostream & os ) const;
661 class CoreArityMismatch : public RuntimeError
663 const char * title;
664 RefCountPtr< const char > titleMem;
665 const size_t functionArityLow;
666 const size_t functionArityHigh;
667 const size_t callArity;
668 public:
669 CoreArityMismatch( const char * _title, size_t _functionArity, size_t _callArity );
670 CoreArityMismatch( const char * _title, size_t _functionArityLow, size_t _functionArityHigh, size_t _callArity );
671 CoreArityMismatch( const RefCountPtr< const char > & _title, size_t _functionArity, size_t _callArity );
672 CoreArityMismatch( const RefCountPtr< const char > & _title, size_t _functionArityLow, size_t _functionArityHigh, size_t _callArity );
673 virtual ~CoreArityMismatch( );
674 virtual void display( std::ostream & os ) const;
677 class CoreNoNamedFormals : public RuntimeError
679 const char * title;
680 RefCountPtr< const char > titleMem;
681 public:
682 CoreNoNamedFormals( const char * _title );
683 CoreNoNamedFormals( const RefCountPtr< const char > & _title );
684 virtual ~CoreNoNamedFormals( );
685 virtual void display( std::ostream & os ) const;
688 class CoreTypeMismatch : public RuntimeError
690 const char * title_;
691 RefCountPtr< const char > titleMem_;
692 const Ast::SourceLocation argLoc_;
693 RefCountPtr< const char > valueType_;
694 RefCountPtr< const char > expectedType_;
695 public:
696 CoreTypeMismatch( const Ast::SourceLocation & callLoc,
697 const char * title,
698 const Ast::SourceLocation & argLoc,
699 RefCountPtr< const char > valueType,
700 RefCountPtr< const char > expectedType );
701 CoreTypeMismatch( const Ast::SourceLocation & callLoc,
702 RefCountPtr< const char > title,
703 const Ast::SourceLocation & argLoc,
704 RefCountPtr< const char > valueType,
705 RefCountPtr< const char > expectedType );
706 CoreTypeMismatch( const Ast::SourceLocation & callLoc,
707 const char * title,
708 Kernel::Arguments & args,
709 size_t argNo,
710 RefCountPtr< const char > expectedType );
711 CoreTypeMismatch( const Ast::SourceLocation & callLoc,
712 RefCountPtr< const char > title,
713 Kernel::Arguments & args,
714 size_t argNo,
715 RefCountPtr< const char > expectedType );
716 virtual ~CoreTypeMismatch( );
717 virtual void display( std::ostream & os ) const;
720 class CoreDynamicTypeMismatch : public RuntimeError
722 const char * title_;
723 RefCountPtr< const char > titleMem_;
724 const char * id_;
725 RefCountPtr< const char > idMem_;
726 RefCountPtr< const char > valueType_;
727 RefCountPtr< const char > expectedType_;
728 public:
729 CoreDynamicTypeMismatch( const Ast::SourceLocation & callLoc,
730 const char * title,
731 const char * id,
732 RefCountPtr< const char > valueType,
733 RefCountPtr< const char > expectedType );
734 virtual ~CoreDynamicTypeMismatch( );
735 virtual void display( std::ostream & os ) const;
738 class CoreStateTypeMismatch : public RuntimeError
740 const char * title_;
741 RefCountPtr< const char > titleMem_;
742 const Ast::SourceLocation argLoc_;
743 RefCountPtr< const char > valueType_;
744 RefCountPtr< const char > expectedType_;
745 public:
746 CoreStateTypeMismatch( const Ast::SourceLocation & callLoc,
747 const char * title,
748 const Ast::SourceLocation & argLoc,
749 RefCountPtr< const char > valueType,
750 RefCountPtr< const char > expectedType );
751 CoreStateTypeMismatch( const Ast::SourceLocation & callLoc,
752 RefCountPtr< const char > title,
753 const Ast::SourceLocation & argLoc,
754 RefCountPtr< const char > valueType,
755 RefCountPtr< const char > expectedType );
756 CoreStateTypeMismatch( const Ast::SourceLocation & callLoc,
757 const char * title,
758 Kernel::Arguments & args,
759 size_t argNo,
760 RefCountPtr< const char > expectedType );
761 CoreStateTypeMismatch( const Ast::SourceLocation & callLoc,
762 RefCountPtr< const char > title,
763 Kernel::Arguments & args,
764 size_t argNo,
765 RefCountPtr< const char > expectedType );
766 virtual ~CoreStateTypeMismatch( );
767 virtual void display( std::ostream & os ) const;
770 class ContinuationTypeMismatch : public RuntimeError
772 RefCountPtr< const char > valueType_;
773 RefCountPtr< const char > expectedType_;
774 public:
775 ContinuationTypeMismatch( const Kernel::Continuation * locationCont,
776 RefCountPtr< const char > valueType,
777 RefCountPtr< const char > expectedType );
778 virtual ~ContinuationTypeMismatch( );
779 virtual void display( std::ostream & os ) const;
782 class CoreOutOfRange : public CatchableError
784 const char * title_;
785 size_t argNo_;
786 const Ast::SourceLocation argLoc_;
787 const char * msg_;
788 RefCountPtr< const char > msgMem_;
789 public:
790 CoreOutOfRange( const char * title, Kernel::Arguments & args, size_t argNo, RefCountPtr< const char > msg );
791 CoreOutOfRange( const char * title, Kernel::Arguments & args, size_t argNo, const char * msg );
792 virtual ~CoreOutOfRange( );
793 virtual void display( std::ostream & os ) const;
794 virtual RefCountPtr< const Lang::Exception > clone( const Kernel::ContRef & cont ) const;
797 class UserOutOfRange : public CatchableError
799 RefCountPtr< const Lang::Symbol > kind_;
800 RefCountPtr< const Lang::String > source_;
801 RefCountPtr< const Lang::Integer > details_;
802 RefCountPtr< const char > message_;
803 public:
804 UserOutOfRange( const RefCountPtr< const Lang::Symbol > & kind, const RefCountPtr< const Lang::String > & source, const RefCountPtr< const Lang::Integer > & details, const RefCountPtr< const char > & message );
805 virtual ~UserOutOfRange( );
806 virtual void display( std::ostream & os ) const;
807 virtual RefCountPtr< const Lang::Exception > clone( const Kernel::ContRef & cont ) const;
810 class UserTypeMismatch : public CatchableError
812 RefCountPtr< const Lang::Symbol > kind_;
813 RefCountPtr< const Lang::String > source_;
814 RefCountPtr< const Lang::Integer > details_;
815 RefCountPtr< const char > expectedType_;
816 RefCountPtr< const char > valueType_;
817 public:
818 UserTypeMismatch( const RefCountPtr< const Lang::Symbol > & kind, const RefCountPtr< const Lang::String > & source, const RefCountPtr< const Lang::Integer > & details, const RefCountPtr< const char > & expectedType, const RefCountPtr< const char > & valueType );
819 virtual ~UserTypeMismatch( );
820 virtual void display( std::ostream & os ) const;
821 virtual RefCountPtr< const Lang::Exception > clone( const Kernel::ContRef & cont ) const;
824 class CoreRequirement : public CatchableError
826 const char * title_;
827 const char * msg_;
828 RefCountPtr< const char > msgMem_;
829 public:
830 CoreRequirement( RefCountPtr< const char > msg, const char * title, const Ast::SourceLocation & callLoc );
831 CoreRequirement( const char * msg, const char * title, const Ast::SourceLocation & callLoc );
832 virtual ~CoreRequirement( );
833 virtual void display( std::ostream & os ) const;
834 virtual RefCountPtr< const Lang::Exception > clone( const Kernel::ContRef & cont ) const;
837 class TeXLabelError : public RuntimeError
839 const Ast::SourceLocation strLoc_;
840 bool quoted_;
841 const char * region_;
842 RefCountPtr< const char > summary_;
843 RefCountPtr< const char > details_;
844 public:
845 TeXLabelError( bool quoted, const char * region, RefCountPtr< const char > summary, RefCountPtr< const char > details, const Ast::SourceLocation & strLoc );
846 virtual ~TeXLabelError( );
847 virtual void display( std::ostream & os ) const;
848 virtual Interaction::ExitCode exitCode( ) const { return Interaction::EXIT_TEX_ERROR; }
851 class StaticTeXLabelError : public StaticInconsistency
853 bool quoted_;
854 const char * region_;
855 RefCountPtr< const char > summary_;
856 RefCountPtr< const char > details_;
857 public:
858 StaticTeXLabelError( bool quoted, const char * region, RefCountPtr< const char > summary, RefCountPtr< const char > details, const Ast::SourceLocation & strLoc );
859 virtual ~StaticTeXLabelError( );
860 virtual void display( std::ostream & os ) const;
861 virtual Interaction::ExitCode exitCode( ) const { return Interaction::EXIT_TEX_ERROR; }
864 class MultipleDynamicBind : public RuntimeError
866 const char * id;
867 Ast::SourceLocation prevLoc;
868 public:
869 MultipleDynamicBind( const char * _id, const Ast::SourceLocation & _loc, const Ast::SourceLocation & _prevLoc );
870 virtual ~MultipleDynamicBind( );
871 virtual void display( std::ostream & os ) const;
874 class UndefinedEscapeContinuation : public RuntimeError
876 const char * id;
877 public:
878 UndefinedEscapeContinuation( const char * _id, const Ast::SourceLocation & _loc );
879 virtual ~UndefinedEscapeContinuation( );
880 virtual void display( std::ostream & os ) const;
883 class DeadStateAccess : public RuntimeError
885 public:
886 DeadStateAccess( );
887 virtual ~DeadStateAccess( );
888 virtual void display( std::ostream & os ) const;
891 class UnFreezable : public RuntimeError
893 public:
894 UnFreezable( );
895 virtual ~UnFreezable( );
896 virtual void display( std::ostream & os ) const;
899 class UnPeekable : public RuntimeError
901 public:
902 UnPeekable( );
903 virtual ~UnPeekable( );
904 virtual void display( std::ostream & os ) const;
907 class UninitializedAccess : public RuntimeError
909 public:
910 UninitializedAccess( );
911 virtual ~UninitializedAccess( );
912 virtual void display( std::ostream & os ) const;
915 class DtMinError : public CatchableError
917 double dt;
918 public:
919 DtMinError( double _dt );
920 virtual ~DtMinError( );
921 virtual void display( std::ostream & os ) const;
922 virtual RefCountPtr< const Lang::Exception > clone( const Kernel::ContRef & cont ) const;
923 virtual Interaction::ExitCode exitCode( ) const { return Interaction::EXIT_TOLERANCE_ERROR; }
926 class AffineTransformKillsPlane : public CatchableError
928 double sigma2_;
929 public:
930 AffineTransformKillsPlane( double sigma2 );
931 virtual ~AffineTransformKillsPlane( );
932 virtual void display( std::ostream & os ) const;
933 virtual RefCountPtr< const Lang::Exception > clone( const Kernel::ContRef & cont ) const;
936 class MissingFontMetrics : public RuntimeError
938 RefCountPtr< const char > fontname_;
939 const std::list< std::string > * searchPath_;
940 public:
941 MissingFontMetrics( RefCountPtr< const char > fontname, const std::list< std::string > * searchPath );
942 virtual ~MissingFontMetrics( );
943 virtual void display( std::ostream & os ) const;
944 virtual Interaction::ExitCode exitCode( ) const { return Interaction::EXIT_EXTERNAL_ERROR; }
947 class FontMetricsError : public RuntimeError
949 RefCountPtr< const char > fontname_;
950 RefCountPtr< const char > message_;
951 public:
952 FontMetricsError( const RefCountPtr< const char > & fontname, const RefCountPtr< const char > & message );
953 virtual ~FontMetricsError( );
954 virtual void display( std::ostream & os ) const;
955 virtual Interaction::ExitCode exitCode( ) const { return Interaction::EXIT_EXTERNAL_ERROR; }
958 class InsertingEmptyPage : public CatchableError
960 public:
961 InsertingEmptyPage( const Ast::SourceLocation & loc );
962 virtual ~InsertingEmptyPage( );
963 virtual void display( std::ostream & os ) const;
964 virtual RefCountPtr< const Lang::Exception > clone( const Kernel::ContRef & cont ) const;
967 class UndefinedCrossRef : public PostCondition
969 private:
970 RefCountPtr< const char > ref_;
971 public:
972 UndefinedCrossRef( const Ast::SourceLocation & _loc, RefCountPtr< const char > ref );
973 virtual ~UndefinedCrossRef( );
974 virtual void display( std::ostream & os ) const;
981 namespace NonLocalExit
983 // The exceptions in this namespace does not represent ordinary exception conditions in the program.
984 // Rather, they can be seen as alternative ways for particular functions to return. Thus, the caller
985 // of such a function shall always take care of any such exceptions, and not let these be passed up.
986 // For this reason, the classes in this namespace does not inherit from Shapes::Exceptions::Exception.
988 class NonLocalExitBase
990 public:
991 NonLocalExitBase( ){ }
994 class DynamicBindingNotFound : public NonLocalExitBase
996 public:
997 DynamicBindingNotFound( ){ }
1000 class CrossDirectionOfParallel : public NonLocalExitBase
1002 public:
1003 CrossDirectionOfParallel( ){ }
1006 class NotThisType : public NonLocalExitBase
1008 public:
1009 NotThisType( ){ }