|
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: Apparently the actual size of PATH_MAX is 260, but a space is |
|
29 * required for the NUL. TODO: Test? |
|
30 */ |
|
31 #define PATH_MAX 259 |
|
32 |
|
33 /* |
|
34 * Characteristics of the char data type. |
|
35 * |
|
36 * TODO: Is MB_LEN_MAX correct? |
|
37 */ |
|
38 #define CHAR_BIT 8 |
|
39 #define MB_LEN_MAX 2 |
|
40 |
|
41 #define SCHAR_MIN (-128) |
|
42 #define SCHAR_MAX 127 |
|
43 |
|
44 #define UCHAR_MAX 255 |
|
45 |
|
46 /* TODO: Is this safe? I think it might just be testing the preprocessor, |
|
47 * not the compiler itself... */ |
|
48 #if ('\x80' < 0) |
|
49 #define CHAR_MIN SCHAR_MIN |
|
50 #define CHAR_MAX SCHAR_MAX |
|
51 #else |
|
52 #define CHAR_MIN 0 |
|
53 #define CHAR_MAX UCHAR_MAX |
|
54 #endif |
|
55 |
|
56 /* |
|
57 * Maximum and minimum values for ints. |
|
58 */ |
|
59 #define INT_MAX 2147483647 |
|
60 #define INT_MIN (-INT_MAX-1) |
|
61 |
|
62 #define UINT_MAX 0xffffffff |
|
63 |
|
64 /* |
|
65 * Maximum and minimum values for shorts. |
|
66 */ |
|
67 #define SHRT_MAX 32767 |
|
68 #define SHRT_MIN (-SHRT_MAX-1) |
|
69 |
|
70 #define USHRT_MAX 0xffff |
|
71 |
|
72 /* |
|
73 * Maximum and minimum values for longs and unsigned longs. |
|
74 * |
|
75 * TODO: This is not correct for Alphas, which have 64 bit longs. |
|
76 */ |
|
77 #define LONG_MAX 2147483647L |
|
78 #define LONG_MIN (-LONG_MAX-1) |
|
79 |
|
80 #define ULONG_MAX 0xffffffffUL |
|
81 |
|
82 #ifndef __STRICT_ANSI__ |
|
83 /* POSIX wants this. */ |
|
84 #define SSIZE_MAX LONG_MAX |
|
85 #endif |
|
86 |
|
87 #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \ |
|
88 || !defined(__STRICT_ANSI__) |
|
89 /* ISO C9x macro names */ |
|
90 #define LLONG_MAX 9223372036854775807LL |
|
91 #define LLONG_MIN (-LLONG_MAX - 1) |
|
92 #define ULLONG_MAX (2ULL * LLONG_MAX + 1) |
|
93 #endif |
|
94 |
|
95 /* |
|
96 * The GNU C compiler also allows 'long long int' |
|
97 */ |
|
98 #if !defined(__STRICT_ANSI__) && defined(__GNUC__) |
|
99 |
|
100 #define LONG_LONG_MAX 9223372036854775807LL |
|
101 #define LONG_LONG_MIN (-LONG_LONG_MAX-1) |
|
102 #define ULONG_LONG_MAX (2ULL * LONG_LONG_MAX + 1) |
|
103 |
|
104 /* MSVC compatibility */ |
|
105 #define _I64_MIN LONG_LONG_MIN |
|
106 #define _I64_MAX LONG_LONG_MAX |
|
107 #define _UI64_MAX ULONG_LONG_MAX |
|
108 |
|
109 #endif /* Not Strict ANSI and GNU C compiler */ |
|
110 |
|
111 |
|
112 #endif /* not _LIMITS_H_ */ |