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 containing debug checking features.
29 ****************************************************************************/
34 #elif defined(__NT_DRIVER__)
36 #elif defined(__OS2_VDD__)
44 /*---------------------------- Global variables ---------------------------*/
47 void (*_CHK_fail)(int fatal,const char *msg,const char *cond,const char *file,int line) = _CHK_defaultFail;
48 static char logFile[256] = "";
50 /*----------------------------- Implementation ----------------------------*/
53 void _CHK_defaultFail(
63 if (logFile[0] == 0) {
64 strcpy(logFile,PM_getNucleusPath());
65 PM_backslash(logFile);
66 strcat(logFile,"scitech.log");
68 if ((f = fopen(logFile,"a+")) != NULL) {
69 #if defined(__WIN32_VXD__) || defined(__OS2_VDD__) || defined(__NT_DRIVER__)
70 sprintf(buf,msg,cond,file,line);
71 fwrite(buf,1,strlen(buf),f);
73 fprintf(f,msg,cond,file,line);
78 sprintf(buf,"Check failed: check '%s' for details", logFile);
84 /****************************************************************************
86 Sets the location of the debug log file.
92 logFilePath - Full file and path name to debug log file.
95 Sets the name and location of the debug log file. The debug log file is
96 created and written to when runtime checks, warnings and failure conditions
97 are logged to disk when code is compiled in CHECKED mode. By default the
98 log file is called 'scitech.log' and goes into the current SciTech Nucleus
99 path for the application. You can use this function to set the filename
100 and location of the debug log file to your own application specific
102 ****************************************************************************/
103 void PMAPI PM_setDebugLog(
104 const char *logFilePath)
106 strcpy(logFile,logFilePath);