2004-05-08 03:11:51 +02:00
|
|
|
#include "precompiled.h"
|
2004-03-03 00:56:51 +01:00
|
|
|
|
|
|
|
#include "sysdep.h"
|
|
|
|
|
|
|
|
// portable debug output routines. Win32 offers better versions, which
|
|
|
|
// override these.
|
|
|
|
|
|
|
|
#ifndef _WIN32
|
|
|
|
|
2004-06-18 20:56:10 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <wchar.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
2004-03-03 00:56:51 +01:00
|
|
|
// portable output routines (win.cpp overrides these)
|
2004-05-06 19:14:30 +02:00
|
|
|
|
|
|
|
void display_msg(const char* caption, const char* msg)
|
|
|
|
{
|
|
|
|
fprintf(stderr, "%s: %s\n", caption, msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
void wdisplay_msg(const wchar_t* caption, const wchar_t* msg)
|
2004-03-03 00:56:51 +01:00
|
|
|
{
|
2004-06-02 17:12:48 +02:00
|
|
|
fwprintf(stderr, L"%ls: %ls\n", caption, msg);
|
2004-03-03 00:56:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-05-06 19:14:30 +02:00
|
|
|
|
2004-03-03 00:56:51 +01:00
|
|
|
void debug_out(const char* fmt, ...)
|
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
va_start(args, fmt);
|
|
|
|
vprintf(fmt, args);
|
|
|
|
va_end(args);
|
2004-05-06 19:14:30 +02:00
|
|
|
fflush(stdout);
|
2004-03-03 00:56:51 +01:00
|
|
|
}
|
|
|
|
|
2004-03-03 01:37:41 +01:00
|
|
|
|
|
|
|
void check_heap()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2004-03-04 21:36:31 +01:00
|
|
|
#endif // #ifndef _WIN32
|
2004-06-02 17:12:48 +02:00
|
|
|
|
2004-07-12 18:48:10 +02:00
|
|
|
|
|
|
|
void debug_break()
|
|
|
|
{
|
|
|
|
#ifndef NDEBUG
|
|
|
|
# if defined(_WIN32)
|
|
|
|
win_debug_break();
|
|
|
|
# elif defined(_M_IX86)
|
|
|
|
ia32_debug_break();
|
2004-07-13 00:05:49 +02:00
|
|
|
# elif defined(OS_UNIX)
|
|
|
|
unix_debug_break();
|
2004-07-12 18:48:10 +02:00
|
|
|
# else
|
|
|
|
# error "port"
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-07-13 23:17:26 +02:00
|
|
|
|
2004-06-02 17:12:48 +02:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
|
|
|
|
double round(double x)
|
|
|
|
{
|
|
|
|
return (long)(x + 0.5);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2004-06-03 03:43:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
#ifndef HAVE_C99
|
|
|
|
|
|
|
|
float fminf(float a, float b)
|
|
|
|
{
|
|
|
|
return (a < b)? a : b;
|
|
|
|
}
|
|
|
|
|
|
|
|
float fmaxf(float a, float b)
|
|
|
|
{
|
|
|
|
return (a > b)? a : b;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|