OSDN Git Service

mkostemp: fix implementation
[uclinux-h8/uClibc.git] / include / inttypes.h
index 6e02100..fa63398 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2001, 2004, 2007 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
@@ -12,9 +12,8 @@
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 /*
  *     ISO C99: 7.8 Format conversion of integer types <inttypes.h>
@@ -27,7 +26,7 @@
 /* Get the type definitions.  */
 #include <stdint.h>
 
-#if __UCLIBC_HAS_WCHAR__
+#ifdef __UCLIBC_HAS_WCHAR__
 /* Get a definition for wchar_t.  But we must not define wchar_t itself.  */
 #ifndef ____gwchar_t_defined
 # ifdef __cplusplus
@@ -70,8 +69,8 @@ typedef wchar_t __gwchar_t;
 # define PRIdLEAST64   __PRI64_PREFIX "d"
 
 # define PRIdFAST8     "d"
-# define PRIdFAST16    "d"
-# define PRIdFAST32    "d"
+# define PRIdFAST16    __PRIPTR_PREFIX "d"
+# define PRIdFAST32    __PRIPTR_PREFIX "d"
 # define PRIdFAST64    __PRI64_PREFIX "d"
 
 
@@ -86,8 +85,8 @@ typedef wchar_t __gwchar_t;
 # define PRIiLEAST64   __PRI64_PREFIX "i"
 
 # define PRIiFAST8     "i"
-# define PRIiFAST16    "i"
-# define PRIiFAST32    "i"
+# define PRIiFAST16    __PRIPTR_PREFIX "i"
+# define PRIiFAST32    __PRIPTR_PREFIX "i"
 # define PRIiFAST64    __PRI64_PREFIX "i"
 
 /* Octal notation.  */
@@ -102,8 +101,8 @@ typedef wchar_t __gwchar_t;
 # define PRIoLEAST64   __PRI64_PREFIX "o"
 
 # define PRIoFAST8     "o"
-# define PRIoFAST16    "o"
-# define PRIoFAST32    "o"
+# define PRIoFAST16    __PRIPTR_PREFIX "o"
+# define PRIoFAST32    __PRIPTR_PREFIX "o"
 # define PRIoFAST64    __PRI64_PREFIX "o"
 
 /* Unsigned integers.  */
@@ -118,8 +117,8 @@ typedef wchar_t __gwchar_t;
 # define PRIuLEAST64   __PRI64_PREFIX "u"
 
 # define PRIuFAST8     "u"
-# define PRIuFAST16    "u"
-# define PRIuFAST32    "u"
+# define PRIuFAST16    __PRIPTR_PREFIX "u"
+# define PRIuFAST32    __PRIPTR_PREFIX "u"
 # define PRIuFAST64    __PRI64_PREFIX "u"
 
 /* lowercase hexadecimal notation.  */
@@ -134,8 +133,8 @@ typedef wchar_t __gwchar_t;
 # define PRIxLEAST64   __PRI64_PREFIX "x"
 
 # define PRIxFAST8     "x"
-# define PRIxFAST16    "x"
-# define PRIxFAST32    "x"
+# define PRIxFAST16    __PRIPTR_PREFIX "x"
+# define PRIxFAST32    __PRIPTR_PREFIX "x"
 # define PRIxFAST64    __PRI64_PREFIX "x"
 
 /* UPPERCASE hexadecimal notation.  */
@@ -150,8 +149,8 @@ typedef wchar_t __gwchar_t;
 # define PRIXLEAST64   __PRI64_PREFIX "X"
 
 # define PRIXFAST8     "X"
-# define PRIXFAST16    "X"
-# define PRIXFAST32    "X"
+# define PRIXFAST16    __PRIPTR_PREFIX "X"
+# define PRIXFAST32    __PRIPTR_PREFIX "X"
 # define PRIXFAST64    __PRI64_PREFIX "X"
 
 
@@ -304,25 +303,145 @@ extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom)
       __THROW __attribute__ ((__const__));
 
 /* Like `strtol' but convert to `intmax_t'.  */
-extern intmax_t strtoimax (__const char *__restrict __nptr,
+extern intmax_t strtoimax (const char *__restrict __nptr,
                           char **__restrict __endptr, int __base) __THROW;
 
 /* Like `strtoul' but convert to `uintmax_t'.  */
-extern uintmax_t strtoumax (__const char *__restrict __nptr,
+extern uintmax_t strtoumax (const char *__restrict __nptr,
                            char ** __restrict __endptr, int __base) __THROW;
 
-#if __UCLIBC_HAS_WCHAR__
+#ifdef __UCLIBC_HAS_WCHAR__
 /* Like `wcstol' but convert to `intmax_t'.  */
-extern intmax_t wcstoimax (__const __gwchar_t *__restrict __nptr,
+extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr,
                           __gwchar_t **__restrict __endptr, int __base)
      __THROW;
 
 /* Like `wcstoul' but convert to `uintmax_t'.  */
-extern uintmax_t wcstoumax (__const __gwchar_t *__restrict __nptr,
+extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr,
                            __gwchar_t ** __restrict __endptr, int __base)
      __THROW;
 #endif
 
+#if 0 /*def __USE_EXTERN_INLINES*/
+
+# if __WORDSIZE == 64
+
+extern long int __strtol_internal (const char *__restrict __nptr,
+                                  char **__restrict __endptr,
+                                  int __base, int __group)
+  __THROW __nonnull ((1)) __wur;
+/* Like `strtol' but convert to `intmax_t'.  */
+__extern_inline intmax_t
+__NTH (strtoimax (const char *__restrict nptr, char **__restrict endptr,
+                 int base))
+{
+  return __strtol_internal (nptr, endptr, base, 0);
+}
+
+extern unsigned long int __strtoul_internal (const char *
+                                            __restrict __nptr,
+                                            char ** __restrict __endptr,
+                                            int __base, int __group)
+  __THROW __nonnull ((1)) __wur;
+/* Like `strtoul' but convert to `uintmax_t'.  */
+__extern_inline uintmax_t
+__NTH (strtoumax (const char *__restrict nptr, char **__restrict endptr,
+                 int base))
+{
+  return __strtoul_internal (nptr, endptr, base, 0);
+}
+
+extern long int __wcstol_internal (const __gwchar_t * __restrict __nptr,
+                                  __gwchar_t **__restrict __endptr,
+                                  int __base, int __group)
+  __THROW __nonnull ((1)) __wur;
+/* Like `wcstol' but convert to `intmax_t'.  */
+__extern_inline intmax_t
+__NTH (wcstoimax (const __gwchar_t *__restrict nptr,
+                 __gwchar_t **__restrict endptr, int base))
+{
+  return __wcstol_internal (nptr, endptr, base, 0);
+}
+
+extern unsigned long int __wcstoul_internal (const __gwchar_t *
+                                            __restrict __nptr,
+                                            __gwchar_t **
+                                            __restrict __endptr,
+                                            int __base, int __group)
+  __THROW __nonnull ((1)) __wur;
+/* Like `wcstoul' but convert to `uintmax_t'.  */
+__extern_inline uintmax_t
+__NTH (wcstoumax (const __gwchar_t *__restrict nptr,
+                 __gwchar_t **__restrict endptr, int base))
+{
+  return __wcstoul_internal (nptr, endptr, base, 0);
+}
+
+# else /* __WORDSIZE == 32 */
+
+__extension__
+extern long long int __strtoll_internal (const char *__restrict __nptr,
+                                        char **__restrict __endptr,
+                                        int __base, int __group)
+  __THROW __nonnull ((1)) __wur;
+/* Like `strtol' but convert to `intmax_t'.  */
+__extern_inline intmax_t
+__NTH (strtoimax (const char *__restrict nptr, char **__restrict endptr,
+                 int base))
+{
+  return __strtoll_internal (nptr, endptr, base, 0);
+}
+
+__extension__
+extern unsigned long long int __strtoull_internal (const char *
+                                                  __restrict __nptr,
+                                                  char **
+                                                  __restrict __endptr,
+                                                  int __base,
+                                                  int __group)
+  __THROW __nonnull ((1)) __wur;
+/* Like `strtoul' but convert to `uintmax_t'.  */
+__extern_inline uintmax_t
+__NTH (strtoumax (const char *__restrict nptr, char **__restrict endptr,
+                 int base))
+{
+  return __strtoull_internal (nptr, endptr, base, 0);
+}
+
+__extension__
+extern long long int __wcstoll_internal (const __gwchar_t *
+                                        __restrict __nptr,
+                                        __gwchar_t **__restrict __endptr,
+                                        int __base, int __group)
+  __THROW __nonnull ((1)) __wur;
+/* Like `wcstol' but convert to `intmax_t'.  */
+__extern_inline intmax_t
+__NTH (wcstoimax (const __gwchar_t *__restrict nptr,
+                 __gwchar_t **__restrict endptr, int base))
+{
+  return __wcstoll_internal (nptr, endptr, base, 0);
+}
+
+
+__extension__
+extern unsigned long long int __wcstoull_internal (const __gwchar_t *
+                                                  __restrict __nptr,
+                                                  __gwchar_t **
+                                                  __restrict __endptr,
+                                                  int __base,
+                                                  int __group)
+  __THROW __nonnull ((1)) __wur;
+/* Like `wcstoul' but convert to `uintmax_t'.  */
+__extern_inline uintmax_t
+__NTH (wcstoumax (const __gwchar_t *__restrict nptr,
+                 __gwchar_t **__restrict endptr, int base))
+{
+  return __wcstoull_internal (nptr, endptr, base, 0);
+}
+
+# endif        /* __WORDSIZE == 32     */
+#endif /* Use extern inlines.  */
+
 __END_DECLS
 
 #endif /* inttypes.h */