1 /****************************************************************************
3 * SciTech OS Portability Manager Library
5 * ========================================================================
7 * The contents of this file are subject to the SciTech MGL Public
8 * License Version 1.0 (the "License"); you may not use this file
9 * except in compliance with the License. You may obtain a copy of
10 * the License at http://www.scitechsoft.com/mgl-license.txt
12 * Software distributed under the License is distributed on an
13 * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
14 * implied. See the License for the specific language governing
15 * rights and limitations under the License.
17 * The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc.
19 * The Initial Developer of the Original Code is SciTech Software, Inc.
20 * All Rights Reserved.
22 * ========================================================================
27 * Description: Main module for building checked builds of products with
28 * assertions and trace code.
30 ****************************************************************************/
37 #define WIN32_LEAN_AND_MEAN
44 /*---------------------------- Global variables ---------------------------*/
46 #define LOGFILE "\\scitech.log"
48 void (*_CHK_fail)(int fatal,const char *msg,const char *cond,const char *file,int line) = _CHK_defaultFail;
50 /*---------------------------- Implementation -----------------------------*/
52 /****************************************************************************
54 Handles fatal error and warning conditions for checked builds.
60 This function is called whenever an inline check or warning fails in any
61 of the SciTech runtime libraries. Warning conditions simply cause the
62 condition to be logged to the log file and send to the system debugger
63 under Window. Fatal error conditions do all of the above, and then
64 terminate the program with a fatal error conditions.
66 This handler may be overriden by the user code if necessary to replace it
67 with a different handler (the MGL for instance overrides this and replaces
68 it with a handler that does an MGL_exit() before terminating the application
69 so that it will clean up correctly.
70 ****************************************************************************/
71 void _CHK_defaultFail(
79 FILE *log = fopen(LOGFILE, "at+");
81 sprintf(buf,msg,cond,file,line);
92 MessageBox(NULL, buf,"Fatal Error!",MB_ICONEXCLAMATION);