ccutil/globaloc.cpp File Reference

#include "mfcpch.h"
#include <signal.h>
#include "errcode.h"
#include "tprintf.h"

Go to the source code of this file.

Functions

Variables


Function Documentation

void err_exit (  ) 

All program exits should go through this point; allows a meaningful status code to be generated for the real exit() call.

The status code is made up as follows:

Bit  0    : 1 = Program Abort   0 = System Abort
Bits 1,2  : IF bit 0 = 1 THEN ERRCODE::abort_code
            ELSE    0 = Bus Err or Seg Vi
                    1 = Floating point exception
                    2 = TimeOut (Signal 15 from command timer)
                    3 = Any other signal
Bits 3..7 : Location code NEVER 0 !

Definition at line 75 of file globaloc.cpp.

References signal_exit().

00075                 { 
00076   signal_exit (-1);
00077 }

void set_global_loc_code ( int  loc_code  ) 

FIX:.

Definition at line 107 of file globaloc.cpp.

References global_loc_code.

00107                                        { 
00108   global_loc_code = loc_code;
00109 
00110 }

void set_global_subloc_code ( int  loc_code  ) 

FIX:.

Definition at line 116 of file globaloc.cpp.

References global_subloc_code.

00116                                           { 
00117   global_subloc_code = loc_code;
00118 
00119 }

void set_global_subsubloc_code ( int  loc_code  ) 

FIX:.

Definition at line 125 of file globaloc.cpp.

References global_subsubloc_code.

00125                                              { 
00126   global_subsubloc_code = loc_code;
00127 
00128 }

void signal_exit ( int  signal_code  ) 

Note:
File: errcode.h (Formerly error.h)
Header file for generic error handler class
Author:
Ray Smith
Date:
Tue May 1 16:23:36 BST 1990
 * (C) Copyright 1990, Hewlett-Packard Ltd.
 ** 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 35 of file globaloc.cpp.

References global_abort_code, global_loc_code, global_subloc_code, global_subsubloc_code, LOC_FUZZY_SPACE, LOC_PASS2, and tprintf().

00037                   {
00038   int exit_status;
00039 
00040   if ((global_loc_code == LOC_PASS2) || (global_loc_code == LOC_FUZZY_SPACE))
00041     global_loc_code += global_subloc_code + global_subsubloc_code;
00042 
00043   if (signal_code < 0) {
00044     exit_status = global_loc_code * 8 + global_abort_code * 2 + 1;
00045     tprintf ("Signal_exit %d ABORT. LocCode: %d  AbortCode: %d\n",
00046       exit_status, global_loc_code, global_abort_code);
00047   }
00048   else {
00049     exit_status = global_loc_code * 8 + signal_code * 2;
00050     tprintf ("Signal_exit %d SIGNAL ABORT. LocCode: %d  SignalCode: %d\n",
00051       exit_status, global_loc_code, signal_code);
00052   }
00053 
00054   exit(exit_status); 
00055 }

void signal_termination_handler ( int  sig  ) 

The real signal.

Definition at line 83 of file globaloc.cpp.

References signal_exit(), and tprintf().

00084                                          {
00085   tprintf ("Signal_termination_handler called with signal %d\n", sig);
00086   switch (sig) {
00087     case SIGABRT:
00088       signal_exit (-1);          //use abort code
00089       //         case SIGBUS:
00090     case SIGSEGV:
00091       signal_exit (0);
00092     case SIGFPE:
00093       signal_exit (1);           //floating point
00094     case SIGTERM:
00095       signal_exit (2);           //timeout by cmdtimer
00096     default:
00097       signal_exit (3);           //Anything else
00098   }
00099 }


Variable Documentation

INT16 global_abort_code = NO_ABORT_CODE

Definition at line 30 of file globaloc.cpp.

Referenced by ERRCODE::error(), and signal_exit().

INT16 global_loc_code = LOC_INIT

Note:
File: globaloc.cpp
Generic error handler function
Author:
Ray Smith
Date:
Tue May 1 16:28:39 BST 1990
 * (C) Copyright 1989, Hewlett-Packard Ltd.
 ** 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 25 of file globaloc.cpp.

Referenced by set_global_loc_code(), and signal_exit().

INT16 global_subloc_code = SUBLOC_NORM

Definition at line 26 of file globaloc.cpp.

Referenced by set_global_subloc_code(), and signal_exit().

INT16 global_subsubloc_code = SUBSUBLOC_OTHER

Definition at line 28 of file globaloc.cpp.

Referenced by set_global_subsubloc_code(), and signal_exit().


Generated on Wed Feb 28 19:49:16 2007 for Tesseract by  doxygen 1.5.1