1 /**
2  * D header file for C99.
3  *
4  * $(C_HEADER_DESCRIPTION pubs.opengroup.org/onlinepubs/009695399/basedefs/_limits.h.html, _limits.h)
5  *
6  * Copyright: Copyright Sean Kelly 2005 - 2009.
7  * License: Distributed under the
8  *      $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0).
9  *    (See accompanying file LICENSE)
10  * Authors:   Sean Kelly
11  * Source:    $(DRUNTIMESRC core/stdc/_limits.d)
12  * Standards: ISO/IEC 9899:1999 (E)
13  */
14 
15 module core.stdc.limits;
16 
17 version (OSX)
18     version = Darwin;
19 else version (iOS)
20     version = Darwin;
21 else version (TVOS)
22     version = Darwin;
23 else version (WatchOS)
24     version = Darwin;
25 
26 import core.stdc.config;
27 
28 extern (C):
29 @trusted: // Constants only.
30 nothrow:
31 @nogc:
32 
33 //
34 // Numerical limits
35 //
36 
37 ///
38 enum CHAR_BIT       = 8;
39 ///
40 enum SCHAR_MIN      = byte.min;
41 ///
42 enum SCHAR_MAX      = byte.max;
43 ///
44 enum UCHAR_MAX      = ubyte.max;
45 ///
46 enum CHAR_MIN       = char.min;
47 ///
48 enum CHAR_MAX       = char.max;
49 ///
50 enum MB_LEN_MAX     = 2;
51 ///
52 enum SHRT_MIN       = short.min;
53 ///
54 enum SHRT_MAX       = short.max;
55 ///
56 enum USHRT_MAX      = ushort.max;
57 ///
58 enum INT_MIN        = int.min;
59 ///
60 enum INT_MAX        = int.max;
61 ///
62 enum UINT_MAX       = uint.max;
63 ///
64 enum LONG_MIN       = c_long.min;
65 ///
66 enum LONG_MAX       = c_long.max;
67 ///
68 enum ULONG_MAX      = c_ulong.max;
69 ///
70 enum LLONG_MIN      = long.min;
71 ///
72 enum LLONG_MAX      = long.max;
73 ///
74 enum ULLONG_MAX     = ulong.max;
75 
76 //
77 // File system limits
78 //
79 
80 version (Darwin)
81 {
82     ///
83     enum MAX_CANON      = 1024;
84     ///
85     enum MAX_INPUT      = 1024;
86     ///
87     enum NAME_MAX       = 255;
88     ///
89     enum PATH_MAX       = 1024;
90     ///
91     enum PIPE_BUF       = 512;
92 }
93 
94 version (DragonFlyBSD)
95 {
96     ///
97     enum MAX_CANON      = 255;
98     ///
99     enum MAX_INPUT      = 255;
100     ///
101     enum NAME_MAX       = 255;
102     ///
103     enum PATH_MAX       = 1024;
104     ///
105     enum PIPE_BUF       = 512;
106 }
107 else version (FreeBSD)
108 {
109     ///
110     enum MAX_CANON      = 255;
111     ///
112     enum MAX_INPUT      = 255;
113     ///
114     enum NAME_MAX       = 255;
115     ///
116     enum PATH_MAX       = 1024;
117     ///
118     enum PIPE_BUF       = 512;
119 }
120 else version (linux)
121 {
122     ///
123     enum MAX_CANON      = 255;
124     ///
125     enum MAX_INPUT      = 255;
126     ///
127     enum NAME_MAX       = 255;
128     ///
129     enum PATH_MAX       = 4096;
130     ///
131     enum PIPE_BUF       = 4096;
132 }
133 else version (NetBSD)
134 {
135     ///
136     enum MAX_CANON      = 255;
137     ///
138     enum MAX_INPUT      = 255;
139     ///
140     enum NAME_MAX       = 511;
141     ///
142     enum PATH_MAX       = 1024;
143     ///
144     enum PIPE_BUF       = 512;
145 }
146 else version (OpenBSD)
147 {
148     ///
149     enum MAX_CANON      = 255;
150     ///
151     enum MAX_INPUT      = 255;
152     ///
153     enum NAME_MAX       = 255;
154     ///
155     enum PATH_MAX       = 1024;
156     ///
157     enum PIPE_BUF       = 512;
158 }
159 else version (Solaris)
160 {
161     ///
162     enum MAX_CANON      = 256;
163     ///
164     enum MAX_INPUT      = 512;
165     ///
166     enum NAME_MAX       = 255;
167     ///
168     enum PATH_MAX       = 1024;
169     ///
170     enum PIPE_BUF       = 5120;
171 }
172 else version (Windows)
173 {
174     ///
175     enum MAX_CANON      = 256;
176     ///
177     enum MAX_INPUT      = 256;
178     ///
179     enum NAME_MAX       = 256;
180     ///
181     enum PATH_MAX       = 260;
182     ///
183     enum PIPE_BUF       = 5120;
184 }