Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/yabause/src/debug.h
2 views
1
/* Copyright 2005-2006 Guillaume Duhamel
2
Copyright 2005 Theo Berkau
3
4
This file is part of Yabause.
5
6
Yabause is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2 of the License, or
9
(at your option) any later version.
10
11
Yabause is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
15
16
You should have received a copy of the GNU General Public License
17
along with Yabause; if not, write to the Free Software
18
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
*/
20
21
#ifndef DEBUG_H
22
#define DEBUG_H
23
24
#include "core.h"
25
#include <stdio.h>
26
27
typedef enum { DEBUG_STRING, DEBUG_STREAM , DEBUG_STDOUT, DEBUG_STDERR, DEBUG_CALLBACK } DebugOutType;
28
29
typedef struct {
30
DebugOutType output_type;
31
union {
32
FILE * stream;
33
char * string;
34
void (*callback) (char*);
35
} output;
36
char * name;
37
} Debug;
38
39
Debug * DebugInit(const char *, DebugOutType, char *);
40
void DebugDeInit(Debug *);
41
42
void DebugChangeOutput(Debug *, DebugOutType, char *);
43
44
void DebugPrintf(Debug *, const char *, u32, const char *, ...);
45
46
extern Debug * MainLog;
47
48
void LogStart(void);
49
void LogStop(void);
50
void LogChangeOutput(DebugOutType t, char * s);
51
52
#ifdef DEBUG
53
#define LOG(...) DebugPrintf(MainLog, __FILE__, __LINE__, __VA_ARGS__)
54
#else
55
#define LOG(...)
56
#endif
57
58
#ifdef CDDEBUG
59
#define CDLOG(...) DebugPrintf(MainLog, __FILE__, __LINE__, __VA_ARGS__)
60
#else
61
#define CDLOG(...)
62
#endif
63
64
#ifdef SCSP_DEBUG
65
#define SCSPLOG(...) DebugPrintf(MainLog, __FILE__, __LINE__, __VA_ARGS__)
66
#else
67
#define SCSPLOG(...)
68
#endif
69
70
#ifdef VDP1_DEBUG
71
#define VDP1LOG(...) DebugPrintf(MainLog, __FILE__, __LINE__, __VA_ARGS__)
72
#else
73
#define VDP1LOG(...)
74
#endif
75
76
#ifdef VDP2_DEBUG
77
#define VDP2LOG(...) DebugPrintf(MainLog, __FILE__, __LINE__, __VA_ARGS__)
78
#else
79
#define VDP2LOG(...)
80
#endif
81
82
#ifdef SMPC_DEBUG
83
#define SMPCLOG(...) DebugPrintf(MainLog, __FILE__, __LINE__, __VA_ARGS__)
84
#else
85
#define SMPCLOG(...)
86
#endif
87
88
#endif
89
90