Created
September 4, 2015 04:40
-
-
Save SilverRainZ/a0d29aafcd939ec475f9 to your computer and use it in GitHub Desktop.
printl
This file contains hidden or 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
// printl.c | |
#ifdef DEBUG | |
inline void printl(const char *fmt, ...){ \ | |
char buf[256]; \ | |
va_list args; \ | |
int i; \ | |
\ | |
memset(buf, 0, sizeof(buf)); \ | |
va_start(args, fmt); \ | |
vsprintk(buf, fmt, args); \ | |
va_end(args); \ | |
for (i = 0; i < strlen(buf); i++){ \ | |
bochs_putc(buf[i]); \ | |
} | |
#else | |
inline void printl(const char *fmt, ...){} | |
#endif | |
// printl.h | |
inline void printl(const char *fmt, ...); | |
// call | |
#define DEBUG 1 | |
printl("aaa"); | |
#undef DEBUG | |
printl("bbb"); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment