libexplain  1.4.D001
libexplain/ac/limits.h
Go to the documentation of this file.
00001 /*
00002  * libexplain - Explain errno values returned by libc functions
00003  * Copyright (C) 2008, 2009, 2013 Peter Miller
00004  * Written by Peter Miller <pmiller@opensource.org.au>
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU Lesser General Public License as published by
00008  * the Free Software Foundation; either version 3 of the License, or (at
00009  * your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public License
00017  * along with this program. If not, see <http://www.gnu.org/licenses/>.
00018  */
00019 
00020 #ifndef LIBEXPLAIN_AC_LIMITS_H
00021 #define LIBEXPLAIN_AC_LIMITS_H
00022 
00028 #include <libexplain/config.h>
00029 
00030 #if HAVE_LIMITS_H
00031 #include <limits.h>
00032 #else
00033 
00034 /*
00035  * fake a few of the values
00036  *      (the *_MIN things only work on 2s compliment machines,
00037  *      the *SHRT* things do not work on non-compliant compilers)
00038  */
00039 #ifndef USHRT_MAX
00040 #define USHRT_MAX       ((unsigned short)~(unsigned)0)
00041 #endif
00042 #ifndef SHRT_MAX
00043 #define SHRT_MAX        ((short)(USHRT_MAX >> 1))
00044 #endif
00045 #ifndef SHRT_MIN
00046 #define SHRT_MIN        ((short)(~(unsigned short)SHRT_MAX))
00047 #endif
00048 #ifndef UINT_MAX
00049 #define UINT_MAX        (~(unsigned)0)
00050 #endif
00051 #ifndef INT_MAX
00052 #define INT_MAX         ((int)(UINT_MAX >> 1))
00053 #endif
00054 #ifndef INT_MIN
00055 #define INT_MIN         ((int)(~(unsigned)INT_MAX))
00056 #endif
00057 #ifndef ULONG_MAX
00058 #define ULONG_MAX       (~(unsigned long)0)
00059 #endif
00060 #ifndef LONG_MAX
00061 #define LONG_MAX        ((long)(ULONG_MAX >> 1))
00062 #endif
00063 #ifndef LONG_MIN
00064 #define LONG_MIN        ((long)(~(unsigned long)LONG_MAX))
00065 #endif
00066 #ifndef MB_LEN_MAX
00067 #define MB_LEN_MAX 1
00068 #endif
00069 
00070 #endif /* !HAVE_LIMITS_H */
00071 
00072 #endif /* LIBEXPLAIN_AC_LIMITS_H */
00073 /* vim: set ts=8 sw=4 et : */