gallium: Windows miniport portability fixes.
authorJosé Fonseca <jrfonseca@tungstengraphics.com>
Sat, 26 Jul 2008 00:17:10 +0000 (09:17 +0900)
committerJosé Fonseca <jrfonseca@tungstengraphics.com>
Sat, 26 Jul 2008 00:18:07 +0000 (09:18 +0900)
src/gallium/auxiliary/util/p_debug.c
src/gallium/auxiliary/util/u_snprintf.c
src/gallium/include/pipe/p_util.h

index b0240ad..cdc7e66 100644 (file)
@@ -73,8 +73,7 @@ _EngDebugPrint(const char *format, ...)
 
 void _debug_vprintf(const char *format, va_list ap)
 {
-#ifdef PIPE_SUBSYSTEM_WINDOWS_DISPLAY
-#ifndef WINCE
+#if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
    /* EngDebugPrint does not handle float point arguments, so we need to use
     * our own vsnprintf implementation. It is also very slow, so buffer until
     * we find a newline. */
@@ -85,9 +84,6 @@ void _debug_vprintf(const char *format, va_list ap)
       _EngDebugPrint("%s", buf);
       buf[0] = '\0';
    }
-#else
-   /* TODO: Implement debug print for WINCE */
-#endif
 #elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
    /* EngDebugPrint does not handle float point arguments, so we need to use
     * our own vsnprintf implementation. It is also very slow, so buffer until
@@ -99,7 +95,9 @@ void _debug_vprintf(const char *format, va_list ap)
       OutputDebugStringA(buf);
       buf[0] = '\0';
    }
-#else
+#elif defined(PIPE_SUBSYSTEM_WINDOWS_CE) || defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT) 
+   /* TODO */
+#else /* !PIPE_SUBSYSTEM_WINDOWS */
    vfprintf(stderr, format, ap);
 #endif
 }
@@ -211,7 +209,7 @@ _debug_get_option(const char *name)
 #else
    return NULL;
 #endif
-#elif defined(PIPE_SUBSYSTEM_WINDOWS_CE)
+#elif defined(PIPE_SUBSYSTEM_WINDOWS_CE) || defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT) 
    /* TODO: implement */
    return NULL;
 #else
index c4f4bbd..7fa84d8 100644 (file)
  * <http://www.jhweiss.de/software/snprintf.html>.
  */
 
+#include "pipe/p_config.h"
+
 #if HAVE_CONFIG_H
 #include <config.h>
 #else
@@ -1102,7 +1104,11 @@ again:
         * Factor of ten with the number of digits needed for the fractional
         * part.  For example, if the precision is 3, the mask will be 1000.
         */
+#if defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT)
+       mask = (unsigned long)mypow10(precision);
+#else
        mask = (UINTMAX_T)mypow10(precision);
+#endif
        /*
         * We "cheat" by converting the fractional part to integer by
         * multiplying by a factor of ten.
@@ -1354,7 +1360,11 @@ cast(LDOUBLE value)
        if (value >= UINTMAX_MAX)
                return UINTMAX_MAX;
 
+#if defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT)
+       result = (unsigned long)value;
+#else
        result = (UINTMAX_T)value;
+#endif
        /*
         * At least on NetBSD/sparc64 3.0.2 and 4.99.30, casting long double to
         * an integer type converts e.g. 1.9 to 2 instead of 1 (which violates
index 7dcdd28..892bd4b 100644 (file)
 #include "p_debug.h"
 #include "p_format.h"
 #include "p_pointer.h"
+
+#if defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT) || defined(PIPE_SUBSYSTEM_WINDOWS_CE)
+__inline double ceil(double val)
+{
+       double ceil_val;
+
+       if((val - (long) val) == 0) {
+               ceil_val = val;
+       } else {
+               if(val > 0) {
+                       ceil_val = (long) val + 1;
+               } else {
+                       ceil_val = (long) val;
+               }
+       }
+
+       return ceil_val;
+}
+
+#ifndef PIPE_SUBSYSTEM_WINDOWS_CE
+__inline double floor(double val)
+{
+       double floor_val;
+
+       if((val - (long) val) == 0) {
+               floor_val = val;
+       } else {
+               if(val > 0) {
+                       floor_val = (long) val;
+               } else {
+                       floor_val = (long) val - 1;
+               }
+       }
+
+       return floor_val;
+}
+#endif
+
+#pragma function(pow)
+__inline double __cdecl pow(double val, double exponent)
+{
+       /* XXX */
+       assert(0);
+       return 0;
+}
+
+#pragma function(log)
+__inline double __cdecl log(double val)
+{
+       /* XXX */
+       assert(0);
+       return 0;
+}
+
+#pragma function(atan2)
+__inline double __cdecl atan2(double val)
+{
+       /* XXX */
+       assert(0);
+       return 0;
+}
+#else
 #include <math.h>
 #include <stdarg.h>
+#endif
 
 
 #ifdef __cplusplus