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