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
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
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"
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"
45 extern const std::string additionalLinesPrefix
;
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
;
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
70 Ast::SourceLocation primaryLoc_
;
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
81 Ast::SourceLocation primaryLoc_
;
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
;
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
;
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
;
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
;
120 Ast::SourceLocation abstractLoc
;
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
;
131 Ast::SourceLocation oldLoc
;
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
;
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
;
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
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_
;
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_
;
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_
;
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
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
;
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
;
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
;
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
;
237 IllegalImperative( const Ast::SourceLocation
& _loc
);
238 virtual ~IllegalImperative( );
239 virtual void display( std::ostream
& os
) const;
242 class FileReadOpenError
: public Exception
245 enum Type
{ OPEN
, STAT
};
247 Ast::SourceLocation loc
;
248 RefCountPtr
< const char > filename
;
250 const std::string
* sourceDir_
;
251 const std::list
< std::string
> * searchPath_
;
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
262 Ast::SourceLocation loc
;
263 RefCountPtr
< const char > filename
;
264 const char * purpose_
;
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
;
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
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_
;
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
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_
;
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_
;
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
339 RefCountPtr
< const char > msgMem_
;
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
354 RefCountPtr
< const char > msgMem_
;
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
368 TeXSetupHasChanged( );
369 virtual ~TeXSetupHasChanged( );
372 class MiscellaneousRequirement
: public CatchableError
375 RefCountPtr
< const char > msgMem_
;
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
;
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_
;
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
413 RedefiningLexical( const char * _id
);
414 virtual ~RedefiningLexical( );
415 virtual void display( std::ostream
& os
) const;
418 class RedefiningDynamic
: public RuntimeError
422 RedefiningDynamic( const char * _id
);
423 virtual ~RedefiningDynamic( );
424 virtual void display( std::ostream
& os
) const;
427 class TypeMismatch
: public RuntimeError
430 RefCountPtr
< const char > valueType
;
431 RefCountPtr
< const char > expectedType
;
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
;
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
451 enum Kind
{ VALUE
, STATE
};
452 enum Ref
{ FIELD
, MUTATOR
};
456 RefCountPtr
< const char > valueType
;
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
;
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
;
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
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
;
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
;
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
;
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
534 enum Type
{ VARIABLE
, STATE
, DYNAMIC_VARIABLE
, DYNAMIC_STATE
, TYPE
};
536 RefCountPtr
< const char > id
;
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
;
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
;
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
;
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
574 RefCountPtr
< const char > msgMem_
;
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_
;
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
597 enum Type
{ VARIABLE
, STATE
};
599 const Ast::SourceLocation formalsLoc
;
600 const size_t functionArity
;
601 const size_t callArity
;
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
612 const Ast::SourceLocation formalsLoc_
;
613 const size_t formalsArity_
;
614 const size_t callArity_
;
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
624 enum Type
{ VARIABLE
, STATE
};
626 const Ast::SourceLocation formalsLoc
;
627 RefCountPtr
< const char > name
;
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
638 enum Type
{ VARIABLE
, STATE
};
640 const Ast::SourceLocation formalsLoc
;
641 RefCountPtr
< const char > name
;
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_
;
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
664 RefCountPtr
< const char > titleMem
;
665 const size_t functionArityLow
;
666 const size_t functionArityHigh
;
667 const size_t callArity
;
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
680 RefCountPtr
< const char > titleMem
;
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
691 RefCountPtr
< const char > titleMem_
;
692 const Ast::SourceLocation argLoc_
;
693 RefCountPtr
< const char > valueType_
;
694 RefCountPtr
< const char > expectedType_
;
696 CoreTypeMismatch( const Ast::SourceLocation
& callLoc
,
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
,
708 Kernel::Arguments
& args
,
710 RefCountPtr
< const char > expectedType
);
711 CoreTypeMismatch( const Ast::SourceLocation
& callLoc
,
712 RefCountPtr
< const char > title
,
713 Kernel::Arguments
& args
,
715 RefCountPtr
< const char > expectedType
);
716 virtual ~CoreTypeMismatch( );
717 virtual void display( std::ostream
& os
) const;
720 class CoreDynamicTypeMismatch
: public RuntimeError
723 RefCountPtr
< const char > titleMem_
;
725 RefCountPtr
< const char > idMem_
;
726 RefCountPtr
< const char > valueType_
;
727 RefCountPtr
< const char > expectedType_
;
729 CoreDynamicTypeMismatch( const Ast::SourceLocation
& callLoc
,
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
741 RefCountPtr
< const char > titleMem_
;
742 const Ast::SourceLocation argLoc_
;
743 RefCountPtr
< const char > valueType_
;
744 RefCountPtr
< const char > expectedType_
;
746 CoreStateTypeMismatch( const Ast::SourceLocation
& callLoc
,
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
,
758 Kernel::Arguments
& args
,
760 RefCountPtr
< const char > expectedType
);
761 CoreStateTypeMismatch( const Ast::SourceLocation
& callLoc
,
762 RefCountPtr
< const char > title
,
763 Kernel::Arguments
& args
,
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_
;
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
786 const Ast::SourceLocation argLoc_
;
788 RefCountPtr
< const char > msgMem_
;
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_
;
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_
;
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
828 RefCountPtr
< const char > msgMem_
;
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_
;
841 const char * region_
;
842 RefCountPtr
< const char > summary_
;
843 RefCountPtr
< const char > details_
;
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
854 const char * region_
;
855 RefCountPtr
< const char > summary_
;
856 RefCountPtr
< const char > details_
;
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
867 Ast::SourceLocation prevLoc
;
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
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
887 virtual ~DeadStateAccess( );
888 virtual void display( std::ostream
& os
) const;
891 class UnFreezable
: public RuntimeError
895 virtual ~UnFreezable( );
896 virtual void display( std::ostream
& os
) const;
899 class UnPeekable
: public RuntimeError
903 virtual ~UnPeekable( );
904 virtual void display( std::ostream
& os
) const;
907 class UninitializedAccess
: public RuntimeError
910 UninitializedAccess( );
911 virtual ~UninitializedAccess( );
912 virtual void display( std::ostream
& os
) const;
915 class DtMinError
: public CatchableError
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
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_
;
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_
;
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
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
970 RefCountPtr
< const char > ref_
;
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
991 NonLocalExitBase( ){ }
994 class DynamicBindingNotFound
: public NonLocalExitBase
997 DynamicBindingNotFound( ){ }
1000 class CrossDirectionOfParallel
: public NonLocalExitBase
1003 CrossDirectionOfParallel( ){ }
1006 class NotThisType
: public NonLocalExitBase