📄 debug.c
字号:
/****************************************************************************** SciTech OS Portability Manager Library** ========================================================================** The contents of this file are subject to the SciTech MGL Public* License Version 1.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.scitechsoft.com/mgl-license.txt** Software distributed under the License is distributed on an* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or* implied. See the License for the specific language governing* rights and limitations under the License.** The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc.** The Initial Developer of the Original Code is SciTech Software, Inc.* All Rights Reserved.** ========================================================================** Language: ANSI C* Environment: Any** Description: Main module containing debug checking features.*****************************************************************************/#include "pmapi.h"#ifndef __WIN32_VXD__#include <stdio.h>#include <stdlib.h>#include <string.h>#else#include "vxdfile.h"#endif/*---------------------------- Global variables ---------------------------*/void (*_CHK_fail)(int fatal,const char *msg,const char *cond,const char *file,int line) = _CHK_defaultFail;static char logFile[256] = "";/*----------------------------- Implementation ----------------------------*/void _CHK_defaultFail( int fatal, const char *msg, const char *cond, const char *file, int line){ FILE *f; char buf[256]; if (logFile[0] == 0) { strcpy(logFile,PM_getNucleusPath()); PM_backslash(logFile); strcat(logFile,"scitech.log"); } if ((f = fopen(logFile,"a+")) != NULL) {#ifdef __WIN32_VXD__ sprintf(buf,msg,cond,file,line); fwrite(buf,1,strlen(buf),f);#else fprintf(f,msg,cond,file,line);#endif fclose(f); } if (fatal) { sprintf(buf,"Check failed: check '%s' for details", logFile); PM_fatalError(buf); }}void PMAPI PM_setDebugLog( const char *logFilePath){ strcpy(logFile,logFilePath);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -