diff options
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/alpha/__math.h | 39 | ||||
-rw-r--r-- | sysdeps/generic/socketbits.h | 2 | ||||
-rw-r--r-- | sysdeps/i386/elf/start.S | 2 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/s_fpclassify.c | 2 | ||||
-rw-r--r-- | sysdeps/posix/euidaccess.c | 63 | ||||
-rwxr-xr-x | sysdeps/sparc/configure | 4 | ||||
-rw-r--r-- | sysdeps/sparc/configure.in | 6 | ||||
-rw-r--r-- | sysdeps/stub/euidaccess.c | 31 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/socketbits.h | 2 | ||||
-rw-r--r-- | sysdeps/wordsize-32/inttypes.h | 340 | ||||
-rw-r--r-- | sysdeps/wordsize-64/inttypes.h | 340 |
11 files changed, 762 insertions, 69 deletions
diff --git a/sysdeps/alpha/__math.h b/sysdeps/alpha/__math.h index 50d8ac3b0a..0f76027317 100644 --- a/sysdeps/alpha/__math.h +++ b/sysdeps/alpha/__math.h @@ -1,22 +1,22 @@ /* Inline math functions for Alpha. -Copyright (C) 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. -Contributed by David Mosberger-Tang. + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David Mosberger-Tang. -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ #if defined (__GNUC__) && !defined (__NO_MATH_INLINES) @@ -41,13 +41,4 @@ atan (double __x) return __atan2 (__x, 1.0); } -#ifdef __USE_MISC -extern __inline double -cabs (struct __cabs_complex __z) -{ - extern double __hypot (double, double); - return __hypot(__z.x, __z.y); -} -#endif - #endif diff --git a/sysdeps/generic/socketbits.h b/sysdeps/generic/socketbits.h index db1a0ac7ee..5d85a8e079 100644 --- a/sysdeps/generic/socketbits.h +++ b/sysdeps/generic/socketbits.h @@ -50,6 +50,7 @@ enum __socket_type #define PF_UNSPEC 0 /* Unspecified. */ #define PF_LOCAL 1 /* Local to host (pipes and file-domain). */ #define PF_UNIX PF_LOCAL /* Old BSD name for PF_LOCAL. */ +#define PF_FILE PF_LOCAL /* POSIX name for PF_LOCAL. */ #define PF_INET 2 /* IP protocol family. */ #define PF_IMPLINK 3 /* ARPAnet IMP protocol. */ #define PF_PUP 4 /* PUP protocols. */ @@ -82,6 +83,7 @@ enum __socket_type #define AF_UNSPEC PF_UNSPEC #define AF_LOCAL PF_LOCAL #define AF_UNIX PF_UNIX +#define AF_FILE PF_FILE #define AF_INET PF_INET #define AF_IMPLINK PF_IMPLINK #define AF_PUP PF_PUP diff --git a/sysdeps/i386/elf/start.S b/sysdeps/i386/elf/start.S index 53e324b91b..8b7faaefc4 100644 --- a/sysdeps/i386/elf/start.S +++ b/sysdeps/i386/elf/start.S @@ -73,6 +73,8 @@ nofini: boundary to avoid penalties from misaligned accesses. Thanks to Edward Seidl <seidl@janed.com> for pointing this out. */ andl $0xfffffff8, %esp + pushl %eax /* Push garbage because we allocate + twelve more bytes. */ pushl %eax /* Push third argument: envp. */ pushl %edx /* Push second argument: argv. */ diff --git a/sysdeps/libm-ieee754/s_fpclassify.c b/sysdeps/libm-ieee754/s_fpclassify.c index dd4e742260..72a15369b5 100644 --- a/sysdeps/libm-ieee754/s_fpclassify.c +++ b/sysdeps/libm-ieee754/s_fpclassify.c @@ -29,7 +29,7 @@ __fpclassify (double x) u_int32_t hx, lx; int retval = FP_NORMAL; - GET_WORDS (hx, lx, x); + EXTRACT_WORDS (hx, lx, x); lx |= hx & 0xfffff; hx &= 0x7ff00000; if ((hx | lx) == 0) diff --git a/sysdeps/posix/euidaccess.c b/sysdeps/posix/euidaccess.c index 04648ce08b..ed59582154 100644 --- a/sysdeps/posix/euidaccess.c +++ b/sysdeps/posix/euidaccess.c @@ -1,22 +1,21 @@ -/* euidaccess -- check if effective user id can access file - Copyright (C) 1990, 1991, 1995, 1996 Free Software Foundation, Inc. +/* Check if effective user id can access file + Copyright (C) 1990, 1991, 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. -This file is part of the GNU C Library. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ /* Written by David MacKenzie and Torbjorn Granlund. Adapted for GNU C library by Roland McGrath. */ @@ -95,6 +94,7 @@ extern int errno; #ifdef _LIBC #define group_member __group_member +#define euidaccess __euidaccess #else @@ -104,6 +104,14 @@ static uid_t uid; /* The user's real group id. */ static gid_t gid; +#ifdef HAVE_GETGROUPS +int group_member (); +#else +#define group_member(gid) 0 +#endif + +#endif + /* The user's effective user id. */ static uid_t euid; @@ -113,14 +121,6 @@ static gid_t egid; /* Nonzero if UID, GID, EUID, and EGID have valid values. */ static int have_ids = 0; -#ifdef HAVE_GETGROUPS -int group_member (); -#else -#define group_member(gid) 0 -#endif - -#endif - /* Return 0 if the user has permission of type MODE on file PATH; otherwise, return -1 and set `errno' to EACCESS. @@ -137,9 +137,6 @@ euidaccess (path, mode) int granted; #ifdef _LIBC - uid_t euid; - gid_t egid; - if (! __libc_enable_secure) /* If we are not set-uid or set-gid, access does the same. */ return access (path, mode); @@ -171,8 +168,12 @@ euidaccess (path, mode) #ifdef _LIBC /* Now we need the IDs. */ - euid = geteuid (); - egid = getegid (); + if (have_ids == 0) + { + have_ids = 1; + euid = geteuid (); + egid = getegid (); + } #endif /* The super-user can read and write any file, and execute any file @@ -192,6 +193,10 @@ euidaccess (path, mode) __set_errno (EACCESS); return -1; } +#undef euidaccess +#ifdef weak_alias +weak_alias (__euidaccess, euidaccess) +#endif #ifdef TEST #include <stdio.h> diff --git a/sysdeps/sparc/configure b/sysdeps/sparc/configure new file mode 100755 index 0000000000..56168677a2 --- /dev/null +++ b/sysdeps/sparc/configure @@ -0,0 +1,4 @@ + # Local configure fragment for sysdeps/sparc. + +# The assembler on SPARC needs the -fPIC flag even when it's assembler code. +ASFLAGS_SO = -fPIC diff --git a/sysdeps/sparc/configure.in b/sysdeps/sparc/configure.in new file mode 100644 index 0000000000..3e2b2f04f9 --- /dev/null +++ b/sysdeps/sparc/configure.in @@ -0,0 +1,6 @@ +sinclude(./aclocal.m4)dnl Autoconf lossage +GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. +# Local configure fragment for sysdeps/sparc. + +# The assembler on SPARC needs the -fPIC flag even when it's assembler code. +ASFLAGS_SO = -fPIC diff --git a/sysdeps/stub/euidaccess.c b/sysdeps/stub/euidaccess.c index 79296a77f4..f11c74b8f7 100644 --- a/sysdeps/stub/euidaccess.c +++ b/sysdeps/stub/euidaccess.c @@ -1,28 +1,28 @@ /* Test for access to FILE using effective UID and GID. Stub version. -Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. + Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ #include <errno.h> #include <stddef.h> #include <unistd.h> int -euidaccess (file, type) +__euidaccess (file, type) const char *file; int type; { @@ -35,4 +35,5 @@ euidaccess (file, type) __set_errno (ENOSYS); return -1; } +weak_alias (__euidaccess, euidaccess) stub_warning (euidaccess) diff --git a/sysdeps/unix/sysv/linux/socketbits.h b/sysdeps/unix/sysv/linux/socketbits.h index 915e0f001e..38a8fb74d1 100644 --- a/sysdeps/unix/sysv/linux/socketbits.h +++ b/sysdeps/unix/sysv/linux/socketbits.h @@ -55,6 +55,7 @@ enum __socket_type #define PF_UNSPEC 0 /* Unspecified. */ #define PF_LOCAL 1 /* Local to host (pipes and file-domain). */ #define PF_UNIX PF_LOCAL /* Old BSD name for PF_LOCAL. */ +#define PF_FILE PF_LOCAL /* POSIX name for PF_LOCAL. */ #define PF_INET 2 /* IP protocol family. */ #define PF_AX25 3 /* Amateur Radio AX.25. */ #define PF_IPX 4 /* Novell Internet Protocol. */ @@ -70,6 +71,7 @@ enum __socket_type #define AF_UNSPEC PF_UNSPEC #define AF_LOCAL PF_LOCAL #define AF_UNIX PF_UNIX +#define AF_FILE PF_FILE #define AF_INET PF_INET #define AF_AX25 PF_AX25 #define AF_IPX PF_IPX diff --git a/sysdeps/wordsize-32/inttypes.h b/sysdeps/wordsize-32/inttypes.h new file mode 100644 index 0000000000..f9735a1309 --- /dev/null +++ b/sysdeps/wordsize-32/inttypes.h @@ -0,0 +1,340 @@ +/* Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* + * ISO C 9X: 7.4 Integral types <inttypes.h> + */ + +#ifndef _INTTYPES_H +#define _INTTYPES_H 1 + +/* Exact integral types. */ + +/* Signed. */ +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; +typedef long long int int64_t; + +/* Unsigned. */ +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; +typedef unsigned int uint32_t; +typedef unsigned long long int uint64_t; + + +/* Largest integral types. */ +typedef long long int intmax_t; +typedef unsigned long long int uintmax_t; + + +/* Types for `void *' pointers. */ +typedef int intptr_t; +typedef unsigned int uintptr_t; + + +/* Efficient types. */ +typedef int intfast_t; +typedef unsigned int uintfast_t; + + +/* Small types. */ + +/* Signed. */ +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; +typedef long long int int_least64_t; + +/* Unsigned. */ +typedef unsigned char int_least8_t; +typedef unsigned short int int_least16_t; +typedef unsigned int int_least32_t; +typedef unsigned long long int int_least64_t; + + +/* Fast types. */ + +/* Signed. */ +typedef signed char int_fast8_t; +typedef int int_fast16_t; +typedef int int_fast32_t; +typedef long long int int_fast64_t; + +/* Unsigned. */ +typedef unsigned char int_fast8_t; +typedef unsigned int int_fast16_t; +typedef unsigned int int_fast32_t; +typedef unsigned long long int int_fast64_t; + + +/* Limits of integral types. */ + +/* Minimum of signed integral types. */ +#define INT8_MIN (-128) +#define INT16_MIN (-32767-1) +#define INT32_MIN (-2147483647-1) +#define INT64_MIN (-9223372036854775807LL-1) +/* Maximum of signed integral types. */ +#define INT8_MAX (127) +#define INT16_MAX (32767) +#define INT32_MAX (2147483647) +#define INT64_MAX (9223372036854775807LL) + +/* Maximum of unsigned integral types. */ +#define UINT8_MAX (255U) +#define UINT16_MAX (65535U) +#define UINT32_MAX (4294967295U) +#define UINT64_MAX (18446744073709551615uLL) + + +/* Minimum of signed integral types having a minimum size. */ +#define INT_LEAST8_MIN (-128) +#define INT_LEAST16_MIN (-32767-1) +#define INT_LEAST32_MIN (-2147483647-1) +#define INT_LEAST64_MIN (-9223372036854775807LL-1) +/* Maximum of signed integral types having a minimum size. */ +#define INT_LEAST8_MAX (127) +#define INT_LEAST16_MAX (32767) +#define INT_LEAST32_MAX (2147483647) +#define INT_LEAST64_MAX (9223372036854775807LL) + +/* Maximum of unsigned integral types having a minimum size. */ +#define UINT_LEAST8_MAX (255U) +#define UINT_LEAST16_MAX (65535U) +#define UINT_LEAST32_MAX (4294967295U) +#define UINT_LEAST64_MAX (18446744073709551615uLL) + + +/* Minimum of fast signed integral types having a minimum size. */ +#define INT_LEAST8_MIN (-128) +#define INT_LEAST16_MIN (-2147483647-1) +#define INT_LEAST32_MIN (-2147483647-1) +#define INT_LEAST64_MIN (-9223372036854775807LL-1) +/* Maximum of fast signed integral types having a minimum size. */ +#define INT_LEAST8_MAX (127) +#define INT_LEAST16_MAX (2147483647) +#define INT_LEAST32_MAX (2147483647) +#define INT_LEAST64_MAX (9223372036854775807LL) + +/* Maximum of fast unsigned integral types having a minimum size. */ +#define UINT_LEAST8_MAX (255U) +#define UINT_LEAST16_MAX (4294967295U) +#define UINT_LEAST32_MAX (4294967295U) +#define UINT_LEAST64_MAX (18446744073709551615uLL) + + +/* Minimum for most efficient signed integral types. */ +#define INTFAST_MIN (-128) +/* Maximum for most efficient signed integral types. */ +#define INTFAST_MAX (127) + +/* Maximum for most efficient unsigned integral types. */ +#define UINTFAST_MAX (255) + + +/* Minimum for largest signed integral type. */ +#define INTMAX_MIN (-9223372036854775807LL-1) +/* Maximum for largest signed integral type. */ +#define INTMAX_MAX (9223372036854775807LL) + +/* Maximum for largest unsigned integral type. */ +#define UINTMAX_MAX (18446744073709551615uLL) + + +/* Values to test for integral types holding `void *' pointer. */ +#define INTPTR_MAX (2147483647) +#define UINTPTR_MAX (4294967295U) + + +/* Macros for creating constants. */ +#define __CONCAT__(A, B) A ## B + +/* Signed. */ +#define INT8_C(c) ((int8_t) c) +#define INT16_C(c) ((int16_t) c) +#define INT32_C(c) ((int32_t) c) +#define INT64_C(c) ((int64_t) __CONCAT__ (c,ll)) + +/* Unsigned. */ +#define UINT8_C(c) ((uint8_t) __CONCAT__ (c,u)) +#define UINT16_C(c) ((uint16_t) __CONCAT__ (c,u)) +#define UINT32_C(c) ((uint32_t) __CONCAT__ (c,u)) +#define UINT64_C(c) ((uint64_t) __CONCAT__ (c,ull)) + +/* Maximal type. */ +#define INTMAX_C(c) ((intmax_t) __CONCAT__ (c,ll)) +#define UINTMAX_C(c) ((uintmax_t) __CONCAT__ (c,ull)) + + +/* Macros for printing format specifiers. */ + +/* Decimal notation. */ +#define PRId8 "d" +#define PRId16 "d" +#define PRId32 "d" +#define PRId64 "lld" + +#define PRIdLEAST8 "d" +#define PRIdLEAST16 "d" +#define PRIdLEAST32 "d" +#define PRIdLEAST64 "lld" + +#define PRIdFAST8 "d" +#define PRIdFAST16 "d" +#define PRIdFAST32 "d" +#define PRIdFAST64 "lld" + + +#define PRIi8 "i" +#define PRIi16 "i" +#define PRIi32 "i" +#define PRIi64 "lli" + +#define PRIiLEAST8 "i" +#define PRIiLEAST16 "i" +#define PRIiLEAST32 "i" +#define PRIiLEAST64 "lli" + +#define PRIiFAST8 "i" +#define PRIiFAST16 "i" +#define PRIiFAST32 "i" +#define PRIiFAST64 "lli" + +/* Octal notation. */ +#define PRIo8 "o" +#define PRIo16 "o" +#define PRIo32 "o" +#define PRIo64 "llo" + +#define PRIoLEAST8 "o" +#define PRIoLEAST16 "o" +#define PRIoLEAST32 "o" +#define PRIoLEAST64 "llo" + +#define PRIoFAST8 "o" +#define PRIoFAST16 "o" +#define PRIoFAST32 "o" +#define PRIoFAST64 "llo" + +/* lowercase hexadecimal notation. */ +#define PRIx8 "x" +#define PRIx16 "x" +#define PRIx32 "x" +#define PRIx64 "llx" + +#define PRIxLEAST8 "x" +#define PRIxLEAST16 "x" +#define PRIxLEAST32 "x" +#define PRIxLEAST64 "llx" + +#define PRIxFAST8 "x" +#define PRIxFAST16 "x" +#define PRIxFAST32 "x" +#define PRIxFAST64 "llx" + +/* UPPERCASE hexadecimal notation. */ +#define PRIX8 "X" +#define PRIX16 "X" +#define PRIX32 "X" +#define PRIX64 "llX" + +#define PRIXLEAST8 "X" +#define PRIXLEAST16 "X" +#define PRIXLEAST32 "X" +#define PRIXLEAST64 "llX" + +#define PRIXFAST8 "X" +#define PRIXFAST16 "X" +#define PRIXFAST32 "X" +#define PRIXFAST64 "llX" + + +/* Unsigned integers. */ +#define PRIu8 "u" +#define PRIu16 "u" +#define PRIu32 "u" +#define PRIu64 "llu" + +#define PRIuLEAST8 "u" +#define PRIuLEAST16 "u" +#define PRIuLEAST32 "u" +#define PRIuLEAST64 "llu" + +#define PRIuFAST8 "u" +#define PRIuFAST16 "u" +#define PRIuFAST32 "u" +#define PRIuFAST64 "llu" + + +/* Macros for printing `intmax_t' and `uintmax_t'. */ +#define PRIdMAX "lld" +#define PRIoMAX "llo" +#define PRIxMAX "llx" +#define PRIuMAX "llu" + + +/* Macros for printing `intfast_t' and `uintfast_t'. */ +#define PRIdFAST "d" +#define PRIoFAST "o" +#define PRIxFAST "x" +#define PRIuFAST "u" + + +/* Macros for printing `intptr_t' and `uintptr_t'. */ +#define PRIdPTR "d" +#define PRIoPTR "o" +#define PRIxPTR "x" +#define PRIuPTR "u" + + +/* Macros for printing format specifiers. */ + +/* Decimal notation. */ +#define SCNd16 "hd" +#define SCNd32 "d" +#define SCNd64 "lld" + +#define SCNi16 "hi" +#define SCNi32 "i" +#define SCNi64 "lli" + +/* Octal notation. */ +#define SCNo16 "ho" +#define SCNo32 "o" +#define SCNo64 "llo" + +/* Hexadecimal notation. */ +#define SCNx16 "hx" +#define SCNx32 "x" +#define SCNx64 "llx" + + +/* Macros for scaning `intfast_t' and `uintfast_t'. */ +#define SCNdFAST "d" +#define SCNiFAST "i" +#define SCNoFAST "o" +#define SCNxFAST "x" + +/* Macros for scaning `intptr_t' and `uintptr_t'. */ +#define SCNdPTR "d" +#define SCNiPTR "i" +#define SCNoPTR "o" +#define SCNxPTR "x" + +#endif /* inttypes.h */ diff --git a/sysdeps/wordsize-64/inttypes.h b/sysdeps/wordsize-64/inttypes.h new file mode 100644 index 0000000000..a86e49c24f --- /dev/null +++ b/sysdeps/wordsize-64/inttypes.h @@ -0,0 +1,340 @@ +/* Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* + * ISO C 9X: 7.4 Integral types <inttypes.h> + */ + +#ifndef _INTTYPES_H +#define _INTTYPES_H 1 + +/* Exact integral types. */ + +/* Signed. */ +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; +typedef long int int64_t; + +/* Unsigned. */ +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; +typedef unsigned int uint32_t; +typedef unsigned long int uint64_t; + + +/* Largest integral types. */ +typedef long long int intmax_t; +typedef unsigned long int uintmax_t; + + +/* Types for `void *' pointers. */ +typedef long int intptr_t; +typedef unsigned long int uintptr_t; + + +/* Efficient types. */ +typedef long int intfast_t; +typedef unsigned long int uintfast_t; + + +/* Small types. */ + +/* Signed. */ +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; +typedef long int int_least64_t; + +/* Unsigned. */ +typedef unsigned char int_least8_t; +typedef unsigned short int int_least16_t; +typedef unsigned int int_least32_t; +typedef unsigned long int int_least64_t; + + +/* Fast types. */ + +/* Signed. */ +typedef signed char int_fast8_t; +typedef int int_fast16_t; +typedef int int_fast32_t; +typedef long int int_fast64_t; + +/* Unsigned. */ +typedef unsigned char int_fast8_t; +typedef unsigned int int_fast16_t; +typedef unsigned int int_fast32_t; +typedef unsigned long int int_fast64_t; + + +/* Limits of integral types. */ + +/* Minimum of signed integral types. */ +#define INT8_MIN (-128) +#define INT16_MIN (-32767-1) +#define INT32_MIN (-2147483647-1) +#define INT64_MIN (-9223372036854775807L-1) +/* Maximum of signed integral types. */ +#define INT8_MAX (127) +#define INT16_MAX (32767) +#define INT32_MAX (2147483647) +#define INT64_MAX (9223372036854775807L) + +/* Maximum of unsigned integral types. */ +#define UINT8_MAX (255U) +#define UINT16_MAX (65535U) +#define UINT32_MAX (4294967295U) +#define UINT64_MAX (18446744073709551615uL) + + +/* Minimum of signed integral types having a minimum size. */ +#define INT_LEAST8_MIN (-128) +#define INT_LEAST16_MIN (-32767-1) +#define INT_LEAST32_MIN (-2147483647-1) +#define INT_LEAST64_MIN (-9223372036854775807L-1) +/* Maximum of signed integral types having a minimum size. */ +#define INT_LEAST8_MAX (127) +#define INT_LEAST16_MAX (32767) +#define INT_LEAST32_MAX (2147483647) +#define INT_LEAST64_MAX (9223372036854775807L) + +/* Maximum of unsigned integral types having a minimum size. */ +#define UINT_LEAST8_MAX (255U) +#define UINT_LEAST16_MAX (65535U) +#define UINT_LEAST32_MAX (4294967295U) +#define UINT_LEAST64_MAX (18446744073709551615uL) + + +/* Minimum of fast signed integral types having a minimum size. */ +#define INT_LEAST8_MIN (-128) +#define INT_LEAST16_MIN (-2147483647-1) +#define INT_LEAST32_MIN (-2147483647-1) +#define INT_LEAST64_MIN (-9223372036854775807L-1) +/* Maximum of fast signed integral types having a minimum size. */ +#define INT_LEAST8_MAX (127) +#define INT_LEAST16_MAX (2147483647) +#define INT_LEAST32_MAX (2147483647) +#define INT_LEAST64_MAX (9223372036854775807L) + +/* Maximum of fast unsigned integral types having a minimum size. */ +#define UINT_LEAST8_MAX (255U) +#define UINT_LEAST16_MAX (4294967295U) +#define UINT_LEAST32_MAX (4294967295U) +#define UINT_LEAST64_MAX (18446744073709551615uL) + + +/* Minimum for most efficient signed integral types. */ +#define INTFAST_MIN (-128) +/* Maximum for most efficient signed integral types. */ +#define INTFAST_MAX (127) + +/* Maximum for most efficient unsigned integral types. */ +#define UINTFAST_MAX (255) + + +/* Minimum for largest signed integral type. */ +#define INTMAX_MIN (-9223372036854775807L-1) +/* Maximum for largest signed integral type. */ +#define INTMAX_MAX (9223372036854775807L) + +/* Maximum for largest unsigned integral type. */ +#define UINTMAX_MAX (18446744073709551615uL) + + +/* Values to test for integral types holding `void *' pointer. */ +#define INTPTR_MAX (9223372036854775807L) +#define UINTPTR_MAX (18446744073709551615uL) + + +/* Macros for creating constants. */ +#define __CONCAT__(A, B) A ## B + +/* Signed. */ +#define INT8_C(c) ((int8_t) c) +#define INT16_C(c) ((int16_t) c) +#define INT32_C(c) ((int32_t) c) +#define INT64_C(c) ((int64_t) __CONCAT__ (c,l)) + +/* Unsigned. */ +#define UINT8_C(c) ((uint8_t) __CONCAT__ (c,u)) +#define UINT16_C(c) ((uint16_t) __CONCAT__ (c,u)) +#define UINT32_C(c) ((uint32_t) __CONCAT__ (c,u)) +#define UINT64_C(c) ((uint64_t) __CONCAT__ (c,ul)) + +/* Maximal type. */ +#define INTMAX_C(c) ((intmax_t) __CONCAT__ (c,ll)) +#define UINTMAX_C(c) ((uintmax_t) __CONCAT__ (c,ul)) + + +/* Macros for printing format specifiers. */ + +/* Decimal notation. */ +#define PRId8 "d" +#define PRId16 "d" +#define PRId32 "d" +#define PRId64 "ld" + +#define PRIdLEAST8 "d" +#define PRIdLEAST16 "d" +#define PRIdLEAST32 "d" +#define PRIdLEAST64 "ld" + +#define PRIdFAST8 "d" +#define PRIdFAST16 "d" +#define PRIdFAST32 "d" +#define PRIdFAST64 "ld" + + +#define PRIi8 "i" +#define PRIi16 "i" +#define PRIi32 "i" +#define PRIi64 "li" + +#define PRIiLEAST8 "i" +#define PRIiLEAST16 "i" +#define PRIiLEAST32 "i" +#define PRIiLEAST64 "li" + +#define PRIiFAST8 "i" +#define PRIiFAST16 "i" +#define PRIiFAST32 "i" +#define PRIiFAST64 "li" + +/* Octal notation. */ +#define PRIo8 "o" +#define PRIo16 "o" +#define PRIo32 "o" +#define PRIo64 "lo" + +#define PRIoLEAST8 "o" +#define PRIoLEAST16 "o" +#define PRIoLEAST32 "o" +#define PRIoLEAST64 "lo" + +#define PRIoFAST8 "o" +#define PRIoFAST16 "o" +#define PRIoFAST32 "o" +#define PRIoFAST64 "lo" + +/* lowercase hexadecimal notation. */ +#define PRIx8 "x" +#define PRIx16 "x" +#define PRIx32 "x" +#define PRIx64 "lx" + +#define PRIxLEAST8 "x" +#define PRIxLEAST16 "x" +#define PRIxLEAST32 "x" +#define PRIxLEAST64 "lx" + +#define PRIxFAST8 "x" +#define PRIxFAST16 "x" +#define PRIxFAST32 "x" +#define PRIxFAST64 "lx" + +/* UPPERCASE hexadecimal notation. */ +#define PRIX8 "X" +#define PRIX16 "X" +#define PRIX32 "X" +#define PRIX64 "lX" + +#define PRIXLEAST8 "X" +#define PRIXLEAST16 "X" +#define PRIXLEAST32 "X" +#define PRIXLEAST64 "lX" + +#define PRIXFAST8 "X" +#define PRIXFAST16 "X" +#define PRIXFAST32 "X" +#define PRIXFAST64 "lX" + + +/* Unsigned integers. */ +#define PRIu8 "u" +#define PRIu16 "u" +#define PRIu32 "u" +#define PRIu64 "lu" + +#define PRIuLEAST8 "u" +#define PRIuLEAST16 "u" +#define PRIuLEAST32 "u" +#define PRIuLEAST64 "lu" + +#define PRIuFAST8 "u" +#define PRIuFAST16 "u" +#define PRIuFAST32 "u" +#define PRIuFAST64 "lu" + + +/* Macros for printing `intmax_t' and `uintmax_t'. */ +#define PRIdMAX "ld" +#define PRIoMAX "lo" +#define PRIxMAX "lx" +#define PRIuMAX "lu" + + +/* Macros for printing `intfast_t' and `uintfast_t'. */ +#define PRIdFAST "d" +#define PRIoFAST "o" +#define PRIxFAST "x" +#define PRIuFAST "u" + + +/* Macros for printing `intptr_t' and `uintptr_t'. */ +#define PRIdPTR "ld" +#define PRIoPTR "lo" +#define PRIxPTR "lx" +#define PRIuPTR "lu" + + +/* Macros for printing format specifiers. */ + +/* Decimal notation. */ +#define SCNd16 "hd" +#define SCNd32 "d" +#define SCNd64 "ld" + +#define SCNi16 "hi" +#define SCNi32 "i" +#define SCNi64 "li" + +/* Octal notation. */ +#define SCNo16 "ho" +#define SCNo32 "o" +#define SCNo64 "lo" + +/* Hexadecimal notation. */ +#define SCNx16 "hx" +#define SCNx32 "x" +#define SCNx64 "lx" + + +/* Macros for scaning `intfast_t' and `uintfast_t'. */ +#define SCNdFAST "d" +#define SCNiFAST "i" +#define SCNoFAST "o" +#define SCNxFAST "x" + +/* Macros for scaning `intptr_t' and `uintptr_t'. */ +#define SCNdPTR "ld" +#define SCNiPTR "li" +#define SCNoPTR "lo" +#define SCNxPTR "lx" + +#endif /* inttypes.h */ |