#if !defined(INCLUDED_BYTESTREAMUTILS_H)
#define INCLUDED_BYTESTREAMUTILS_H
-#include <algorithm>
-
-#if defined(_MSC_VER)
-
-typedef signed short int16_t;
-typedef unsigned short uint16_t;
-typedef signed int int32_t;
-typedef unsigned int uint32_t;
-
-#else
+#if defined(__GCC__)
#define _ISOC9X_SOURCE 1
#define _ISOC99_SOURCE 1
#endif
+#include <algorithm>
+
+// if C99 is unavailable, fall back to the types most likely to be the right sizes
+#if !defined(int16_t)
+typedef signed short int16_t;
+#endif
+#if !defined(uint16_t)
+typedef unsigned short uint16_t;
+#endif
+#if !defined(int32_t)
+typedef signed int int32_t;
+#endif
+#if !defined(uint32_t)
+typedef unsigned int uint32_t;
+#endif
+
+
+
template<typename InputStreamType, typename Type>
inline void istream_read_little_endian(InputStreamType& istream, Type& value)
#include "generic/vector.h"
-#if 0
-
-#define lrint(dbl) ((int)((dbl) + 0.5))
-#define lrintf(flt) ((int)((flt) + 0.5))
-
-#endif
-
#if defined (_MSC_VER)
inline int lrint (double flt)
return i;
}
-#else // lrint is part of ISO C99
+#elif defined(__FreeBSD__)
+inline int lrint(double f)
+{
+ return static_cast<int>(f + 0.5);
+}
+
+#elif defined(__GCC__)
+
+ // lrint is part of ISO C99
#define _ISOC9X_SOURCE 1
#define _ISOC99_SOURCE 1
#define __USE_ISOC9X 1
#define __USE_ISOC99 1
+#else
+#error "unsupported platform"
#endif
#include <cmath>
#include <float.h>
#include <algorithm>
+
//#include "debugging/debugging.h"
/// \brief Returns true if \p self is equal to other \p other within \p epsilon.
-#include <ctype.h>
-
-#ifdef __APPLE__
-#define __toascii(c) ((c) & 0x7f)
-#endif
-
-inline char ascii_for_keyval(int keyval)
-{
- return __toascii(keyval);
-}
-
-
+#include <cctype>
#include <gtk/gtkbox.h>
#include <gtk/gtkliststore.h>
}
else if(accelerator.key != 0)
{
- m_file << ascii_for_keyval(accelerator.key);
+ m_file << gdk_keyval_name(accelerator.key);
}
if(accelerator.modifiers & GDK_MOD1_MASK)
qglXUseXFont = glXUseXFont;
// qglXGetProcAddressARB = glXGetProcAddressARB; // Utah-GLX fix
- qglXGetProcAddressARB = (glXGetProcAddressARBProc)dlsym(NULL, "glXGetProcAddressARB");
+ qglXGetProcAddressARB = (glXGetProcAddressARBProc)dlsym(RTLD_DEFAULT, "glXGetProcAddressARB");
if ((qglXQueryExtension == 0) || (qglXQueryExtension(GDK_DISPLAY(),0,0) != True))
return 0;
#else