home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Computer Club Elmshorn Atari PD
/
CCE_PD.iso
/
pc
/
0400
/
CCE_0423.ZIP
/
CCE_0423.PD
/
GPINCL13.ZOO
/
limits.h
< prev
next >
Wrap
C/C++ Source or Header
|
1992-07-23
|
8KB
|
283 lines
/*
* LIMITS.H
* see ansi draft sec 4.1.3 and 2.2.4.2
*/
#ifndef _LIMITS_H
#define _LIMITS_H
#ifndef _COMPILER_H
#include <compiler.h>
#endif
#ifndef __MINT__
#define PATHSIZE (128) /* maximum pathname length */
#define BITSPERBYTE 8
#endif
#define CHAR_BIT 8
#define SCHAR_MAX 127
#define SCHAR_MIN (-128)
#define UCHAR_MAX 255
#ifdef __CHAR_UNSIGNED__
#define CHAR_MAX UCHAR_MAX
#define CHAR_MIN 0
#else
#define CHAR_MAX SCHAR_MAX
#define CHAR_MIN SCHAR_MIN
#endif
#define SHRT_MAX 32767
#define SHRT_MIN (-32768)
#define LONG_MAX 2147483647L
#define LONG_MIN (-2147483648L)
#define USHRT_MAX 65535U
#define ULONG_MAX 4294967295UL
#ifdef __MSHORT__ /* 16 bit ints */
#define INT_MAX SHRT_MAX
#define INT_MIN SHRT_MIN
#define UINT_MAX USHRT_MAX
#else /* 32 bit ints */
#define INT_MAX 2147483647
#define INT_MIN (-2147483648)
#define UINT_MAX 4294967295U
#endif /* __MSHORT__ */
#define MB_LEN_MAX 1 /* max. number of bytes in a multibyte character */
/*
* POSIX-specific stuff; see 1003.1 sect. 2.9
*
* Note that the library is *not* POSIX compliant; hence
* the illegally small values for some constants (e.g. _POSIX_LINK_MAX)
*/
#define _POSIX_ARG_MAX 4096
#define _POSIX_CHILD_MAX 6
#define _POSIX_LINK_MAX 8
#define _POSIX_MAX_CANON 64 /* <- NON-CONFORMING */
#define _POSIX_MAX_INPUT 64 /* <- NON-CONFORMING */
#define _POSIX_NAME_MAX 14
#define _POSIX_NGROUPS_MAX 0
#define _POSIX_OPEN_MAX 16
#define _POSIX_PATH_MAX 128 /* <- NON-CONFORMING */
#define _POSIX_PIPE_BUF 512
#ifndef __STRICT_ANSI__
#define NGROUPS_MAX _POSIX_NGROUPS_MAX
#if 0
/* both of these are actually limited by available memory */
#define ARG_MAX 32767
#define CHILD_MAX 16
#endif
#define OPEN_MAX 20
#ifdef __MINT__
# define LINK_MAX 32767
#else
# define LINK_MAX 1
#endif
#define MAX_CANON _POSIX_MAX_CANON
#define MAX_INPUT _POSIX_MAX_INPUT
#define NAME_MAX 31
/* actually, MiNT file systems _could_ support more */
/* _LIB_NAME_MAX longest name supported in the library
* before you change this, please look at stat.c, symdir.c, dirent.[ch],
* unx2dos.c.
* for the TOS library, this must be atleast 32 to maintain backwards
* compatibility.
*/
#ifndef __MINT__
# define _LIB_NAME_MAX 32 /* CAUTION: dont make this any smaller */
#else
# define _LIB_NAME_MAX NAME_MAX
#endif
#define PATH_MAX _POSIX_PATH_MAX
#define PIPE_BUF _POSIX_PIPE_BUF
#endif /* __STRICT_ANSI__ */
#ifndef _values_h
#define _values_h 1
#define BITSPERBYTE 8
#define BITS(type) (BITSPERBYTE * (int)sizeof(type))
#define CHARBITS BITS(char)
#define SHORTBITS BITS(short)
#define INTBITS BITS(int)
#define LONGBITS BITS(long)
#define PTRBITS BITS(char*)
#define DOUBLEBITS BITS(double)
#define FLOATBITS BITS(float)
#define MINSHORT ((short)(1 << (SHORTBITS - 1)))
#define MININT (1 << (INTBITS - 1))
#define MINLONG (1L << (LONGBITS - 1))
#define MAXSHORT ((short)~MINSHORT)
#define MAXINT (~MININT)
#define MAXLONG (~MINLONG)
#define HIBITS MINSHORT
#define HIBITL MINLONG
#if defined(sun) || defined(hp300) || defined(hpux) || defined(masscomp) || defined(sgi)
#ifdef masscomp
#define MAXDOUBLE \
({ \
double maxdouble_val; \
\
__asm ("fmove%.d #0x7fefffffffffffff,%0" /* Max double */ \
: "=f" (maxdouble_val) \
: /* no inputs */); \
maxdouble_val; \
})
#define MAXFLOAT ((float) 3.40e+38)
#else
#define MAXDOUBLE 1.79769313486231470e+308
#define MAXFLOAT ((float)3.40282346638528860e+38)
#endif
#define MINDOUBLE 4.94065645841246544e-324
#define MINFLOAT ((float)1.40129846432481707e-45)
#define _IEEE 1
#define _DEXPLEN 11
#define _FEXPLEN 8
#define _HIDDENBIT 1
#define DMINEXP (-(DMAXEXP + DSIGNIF - _HIDDENBIT - 3))
#define FMINEXP (-(FMAXEXP + FSIGNIF - _HIDDENBIT - 3))
#define DMAXEXP ((1 << _DEXPLEN - 1) - 1 + _IEEE)
#define FMAXEXP ((1 << _FEXPLEN - 1) - 1 + _IEEE)
#elif defined(sony)
#define MAXDOUBLE 1.79769313486231470e+308
#define MAXFLOAT ((float)3.40282346638528860e+38)
#define MINDOUBLE 2.2250738585072010e-308
#define MINFLOAT ((float)1.17549435e-38)
#define _IEEE 1
#define _DEXPLEN 11
#define _FEXPLEN 8
#define _HIDDENBIT 1
#define DMINEXP (-(DMAXEXP + DSIGNIF - _HIDDENBIT - 3))
#define FMINEXP (-(FMAXEXP + FSIGNIF - _HIDDENBIT - 3))
#define DMAXEXP ((1 << _DEXPLEN - 1) - 1 + _IEEE)
#define FMAXEXP ((1 << _FEXPLEN - 1) - 1 + _IEEE)
#elif defined(sequent)
extern double _maxdouble, _mindouble;
extern float _maxfloat, _minfloat;
#define MAXDOUBLE _maxdouble
#define MAXFLOAT _maxfloat
#define MINDOUBLE _mindouble
#define MINFLOAT _minfloat
#define _IEEE 1
#define _DEXPLEN 11
#define _FEXPLEN 8
#define _HIDDENBIT 1
#define DMINEXP (-(DMAXEXP - 3))
#define FMINEXP (-(FMAXEXP - 3))
#define DMAXEXP ((1 << _DEXPLEN - 1) - 1 + _IEEE)
#define FMAXEXP ((1 << _FEXPLEN - 1) - 1 + _IEEE)
#elif defined(i386)
#define MAXDOUBLE 1.79769313486231570e+308
#define MAXFLOAT ((float)3.40282346638528860e+38)
#define MINDOUBLE 2.22507385850720140e-308
#define MINFLOAT ((float)1.17549435082228750e-38)
#define _IEEE 0
#define _DEXPLEN 11
#define _FEXPLEN 8
#define _HIDDENBIT 1
#define DMINEXP (-DMAXEXP)
#define FMINEXP (-FMAXEXP)
#define DMAXEXP ((1 << _DEXPLEN - 1) - 1 + _IEEE)
#define FMAXEXP ((1 << _FEXPLEN - 1) - 1 + _IEEE)
/* from Andrew Klossner <andrew%frip.wv.tek.com@relay.cs.net> */
#elif defined(m88k)
/* These are "good" guesses ...
I'll figure out the true mins and maxes later, at the time I find
out the mins and maxes that the compiler can tokenize. */
#define MAXDOUBLE 1.79769313486231e+308
#define MAXFLOAT ((float)3.40282346638528e+38)
#define MINDOUBLE 2.22507385850720e-308
#define MINFLOAT ((float)1.17549435082228e-38)
#define _IEEE 1
#define _DEXPLEN 11
#define _FEXPLEN 8
#define _HIDDENBIT 1
#define DMINEXP (1-DMAXEXP)
#define FMINEXP (1-FMAXEXP)
#define DMAXEXP ((1 << _DEXPLEN - 1) - 1 + _IEEE)
#define FMAXEXP ((1 << _FEXPLEN - 1) - 1 + _IEEE)
#elif defined(convex)
#define MAXDOUBLE 8.9884656743115785e+306
#define MAXFLOAT ((float) 1.70141173e+38)
#define MINDOUBLE 5.5626846462680035e-308
#define MINFLOAT ((float) 2.93873588e-39)
#define _IEEE 0
#define _DEXPLEN 11
#define _FEXPLEN 8
#define _HIDDENBIT 1
#define DMINEXP (-DMAXEXP)
#define FMINEXP (-FMAXEXP)
#define DMAXEXP ((1 << _DEXPLEN - 1) - 1 + _IEEE)
#define FMAXEXP ((1 << _FEXPLEN - 1) - 1 + _IEEE)
#elif defined(atarist)
#define MAXDOUBLE 1.7976931348623158e+308
#define MAXFLOAT ((float)3.40282347e+38)
#define MINDOUBLE 2.2250738585072014e-308
#define MINFLOAT ((float)1.17549435e-38)
#define _IEEE 1
#define _DEXPLEN 11
#define _FEXPLEN 8
#define _HIDDENBIT 1
#define DMINEXP (-(DMAXEXP + DSIGNIF - _HIDDENBIT - 3))
#define FMINEXP (-(FMAXEXP + FSIGNIF - _HIDDENBIT - 3))
#define DMAXEXP ((1 << _DEXPLEN - 1) - 1 + _IEEE)
#define FMAXEXP ((1 << _FEXPLEN - 1) - 1 + _IEEE)
// #elif defined(vax)
// use vax versions by default -- they seem to be the most conservative
#else
#define MAXDOUBLE 1.701411834604692293e+38
#define MINDOUBLE (2.938735877055718770e-39)
#define MAXFLOAT 1.7014117331926443e+38
#define MINFLOAT 2.9387358770557188e-39
#define _IEEE 0
#define _DEXPLEN 8
#define _FEXPLEN 8
#define _HIDDENBIT 1
#define DMINEXP (-DMAXEXP)
#define FMINEXP (-FMAXEXP)
#define DMAXEXP ((1 << _DEXPLEN - 1) - 1 + _IEEE)
#define FMAXEXP ((1 << _FEXPLEN - 1) - 1 + _IEEE)
#endif
#define DSIGNIF (DOUBLEBITS - _DEXPLEN + _HIDDENBIT - 1)
#define FSIGNIF (FLOATBITS - _FEXPLEN + _HIDDENBIT - 1)
#define DMAXPOWTWO ((double)(1L << LONGBITS -2)*(1L << DSIGNIF - LONGBITS +1))
#define FMAXPOWTWO ((float)(1L << FSIGNIF - 1))
#endif
#endif /* _LIMITS_H */