⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 trace.c

📁 俄罗斯高人Mamaich的Pocket gcc编译器(运行在PocketPC上)的全部源代码。
💻 C
字号:
#include <stdlib.h>#include <stdio.h>#include <stdarg.h>#include "sys/wcetrace.h"#include "sys/wcefile.h"static HANDLE __wcetracehnd = NULL;static int   __wcetrace = 1;voidWCETRACESET(int trace){  __wcetrace = trace;}voidWCETRACE(int level, const char *fmt, ...){  char buf[1024];  char tracepath[256];  wchar_t tracepathw[256];  int nwritten;  int len = 0;  va_list ap;  if(!__wcetrace)    return;  if (__wcetracehnd == NULL) {    strcpy(tracepath, "/temp/wcetrace.log");    mbstowcs(tracepathw, tracepath, strlen(tracepath) + 1);    __wcetracehnd = CreateFileW(tracepathw, GENERIC_WRITE,       FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, 0, NULL);  }#if 0#if 1  len = sprintf(buf, "T%08x: ", GetCurrentThreadId());#else  len = sprintf(buf, "%08d:%08x: ", GetTickCount(), GetCurrentProcessId());#endif#endif  if(__wcetracehnd != INVALID_HANDLE_VALUE) {    va_start(ap, fmt);    vsprintf(buf + len, fmt, ap);    strcat(buf, "\n");    WriteFile(__wcetracehnd, buf, strlen(buf), (DWORD *)&nwritten, NULL);  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -