瀏覽代碼

changes core/basics

Johannes R 12 年之前
父節點
當前提交
c2055bcd2e
共有 2 個文件被更改,包括 23 次插入0 次删除
  1. 10 0
      core/basics/CrossplatformDefines.h
  2. 13 0
      core/basics/numerictools.h

+ 10 - 0
core/basics/CrossplatformDefines.h

@@ -13,6 +13,16 @@
 #if _MSC_VER
 #if _MSC_VER
 #   define FILE_LINE_LINK __FILE__ "(" STRINGISE(__LINE__) ") : "
 #   define FILE_LINE_LINK __FILE__ "(" STRINGISE(__LINE__) ") : "
 #   define WARNING(exp) (FILE_LINE_LINK "WARNING: " exp)
 #   define WARNING(exp) (FILE_LINE_LINK "WARNING: " exp)
+
+#   define __MESSAGE(text) __pragma( message(__FILE__ "(" STRINGISE(__LINE__) ")" text) ) 
+#   define ERROR(text) __MESSAGE( " : Error: " #text )
+#   define MESSAGE(text) __MESSAGE( ": " #text )
+//#   define TODO(text) WARNING( TODO: text )
+//use as:
+//ERROR( This will be a compiler error );
+//MESSAGE( Well this is what I have to say about this code );
+//TODO( Still have to fix 3D rendering );
+
 #else//__GNUC__ - may need other defines for different compilers
 #else//__GNUC__ - may need other defines for different compilers
 #   define WARNING(exp) ("WARNING: " exp)
 #   define WARNING(exp) ("WARNING: " exp)
 #endif
 #endif

+ 13 - 0
core/basics/numerictools.h

@@ -240,6 +240,19 @@ inline bool isNaN(float x) {
 #endif
 #endif
 }
 }
 
 
+inline bool isFinite(double x)
+{
+#ifdef WIN32
+	#ifdef NICE_BOOST_FOUND
+	    return boost::math::isfinite(x);
+	#else
+		ERROR("isFinite() not defined (and neither is boost found for compensation...)")
+	#endif
+#else
+	return finite(x);
+#endif
+}
+
 /**
 /**
  * Create NaN
  * Create NaN
  */
  */