]> pd.if.org Git - pdclib/blobdiff - platform/win32/internals/_PDCLIB_config.h
<time.h>: define timespec_get, TIME_UTC, to support <threads.h> implementations
[pdclib] / platform / win32 / internals / _PDCLIB_config.h
index c828c7a3b1de50a4538346908a217ae86b85b2a4..1d233ebd630d00f4067ed84e6f24b5666a8a166a 100644 (file)
@@ -219,6 +219,19 @@ struct _PDCLIB_imaxdiv_t
 #define _PDCLIB_clock double
 #define _PDCLIB_CLOCKS_PER_SEC 1000000
 
+/* <time.h>: TIME_UTC
+ *
+ * The TIME_UTC parameter is passed to the timespec_get function in order to get
+ * the system time in UTC since an implementation defined epoch (not necessarily
+ * the same as that used for time_t). That said, on POSIX the obvious 
+ * implementation of timespec_get for TIME_UTC is to wrap 
+ * clock_gettime(CLOCK_REALTIME, ...), which is defined as time in UTC since the
+ * same epoch.
+ *
+ * This may be any non-zero integer value.
+ */
+#define _PDCLIB_TIME_UTC 1
+
 /* -------------------------------------------------------------------------- */
 /* Floating Point                                                             */
 /* -------------------------------------------------------------------------- */
@@ -246,6 +259,18 @@ struct _PDCLIB_imaxdiv_t
 */
 #define _PDCLIB_DECIMAL_DIG 17
 
+/* Floating point types
+ *
+ * PDCLib (at present) assumes IEEE 754 floating point formats
+ * The following names are used:
+ *    SINGLE:   IEEE 754 single precision (32-bit)
+ *    DOUBLE:   IEEE 754 double precision (64-bit)
+ *    EXTENDED: IEEE 754 extended precision (80-bit, as x87)
+ */
+#define _PDCLIB_FLOAT_TYPE   SINGLE
+#define _PDCLIB_DOUBLE_TYPE  DOUBLE
+#define _PDCLIB_LDOUBLE_TYPE EXTENDED
+
 /* -------------------------------------------------------------------------- */
 /* Platform-dependent macros defined by the standard headers.                 */
 /* -------------------------------------------------------------------------- */
@@ -273,13 +298,22 @@ struct _PDCLIB_imaxdiv_t
 */
 
 #ifdef __GNUC__
+  typedef __builtin_va_list _PDCLIB_va_list;
+  #define _PDCLIB_va_arg( ap, type ) (__builtin_va_arg( (ap), type ))
+  #define _PDCLIB_va_copy( dest, src ) (__builtin_va_copy( (dest), (src) ))
+  #define _PDCLIB_va_end( ap ) (__builtin_va_end( ap ) )
+  #define _PDCLIB_va_start( ap, parmN ) (__builtin_va_start( (ap), (parmN) ))
+#elif (defined(__i386__) || defined(__i386) || defined(_M_IX86)) && !(defined(__amd64__) || defined(__x86_64__) || defined(_M_AMD64))
+  /* Internal helper macro. va_round is not part of <stdarg.h>. */
+  #define _PDCLIB_va_round( type ) ( (sizeof(type) + sizeof(void *) - 1) & ~(sizeof(void *) - 1) )
+
   typedef char * _PDCLIB_va_list;
-  #define _PDCLIB_va_arg( ap, type ) __builtin_va_arg( ap, type )
-  #define _PDCLIB_va_copy( dest, src ) __builtin_va_copy( dest, src)
-  #define _PDCLIB_va_end( ap ) __builtin_va_end( ap ) 
-  #define _PDCLIB_va_start( ap, parmN ) __builtin_va_start( ap, parmN )
+  #define _PDCLIB_va_arg( ap, type ) ( (ap) += (_PDCLIB_va_round(type)), ( *(type*) ( (ap) - (_PDCLIB_va_round(type)) ) ) )
+  #define _PDCLIB_va_copy( dest, src ) ( (dest) = (src), (void)0 )
+  #define _PDCLIB_va_end( ap ) ( (ap) = (void *)0, (void)0 )
+  #define _PDCLIB_va_start( ap, parmN ) ( (ap) = (char *) &parmN + ( _PDCLIB_va_round(parmN) ), (void)0 )
 #else
-  #error Compiler support please
+  #error Compiler/Architecture support please
 #endif
 
 /* -------------------------------------------------------------------------- */
@@ -328,7 +362,7 @@ typedef void * _PDCLIB_fd_t;
 #define _PDCLIB_FILENAME_MAX 128
 
 /* Maximum length of filenames generated by tmpnam(). (See tmpfile.c.) */
-#define _PDCLIB_L_tmpnam 46
+#define _PDCLIB_L_tmpnam 260
 
 /* Number of distinct file names that can be generated by tmpnam(). */
 #define _PDCLIB_TMP_MAX 50