mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-18 04:53:06 +01:00
Added debugOutput.
This commit is contained in:
@@ -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__
|
||||
|
||||
@@ -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_?"
|
||||
|
||||
Reference in New Issue
Block a user