| 1 |
/* |
| 2 |
* exception.h - more exception classes |
| 3 |
* |
| 4 |
* Copyright (c) 2000-2024 Shiro Kawai <[email protected]> |
| 5 |
* |
| 6 |
* Redistribution and use in source and binary forms, with or without |
| 7 |
* modification, are permitted provided that the following conditions |
| 8 |
* are met: |
| 9 |
* |
| 10 |
* 1. Redistributions of source code must retain the above copyright |
| 11 |
* notice, this list of conditions and the following disclaimer. |
| 12 |
* |
| 13 |
* 2. Redistributions in binary form must reproduce the above copyright |
| 14 |
* notice, this list of conditions and the following disclaimer in the |
| 15 |
* documentation and/or other materials provided with the distribution. |
| 16 |
* |
| 17 |
* 3. Neither the name of the authors nor the names of its contributors |
| 18 |
* may be used to endorse or promote products derived from this |
| 19 |
* software without specific prior written permission. |
| 20 |
* |
| 21 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 22 |
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 23 |
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 24 |
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 25 |
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 26 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED |
| 27 |
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 28 |
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 29 |
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 30 |
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 31 |
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 32 |
*/ |
| 33 |
|
| 34 |
#ifndef GAUCHE_EXCEPTION_H |
| 35 |
#define GAUCHE_EXCEPTION_H |
| 36 |
|
| 37 |
/* Condition class hierarchy |
| 38 |
|
| 39 |
<condition> ; srfi-35 |
| 40 |
+- <compound-condition> |
| 41 |
+- <serious-condition> ; srfi-35 |
| 42 |
| +- <serious-compound-condition> ; also inherits <compound-condition> |
| 43 |
+- <message-condition> ; srfi-35 |
| 44 |
| +- <error> ; srfi-35, also inherits <serious-condition> |
| 45 |
| +- <system-error> |
| 46 |
| +- <unhandled-signal-error> |
| 47 |
| +- <unbound-varaible-error> |
| 48 |
| +- <read-error> ; srfi-36 |
| 49 |
| +- <io-error> ; srfi-36 |
| 50 |
| | +- <port-error> ; srfi-36 |
| 51 |
| | +- <io-read-error> ; srfi-36 |
| 52 |
| | | +- <io-decoding-error> ; (srfi-186) |
| 53 |
| | +- <io-write-error> ; srfi-36 |
| 54 |
| | | +- <io-encoding-error> ; (srfi-186) |
| 55 |
| | +- <io-closed-error> ; srfi-36 |
| 56 |
| | +- <io-unit-error> |
| 57 |
| | +- <io-invalid-position-error> ; srfi-192 |
| 58 |
| +- <continuation-error> ; srfi-226 |
| 59 |
+- <thread-exception> ; srfi-18 |
| 60 |
| +- <join-timeout-exception> ; srfi-18 |
| 61 |
| +- <abandoned-mutex-exception> ; srfi-18 |
| 62 |
| +- <terminated-thread-exception> ; srfi-18 |
| 63 |
| +- <uncaught-exception> ; srfi-18 |
| 64 |
+- <mixin-condition> |
| 65 |
+- <load-condition-mixin> ; compounded to an error during loading |
| 66 |
+- <compile-error-mixin> ; compounded to an error during compiling |
| 67 |
+- <io-filename-error> ; srfi-36; compounded to <system-error> (*) |
| 68 |
+- <io-malformed-filename-error> ; ditto (*) |
| 69 |
+- <io-protection-error> ; ditto (*) |
| 70 |
| +- <io-file-is-read-only-error> ; ditto (*) |
| 71 |
+- <io-file-already-exists-error> ; ditto (*) |
| 72 |
+- <io-no-such-file-error> ; ditto (*) |
| 73 |
|
| 74 |
SRFI-35 does not make distinction between primary inheritance and mixin |
| 75 |
inheritance; the <mixin-condition> subtree is Gauche's convention. The |
| 76 |
default error reporting routine treats mixins specially. |
| 77 |
|
| 78 |
(*) Those classes are defined, but not yet used. |
| 79 |
*/ |
| 80 |
|
| 81 |
/*--------------------------------------------------- |
| 82 |
* Base conditions. |
| 83 |
*/ |
| 84 |
|
| 85 |
/* <condition> : root of all condition types. */ |
| 86 |
typedef ScmInstance ScmCondition; |
| 87 |
|
| 88 |
SCM_CLASS_DECL(Scm_ConditionClass); |
| 89 |
#define SCM_CLASS_CONDITION (&Scm_ConditionClass) |
| 90 |
#define SCM_CONDITIONP(obj) SCM_ISA(obj, SCM_CLASS_CONDITION) |
| 91 |
|
| 92 |
SCM_EXTERN int Scm_ConditionHasType(ScmObj c, ScmObj k); |
| 93 |
|
| 94 |
/* <message-condition> : condition with message. */ |
| 95 |
/* R7RS requires error condition to store 'message' and 'irritants' separately. |
| 96 |
We can't add fields during 0.9 to keep ABI compatibility. So, as the |
| 97 |
temporary solution, we clam them into the 'message' fields. The message |
| 98 |
field now contain a list of one or more elements, as follows: |
| 99 |
(<preformatted-message> <message-prefix> <irritant> ...) |
| 100 |
Where <preformatted-message> is a string and that's what we get |
| 101 |
to access "message" slot of a error condition. <message-prefix> and |
| 102 |
<irritant>s are just what is passed to "error" procedure: |
| 103 |
(error <message-prefix> <irritant> ...) |
| 104 |
For errorf and the family, it's tricky to separate <irritant>s. For now |
| 105 |
we preformat the message and treat it as if it was given as the |
| 106 |
<message-prefix>, with no irritants. |
| 107 |
|
| 108 |
In Scheme level we won't show this structure. If Scheme code accesses |
| 109 |
the message slot, we return <preformatted-message>. |
| 110 |
|
| 111 |
C code that access 'message' slot directly needs to be modified. |
| 112 |
*/ |
| 113 |
|
| 114 |
typedef struct ScmMessageConditionRec { |
| 115 |
ScmCondition common; |
| 116 |
ScmObj message; /* message - should be accessed via Scm_ConditionMessage */ |
| 117 |
} ScmMessageCondition; |
| 118 |
|
| 119 |
SCM_CLASS_DECL(Scm_MessageConditionClass); |
| 120 |
#define SCM_CLASS_MESSAGE_CONDITION (&Scm_MessageConditionClass) |
| 121 |
#define SCM_MESSAGE_CONDITION_P(obj) SCM_ISA(obj, SCM_CLASS_MESSAGE_CONDITION) |
| 122 |
#define SCM_MESSAGE_CONDITION(obj) ((ScmMessageCondition*)(obj)) |
| 123 |
|
| 124 |
/* default 'print' procedure for class definition */ |
| 125 |
SCM_EXTERN void Scm_MessageConditionPrint(ScmObj obj, ScmPort *port, |
| 126 |
ScmWriteContext *ctx); |
| 127 |
|
| 128 |
/* <serious-condition> : condition which can't be restarted */ |
| 129 |
typedef ScmCondition ScmSeriousCondition; |
| 130 |
|
| 131 |
SCM_CLASS_DECL(Scm_SeriousConditionClass); |
| 132 |
#define SCM_CLASS_SERIOUS_CONDITION (&Scm_SeriousConditionClass) |
| 133 |
#define SCM_SERIOUS_CONDITION_P(obj) SCM_ISA(obj, SCM_CLASS_SERIOUS_CONDITION) |
| 134 |
#define SCM_SERIOUS_CONDITION(obj) ((ScmSeriousCondition*)(obj)) |
| 135 |
|
| 136 |
/*--------------------------------------------------- |
| 137 |
* Errors |
| 138 |
*/ |
| 139 |
|
| 140 |
/* <error>: root of all errors. */ |
| 141 |
typedef ScmMessageCondition ScmError; |
| 142 |
|
| 143 |
SCM_CLASS_DECL(Scm_ErrorClass); |
| 144 |
#define SCM_CLASS_ERROR (&Scm_ErrorClass) |
| 145 |
#define SCM_ERRORP(obj) SCM_ISA(obj, SCM_CLASS_ERROR) |
| 146 |
#define SCM_ERROR(obj) ((ScmError*)(obj)) |
| 147 |
#define SCM_ERROR_MESSAGE(obj) Scm_ConditionMessage(obj) |
| 148 |
|
| 149 |
SCM_EXTERN ScmObj Scm_MakeError(ScmObj message); |
| 150 |
|
| 151 |
/* <system-error>: error from system calls */ |
| 152 |
typedef struct ScmSystemErrorRec { |
| 153 |
ScmError common; |
| 154 |
int error_number; /* errno */ |
| 155 |
} ScmSystemError; |
| 156 |
|
| 157 |
SCM_CLASS_DECL(Scm_SystemErrorClass); |
| 158 |
#define SCM_CLASS_SYSTEM_ERROR (&Scm_SystemErrorClass) |
| 159 |
#define SCM_SYSTEM_ERROR(obj) ((ScmSystemError*)(obj)) |
| 160 |
#define SCM_SYSTEM_ERROR_P(obj) SCM_ISA(obj, SCM_CLASS_SYSTEM_ERROR) |
| 161 |
|
| 162 |
SCM_EXTERN ScmObj Scm_MakeSystemError(ScmObj message, int error_num); |
| 163 |
|
| 164 |
/* <unhandled-signal-error>: unhandled signal */ |
| 165 |
typedef struct ScmUnhandledSignalErrorRec { |
| 166 |
ScmError common; |
| 167 |
int signal; /* signal number */ |
| 168 |
} ScmUnhandledSignalError; |
| 169 |
|
| 170 |
SCM_CLASS_DECL(Scm_UnhandledSignalErrorClass); |
| 171 |
#define SCM_CLASS_UNHANDLED_SIGNAL_ERROR (&Scm_UnhandledSignalErrorClass) |
| 172 |
#define SCM_UNHANDLED_SIGNAL_ERROR(obj) ((ScmUnhandledSignalError*)(obj)) |
| 173 |
#define SCM_UNHANDLED_SIGNAL_ERROR_P(obj) SCM_ISA(obj, SCM_CLASS_UNHANDLED_SIGNAL_ERROR) |
| 174 |
|
| 175 |
/* <unbound-variable-error>: unbound variable */ |
| 176 |
typedef struct ScmUnboundVariableErrorRec { |
| 177 |
ScmError common; |
| 178 |
ScmObj identifier; /* (</> <symbol> <identifier>) */ |
| 179 |
} ScmUnboundVariableError; |
| 180 |
|
| 181 |
SCM_CLASS_DECL(Scm_UnboundVariableErrorClass); |
| 182 |
#define SCM_CLASS_UNBOUND_VARIABLE_ERROR (&Scm_UnboundVariableErrorClass) |
| 183 |
#define SCM_UNBOUND_VARIABLE_ERROR(obj) ((ScmUnboundVariableError*)(obj)) |
| 184 |
#define SCM_UNBOUND_VARIABLE_ERROR_P(obj) SCM_ISA(obj, SCM_CLASS_UNBOUND_VARIABLE_ERROR) |
| 185 |
|
| 186 |
SCM_EXTERN ScmObj Scm_MakeUnboundVariableError(ScmObj identifier); |
| 187 |
|
| 188 |
/* <read-error>: error from the reader */ |
| 189 |
typedef struct ScmReadErrorRec { |
| 190 |
ScmError common; |
| 191 |
ScmPort *port; /* input port where we're reading from. */ |
| 192 |
int line; /* line number (if available), or -1 */ |
| 193 |
} ScmReadError; |
| 194 |
|
| 195 |
SCM_CLASS_DECL(Scm_ReadErrorClass); |
| 196 |
#define SCM_CLASS_READ_ERROR (&Scm_ReadErrorClass) |
| 197 |
#define SCM_READ_ERROR(obj) ((ScmReadError*)(obj)) |
| 198 |
#define SCM_READ_ERROR_P(obj) SCM_ISA(obj, SCM_CLASS_READ_ERROR) |
| 199 |
|
| 200 |
SCM_EXTERN ScmObj Scm_MakeReadError(ScmObj message, ScmPort *p, int line); |
| 201 |
|
| 202 |
/* <io-error>: abstract class for I/O related error. */ |
| 203 |
typedef ScmError ScmIOError; |
| 204 |
|
| 205 |
SCM_CLASS_DECL(Scm_IOErrorClass); |
| 206 |
#define SCM_CLASS_IO_ERROR (&Scm_IOErrorClass) |
| 207 |
#define SCM_IO_ERROR_P(obj) SCM_ISA(obj, SCM_CLASS_IO_ERROR) |
| 208 |
|
| 209 |
/* <port-error>: Port related error, inherits <io-error> */ |
| 210 |
typedef struct ScmPortErrorRec { |
| 211 |
ScmIOError common; |
| 212 |
ScmPort *port; /* The port where I/O error occurs */ |
| 213 |
ScmObj auxinfo; /* alist of auxiliary info, depending on the |
| 214 |
subclases. */ |
| 215 |
} ScmPortError; |
| 216 |
|
| 217 |
SCM_CLASS_DECL(Scm_PortErrorClass); |
| 218 |
#define SCM_CLASS_PORT_ERROR (&Scm_PortErrorClass) |
| 219 |
#define SCM_PORT_ERROR(obj) ((ScmPortError*)(obj)) |
| 220 |
#define SCM_PORT_ERROR_P(obj) SCM_ISA(obj, SCM_CLASS_PORT_ERROR) |
| 221 |
|
| 222 |
/* <io-read-error>, <io-write-error>, <io-closed-error> : |
| 223 |
subclasses of port-error */ |
| 224 |
|
| 225 |
typedef ScmPortError ScmIOReadError; |
| 226 |
typedef ScmPortError ScmIOWriteError; |
| 227 |
typedef ScmPortError ScmIOClosedError; |
| 228 |
typedef ScmPortError ScmIOUnitError; |
| 229 |
typedef ScmPortError ScmIODecodingError; |
| 230 |
typedef ScmPortError ScmIOEncodingError; |
| 231 |
typedef ScmPortError ScmIOInvalidPositionError; |
| 232 |
|
| 233 |
SCM_CLASS_DECL(Scm_IOReadErrorClass); |
| 234 |
#define SCM_CLASS_IO_READ_ERROR (&Scm_IOReadErrorClass) |
| 235 |
SCM_CLASS_DECL(Scm_IOWriteErrorClass); |
| 236 |
#define SCM_CLASS_IO_WRITE_ERROR (&Scm_IOWriteErrorClass) |
| 237 |
SCM_CLASS_DECL(Scm_IOClosedErrorClass); |
| 238 |
#define SCM_CLASS_IO_CLOSED_ERROR (&Scm_IOClosedErrorClass) |
| 239 |
SCM_CLASS_DECL(Scm_IOUnitErrorClass); |
| 240 |
#define SCM_CLASS_IO_UNIT_ERROR (&Scm_IOUnitErrorClass) |
| 241 |
|
| 242 |
SCM_CLASS_DECL(Scm_IODecodingErrorClass); |
| 243 |
#define SCM_CLASS_IO_DECODING_ERROR (&Scm_IODecodingErrorClass) |
| 244 |
SCM_CLASS_DECL(Scm_IOEncodingErrorClass); |
| 245 |
#define SCM_CLASS_IO_ENCODING_ERROR (&Scm_IOEncodingErrorClass) |
| 246 |
SCM_CLASS_DECL(Scm_IOInvalidPositionErrorClass); |
| 247 |
#define SCM_CLASS_IO_INVALID_POSITION_ERROR (&Scm_IOInvalidPositionErrorClass) |
| 248 |
|
| 249 |
/* <continuation-error> */ |
| 250 |
typedef struct ScmContinuationErrorRec { |
| 251 |
ScmError common; |
| 252 |
ScmObj promptTag; |
| 253 |
} ScmContinuationError; |
| 254 |
|
| 255 |
SCM_CLASS_DECL(Scm_ContinuationErrorClass); |
| 256 |
#define SCM_CLASS_CONTINUATION_ERROR (&Scm_ContinuationErrorClass) |
| 257 |
#define SCM_CONTINUATION_ERROR_P(obj) SCM_ISA(obj, SCM_CLASS_CONTINUATION_ERROR) |
| 258 |
|
| 259 |
/*--------------------------------------------------- |
| 260 |
* Compounders |
| 261 |
*/ |
| 262 |
|
| 263 |
/* compound condition may automatically be an instance of |
| 264 |
<serious-compound-condition> if any of its component |
| 265 |
exception is an instance of <serious-condition>. |
| 266 |
|
| 267 |
Compound condition never 'nests', i.e. any member of conditions |
| 268 |
isn't a compound condition itself. */ |
| 269 |
|
| 270 |
typedef struct ScmCompoundConditionRec { |
| 271 |
ScmCondition common; |
| 272 |
ScmObj conditions; /* list of simple conditions */ |
| 273 |
} ScmCompoundCondition; |
| 274 |
|
| 275 |
SCM_CLASS_DECL(Scm_CompoundConditionClass); |
| 276 |
#define SCM_CLASS_COMPOUND_CONDITION (&Scm_CompoundConditionClass) |
| 277 |
#define SCM_COMPOUND_CONDITION(obj) ((ScmCompoundCondition*)(obj)) |
| 278 |
#define SCM_COMPOUND_CONDITION_P(obj) SCM_ISA(obj, SCM_CLASS_COMPOUND_CONDITION) |
| 279 |
|
| 280 |
SCM_CLASS_DECL(Scm_SeriousCompoundConditionClass); |
| 281 |
#define SCM_CLASS_SERIOUS_COMPOUND_CONDITION (&Scm_SeriousCompoundConditionClass) |
| 282 |
#define SCM_SERIOUS_COMPOUND_CONDITION_P(obj) SCM_ISA(obj, SCM_CLASS_SERIOUS_COMPOUND_CONDITION) |
| 283 |
|
| 284 |
SCM_EXTERN ScmObj Scm_MakeCompoundCondition(ScmObj conditions); |
| 285 |
SCM_EXTERN ScmObj Scm_ExtractSimpleCondition(ScmObj condition, ScmClass *type); |
| 286 |
|
| 287 |
/*--------------------------------------------------- |
| 288 |
* Thread exceptions |
| 289 |
*/ |
| 290 |
|
| 291 |
typedef struct ScmThreadExceptionRec { |
| 292 |
SCM_HEADER; |
| 293 |
ScmVM *thread; /* the thread that caused the exception */ |
| 294 |
ScmObj data; /* additional data. |
| 295 |
<join-timeout-exception> : n/a |
| 296 |
<abandoned-mutex-exception> : mutex |
| 297 |
<terminated-thread-exception> : n/a |
| 298 |
<uncaught-exception> : exception |
| 299 |
*/ |
| 300 |
} ScmThreadException; |
| 301 |
|
| 302 |
SCM_EXTERN ScmObj Scm_MakeThreadException(ScmClass*, ScmVM*); |
| 303 |
|
| 304 |
SCM_CLASS_DECL(Scm_ThreadExceptionClass); |
| 305 |
#define SCM_CLASS_THREAD_EXCEPTION (&Scm_ThreadExceptionClass) |
| 306 |
#define SCM_THREAD_EXCEPTION_P(obj) SCM_ISA(obj, SCM_CLASS_THREAD_EXCEPTION) |
| 307 |
#define SCM_THREAD_EXCEPTION(obj) ((ScmThreadException*)(obj)) |
| 308 |
|
| 309 |
SCM_CLASS_DECL(Scm_JoinTimeoutExceptionClass); |
| 310 |
#define SCM_CLASS_JOIN_TIMEOUT_EXCEPTION (&Scm_JoinTimeoutExceptionClass) |
| 311 |
#define SCM_JOIN_TIMEOUT_EXCEPTION_P(obj) SCM_ISA(obj, SCM_CLASS_JOIN_TIMEOUT_EXCEPTION) |
| 312 |
|
| 313 |
SCM_CLASS_DECL(Scm_AbandonedMutexExceptionClass); |
| 314 |
#define SCM_CLASS_ABANDONED_MUTEX_EXCEPTION (&Scm_AbandonedMutexExceptionClass) |
| 315 |
#define SCM_ABANDONED_MUTEX_EXCEPTION_P(obj) SCM_ISA(obj, SCM_CLASS_ABANDONED_MUTEX_EXCEPTION) |
| 316 |
|
| 317 |
SCM_CLASS_DECL(Scm_TerminatedThreadExceptionClass); |
| 318 |
#define SCM_CLASS_TERMINATED_THREAD_EXCEPTION (&Scm_TerminatedThreadExceptionClass) |
| 319 |
#define SCM_TERMINATED_THREAD_EXCEPTION_P(obj) SCM_ISA(obj, SCM_CLASS_TERMINATED_THREAD_EXCEPTION) |
| 320 |
|
| 321 |
SCM_CLASS_DECL(Scm_UncaughtExceptionClass); |
| 322 |
#define SCM_CLASS_UNCAUGHT_EXCEPTION (&Scm_UncaughtExceptionClass) |
| 323 |
#define SCM_UNCAUGHT_EXCEPTION_P(obj) SCM_ISA(obj, SCM_CLASS_UNCAUGHT_EXCEPTION) |
| 324 |
|
| 325 |
/*--------------------------------------------------- |
| 326 |
* Mixins |
| 327 |
*/ |
| 328 |
|
| 329 |
/* Mixin conditions are used to be compounded to the main <error> condition |
| 330 |
to add some more context. It is not a mixin classes in ordinary sense, |
| 331 |
since it won't be used for multiple inheritance; instead, an instance |
| 332 |
of the mixin class is compounded at runtime. See, for example, |
| 333 |
the 'compile' function in compile.scm mixing <compile-error-mixin> |
| 334 |
into the error raised during compilation. |
| 335 |
|
| 336 |
The default error reporter calls a method report-additional-condition |
| 337 |
on each mixin condition in the error heading. |
| 338 |
See print-default-error-heading in libexc.scm. The method definitions |
| 339 |
are in libomega.scm. |
| 340 |
*/ |
| 341 |
|
| 342 |
SCM_CLASS_DECL(Scm_MixinConditionClass); |
| 343 |
#define SCM_CLASS_MIXIN_CONDITION (&Scm_MixinConditionClass) |
| 344 |
#define SCM_MIXIN_CONDITION_P(obj) SCM_ISA(obj, SCM_CLASS_MIXIN_CONDITION) |
| 345 |
|
| 346 |
/* <condition-continuation-mixin> |
| 347 |
This attaches the continuation of the expression that raised it. |
| 348 |
You can extract stack trace from it. |
| 349 |
Some implementations attach stack trace to a condition unconditionally; |
| 350 |
in Gauche it is not a lightweight operation to extract a continuation, |
| 351 |
so we chose to let the code decide whether to attach this info. |
| 352 |
*/ |
| 353 |
typedef struct ScmConditionContinuationMixinRec { |
| 354 |
ScmCondition common; |
| 355 |
ScmObj continuation; |
| 356 |
} ScmConditionContinuationMixin; |
| 357 |
|
| 358 |
SCM_CLASS_DECL(Scm_ConditionContinuationMixinClass); |
| 359 |
#define SCM_CLASS_CONDITION_CONTINUATION_MIXIN (&Scm_ConditionContinuationMixinClass) |
| 360 |
#define SCM_CONDITION_CONTINUATION_MIXIN_P(obj) SCM_ISA(obj, SCM_CLASS_CONDITION_CONTINUATION_MIXIN) |
| 361 |
#define SCM_CONDITION_CONTINUATION_MIXIN(obj) ((ScmConditionContinuationMixin*)(obj)) |
| 362 |
|
| 363 |
/* <load-condition-mixin> |
| 364 |
Attached to the error during loading. |
| 365 |
*/ |
| 366 |
|
| 367 |
typedef struct ScmLoadConditionMixinRec { |
| 368 |
ScmCondition common; |
| 369 |
ScmObj history; /* current-load-history */ |
| 370 |
ScmObj port; /* current-load-port */ |
| 371 |
} ScmLoadConditionMixin; |
| 372 |
|
| 373 |
SCM_CLASS_DECL(Scm_LoadConditionMixinClass); |
| 374 |
#define SCM_CLASS_LOAD_CONDITION_MIXIN (&Scm_LoadConditionMixinClass) |
| 375 |
#define SCM_LOAD_CONDITION_MIXIN_P(obj) SCM_ISA(obj, SCM_CLASS_LOAD_CONDITION_MIXIN) |
| 376 |
#define SCM_LOAD_CONDITION_MIXIN(obj) ((ScmLoadConditionMixin*)(obj)) |
| 377 |
|
| 378 |
/* <compile-error-mixin> |
| 379 |
Attached to the error during compiling. |
| 380 |
The EXPR slot contains the offending expression. If it is a pair, |
| 381 |
you may extract source info from it. |
| 382 |
*/ |
| 383 |
|
| 384 |
typedef struct ScmCompileErrorMixinRec { |
| 385 |
ScmCondition condition; |
| 386 |
ScmObj expr; /* offending expr */ |
| 387 |
} ScmCompileErrorMixin; |
| 388 |
|
| 389 |
SCM_CLASS_DECL(Scm_CompileErrorMixinClass); |
| 390 |
#define SCM_CLASS_COMPILE_ERROR_MIXIN (&Scm_CompileErrorMixinClass) |
| 391 |
#define SCM_COMPILE_ERROR_MIXIN_P(obj) SCM_ISA(obj, SCM_CLASS_COMPILE_ERROR_MIXIN) |
| 392 |
#define SCM_COMPILE_ERROR_MIXIN(obj) ((ScmCompileErrorMixin*)(obj)) |
| 393 |
|
| 394 |
/* This struct is shared among all subclasses of &i/o-filename-error. */ |
| 395 |
typedef struct ScmFilenameErrorMixinRec { |
| 396 |
ScmCondition common; |
| 397 |
ScmObj filename; /* offending name */ |
| 398 |
} ScmFilenameErrorMixin; |
| 399 |
|
| 400 |
SCM_CLASS_DECL(Scm_FilenameErrorMixinClass); |
| 401 |
#define SCM_CLASS_FILENAME_ERROR_MIXIN (&Scm_FilenameErrorMixinClass) |
| 402 |
#define SCM_FILENAME_ERROR_MIXIN_P(obj) SCM_ISA(obj, SCM_CLASS_FILENAME_ERROR_MIXIN) |
| 403 |
#define SCM_FILENAME_ERROR_MIXIN(obj) ((ScmFilenameErrorMixin*)(obj)) |
| 404 |
|
| 405 |
SCM_CLASS_DECL(Scm_FilenameErrorMixinClass); |
| 406 |
SCM_CLASS_DECL(Scm_MalformedFilenameErrorMixinClass); |
| 407 |
SCM_CLASS_DECL(Scm_FileProtectionErrorMixinClass); |
| 408 |
SCM_CLASS_DECL(Scm_FileIsReadOnlyErrorMixinClass); |
| 409 |
SCM_CLASS_DECL(Scm_FileAlreadyExistsErrorMixinClass); |
| 410 |
SCM_CLASS_DECL(Scm_NoSuchFileErrorMixinClass); |
| 411 |
|
| 412 |
#endif /*GAUCHE_EXCEPTION_H*/ |