]> pd.if.org Git - pdclib/commitdiff
Excluded *_C macros from first release; cosmetic touches.
authorsolar <unknown>
Sun, 12 Dec 2004 10:26:43 +0000 (10:26 +0000)
committersolar <unknown>
Sun, 12 Dec 2004 10:26:43 +0000 (10:26 +0000)
_PDCLIB_config.h
_PDCLIB_int.h
float.h
iso646.h
limits.h
stdarg.h
stdbool.h
stddef.h
stdint.h

index 2b69f07c121805e1a2c3d85ed8d7d95029e595c1..a8ef2fa8507530b4e32c3d428fb901f3221a41cb 100644 (file)
@@ -1,6 +1,6 @@
 /* $Id$ */
 
 /* $Id$ */
 
-/* Release: $Name$ */
+/* Release $Name$ */
 
 /* Internal PDCLib configuration <_PDCLIB_config.h>
    (Generic Template)
 
 /* Internal PDCLib configuration <_PDCLIB_config.h>
    (Generic Template)
 /* Integers                                                                   */
 /* -------------------------------------------------------------------------- */
 /* Assuming 8-bit char, two's-complement architecture here. 'short' being     */
 /* Integers                                                                   */
 /* -------------------------------------------------------------------------- */
 /* Assuming 8-bit char, two's-complement architecture here. 'short' being     */
-/* either 8 or 16 bit, 'int' being either 16, 32 or 64 bit, 'long' being      */
-/* either 32 or 64 bit, and 'long long' being 64 bit if 'long' is not, 64 or  */
-/* 128 bit otherwise.                                                         */
+/* 16 bit, 'int' being either 16, 32 or 64 bit, 'long' being either 32 or 64  */
+/* bit (but 64 bit only if 'int' is 32 bit), and 'long long' being 64 bit if  */
+/* 'long' is not, 64 or 128 bit otherwise.                                    */
 /* Author is quite willing to support other systems but would like to hear of */
 /* interest in such support and details on the to-be-supported architecture   */
 /* Author is quite willing to support other systems but would like to hear of */
 /* interest in such support and details on the to-be-supported architecture   */
-/* first before going to lengths about it.                                    */
+/* first, before going to lengths about it.                                   */
 /* -------------------------------------------------------------------------- */
 
 /* Comment out (or delete) the line below if your 'char' type is unsigned.    */
 /* -------------------------------------------------------------------------- */
 
 /* Comment out (or delete) the line below if your 'char' type is unsigned.    */
-#define _PDCLIB_CHAR_SIGNED _PDCLIB_CHAR_SIGNED
+#define _PDCLIB_CHAR_SIGNED 1
 
 /* Width of the integer types short, int, long, and long long, in bytes.      */
 
 /* Width of the integer types short, int, long, and long long, in bytes.      */
+/* SHRT == 2, INT >= SHRT, LONG >= INT >= 4, LLONG >= LONG - check your       */
+/* compiler manuals.                                                          */
 #define _PDCLIB_SHRT_BYTES  2
 #define _PDCLIB_INT_BYTES   4
 #define _PDCLIB_LONG_BYTES  4
 #define _PDCLIB_SHRT_BYTES  2
 #define _PDCLIB_INT_BYTES   4
 #define _PDCLIB_LONG_BYTES  4
 /* -------------------------------------------------------------------------- */
 /* What follows are a couple of "special" typedefs and their limits. Again,   */
 /* the actual definition of the limits is done in <_PDCLIB_int.h>, and the    */
 /* -------------------------------------------------------------------------- */
 /* What follows are a couple of "special" typedefs and their limits. Again,   */
 /* the actual definition of the limits is done in <_PDCLIB_int.h>, and the    */
-/* defines here are merely "configuration".                                   */
-/* Type is defined directly, limits are defined the same way as the "fastest" */
-/* limits above (SHRT, USHRT, INT, UINT, LONG, ULONG, LLONG, or ULLONG).      */
+/* defines here are merely "configuration". See above for details.            */
 /* -------------------------------------------------------------------------- */
 
 /* The result type of substracting two pointers */
 /* -------------------------------------------------------------------------- */
 
 /* The result type of substracting two pointers */
-typedef int             _PDCLIB_ptrdiff_t;
+#define _PDCLIB_ptrdiff int
 #define _PDCLIB_PTRDIFF INT
 
 /* An integer type that can be accessed as atomic entity (think asynchronous
 #define _PDCLIB_PTRDIFF INT
 
 /* An integer type that can be accessed as atomic entity (think asynchronous
@@ -79,14 +79,20 @@ typedef int             _PDCLIB_ptrdiff_t;
 #define _PDCLIB_SIG_ATOMIC INT
 
 /* Result type of the 'sizeof' operator */
 #define _PDCLIB_SIG_ATOMIC INT
 
 /* Result type of the 'sizeof' operator */
-typedef unsigned int _PDCLIB_size_t;
+#define _PDCLIB_size unsigned int
 #define _PDCLIB_SIZE UINT
 
 /* Large enough an integer to hold all character codes of the largest supported
    locale.
 */
 #define _PDCLIB_SIZE UINT
 
 /* Large enough an integer to hold all character codes of the largest supported
    locale.
 */
-#define _PDCLIB_WCHAR  USHRT
-typedef unsigned short _PDCLIB_wchar_t;
+#define _PDCLIB_wchar unsigned short 
+#define _PDCLIB_WCHAR USHRT
+
+#define _PDCLIB_intptr int
+#define _PDCLIB_INTPTR INT
+
+#define _PDCLIB_intmax long long int
+#define _PDCLIB_INTMAX LLINT
 
 /* -------------------------------------------------------------------------- */
 /* Floating Point                                                             */
 
 /* -------------------------------------------------------------------------- */
 /* Floating Point                                                             */
index 3192823dd11f171be1ceec0fd6869a96d8ab5c9b..14a295728deb08b853fd22c89e01b2d0e0982c02 100644 (file)
@@ -1,8 +1,8 @@
 /* $Id$ */
 
 /* $Id$ */
 
-/* Release: $Name$ */
+/* Release $Name$ */
 
 
-/* Internal PDCLib logic <_PDCLIB_internal.h>
+/* PDCLib internal integer logic <_PDCLIB_int.h>
 
    This file is part of the Public Domain C Library (PDCLib).
    Permission is granted to use, modify, and / or redistribute at will.
 
    This file is part of the Public Domain C Library (PDCLib).
    Permission is granted to use, modify, and / or redistribute at will.
 #include <_PDCLIB_config.h>
 #endif
 
 #include <_PDCLIB_config.h>
 #endif
 
+#ifndef _PDCLIB_AUX_H
+#define _PDCLIB_AUX_H _PDCLIB_AUX_H
+#include <_PDCLIB_aux.h>
+#endif
+
 /* null pointer constant */
 #define _PDCLIB_NULL 0
 
 /* null pointer constant */
 #define _PDCLIB_NULL 0
 
-/* -------------------------------------------------------------------------- */
-/* Helper macros:                                                             */
-/* _PDCLIB_cc( x, y ) concatenates two preprocessor tokens without extending  */
-/* _PDCLIB_concat( x, y ) concatenates two preprocessor tokens with extending */
-/* -------------------------------------------------------------------------- */
-
-#define _PDCLIB_cc( x, y )     x ## y
-#define _PDCLIB_concat( x, y ) _PDCLIB_cc( x, y )
-
 /* -------------------------------------------------------------------------- */
 /* Limits of native datatypes                                                 */
 /* -------------------------------------------------------------------------- */
 /* -------------------------------------------------------------------------- */
 /* Limits of native datatypes                                                 */
 /* -------------------------------------------------------------------------- */
 #endif
 
 /* Setting 'short' limits                                                     */
 #endif
 
 /* Setting 'short' limits                                                     */
-#if     _PDCLIB_SHRT_BYTES == 1
-#define _PDCLIB_SHRT_MAX   0x7f
-#define _PDCLIB_SHRT_MIN   (-0x7f - 1)
-#define _PDCLIB_USHRT_MAX  0xff
-#elif   _PDCLIB_SHRT_BYTES == 2
-#define _PDCLIB_SHRT_MAX   0x7fff
-#define _PDCLIB_SHRT_MIN   (-0x7fff - 1)
-#define _PDCLIB_USHRT_MAX  0xffff
+#if     _PDCLIB_SHRT_BYTES == 2
+#define _PDCLIB_SHRT_MAX      0x7fff
+#define _PDCLIB_SHRT_MIN      (-0x7fff - 1)
+#define _PDCLIB_USHRT_MAX     0xffff
 #else
 #else
-#error Unsupported width of 'short' (neither 8 nor 16 bit).
+#error Unsupported width of 'short' (not 16 bit).
 #endif
 #define _PDCLIB_USHRT_MIN 0
 
 #endif
 #define _PDCLIB_USHRT_MIN 0
 
+#if _PDCLIB_INT_BYTES < _PDCLIB_SHRT_BYTES
+#error Bogus setting: short > int? Check _PDCLIB_config.h.
+#endif
+
 /* Setting 'int' limits                                                       */
 #if     _PDCLIB_INT_BYTES == 2
 #define _PDCLIB_INT_MAX   0x7fff
 /* Setting 'int' limits                                                       */
 #if     _PDCLIB_INT_BYTES == 2
 #define _PDCLIB_INT_MAX   0x7fff
 #define _PDCLIB_ULLONG_MIN 0
 
 /* -------------------------------------------------------------------------- */
 #define _PDCLIB_ULLONG_MIN 0
 
 /* -------------------------------------------------------------------------- */
-/* <stdint.h> exact-width types, their limits and literals                    */
+/* <stdint.h> exact-width types and their limits                              */
 /* -------------------------------------------------------------------------- */
 
 /* Setting 'int8_t', its limits, and its literal.                             */
 /* -------------------------------------------------------------------------- */
 
 /* Setting 'int8_t', its limits, and its literal.                             */
-#if     _PDCLIB_SHRT_BYTES == 1
-typedef signed short       _PDCLIB_int8_t;
-typedef unsigned short     _PDCLIB_uint8_t;
-#define _PDCLIB_INT8_MAX   _PDCLIB_SHRT_MAX
-#define _PDCLIB_INT8_MIN   _PDCLIB_SHRT_MIN
-#define _PDCLIB_UINT8_MAX  _PDCLIB_USHRT_MAX
-#else
+#if     _PDCLIB_CHAR_BIT == 8
 typedef signed char        _PDCLIB_int8_t;
 typedef unsigned char      _PDCLIB_uint8_t;
 #define _PDCLIB_INT8_MAX   _PDCLIB_CHAR_MAX
 #define _PDCLIB_INT8_MIN   _PDCLIB_CHAR_MIN
 #define _PDCLIB_UINT8_MAX  _PDCLIB_UCHAR_MAX
 typedef signed char        _PDCLIB_int8_t;
 typedef unsigned char      _PDCLIB_uint8_t;
 #define _PDCLIB_INT8_MAX   _PDCLIB_CHAR_MAX
 #define _PDCLIB_INT8_MIN   _PDCLIB_CHAR_MIN
 #define _PDCLIB_UINT8_MAX  _PDCLIB_UCHAR_MAX
+#else
+#error Unsupported width of char (not 8 bits).
 #endif
 
 /* Setting 'int16_t', its limits, and its literal                             */
 #endif
 
 /* Setting 'int16_t', its limits, and its literal                             */
@@ -215,45 +207,33 @@ typedef unsigned _PDCLIB_fast64 _PDCLIB_uint_fast64_t;
 #define _PDCLIB_UINT_FAST64_MAX concat( concat( _PDCLIB_U, _PDCLIB_FAST64 ), _MAX )
 
 /* -------------------------------------------------------------------------- */
 #define _PDCLIB_UINT_FAST64_MAX concat( concat( _PDCLIB_U, _PDCLIB_FAST64 ), _MAX )
 
 /* -------------------------------------------------------------------------- */
-/* Various <stddef.h> limits                                                  */
+/* Various <stddef.h> typedefs and limits                                     */
 /* -------------------------------------------------------------------------- */
 
 /* -------------------------------------------------------------------------- */
 
+typedef _PDCLIB_ptrdiff     _PDCLIB_ptrdiff_t
 #define _PDCLIB_PTRDIFF_MIN concat( concat( _PDCLIB_, _PDCLIB_PTRDIFF ), _MIN )
 #define _PDCLIB_PTRDIFF_MAX concat( concat( _PDCLIB_, _PDCLIB_PTRDIFF ), _MAX )
 
 #define _PDCLIB_SIG_ATOMIC_MIN concat( concat( _PDCLIB_, _PDCLIB_SIG_ATOMIC ), _MIN )
 #define _PDCLIB_SIG_ATOMIC_MAX concat( concat( _PDCLIB_, _PDCLIB_SIG_ATOMIC ), _MAX )
 
 #define _PDCLIB_PTRDIFF_MIN concat( concat( _PDCLIB_, _PDCLIB_PTRDIFF ), _MIN )
 #define _PDCLIB_PTRDIFF_MAX concat( concat( _PDCLIB_, _PDCLIB_PTRDIFF ), _MAX )
 
 #define _PDCLIB_SIG_ATOMIC_MIN concat( concat( _PDCLIB_, _PDCLIB_SIG_ATOMIC ), _MIN )
 #define _PDCLIB_SIG_ATOMIC_MAX concat( concat( _PDCLIB_, _PDCLIB_SIG_ATOMIC ), _MAX )
 
+typedef _PDCLIB_size     _PDCLIB_size_t
 #define _PDCLIB_SIZE_MAX concat( concat( _PDCLIB_, _PDCLIB_SIZE ), _MAX )
 
 #define _PDCLIB_SIZE_MAX concat( concat( _PDCLIB_, _PDCLIB_SIZE ), _MAX )
 
+typedef _PDCLIB_wchar     _PDCLIB_wchar_t
 #define _PDCLIB_WCHAR_MIN concat( concat( _PDCLIB_, _PDCLIB_WCHAR ), _MIN )
 #define _PDCLIB_WCHAR_MAX concat( concat( _PDCLIB_, _PDCLIB_WCHAR ), _MAX )
 
 #define _PDCLIB_WCHAR_MIN concat( concat( _PDCLIB_, _PDCLIB_WCHAR ), _MIN )
 #define _PDCLIB_WCHAR_MAX concat( concat( _PDCLIB_, _PDCLIB_WCHAR ), _MAX )
 
-/* -------------------------------------------------------------------------- */
-/* <stdint.h> "exact width" literal suffixes                                  */
-/* -------------------------------------------------------------------------- */
-
-#define _PDCLIB_INT8_LITERAL  c
-#define _PDCLIB_INT16_LITERAL s
-#define _PDCLIB_INT32_LITERAL l
-#define _PDCLIB_INT64_LITERAL ll
-#define _PDCLIB_UINT8_LITERAL uc
-#define _PDCLIB_UINT16_LITERAL us
-#define _PDCLIB_UINT32_LITERAL ul
-#define _PDCLIB_UINT64_LITERAL ull
+typedef _PDCLIB_intptr          _PDCLIB_intptr_t;
+typedef unsigned _PDCLIB_intptr _PDCLIB_uintptr_t;
+#define _PDCLIB_INTPTR_MIN  concat( concat( _PDCLIB_, _PDCLIB_INTPTR ), _MIN )
+#define _PDCLIB_INTPTR_MAX  concat( concat( _PDCLIB_, _PDCLIB_INTPTR ), _MAX )
+#define _PDCLIB_UINTPTR_MAX concat( concat( _PDCLIB_U, _PDCLIB_INTPTR ), _MAX )
 
 
-/* -------------------------------------------------------------------------- */
-/* <stdint.h> intptr and intmax typedefs and limits                           */
-/* -------------------------------------------------------------------------- */
+typedef _PDCLIB_intmax          _PDCLIB_intmax_t;
+typedef unsigned _PDCLIB_intmax _PDCLIB_uintmax_t;
+#define _PDCLIB_INTMAX_MIN  concat( concat( _PDCLIB_, _PDCLIB_INTMAX ), _MIN )
+#define _PDCLIB_INTMAX_MAX  concat( concat( _PDCLIB_, _PDCLIB_INTMAX ), _MAX )
+#define _PDCLIB_UINTMAX_MAX concat( concat( _PDCLIB_U, _PDCLIB_INTMAX ), _MAX )
 
 
-typedef int                 _PDCLIB_intptr_t;
-#define _PDCLIB_INTPTR_MIN  (-0x7fffff - 1)
-#define _PDCLIB_INTPTR_MAX  0x7fffff
-typedef unsigned int        _PDCLIB_uintptr_t;
-#define _PDCLIB_UINTPTR_MAX 0xffffff
-
-typedef signed long long int   _PDCLIB_intmax_t;
-#define _PDCLIB_INTMAX_MIN     (-0x7fffffffffffffff - 1)
-#define _PDCLIB_INTMAX_MAX     0x7fffffffffffffff
-typedef unsigned long long int _PDCLIB_uintmax_t;
-#define _PDCLIB_UINTMAX_MAX    0xffffffffffffffff
+/* TODO: INTN_C / UINTN_C */
diff --git a/float.h b/float.h
index 40e20006990cd250e77ff629c98efc66b0e748f4..5b878fb0d5f3034167b57273fb6b80c2492b90f9 100644 (file)
--- a/float.h
+++ b/float.h
@@ -1,6 +1,6 @@
 /* $Id$ */
 
 /* $Id$ */
 
-/* Release: $Name$ */
+/* Release $Name$ */
 
 /* 7.7 Characteristics of floating types <float.h>
 
 
 /* 7.7 Characteristics of floating types <float.h>
 
@@ -85,3 +85,4 @@
 #define LDBL_MAX_10_EXP 4932
 
 #endif
 #define LDBL_MAX_10_EXP 4932
 
 #endif
+
index a25af3d16f94380d757994585eda7c6aeb9a2481..48ca809ed35c120fe1409f4e26f72e059759619d 100644 (file)
--- a/iso646.h
+++ b/iso646.h
@@ -1,8 +1,8 @@
 /* $Id$ */
 
 /* $Id$ */
 
-/* Release: $Name$ */
+/* Release $Name$ */
 
 
-/* 7.9 Alternative spellings <iso646.h> */
+/* 7.9 Alternative spellings <iso646.h>
 
    This file is part of the Public Domain C Library (PDCLib).
    Permission is granted to use, modify, and / or redistribute at will.
 
    This file is part of the Public Domain C Library (PDCLib).
    Permission is granted to use, modify, and / or redistribute at will.
@@ -24,3 +24,4 @@
 #define xor_eq \88=
 
 #endif
 #define xor_eq \88=
 
 #endif
+
index 1dfb7908e6b318a119901abbb57cc61d2af12751..0631bf045c1cdd010f952f4f9c4617e4a751721a 100644 (file)
--- a/limits.h
+++ b/limits.h
@@ -1,6 +1,6 @@
 /* $Id$ */
 
 /* $Id$ */
 
-/* Release: $Name$ */
+/* Release $Name$ */
 
 /* 7.10 Sizes of integer types <limits.h>
 
 
 /* 7.10 Sizes of integer types <limits.h>
 
@@ -40,3 +40,4 @@
 #define ULONG_MAX  _PDCLIB_ULONG_MAX
 
 #endif
 #define ULONG_MAX  _PDCLIB_ULONG_MAX
 
 #endif
+
index cb74be2258ba861267d0bdf1d0868f90e1bcfdb9..7558131fbb28e3404a258f1e3eb23ae3fd93a0d6 100644 (file)
--- a/stdarg.h
+++ b/stdarg.h
@@ -1,6 +1,6 @@
 /* $Id$ */
 
 /* $Id$ */
 
-/* Release: $Name$ */
+/* Release $Name$ */
 
 /* 7.15 Variable arguments <stdarg.h> 
 
 
 /* 7.15 Variable arguments <stdarg.h> 
 
@@ -24,3 +24,4 @@ typedef _PDCLIB_va_list va_list;
 #define va_start( ap, parmN ) _PDCLIB_va_start( ap, parmN )
 
 #endif
 #define va_start( ap, parmN ) _PDCLIB_va_start( ap, parmN )
 
 #endif
+
index 8e9b7e316a00dac97900946f359a72af04e01643..f067e975d545ceeaaa5bd360ea0965c864dc9760 100644 (file)
--- a/stdbool.h
+++ b/stdbool.h
@@ -1,6 +1,6 @@
 /* $Id$ */
 
 /* $Id$ */
 
-/* Release: $Name$ */
+/* Release $Name$ */
 
 /* 7.16 Boolean type and values <stdbool.h>
 
 
 /* 7.16 Boolean type and values <stdbool.h>
 
@@ -17,3 +17,4 @@
 #define __bool_true_false_are_defined 1
 
 #endif
 #define __bool_true_false_are_defined 1
 
 #endif
+
index b3e848a0e10cc1854870f2f0652189f676b580b4..d0577d0af36121bf83b5e71c54ebac2bbe3689e1 100644 (file)
--- a/stddef.h
+++ b/stddef.h
@@ -1,6 +1,6 @@
 /* $Id$ */
 
 /* $Id$ */
 
-/* Release: $Name$ */
+/* Release $Name$ */
 
 /* 7.17 Common definitions <stddef.h>
 
 
 /* 7.17 Common definitions <stddef.h>
 
@@ -25,3 +25,4 @@ typedef _PDCLIB_wchar_t   wchar_t;
 #define offsetof( type, member ) _PDCLIB_offsetof( type, member )
 
 #endif
 #define offsetof( type, member ) _PDCLIB_offsetof( type, member )
 
 #endif
+
index 1f0ebd4a78db5d7b4c4a5738dc67d1472fbe019c..806487b79d3c84131fccda5a442ebdfaa47646b2 100644 (file)
--- a/stdint.h
+++ b/stdint.h
@@ -1,6 +1,6 @@
 /* $Id$ */
 
 /* $Id$ */
 
-/* Release: $Name$ */
+/* Release $Name$ */
 
 /* 7.18 Integer types <stdint.h>
 
 
 /* 7.18 Integer types <stdint.h>
 
@@ -181,25 +181,33 @@ typedef _PDCLIB_uintmax_t uintmax_t;
 
 /* Expand to an integer constant of specified value and type int_leastN_t */
 
 
 /* Expand to an integer constant of specified value and type int_leastN_t */
 
-#define INT8_C( value )  _PDCLIB_concat( value, _PDCLIB_INT8_LITERAL )
-#define INT16_C( value ) _PDCLIB_concat( value, _PDCLIB_INT16_LITERAL )
-#define INT32_C( value ) _PDCLIB_concat( value, _PDCLIB_INT32_LITERAL )
-#define INT64_C( value ) _PDCLIB_concat( value, _PDCLIB_INT64_LITERAL )
+/* NOT YET IMPLEMENTED
+#define INT8_C( value )
+#define INT16_C( value )
+#define INT32_C( value )
+#define INT64_C( value )
+*/
 
 /* Expand to an integer constant of specified value and type uint_leastN_t */
 
 
 /* Expand to an integer constant of specified value and type uint_leastN_t */
 
-#define UINT8_C( value )  _PDCLIB_concat( value, _PDCLIB_UINT8_LITERAL )
-#define UINT16_C( value ) _PDCLIB_concat( value, _PDCLIB_UINT16_LITERAL )
-#define UINT32_C( value ) _PDCLIB_concat( value, _PDCLIB_UINT32_LITERAL )
-#define UINT64_C( value ) _PDCLIB_concat( value, _PDCLIB_UINT64_LITERAL )
+/* NOT YET IMPLEMENTED
+#define UINT8_C( value )
+#define UINT16_C( value )
+#define UINT32_C( value )
+#define UINT64_C( value )
+*/
 
 /* 7.18.4.2 Macros for greatest-width integer constants */
 
 /* Expand to an integer constant of specified value and type intmax_t */
 
 /* 7.18.4.2 Macros for greatest-width integer constants */
 
 /* Expand to an integer constant of specified value and type intmax_t */
-#define INTMAX_C( value )  _PDCLIB_concat( value, _PDCLIB_INTMAX_LITERAL )
+/* NOT YET IMPLEMENTED
+#define INTMAX_C( value )
+*/
 
 /* Expand to an integer constant of specified value and type uintmax_t */
 
 /* Expand to an integer constant of specified value and type uintmax_t */
-#define UINTMAX_C( value ) _PDCLIB_concat( value, _PDCLIB_UINTMAX_LITERAL )
+/* NOT YET IMPLEMENTED
+#define UINTMAX_C( value )
+*/
 
 #endif
 
 
 #endif