2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: limits.c /main/2 1996/05/08 19:42:11 drk $ */
24 /***************************************************************
26 * AT&T - PROPRIETARY *
28 * THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
31 * Copyright (c) 1995 AT&T Corp. *
32 * All Rights Reserved *
34 * This software is licensed by AT&T Corp. *
35 * under the terms and conditions of the license in *
36 * http://www.research.att.com/orgs/ssr/book/reuse *
38 * This software was created by the *
39 * Software Engineering Research Department *
40 * AT&T Bell Laboratories *
42 * For further information contact *
43 * gsf@research.att.com *
45 ***************************************************************/
47 /* : : generated by proto : : */
49 #if !defined(__PROTO__)
50 #if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
51 #if defined(__cplusplus)
52 #define __MANGLE__ "C"
57 #define __PROTO__(x) x
59 #define __PARAM__(n,o) n
60 #if !defined(__STDC__) && !defined(__cplusplus)
61 #if !defined(c_plusplus)
72 #define __PROTO__(x) ()
73 #define __OTORP__(x) x
74 #define __PARAM__(n,o) o
82 #if defined(__cplusplus) || defined(c_plusplus)
83 #define __VARARG__ ...
87 #if defined(__STDARG__)
88 #define __VA_START__(p,a) va_start(p,a)
90 #define __VA_START__(p,a) va_start(p)
93 #if defined(__STDPP__directive) && defined(__STDPP__hide)
94 __STDPP__directive pragma pp:hide printf
96 #define printf ______printf
100 #define _POSIX_SOURCE 1
103 #include <sys/types.h>
105 #include "FEATURE/lib"
106 #include "FEATURE/limits.lcl"
107 #include "FEATURE/unistd.lcl"
108 #include "FEATURE/param"
109 #include "FEATURE/types"
111 #if defined(__STDPP__directive) && defined(__STDPP__hide)
112 __STDPP__directive pragma pp:nohide printf
115 #if defined(__STDPP__hide) || defined(printf)
117 extern __MANGLE__ int printf __PROTO__((const char*, ...));
135 * <limits.h> with *constant* valued macros
141 printf("#undef CHAR_BIT\n");
146 while (uc >>= 1) val++;
148 printf("#define CHAR_BIT %lu\n", val);
151 printf("#undef MB_LEN_MAX\n");
155 printf("#define MB_LEN_MAX %lu\n", val);
170 printf("#undef UCHAR_MAX\n");
174 printf("#if defined(__STDC__)\n");
175 printf("#define UCHAR_MAX %luU\n", val);
177 printf("#define UCHAR_MAX %lu\n", val);
182 printf("#undef SCHAR_MIN\n");
184 val = (unsigned char)(uc >> 1) + 1;
186 printf("#define SCHAR_MIN -%lu\n", val);
190 printf("#undef SCHAR_MAX\n");
192 val = (unsigned char)(uc >> 1);
194 printf("#define SCHAR_MAX %lu\n", val);
199 printf("#undef CHAR_MIN\n");
201 printf("#define CHAR_MIN SCHAR_MIN\n");
204 printf("#undef CHAR_MAX\n");
206 printf("#define CHAR_MAX SCHAR_MAX\n");
211 printf("#undef CHAR_MIN\n");
213 printf("#define CHAR_MIN 0\n");
216 printf("#undef CHAR_MAX\n");
218 printf("#define CHAR_MAX UCHAR_MAX\n");
223 printf("#undef USHRT_MAX\n");
227 printf("#if defined(__STDC__)\n");
228 printf("#define USHRT_MAX %luU\n", val);
230 printf("#define USHRT_MAX %lu\n", val);
235 printf("#undef SHRT_MIN\n");
237 val = (unsigned short)(us >> 1) + 1;
239 printf("#define SHRT_MIN -%lu\n", val);
243 printf("#undef SHRT_MAX\n");
245 val = (unsigned short)(us >> 1);
247 printf("#define SHRT_MAX %lu\n", val);
252 printf("#undef UINT_MAX\n");
254 printf("#define UINT_MAX USHRT_MAX\n");
257 printf("#undef INT_MIN\n");
259 printf("#define INT_MIN SHRT_MIN\n");
262 printf("#undef INT_MAX\n");
264 printf("#define INT_MAX SHRT_MAX\n");
270 printf("#undef UINT_MAX\n");
274 printf("#if defined(__STDC__)\n");
275 printf("#define UINT_MAX %luU\n", val);
277 printf("#define UINT_MAX %lu\n", val);
282 printf("#undef INT_MIN\n");
284 val = (unsigned int)(ui >> 1) + 1;
286 if (ui == ul) printf("#define INT_MIN (-%lu-1)\n", val - 1);
287 else printf("#define INT_MIN -%lu\n", val);
291 printf("#undef INT_MAX\n");
293 val = (unsigned int)(ui >> 1);
295 printf("#define INT_MAX %lu\n", val);
301 printf("#undef ULONG_MAX\n");
303 printf("#define ULONG_MAX UINT_MAX\n");
306 printf("#undef LONG_MIN\n");
308 printf("#define LONG_MIN INT_MIN\n");
311 printf("#undef LONG_MAX\n");
313 printf("#define LONG_MAX INT_MAX\n");
319 printf("#undef ULONG_MAX\n");
323 printf("#if defined(__STDC__)\n");
324 printf("#define ULONG_MAX %luU\n", val);
326 printf("#define ULONG_MAX %lu\n", val);
331 printf("#undef LONG_MIN\n");
333 val = (unsigned long)(ul >> 1) + 1;
335 printf("#define LONG_MIN (-%lu-1)\n", val - 1);
339 printf("#undef LONG_MAX\n");
341 val = (unsigned long)(ul >> 1);
343 printf("#define LONG_MAX %lu\n", val);
347 printf("#undef ULONGLONG_MAX\n");
348 printf("#if defined(__STDC__)\n");
349 printf("#define ULONGLONG_MAX %lluLLU\n", ULONGLONG_MAX);
351 printf("#define ULONGLONG_MAX %llu\n", ULONGLONG_MAX);
356 printf("#undef LONGLONG_MIN\n");
357 printf("#if defined(__STDC__)\n");
358 printf("#define LONGLONG_MIN %lldLL\n", LONGLONG_MIN);
360 printf("#define LONGLONG_MIN %lld\n", LONGLONG_MIN);
365 printf("#undef LONGLONG_MAX\n");
366 printf("#if defined(__STDC__)\n");
367 printf("#define LONGLONG_MAX %lldLL\n", LONGLONG_MAX);
369 printf("#define LONGLONG_MAX %lld\n", LONGLONG_MAX);
382 printf(" * pollution control\n");
385 printf("#if defined(__STDPP__directive) && defined(__STDPP__ignore)\n");
386 printf("__STDPP__directive pragma pp:ignore \"limits.h\"\n");
389 printf("#define _limits_h\n");
392 printf("#define __limits_h\n");
395 printf("#define _sys_limits_h\n");
397 #ifdef __sys_limits_h
398 printf("#define __sys_limits_h\n");
401 printf("#define _LIMITS_H_\n");
404 printf("#define __LIMITS_H\n");
406 #ifdef __LIMITS_INCLUDED
407 printf("#define __LIMITS_INCLUDED\n");
409 #ifdef _MACH_MACHLIMITS_H_
410 printf("#define _MACH_MACHLIMITS_H_\n");
412 #ifdef _SYS_LIMITS_H_
413 printf("#define _SYS_LIMITS_H_\n");
415 #ifdef __SYS_LIMITS_H
416 printf("#define __SYS_LIMITS_H\n");
418 #ifdef __SYS_LIMITS_INCLUDED
419 printf("#define __SYS_LIMITS_INCLUDED\n");
421 #ifdef _SYS_SYSLIMITS_H_
422 printf("#define _SYS_SYSLIMITS_H_\n");
425 printf("#define _H_LIMITS\n");
428 printf("#define __H_LIMITS\n");
431 printf("#define _H_SYS_LIMITS\n");
433 #ifdef __H_SYS_LIMITS
434 printf("#define __H_SYS_LIMITS\n");