]> pd.if.org Git - pdclib/blobdiff - includes/limits.h
PDCLib includes with quotes, not <>.
[pdclib] / includes / limits.h
index 0d354959795e879c9db244cc74c03e09b8104627..79fc6f607ae81a4bfd4c25399ef1869c29eac530 100644 (file)
@@ -1,59 +1,39 @@
-/* ----------------------------------------------------------------------------
- * $Id$
- * ----------------------------------------------------------------------------
- * Public Domain C Library - http://pdclib.sourceforge.net
- * This code is Public Domain. Use, modify, and redistribute at will.
- * ----------------------------------------------------------------------------
- * Sizes of integer types
- * ----------------------------------------------------------------------------
- * This header is part of a freestanding implementation
- * --------------------------------------------------------------------------*/
-
-#ifndef _LIMITS_H
-#define _LIMITS_H _LIMITS_H
-
-/* ISO/IEC 9899:1999, ยง5.2.4.2.1
- * The values given below shall be replaced by constant expressions suitable
- * for use in #if preprocessing directives. Moreover, except for CHAR_BIT and
- * MB_LEN_MAX, the following shall be replaced by expressions that have the
- * same type as would an expression that is an object of the corresponding type
- * converted according to the integer promotions. Their implementation-defined
- * values shall be equal or greater in magnitude (absolute value) to those
- * shown, with the same sign.
- */
-
-/* This file is part of the platform personality, and is commonly generated
-   using the enquire utility (included).                                     */
-
-/* Limits of type 'char' */
-#define CHAR_BIT   /* 8 */
-#define CHAR_MAX   /* SCHAR_MAX / UCHAR_MAX */
-#define CHAR_MIN   /* SCHAR_MIN / 0 */
-#define SCHAR_MAX  /* +127 */
-#define SCHAR_MIN  /* -127 */
-#define UCHAR_MAX  /*  255 (2^CHAR_BIT - 1) */
-
-/* Multibyte characters */
-#define MB_LEN_MAX /* 1 */
-
-/* Limits of type 'short int' */
-#define SHRT_MAX   /* +32767 */
-#define SHRT_MIN   /* -32767 */
-#define USHRT_MAX  /*  65535 */
-
-/* Limits of type 'int' */
-#define INT_MAX    /* +32767 */
-#define INT_MIN    /* -32767 */
-#define UINT_MAX   /*  65535 */
-
-/* Limits of type 'long int' */
-#define LONG_MAX   /* +2147483647 */
-#define LONG_MIN   /* -2147483647 */
-#define ULONG_MAX  /*  4294967295 */
-
-/* Limits of type 'long long int' */
-#define LLONG_MAX  /* +9223372036854775807 */
-#define LLONG_MIN  /* -9223372036854775807 */
-#define ULLONG_MAX /* 18446744073709551615 */
-
-#endif /* _LIMITS_H */
+/* Sizes of integer types <limits.h>
+
+   This file is part of the Public Domain C Library (PDCLib).
+   Permission is granted to use, modify, and / or redistribute at will.
+*/
+
+#ifndef _PDCLIB_LIMITS_H
+#define _PDCLIB_LIMITS_H _PDCLIB_LIMITS_H
+#include "_PDCLIB_int.h"
+
+/* MSVC 2010 defines this to 5, which is enough for UTF-8 but might rule out
+   stateful encodings (like ISO/IEC 2022). GCC 5.3 defines this to 16, which
+   is meant to ensure future compatibility. For the same reason, we go along
+   with GCC's definition.
+   http://lists.gnu.org/archive/html/bug-gnulib/2015-05/msg00001.html
+*/
+#define MB_LEN_MAX 16
+
+#define LLONG_MIN  _PDCLIB_LLONG_MIN
+#define LLONG_MAX  _PDCLIB_LLONG_MAX
+#define ULLONG_MAX _PDCLIB_ULLONG_MAX
+
+#define CHAR_BIT   _PDCLIB_CHAR_BIT
+#define CHAR_MAX   _PDCLIB_CHAR_MAX
+#define CHAR_MIN   _PDCLIB_CHAR_MIN
+#define SCHAR_MAX  _PDCLIB_SCHAR_MAX
+#define SCHAR_MIN  _PDCLIB_SCHAR_MIN
+#define UCHAR_MAX  _PDCLIB_UCHAR_MAX
+#define SHRT_MAX   _PDCLIB_SHRT_MAX
+#define SHRT_MIN   _PDCLIB_SHRT_MIN
+#define INT_MAX    _PDCLIB_INT_MAX
+#define INT_MIN    _PDCLIB_INT_MIN
+#define LONG_MAX   _PDCLIB_LONG_MAX
+#define LONG_MIN   _PDCLIB_LONG_MIN
+#define USHRT_MAX  _PDCLIB_USHRT_MAX
+#define UINT_MAX   _PDCLIB_UINT_MAX
+#define ULONG_MAX  _PDCLIB_ULONG_MAX
+
+#endif