Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
This change concerne the usage of the semaphore object instead the variable condition...
[simgrid.git] / src / win32 / compiler / visualc.h
index cabcec2..a8af217 100644 (file)
        #undef HAVE_SIGNAL
 #endif
 
+/* "disable the snprintf replacement ( this function is broken on system v only" */
+
+
+
+#ifdef PREFER_PORTABLE_SNPRINTF
+# undef PREFER_PORTABLE_SNPRINTF       1       
+#endif
+
+
 /* The compiler has `snprintf' function. */
-#if defined(HAVE_SNPRINTF)
-       #undef HAVE_SNPRINTF    1
+#if _MSC_VER >= 1400 
+#  ifndef HAVE_SNPRINTF
+#    define HAVE_SNPRINTF      1
+#    ifndef PREFER_PORTABLE_SNPRINTF
+#      define snprintf _snprintf
+#    endif
+#  endif
+#else 
+#  ifdef HAVE_SNPRINTF
+       #undef HAVE_SNPRINTF
+#  endif
 #endif
 
+
+
 /* No `swapcontext' function. */
 #if defined(HAVE_SWAPCONTEXT)
        #undef HAVE_SWAPCONTEXT
 #endif
 
 /* The compiler has the `vsnprintf' function. */
-/*#if !defined(HAVE_VSNPRINTF)
+#ifndef HAVE_VSNPRINTF
        #define HAVE_VSNPRINTF  1
-#endif*/
-
-
-/* enable the asprintf replacement */
-#if !defined(NEED_ASPRINTF)
-       #define NEED_ASPRINTF   1
 #endif
 
-/*#ifdef NEED_ASPRINTF
-#undef NEED_ASPRINTF
-#endif*/
-
 
-/* enable the vasprintf replacement */
-#if  !defined(NEED_VASPRINTF)
-       #define NEED_VASPRINTF  1
+/* disable the asprintf replacement */
+#ifndef NEED_ASPRINTF
+       #define NEED_ASPRINTF   
 #endif
 
-/* "disable the snprintf replacement ( this function is broken on system v only" */
-
-/* FIXME TO ANALYZE */
-#if defined(PREFER_PORTABLE_SNPRINTF)
-       #undef PREFER_PORTABLE_SNPRINTF 
-#endif
 
-#if !defined(PREFER_PORTABLE_SNPRINTF)
-       #define PREFER_PORTABLE_SNPRINTF        
+/* disable the vasprintf replacement */
+#ifndef NEED_VASPRINTF
+       #define NEED_VASPRINTF
 #endif
 
 /* The maximal size of any scalar on this arch */
@@ -348,10 +353,15 @@ the double. For now, GRAS requires the structures to be compacted. */
 #define va_copy(d, s) __VA_COPY_USE(d, s)
 #endif
 
-#ifdef USE_UCONTEXT
-#undef USE_UCONTEXT
+/* xbt contexts are based on our threads implementation */
+#ifndef CONTEXT_THREADS
+#define CONTEXT_THREADS 1
 #endif
 
+/* xbt contexts are not based on ucontext */
+#ifdef CONTEXT_UCONTEXT
+#undef CONTEXT_UCONTEXT
+#endif
 
 /* Define to id of used va_copy() implementation */
 #define __VA_COPY_USE __VA_COPY_USE_C99
@@ -389,19 +399,57 @@ the double. For now, GRAS requires the structures to be compacted. */
  * Replace winsock2.h,ws2tcpip.h and winsock.h header files */
 #include <windows.h>
 
-/* types */
-typedef unsigned int uint32_t;
-typedef int socklen_t;
 
 /* Choose setjmp as exception implementation */
 #ifndef __EX_MCTX_SJLJ__
 #define __EX_MCTX_SJLJ__
 #endif 
 
-/* this is used in context managment. */
-#ifndef USE_WIN_THREADS
-#define USE_WIN_THREADS
+
+
+#include <sys/stat.h>
+
+#define S_IWUSR _S_IWRITE
+#define S_IRUSR _S_IREAD
+
+#define HAVE_STRUCT_TIMESPEC           0
+
+#define HAVE_STRUCT_TM                         1
+
+#define HAVE_GETTIMEOFDAY                      1
+
+#ifdef _WIN32_WINNT
+       #if _WIN32_WINNT < 0x0400
+               #undef _WIN32_WINNT
+               #define _WIN32_WINNT 0x0400
+       #endif
+#else
+       #define _WIN32_WINNT 0x0400     
 #endif
 
+/* Visual C++ does not declare the ssize_t type */
+typedef int ssize_t;
+
+/* Visual C++ does not declare the mode_t type */
+typedef unsigned int mode_t;
+
+/* Visual C++ does not declare the uint32_t type */
+typedef unsigned int uint32_t;
+
+/* Visual C++ doesn't declare the structure timespec */
+struct timespec 
+{
+       long    tv_sec;        /* seconds                                                       */
+       long    tv_nsec;       /* nanoseconds                                           */
+};
+
+/* Visual C++ doesn't declare the structure timezone :
+ *(a structure used to indicate the local time zone)
+ */
+struct timezone 
+{
+       int tz_minuteswest;     /* of Greenwich                                         */
+    int tz_dsttime;            /* type of dst correction to apply      */
+};
 
 #endif /* #ifndef __XBT_VISUALC_COMPILER_CONFIG_H__ */