]> pd.if.org Git - pdclib.old/blobdiff - platform/example/internals/_PDCLIB_config.h
Bring example platform up to date
[pdclib.old] / platform / example / internals / _PDCLIB_config.h
index ff4349510dd0093b3e2a9f0dc899e0f25147fc25..047fd94a17d320f1532559d7f54f53f43d63189c 100644 (file)
 /* specific platforms, e.g. by swapping int instead of char.                  */
 #define _PDCLIB_memswp( i, j, size ) char tmp; do { tmp = *i; *i++ = *j; *j++ = tmp; } while ( --size );
 
-/* Define this to some compiler directive that can be written after the       */
-/* parameter list of a function declaration to indicate the function does     */
-/* never return. If your compiler does not support such a directive, define   */
-/* to nothing. (This is to avoid warnings with the exit functions under GCC.) */
-#define _PDCLIB_NORETURN __attribute__(( noreturn ))
-
 /* The maximum value that errno can be set to. This is used to set the size   */
 /* of the array in struct lconv (<locale.h>) holding error messages for the   */
 /* strerror() and perror() functions. (If you change this value because you   */
 /* compiler manuals.                                                          */
 #define _PDCLIB_SHRT_BYTES  2
 #define _PDCLIB_INT_BYTES   4
-#define _PDCLIB_LONG_BYTES  4
+#if defined(__LP64__) || defined(_LP64)
+#  define _PDCLIB_LONG_BYTES 8
+#else
+#  define _PDCLIB_LONG_BYTES  4
+#endif
 #define _PDCLIB_LLONG_BYTES 8
 
 /* <stdlib.h> defines the div() function family that allows taking quotient   */
@@ -131,8 +129,8 @@ struct _PDCLIB_lldiv_t
 /* -------------------------------------------------------------------------- */
 
 /* The result type of substracting two pointers */
-#define _PDCLIB_ptrdiff int
-#define _PDCLIB_PTRDIFF INT
+#define _PDCLIB_ptrdiff long
+#define _PDCLIB_PTRDIFF LONG
 #define _PDCLIB_PTR_CONV
 
 /* An integer type that can be accessed as atomic entity (think asynchronous
@@ -143,17 +141,18 @@ struct _PDCLIB_lldiv_t
 #define _PDCLIB_SIG_ATOMIC INT
 
 /* Result type of the 'sizeof' operator (must be unsigned) */
-#define _PDCLIB_size unsigned int
-#define _PDCLIB_SIZE UINT
+#define _PDCLIB_size unsigned long
+#define _PDCLIB_SIZE ULONG
 
 /* Large enough an integer to hold all character codes of the largest supported
    locale.
 */
-#define _PDCLIB_wchar unsigned short 
-#define _PDCLIB_WCHAR USHRT
+#define _PDCLIB_wint  signed int
+#define _PDCLIB_wchar unsigned int
+#define _PDCLIB_WCHAR UINT
 
-#define _PDCLIB_intptr int
-#define _PDCLIB_INTPTR INT
+#define _PDCLIB_intptr long
+#define _PDCLIB_INTPTR LONG
 
 /* Largest supported integer type. Implementation note: see _PDCLIB_atomax(). */
 #define _PDCLIB_intmax long long int
@@ -201,6 +200,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                                                             */
 /* -------------------------------------------------------------------------- */
@@ -228,6 +240,22 @@ 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
+#if defined(__i386__) || defined(__amd64__)
+  #define _PDCLIB_LDOUBLE_TYPE EXTENDED
+#else
+  #define _PDCLIB_LDOUBLE_TYPE DOUBLE
+#endif
+
 /* -------------------------------------------------------------------------- */
 /* Platform-dependent macros defined by the standard headers.                 */
 /* -------------------------------------------------------------------------- */
@@ -283,15 +311,15 @@ typedef char * _PDCLIB_va_list;
 
 /* TODO: Better document these */
 
-/* I/O ---------------------------------------------------------------------- */
+/* Locale --------------------------------------------------------------------*/
 
-/* The type of the file descriptor returned by _PDCLIB_open(). */
-typedef int _PDCLIB_fd_t;
+/* Locale method. See _PDCLIB_locale.h */
+/* #define _PDCLIB_LOCALE_METHOD _PDCLIB_LOCALE_METHOD_TSS */
 
-/* The value (of type _PDCLIB_fd_t) returned by _PDCLIB_open() if the operation
-   failed.
-*/
-#define _PDCLIB_NOHANDLE ( (_PDCLIB_fd_t) -1 )
+/* wchar_t encoding */
+#define _PDCLIB_WCHAR_ENCODING _PDCLIB_WCHAR_ENCODING_UCS4
+
+/* I/O ---------------------------------------------------------------------- */
 
 /* The default size for file buffers. Must be at least 256. */
 #define _PDCLIB_BUFSIZ 1024