[1046] | 1 | /*
|
---|
| 2 | * limits.h
|
---|
| 3 | * This file has no copyright assigned and is placed in the Public Domain.
|
---|
| 4 | * This file is a part of the mingw-runtime package.
|
---|
| 5 | * No warranty is given; refer to the file DISCLAIMER within the package.
|
---|
| 6 | *
|
---|
| 7 | * Functions for manipulating paths and directories (included from io.h)
|
---|
| 8 | * plus functions for setting the current drive.
|
---|
| 9 | *
|
---|
| 10 | * Defines constants for the sizes of integral types.
|
---|
| 11 | *
|
---|
| 12 | * NOTE: GCC should supply a version of this header and it should be safe to
|
---|
| 13 | * use that version instead of this one (maybe safer).
|
---|
| 14 | *
|
---|
| 15 | */
|
---|
| 16 |
|
---|
| 17 | #ifndef _LIMITS_H_
|
---|
| 18 | #define _LIMITS_H_
|
---|
| 19 |
|
---|
| 20 | /* All the headers include this file. */
|
---|
| 21 | #include <_mingw.h>
|
---|
| 22 |
|
---|
| 23 | /*
|
---|
| 24 | * File system limits
|
---|
| 25 | *
|
---|
| 26 | * TODO: NAME_MAX and OPEN_MAX are file system limits or not? Are they the
|
---|
| 27 | * same as FILENAME_MAX and FOPEN_MAX from stdio.h?
|
---|
| 28 | * NOTE: PATH_MAX is the POSIX equivalent for Microsoft's MAX_PATH; the two
|
---|
| 29 | * are semantically identical, with a limit of 259 characters for the
|
---|
| 30 | * path name, plus one for a terminating NUL, for a total of 260.
|
---|
| 31 | */
|
---|
| 32 | #ifndef __STRICT_ANSI__
|
---|
| 33 | # define PATH_MAX 260
|
---|
| 34 | #endif
|
---|
| 35 |
|
---|
| 36 | /*
|
---|
| 37 | * Characteristics of the char data type.
|
---|
| 38 | *
|
---|
| 39 | * TODO: Is MB_LEN_MAX correct?
|
---|
| 40 | */
|
---|
| 41 | #define CHAR_BIT 8
|
---|
| 42 | #define MB_LEN_MAX 2
|
---|
| 43 |
|
---|
| 44 | #define SCHAR_MIN (-128)
|
---|
| 45 | #define SCHAR_MAX 127
|
---|
| 46 |
|
---|
| 47 | #define UCHAR_MAX 255
|
---|
| 48 |
|
---|
| 49 | /* TODO: Is this safe? I think it might just be testing the preprocessor,
|
---|
| 50 | * not the compiler itself... */
|
---|
| 51 | #if ('\x80' < 0)
|
---|
| 52 | #define CHAR_MIN SCHAR_MIN
|
---|
| 53 | #define CHAR_MAX SCHAR_MAX
|
---|
| 54 | #else
|
---|
| 55 | #define CHAR_MIN 0
|
---|
| 56 | #define CHAR_MAX UCHAR_MAX
|
---|
| 57 | #endif
|
---|
| 58 |
|
---|
| 59 | /*
|
---|
| 60 | * Maximum and minimum values for ints.
|
---|
| 61 | */
|
---|
| 62 | #define INT_MAX 2147483647
|
---|
| 63 | #define INT_MIN (-INT_MAX-1)
|
---|
| 64 |
|
---|
| 65 | #define UINT_MAX 0xffffffff
|
---|
| 66 |
|
---|
| 67 | /*
|
---|
| 68 | * Maximum and minimum values for shorts.
|
---|
| 69 | */
|
---|
| 70 | #define SHRT_MAX 32767
|
---|
| 71 | #define SHRT_MIN (-SHRT_MAX-1)
|
---|
| 72 |
|
---|
| 73 | #define USHRT_MAX 0xffff
|
---|
| 74 |
|
---|
| 75 | /*
|
---|
| 76 | * Maximum and minimum values for longs and unsigned longs.
|
---|
| 77 | *
|
---|
| 78 | * TODO: This is not correct for Alphas, which have 64 bit longs.
|
---|
| 79 | */
|
---|
| 80 | #define LONG_MAX 2147483647L
|
---|
| 81 | #define LONG_MIN (-LONG_MAX-1)
|
---|
| 82 |
|
---|
| 83 | #define ULONG_MAX 0xffffffffUL
|
---|
| 84 |
|
---|
| 85 | #ifndef __STRICT_ANSI__
|
---|
| 86 | /* POSIX wants this. */
|
---|
| 87 | #define SSIZE_MAX LONG_MAX
|
---|
| 88 | #endif
|
---|
| 89 |
|
---|
| 90 | #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
|
---|
| 91 | || !defined(__STRICT_ANSI__)
|
---|
| 92 | /* ISO C9x macro names */
|
---|
| 93 | #define LLONG_MAX 9223372036854775807LL
|
---|
| 94 | #define LLONG_MIN (-LLONG_MAX - 1)
|
---|
| 95 | #define ULLONG_MAX (2ULL * LLONG_MAX + 1)
|
---|
| 96 | #endif
|
---|
| 97 |
|
---|
| 98 | /*
|
---|
| 99 | * The GNU C compiler also allows 'long long int'
|
---|
| 100 | */
|
---|
| 101 | #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
|
---|
| 102 |
|
---|
| 103 | #define LONG_LONG_MAX 9223372036854775807LL
|
---|
| 104 | #define LONG_LONG_MIN (-LONG_LONG_MAX-1)
|
---|
| 105 | #define ULONG_LONG_MAX (2ULL * LONG_LONG_MAX + 1)
|
---|
| 106 |
|
---|
| 107 | /* MSVC compatibility */
|
---|
| 108 | #define _I64_MIN LONG_LONG_MIN
|
---|
| 109 | #define _I64_MAX LONG_LONG_MAX
|
---|
| 110 | #define _UI64_MAX ULONG_LONG_MAX
|
---|
| 111 |
|
---|
| 112 | #endif /* Not Strict ANSI and GNU C compiler */
|
---|
| 113 |
|
---|
| 114 |
|
---|
| 115 | #endif /* not _LIMITS_H_ */
|
---|