#include <setjmp.h>
Go to the source code of this file.
#define DO_NOTHING 0 |
#define NOERROR 0 |
Definition at line 28 of file danerror.h.
#define SetErrorTrap | ( | Proc | ) | setjmp(PushErrorTrap(Proc)) |
** (c) Copyright Hewlett-Packard Company, 1988. ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** http://www.apache.org/licenses/LICENSE-2.0 ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License.
Definition at line 27 of file danerror.h.
Referenced by cc_recog().
typedef void(*) VOID_PROC() |
Definition at line 37 of file danerror.h.
void DoError | ( | int | Error, | |
const char * | Message | |||
) |
Prints the specified error message to stderr & jumps to the current error trap.
Error | Error number which is to be trapped | |
Message | Pointer to a string to be printed as an error message |
Definition at line 84 of file danerror.cpp.
References assert(), cprintf(), CurrentTrapDepth, DO_NOTHING, ErrorTrapStack, FALSE, NULL, ProcTrapStack, and signal_termination_handler().
Referenced by Efopen(), Efree(), Emalloc(), Erealloc(), ExtractorStub(), FillAmbigTable(), HeapPush(), HeapStore(), MakeSample(), memalloc_p(), memfree(), NameToChar(), PushErrorTrap(), ReadCharDescription(), ReadFeature(), ReadFeatureSet(), ReadNFloats(), ReadParamDesc(), ReadProtoStyle(), ReadPrototype(), ReadSampleSize(), and ShortNameToFeatureType().
00084 { 00085 if (Message != NULL) { 00086 cprintf ("\nError: %s!\n", Message); 00087 } 00088 00089 if (CurrentTrapDepth <= 0) { 00090 cprintf ("\nFatal error: No error trap defined!\n"); 00091 00092 /* SPC 20/4/94 00093 There used to be a call to abort() here. I've changed it to call into the 00094 C++ error code to generate a meaningful status code 00095 */ 00096 signal_termination_handler(Error); 00097 } 00098 00099 if (ProcTrapStack[CurrentTrapDepth - 1] != DO_NOTHING) 00100 (*ProcTrapStack[CurrentTrapDepth - 1]) (); 00101 00102 longjmp (ErrorTrapStack[CurrentTrapDepth - 1], 1); 00103 assert(FALSE); 00104 } /* DoError */
jmp_buf& PushErrorTrap | ( | VOID_PROC | Procedure | ) |
Pushes a new error trap onto the top of the error trap stack.
Procedure | Trap procedure to execute |
WARNING: a procedure that calls PushErrorTrap should never exit before calling ReleaseErrorTrap.
Definition at line 129 of file danerror.cpp.
References CurrentTrapDepth, DoError(), ERRORTRAPDEPTH, ErrorTrapStack, MAXTRAPDEPTH, and ProcTrapStack.
00129 { 00130 if (CurrentTrapDepth >= MAXTRAPDEPTH) 00131 DoError (ERRORTRAPDEPTH, "Error trap depth exceeded"); 00132 ProcTrapStack[CurrentTrapDepth] = Procedure; 00133 return ErrorTrapStack[CurrentTrapDepth++]; 00134 00135 } /* PushErrorTrap */
void ReleaseErrorTrap | ( | ) |
Removes the current error trap from the error trap stack, thus returning control to the previous error trap.
Definition at line 60 of file danerror.cpp.
References CurrentTrapDepth.
Referenced by cc_recog().
00060 { 00061 if (CurrentTrapDepth > 0) { 00062 CurrentTrapDepth--; 00063 } 00064 } /* ReleaseErrorTrap */