aboutsummaryrefslogtreecommitdiff
path: root/stdlib/stdlib.h
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/stdlib.h')
-rw-r--r--stdlib/stdlib.h56
1 files changed, 53 insertions, 3 deletions
diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h
index 232b381..6ab675f 100644
--- a/stdlib/stdlib.h
+++ b/stdlib/stdlib.h
@@ -90,6 +90,7 @@ typedef union
# define WIFSTOPPED(status) __WIFSTOPPED(__WAIT_INT(status))
#endif /* X/Open and <sys/wait.h> not included. */
+__BEGIN_NAMESPACE_STD
/* Returned by `div'. */
typedef struct
{
@@ -106,8 +107,10 @@ typedef struct
} ldiv_t;
# define __ldiv_t_defined 1
#endif
+__END_NAMESPACE_STD
#if defined __USE_ISOC99 && !defined __lldiv_t_defined
+__BEGIN_NAMESPACE_C99
/* Returned by `lldiv'. */
__extension__ typedef struct
{
@@ -115,6 +118,7 @@ __extension__ typedef struct
long long int rem; /* Remainder. */
} lldiv_t;
# define __lldiv_t_defined 1
+__END_NAMESPACE_C99
#endif
@@ -133,32 +137,41 @@ __extension__ typedef struct
extern size_t __ctype_get_mb_cur_max (void) __THROW;
+__BEGIN_NAMESPACE_STD
/* Convert a string to a floating-point number. */
extern double atof (__const char *__nptr) __THROW __attribute_pure__;
/* Convert a string to an integer. */
extern int atoi (__const char *__nptr) __THROW __attribute_pure__;
/* Convert a string to a long integer. */
extern long int atol (__const char *__nptr) __THROW __attribute_pure__;
+__END_NAMESPACE_STD
#if defined __USE_ISOC99 || (defined __GLIBC_HAVE_LONG_LONG && defined __USE_MISC)
+__BEGIN_NAMESPACE_C99
/* Convert a string to a long long integer. */
__extension__ extern long long int atoll (__const char *__nptr)
__THROW __attribute_pure__;
+__END_NAMESPACE_C99
#endif
+__BEGIN_NAMESPACE_STD
/* Convert a string to a floating-point number. */
extern double strtod (__const char *__restrict __nptr,
char **__restrict __endptr) __THROW;
+__END_NAMESPACE_STD
#ifdef __USE_ISOC99
+__BEGIN_NAMESPACE_C99
/* Likewise for `float' and `long double' sizes of floating-point numbers. */
extern float strtof (__const char *__restrict __nptr,
char **__restrict __endptr) __THROW;
extern long double strtold (__const char *__restrict __nptr,
char **__restrict __endptr) __THROW;
+__END_NAMESPACE_C99
#endif
+__BEGIN_NAMESPACE_STD
/* Convert a string to a long integer. */
extern long int strtol (__const char *__restrict __nptr,
char **__restrict __endptr, int __base) __THROW;
@@ -166,6 +179,7 @@ extern long int strtol (__const char *__restrict __nptr,
extern unsigned long int strtoul (__const char *__restrict __nptr,
char **__restrict __endptr, int __base)
__THROW;
+__END_NAMESPACE_C99
#if defined __GLIBC_HAVE_LONG_LONG && defined __USE_BSD
/* Convert a string to a quadword integer. */
@@ -180,8 +194,7 @@ extern unsigned long long int strtouq (__const char *__restrict __nptr,
#endif /* GCC and use BSD. */
#if defined __USE_ISOC99 || (defined __GLIBC_HAVE_LONG_LONG && defined __USE_MISC)
-/* These functions will part of the standard C library in ISO C99. */
-
+__BEGIN_NAMESPACE_C99
/* Convert a string to a quadword integer. */
__extension__
extern long long int strtoll (__const char *__restrict __nptr,
@@ -191,6 +204,7 @@ __extension__
extern unsigned long long int strtoull (__const char *__restrict __nptr,
char **__restrict __endptr, int __base)
__THROW;
+__END_NAMESPACE_C99
#endif /* ISO C99 or GCC and use MISC. */
@@ -290,6 +304,7 @@ extern unsigned long long int __strtoull_internal (__const char *
#ifdef __USE_EXTERN_INLINES
/* Define inline functions which call the internal entry points. */
+__BEGIN_NAMESPACE_STD
extern __inline double
strtod (__const char *__restrict __nptr, char **__restrict __endptr) __THROW
{
@@ -307,8 +322,10 @@ strtoul (__const char *__restrict __nptr, char **__restrict __endptr,
{
return __strtoul_internal (__nptr, __endptr, __base, 0);
}
+__END_NAMESPACE_STD
# ifdef __USE_ISOC99
+__BEGIN_NAMESPACE_C99
extern __inline float
strtof (__const char *__restrict __nptr, char **__restrict __endptr) __THROW
{
@@ -319,6 +336,7 @@ strtold (__const char *__restrict __nptr, char **__restrict __endptr) __THROW
{
return __strtold_internal (__nptr, __endptr, 0);
}
+__END_NAMESPACE_C99
# endif
# ifdef __USE_BSD
@@ -337,6 +355,7 @@ strtouq (__const char *__restrict __nptr, char **__restrict __endptr,
# endif
# if defined __USE_MISC || defined __USE_ISOC99
+__BEGIN_NAMESPACE_C99
__extension__ extern __inline long long int
strtoll (__const char *__restrict __nptr, char **__restrict __endptr,
int __base) __THROW
@@ -349,8 +368,10 @@ strtoull (__const char * __restrict __nptr, char **__restrict __endptr,
{
return __strtoull_internal (__nptr, __endptr, __base, 0);
}
+__END_NAMESPACE_C99
# endif
+__BEGIN_NAMESPACE_STD
extern __inline double
atof (__const char *__nptr) __THROW
{
@@ -366,13 +387,16 @@ atol (__const char *__nptr) __THROW
{
return strtol (__nptr, (char **) NULL, 10);
}
+__END_NAMESPACE_STD
# if defined __USE_MISC || defined __USE_ISOC99
+__BEGIN_NAMESPACE_C99
__extension__ extern __inline long long int
atoll (__const char *__nptr) __THROW
{
return strtoll (__nptr, (char **) NULL, 10);
}
+__END_NAMESPACE_C99
# endif
#endif /* Optimizing and Inlining. */
@@ -442,10 +466,12 @@ extern int setstate_r (char *__restrict __statebuf,
#endif /* Use SVID || extended X/Open. */
+__BEGIN_NAMESPACE_STD
/* Return a random integer between 0 and RAND_MAX inclusive. */
extern int rand (void) __THROW;
/* Seed the random number generator with the given number. */
extern void srand (unsigned int __seed) __THROW;
+__END_NAMESPACE_STD
#ifdef __USE_POSIX
/* Reentrant interface according to POSIX.1. */
@@ -522,20 +548,24 @@ extern int lcong48_r (unsigned short int __param[7],
#endif /* don't just need malloc and calloc */
#ifndef __malloc_and_calloc_defined
-#define __malloc_and_calloc_defined
+# define __malloc_and_calloc_defined
+__BEGIN_NAMESPACE_STD
/* Allocate SIZE bytes of memory. */
extern void *malloc (size_t __size) __THROW __attribute_malloc__;
/* Allocate NMEMB elements of SIZE bytes each, all initialized to 0. */
extern void *calloc (size_t __nmemb, size_t __size)
__THROW __attribute_malloc__;
+__END_NAMESPACE_STD
#endif
#ifndef __need_malloc_and_calloc
+__BEGIN_NAMESPACE_STD
/* Re-allocate the previously allocated block
in PTR, making the new block SIZE bytes long. */
extern void *realloc (void *__ptr, size_t __size) __THROW __attribute_malloc__;
/* Free a block allocated by `malloc', `realloc' or `calloc'. */
extern void free (void *__ptr) __THROW;
+__END_NAMESPACE_STD
#ifdef __USE_MISC
/* Free a block. An alias for `free'. (Sun Unices). */
@@ -557,12 +587,14 @@ extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
__THROW __attribute_malloc__;
#endif
+__BEGIN_NAMESPACE_STD
/* Abort execution and generate a core-dump. */
extern void abort (void) __THROW __attribute__ ((__noreturn__));
/* Register a function to be called when `exit' is called. */
extern int atexit (void (*__func) (void)) __THROW;
+__END_NAMESPACE_STD
#ifdef __USE_MISC
/* Register a function to be called with the status
@@ -571,20 +603,26 @@ extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg)
__THROW;
#endif
+__BEGIN_NAMESPACE_STD
/* Call all functions registered with `atexit' and `on_exit',
in the reverse of the order in which they were registered
perform stdio cleanup, and terminate program execution with STATUS. */
extern void exit (int __status) __THROW __attribute__ ((__noreturn__));
+__END_NAMESPACE_STD
#ifdef __USE_ISOC99
+__BEGIN_NAMESPACE_C99
/* Terminate the program with STATUS without calling any of the
functions registered with `atexit' or `on_exit'. */
extern void _Exit (int __status) __THROW __attribute__ ((__noreturn__));
+__END_NAMESPACE_C99
#endif
+__BEGIN_NAMESPACE_STD
/* Return the value of envariable NAME, or NULL if it doesn't exist. */
extern char *getenv (__const char *__name) __THROW;
+__END_NAMESPACE_STD
/* This function is similar to the above but returns NULL if the
programs is running with SUID or SGID enabled. */
@@ -651,8 +689,10 @@ extern char *mkdtemp (char *__template) __THROW;
#endif
+__BEGIN_NAMESPACE_STD
/* Execute the given line as a shell command. */
extern int system (__const char *__command) __THROW;
+__END_NAMESPACE_STD
#ifdef __USE_GNU
@@ -684,6 +724,7 @@ typedef __compar_fn_t comparison_fn_t;
# endif
#endif
+__BEGIN_NAMESPACE_STD
/* Do a binary search for KEY in BASE, which consists of NMEMB elements
of SIZE bytes each, using COMPAR to perform the comparisons. */
extern void *bsearch (__const void *__key, __const void *__base,
@@ -698,12 +739,15 @@ extern void qsort (void *__base, size_t __nmemb, size_t __size,
/* Return the absolute value of X. */
extern int abs (int __x) __THROW __attribute__ ((__const__));
extern long int labs (long int __x) __THROW __attribute__ ((__const__));
+__END_NAMESPACE_STD
+
#ifdef __USE_ISOC99
__extension__ extern long long int llabs (long long int __x)
__THROW __attribute__ ((__const__));
#endif
+__BEGIN_NAMESPACE_STD
/* Return the `div_t', `ldiv_t' or `lldiv_t' representation
of the value of NUMER over DENOM. */
/* GCC may have built-ins for these someday. */
@@ -711,10 +755,14 @@ extern div_t div (int __numer, int __denom)
__THROW __attribute__ ((__const__));
extern ldiv_t ldiv (long int __numer, long int __denom)
__THROW __attribute__ ((__const__));
+__END_NAMESPACE_STD
+
#ifdef __USE_ISOC99
+__BEGIN_NAMESPACE_C99
__extension__ extern lldiv_t lldiv (long long int __numer,
long long int __denom)
__THROW __attribute__ ((__const__));
+__END_NAMESPACE_C99
#endif
@@ -768,6 +816,7 @@ extern int qfcvt_r (long double __value, int __ndigit,
#endif /* use MISC || use X/Open Unix */
+__BEGIN_NAMESPACE_STD
/* Return the length of the multibyte character
in S, which is no longer than N. */
extern int mblen (__const char *__s, size_t __n) __THROW;
@@ -787,6 +836,7 @@ extern size_t mbstowcs (wchar_t *__restrict __pwcs,
extern size_t wcstombs (char *__restrict __s,
__const wchar_t *__restrict __pwcs, size_t __n)
__THROW;
+__END_NAMESPACE_STD
#ifdef __USE_SVID