Added debugOutput.

This commit is contained in:
bkaradzic
2013-04-28 12:13:37 -07:00
parent 4f70c7f296
commit 24786dd2d0
2 changed files with 25 additions and 0 deletions

View File

@@ -8,6 +8,14 @@
#include "bx.h"
#if BX_PLATFORM_ANDROID
# include <android/log.h>
#elif BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360
extern "C" __declspec(dllimport) void __stdcall OutputDebugStringA(const char* _str);
#else
# include <stdio.h>
#endif // BX_PLATFORM_WINDOWS
namespace bx
{
inline void debugBreak()
@@ -26,6 +34,18 @@ namespace bx
#endif // BX
}
inline void debugOutput(const char* _out)
{
#if BX_PLATFORM_ANDROID
__android_log_write(ANDROID_LOG_DEBUG, "", _out);
#elif BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360
OutputDebugStringA(_out);
#else
fputs(_out, stderr);
fflush(stderr);
#endif // BX_PLATFORM_
}
} // namespace bx
#endif // __BX_DEBUG_H__

View File

@@ -20,6 +20,9 @@
#define BX_STRINGIZE(_x) BX_STRINGIZE_(_x)
#define BX_STRINGIZE_(_x) #_x
#define BX_CONCATENATE(_x, _y) BX_CONCATENATE_(_x, _y)
#define BX_CONCATENATE_(_x, _y) _x ## _y
#define BX_FILE_LINE_LITERAL "" __FILE__ "(" BX_STRINGIZE(__LINE__) "): "
#define BX_ALIGN_MASK(_value, _mask) ( ( (_value)+(_mask) ) & ( (~0)&(~(_mask) ) ) )
@@ -37,6 +40,7 @@
# define BX_NO_VTABLE
# define BX_OVERRIDE
# define BX_PRINTF_ARGS(_format, _args) __attribute__ ( (format(__printf__, _format, _args) ) )
# define BX_STATIC_ASSERT(_condition, ...) static_assert(_condition, __VA_ARGS__)
# if BX_COMPILER_CLANG
# define BX_THREAD /* not supported right now */
# else
@@ -52,6 +56,7 @@
# define BX_NO_VTABLE __declspec(novtable)
# define BX_OVERRIDE override
# define BX_PRINTF_ARGS(_format, _args)
# define BX_STATIC_ASSERT(_condition, ...) typedef char BX_CONCATENATE(BX_STATIC_ASSERT_, __LINE__)[1][(_condition)]
# define BX_THREAD __declspec(thread)
#else
# error "Unknown BX_COMPILER_?"