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

📄 trace.cpp

📁 Shorthand是一个强大的脚本语言
💻 CPP
字号:
///////////////////////////////////////////////////////////////////////////////
// $Header: /shorthand/src/trace.cpp 3     8/28/02 6:27a Arm $
//-----------------------------------------------------------------------------
// Project: ShortHand interpreter
// Author: Andrei Remenchuk <andrei@remenchuk.com>
//-----------------------------------------------------------------------------
// trace.cpp: ShortHand debug diagnostics
///////////////////////////////////////////////////////////////////////////////
#include <stdio.h>
#include <malloc.h>
#include <string.h>

#include "shorthand.h"
#include "utils.h"

#ifndef WIN32
#include <stdlib.h>
#include <unistd.h>
#endif


#ifdef _DEBUG

static FILE* trace_file = NULL;
int trace_level = 0;

void trace(int level, const char* format, ...)
{
    if (trace_level >= level)
    {
        if (trace_file == NULL) {
            const char* home = get_home_dir();
            char* name = (char*) alloca(strlen(home) + 20);
            sprintf(name, "%sshorthand.trace", home);
            trace_file = fopen(name, "w");
        }
        if (trace_file != NULL)
        {
            va_list args; va_start(args, format);
            vfprintf(trace_file, format, args);
            fflush(trace_file);
        }
    }
}


#endif

⌨️ 快捷键说明

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