Remove debug.h

This commit is contained in:
Michael Theall 2016-01-25 23:55:59 -06:00
parent 7a2f7747ee
commit 4947dda9c6
3 changed files with 3 additions and 56 deletions

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#ifdef _3DS #ifdef _3DS
#include <3ds.h>
#define ESC(x) "\x1b[" #x #define ESC(x) "\x1b[" #x
#define RESET ESC(0m) #define RESET ESC(0m)
#define BLACK ESC(30m) #define BLACK ESC(30m)

View File

@ -1,54 +0,0 @@
#pragma once
#include <string.h>
#ifdef _3DS
#include <3ds.h>
#endif
/*! print debug message
*
* @param[in] fmt format string
* @param[in] ap varargs list
*
* @returns number of characters written
*/
static inline int
vdebug(const char *fmt,
va_list ap)
{
#ifdef _3DS
int rc;
char buffer[256];
memset(buffer, 0, sizeof(buffer));
/* print to buffer */
rc = vsnprintf(buffer, sizeof(buffer)-1, fmt, ap);
/* call debug service with buffer */
svcOutputDebugString(buffer, rc < sizeof(buffer) ? rc : sizeof(buffer));
return rc;
#else
/* just print to stdout */
return vprintf(fmt, ap);
#endif
}
__attribute__((format(printf,1,2)))
/*! print debug message
*
* @param[in] fmt format string
* @param[in] ... format arguments
*
* @returns number of characters written
*/
static inline int
debug(const char *fmt, ...)
{
int rc;
va_list ap;
va_start(ap, fmt);
rc = vdebug(fmt, ap);
va_end(ap);
return rc;
}

View File

@ -1,13 +1,13 @@
#include "console.h" #include "console.h"
#include <arpa/inet.h> #include <arpa/inet.h>
#include <errno.h> #include <errno.h>
#include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <string.h>
#ifdef _3DS #ifdef _3DS
#include <3ds.h> #include <3ds.h>
#endif #endif
#include "debug.h"
#include "gfx.h" #include "gfx.h"
#ifdef _3DS #ifdef _3DS