-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It's quite annoying to type "if (trace) fprintf(stderr, ..." every time, let's wrap it into some nice macros.
- Loading branch information
1 parent
7d32358
commit 5afd558
Showing
4 changed files
with
66 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#ifndef _TRACE_H | ||
#define _TRACE_H | ||
|
||
#include <stdio.h> | ||
|
||
#define TRACE(...) \ | ||
if (trace) { \ | ||
fprintf(stderr, __VA_ARGS__); \ | ||
fputc('\n', stderr); \ | ||
} | ||
|
||
#define TRACE_PC(...) \ | ||
if (trace) { \ | ||
fprintf(stderr, "%04X ", cpu6_pc()); \ | ||
fprintf(stderr, __VA_ARGS__); \ | ||
fputc('\n', stderr); \ | ||
} | ||
|
||
#define WARN_PC(...) \ | ||
do { \ | ||
fprintf(stderr, "%04X ", cpu6_pc()); \ | ||
fprintf(stderr, __VA_ARGS__); \ | ||
fputc('\n', stderr); \ | ||
} while (0); | ||
|
||
#endif |