ADi-FontEngine  1.0
PDF Optimized FontEngine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PostScriptEngineError.h
Go to the documentation of this file.
1 // PostScriptEngine/PostScriptEngineError.h
2 //
3 // Copyright 2012 - Andreas Dippe
4 //
5 // This file is part of ADi-FontEngine, 2012
6 //-----------------------------------------------------------------------------
7 
8 #ifndef POSTSCRIPTENGINEERROR_H
9 #define POSTSCRIPTENGINEERROR_H
10 
11 #if defined(_WIN32) || defined(_M_X64)
12 # define NOMINMAX
13 # include <windows.h>
14 #elif defined( __APPLE__ )
15 # include <Carbon/Carbon.h>
16 #endif // defined(_WIN32) || defined(_M_X64)
17 
18 //-----------------------------------------------------------------------------
19 //-----------------------------------------------------------------------------
20 
21 namespace PostScript
22 {
23 
24  //! PostScript error codes
26  {
28 
29  , eUnknown = 6000 //!< (6000) ps - Unknown error
30  , eConfigurationError //!< (6001) ps - setpagedevice or setdevparams request cannot be satisfied
31  , eDictFull //!< (6002) ps - No more room in dictionary
32  , eDictStackOverflow //!< (6003) ps - Too many begin operators
33  , eDictStackUnderflow //!< (6004) ps - Too many end operators
34  , eExecStackOverflow //!< (6005) ps - Executive stack nesting too deep
35  , eHandleError //!< (6006) ps - Called to report error information
36  , eInterrupt //!< (6007) ps - External interrupt request (for example, control-C)
37  , eInvalidAccess //!< (6008) ps - Attempt to violate access attribute
38  , eInvalidExit //!< (6009) ps - exit not in loop
39  , eInvalidFileAccess //!< (6010) ps - Unacceptable access string
40  , eInvalidFont //!< (6011) ps - Invalid Font resource name or font or CIDFont dictionary
41  , eInvalidRestore //!< (6012) ps - Improper restore
42  , eIOError //!< (6013) ps - Input/output error
43  , eLimitCheck //!< (6014) ps - Implementation limit exceeded
44  , eNoCurrentPoint //!< (6015) ps - Current point undefined
45  , eRangeCheck //!< (6016) ps - Operand out of bounds
46  , eStackOverflow //!< (6017) ps - Operand stack overflow
47  , eStackUnderflow //!< (6018) ps - Operand stack underflow
48  , eSyntaxError //!< (6019) ps - PostScript language syntax error
49  , eTimeout //!< (6020) ps - Time limit exceeded
50  , eTypeCheck //!< (6021) ps - Operand of wrong type
51  , eUndefined //!< (6022) ps - Name not known
52  , eUndefinedFilename //!< (6023) ps - File not found
53  , eUndefinedResource //!< (6024) ps - Resource instance not found
54  , eUndefinedResult //!< (6025) ps - Overflow, underflow, or meaningless result
55  , eUnmatchedMark //!< (6026) ps - Expected mark not on stack
56  , eUnregistered //!< (6027) ps - Internal error
57  , eVMError //!< (6028) ps - Virtual memory exhausted
58  };
59  //-----------------------------------------------------------------------------
60  //! PostScript C++ exception type
62  {
64  : errcode( ec)
65  {}
66  EErrorCodes errcode; //!< current error code
67  };
68  //-----------------------------------------------------------------------------
69  //-----------------------------------------------------------------------------
70  //-----------------------------------------------------------------------------
71  /*! \brief function to raise PostScript exception
72  \param expr if false a exception with error code will be raised
73  \param errcode PostScript error codes
74  \param dbg_break if true the program will stop if a debugger is present
75  */
76  inline void ThrowPostScriptException( bool expr, EErrorCodes errcode, bool dbg_break = true)
77  {
78  if( !expr) {
79 # if defined( _DEBUG)
80  static bool s_ignore( false);
81  static int s_errorcode( 1); // 1 == impossible
82 # ifdef WIN32
83  if( dbg_break && ::IsDebuggerPresent() && !s_ignore && (s_errorcode != errcode)) {
84  ::DebugBreak();
85  }
86 # elif defined( __APPLE__ )
87  if( dbg_break && !s_ignore && (s_errorcode != errcode)) {
88  ::Debugger();
89  }
90 # else // WIN32
91 # error (define_own_stuff_here)
92 # endif //def WIN32
93 # else // _DEBUG
94  (void)dbg_break;
95 # endif // _DEBUG
96  throw TPostScriptError( errcode);
97  }
98  }
99  //-----------------------------------------------------------------------------
100  /*! \brief function to check program process no excption raise
101  \param expr if false the program will stop if a debugger is present
102  */
103  inline void PostScript_Assert( bool expr)
104  {
105 # if defined( _DEBUG)
106  static bool s_ignore( false);
107  if( !expr) {
108 # ifdef WIN32
109  if( ::IsDebuggerPresent() && !s_ignore) {
110  ::DebugBreak();
111  }
112 # elif defined( __APPLE__ )
113  if( !s_ignore) {
114  ::Debugger();
115  }
116 # else // WIN32
117 # error (define_own_stuff_here)
118 # endif //def WIN32
119  }
120 # else // _DEBUG
121  (void)expr;
122 # endif // _DEBUG
123  }
124  //-----------------------------------------------------------------------------
125 
126 } // namespace PostScript
127 
128 #endif // POSTSCRIPTENGINEERROR_H
129 //-----------------------------------------------------------------------------
130 /*!\history
131 ** ADi-2012-12-14: creation
132 ** ADi-2012-12-18: windows.h must be encapsulated
133 ** RGu-2012-12-18: added Carbon/Carbon.h on mac
134 ** ADi-2013-04-11: reduce compiler warning
135 ** ADi-2013-06-30: disable min and max stupid macros
136 ** ADi-2013-10-16: use Windows NOMINMAX
137 */
(6027) ps - Internal error
Definition: PostScriptEngineError.h:56
(6026) ps - Expected mark not on stack
Definition: PostScriptEngineError.h:55
void PostScript_Assert(bool expr)
function to check program process no excption raise
Definition: PostScriptEngineError.h:103
(6001) ps - setpagedevice or setdevparams request cannot be satisfied
Definition: PostScriptEngineError.h:30
PostScript C++ exception type.
Definition: PostScriptEngineError.h:61
(6018) ps - Operand stack underflow
Definition: PostScriptEngineError.h:47
void ThrowPostScriptException(bool expr, EErrorCodes errcode, bool dbg_break=true)
function to raise PostScript exception
Definition: PostScriptEngineError.h:76
(6004) ps - Too many end operators
Definition: PostScriptEngineError.h:33
(6022) ps - Name not known
Definition: PostScriptEngineError.h:51
(6013) ps - Input/output error
Definition: PostScriptEngineError.h:42
(6016) ps - Operand out of bounds
Definition: PostScriptEngineError.h:45
(6014) ps - Implementation limit exceeded
Definition: PostScriptEngineError.h:43
(6023) ps - File not found
Definition: PostScriptEngineError.h:52
(6017) ps - Operand stack overflow
Definition: PostScriptEngineError.h:46
(6000) ps - Unknown error
Definition: PostScriptEngineError.h:29
(6019) ps - PostScript language syntax error
Definition: PostScriptEngineError.h:48
EErrorCodes
PostScript error codes.
Definition: PostScriptEngineError.h:25
EErrorCodes errcode
current error code
Definition: PostScriptEngineError.h:66
(6028) ps - Virtual memory exhausted
Definition: PostScriptEngineError.h:57
(6008) ps - Attempt to violate access attribute
Definition: PostScriptEngineError.h:37
(6024) ps - Resource instance not found
Definition: PostScriptEngineError.h:53
(6011) ps - Invalid Font resource name or font or CIDFont dictionary
Definition: PostScriptEngineError.h:40
(6007) ps - External interrupt request (for example, control-C)
Definition: PostScriptEngineError.h:36
Definition: PostScriptEngineError.h:27
(6025) ps - Overflow, underflow, or meaningless result
Definition: PostScriptEngineError.h:54
(6020) ps - Time limit exceeded
Definition: PostScriptEngineError.h:49
(6012) ps - Improper restore
Definition: PostScriptEngineError.h:41
(6002) ps - No more room in dictionary
Definition: PostScriptEngineError.h:31
(6009) ps - exit not in loop
Definition: PostScriptEngineError.h:38
TPostScriptError(EErrorCodes ec)
Definition: PostScriptEngineError.h:63
(6021) ps - Operand of wrong type
Definition: PostScriptEngineError.h:50
(6003) ps - Too many begin operators
Definition: PostScriptEngineError.h:32
(6015) ps - Current point undefined
Definition: PostScriptEngineError.h:44
(6010) ps - Unacceptable access string
Definition: PostScriptEngineError.h:39
(6006) ps - Called to report error information
Definition: PostScriptEngineError.h:35
(6005) ps - Executive stack nesting too deep
Definition: PostScriptEngineError.h:34
InsideFont and ADI-FontEngine : Andreas Dippe, © 2013
http://www.insidefont.de