// Rowley C Compiler, runtime support.
//
// Copyright (c) 2001, 2002, 2009, 2010 Rowley Associates Limited.
//
// This file may be distributed under the terms of the License Agreement
// provided with this software.
//
// THIS FILE IS PROVIDED AS IS WITH NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

#ifndef __stdlib_H
#define __stdlib_H

#include "__crossworks.h"

#ifdef __cplusplus
extern "C" {
#endif

#ifndef __SIZE_T_DEFINED
#define __SIZE_T_DEFINED
typedef __SIZE_T size_t;
#endif

#ifndef NULL
#define NULL 0
#endif


/*! \brief EXIT_SUCCESS \ingroup Macros \synopsis

  \desc \b \this pass to \ref exit on successful termination.
*/
#define EXIT_SUCCESS    0


/*! \brief EXIT_FAILURE \ingroup Macros \synopsis

  \desc \b \this pass to \ref exit on unsuccessful termination.
*/
#define EXIT_FAILURE    1


/*! \brief RAND_MAX \ingroup Macros \synopsis

  \desc \b \this expands to an integer constant expression that is the maximum 
  value returned by \ref rand.
*/
#define RAND_MAX 32767

/*! \brief Structure containing quotient and remainder after division of an int \ingroup Types

  \desc \b \this stores the quotient and remainder returned by \ref div.
*/
typedef struct
{
  int quot;
  int rem;
} div_t;

/*! \brief Structure containing quotient and remainder after division of a long \ingroup Types

  \desc \b \this stores the quotient and remainder returned by \ref ldiv.
*/
typedef struct
{
  long quot;
  long rem;
} ldiv_t;


/*! \brief Structure containing quotient and remainder after division of a long long \ingroup Types

  \desc \b \this stores the quotient and remainder returned by \ref lldiv.
*/
typedef struct
{
  long long quot;
  long rem;
} lldiv_t;


/*! \brief Return an integer absolute value \ingroup Integer arithmetic functions \synopsis

  \desc \b \this returns the absolute value of the integer argument \a j.
*/
int abs(int __j);


/*! \brief Return a long integer absolute value \ingroup Integer arithmetic functions \synopsis

  \desc \b \this returns the absolute value of the long integer argument \a j.
*/
long int labs(long int __j);


/*! \brief Return a long long integer absolute value \ingroup Integer arithmetic functions \synopsis

  \desc \b \this returns the absolute value of the long long integer argument \a j.
*/
long long int llabs(long long int __j);


/*! \brief Divide two ints returning quotient and remainder \ingroup Integer arithmetic functions \synopsis

  \desc \b \this computes \a numer / \a denom and \a numer % \a denom
  in a single operation.

  \b \this returns a structure of type \ref div_t comprising both the
  quotient and the remainder. The structures contain the members 
  \b quot (the quotient) and \b rem (the remainder), each of which has 
  the same type as the arguments \a numer and \a denom. If either part 
  of the result cannot be represented, the behavior is undefined.

  \sa \ref div_t
*/
div_t div(int __numer, int __denom);


/*! \brief Divide two longs returning quotient and remainder \ingroup Integer arithmetic functions \synopsis

  \desc \b \this computes \a numer / \a denom and \a numer % \a denom 
  in a single operation.
 
  \b \this returns a structure of type \ref ldiv_t  
  comprising both the quotient and the remainder. The structures contain the members 
  \b quot (the quotient) and \b rem (the remainder), each of which has 
  the same type as the arguments \b numer and \b denom. If either part 
  of the result cannot be represented, the behavior is undefined.

  \sa \ref ldiv_t
*/
ldiv_t ldiv(long int __numer, long int __denom);


/*! \brief Divide two long longs returning quotient and remainder \ingroup Integer arithmetic functions \synopsis

  \b \this computes \b numer / \b denom and \b numer % \b denom 
  in a single operation.
  
  \b \this returns a structure of type \ref lldiv_t 
  comprising both the quotient and the remainder. The structures contain the members 
  \b quot (the quotient) and \b rem (the remainder), each of which has 
  the same type as the arguments \b numer and \b denom. If either part 
  of the result cannot be represented, the behavior is undefined.

 \sa \ref lldiv_t

*/
lldiv_t lldiv(long long int __numer, long long int __denom);


/*! \brief Allocate space for a single object \ingroup Memory allocation functions \synopsis

  \desc \b \this allocates space for an object whose size is specified by 'b size 
  and whose value is indeterminate.

  \b \this returns a null pointer if the space for the object cannot be 
  allocated from free memory; if space for the object can be allocated, \b \this 
  returns a pointer to the start of the allocated space.
*/
void *malloc(size_t __size);


/*! \brief Allocate space for an array of objects and initialize them to zero \ingroup Memory allocation functions \synopsis

  \desc \b \this allocates space for an array of \b nmemb objects, each of 
  whose size is \b size. The space is initialized to all zero bits.

  \b \this returns a null pointer if the space for the array of object cannot 
  be allocated from free memory; if space for the array can be allocated, \b calloc 
  returns a pointer to the start of the allocated space.
*/
void *calloc(size_t __nobj, size_t __size);


/*! \brief Resizes allocated memory space or allocates memory space \ingroup Memory allocation functions \synopsis

  \desc \b \this deallocates the old object pointed to by \b ptr and returns 
  a pointer to a new object that has the size specified by \b size. The contents 
  of the new object is identical to that of the old object prior to deallocation, up to the 
  lesser of the new and old sizes. Any bytes in the new object beyond the size 
  of the old object have indeterminate values.

  If \b ptr is a null pointer, \b \this behaves like \this 
  for the specified size. If memory for the new object cannot be allocated, the 
  old object is not deallocated and its value is unchanged.

  \b \this returns a pointer to the new object (which may have 
  the same value as a pointer to the old object), or a null pointer if the new 
  object could not be allocated.  

  If \b ptr does not match a pointer earlier returned by \b calloc, \b malloc, 
  or \b \this, or if the space has been deallocated by a call to \b free 
  or \b \this, the behavior is undefined.
*/
void *realloc(void *p, size_t __size);


/*! \brief Frees allocated memory for reuse \ingroup Memory allocation functions \synopsis

  \desc \b \this causes the space pointed to by \b ptr to be deallocated, that 
  is, made available for further allocation. If \b ptr is a null pointer, 
  no action occurs.

  If \b ptr does not match a pointer earlier returned by \b calloc, \b malloc, 
  or \b realloc, or if the space has been deallocated by a call to \b \this 
  or \b realloc, the behavior is undefined.
*/
void free(void *__p);


/*! \brief Convert string to double \ingroup String to number conversions \synopsis

  \desc \b \this converts the initial portion of the string pointed to by \b nptr to
  a \b double representation. 
  
  \b \this does not affect the value of \b errno on an error. If the
  value of the result cannot be represented, the behavior is undefined. 

  Except for the behavior on error, \b \this is equivalent to
  \tt{strtod(nptr, (char **)NULL)}.

  \b \this returns the converted value. 

  \sa \ref strtod
*/
double atof(const char *__nptr);


/*! \brief Convert string to double \ingroup String to number conversions \synopsis
 
  \desc \b \this converts the initial portion of the string pointed to by \b nptr 
  to a \b double representation. 

  First, \b \this decomposes the input string into three parts: an initial, 
  possibly empty, sequence of white-space characters (as specified by \ref isspace), 
  a subject sequence resembling a floating-point constant, and a final string 
  of one or more unrecognized characters, including the terminating null character 
  of the input string. \b \this then attempts to convert the subject sequence 
  to a floating-point number, and return the result. 

  The subject sequence is defined as the longest initial subsequence of the input 
  string, starting with the first non-white-space character, that is of the expected 
  form. The subject sequence contains no characters if the input string is empty 
  or consists entirely of white space, or if the first non-white-space character 
  is other than a sign or a permissible letter or digit. 

  The expected form of the subject sequence is an optional plus or minus sign 
  followed by a nonempty sequence of decimal digits optionally containing a decimal-point 
  character, then an optional exponent part.

  If the subject sequence begins with a minus sign, the value resulting from 
  the conversion is negated. 

  A pointer to the final string is stored in the object pointed to by \b \this, 
  provided that \b endptr is not a null pointer. 

  If the subject sequence is empty or does not have the expected form, no conversion 
  is performed, the value of \b nptr is stored in the object pointed to by 
  \b endptr, provided that \b endptr is not a null pointer. 

  \b \this returns the converted value, if any. If no conversion could be 
  performed, zero is returned. If the correct value is outside the range of representable 
  values, \b HUGE_VAL is returned according to the sign of the value, if any, 
  and the value of the macro \ref errno is stored in \ref errno. 
*/
double strtod(const char *__nptr, char **__endptr);


/*! \brief Convert string to float \ingroup String to number conversions \synopsis

  \desc \b \this  converts the initial portion of the string pointed to by \b nptr 
  to a \b double representation. 

  First, \b \this decomposes the input string into three parts: an initial, 
  possibly empty, sequence of white-space characters (as specified by \ref isspace),
  a subject sequence resembling a floating-point constant, and a final string 
  of one or more unrecognized characters, including the terminating null character 
  of the input string. \b \this then attempts to convert the subject sequence 
  to a floating-point number, and return the result. 

  The subject sequence is defined as the longest initial subsequence of the input 
  string, starting with the first non-white-space character, that is of the expected 
  form. The subject sequence contains no characters if the input string is empty 
  or consists entirely of white space, or if the first non-white-space character 
  is other than a sign or a permissible letter or digit. 

  The expected form of the subject sequence is an optional plus or minus sign 
  followed by a nonempty sequence of decimal digits optionally containing a decimal-point 
  character, then an optional exponent part.
  
  If the subject sequence begins with a minus sign, the value resulting from 
  the conversion is negated. 
  A pointer to the final string is stored in the object pointed to by \b endptr, 
  provided that \b endptr is not a null pointer. 

  If the subject sequence is empty or does not have the expected form, no conversion 
  is performed, the value of \b nptr is stored in the object pointed to by 
  \b endptr, provided that \b endptr is not a null pointer. 

  \b \this returns the converted value, if any. If no conversion could be 
  performed, zero is returned. If the correct value is outside the range of representable 
  values, \b HUGE_VALF is returned according to the sign of the value, if 
  any, and the value of the macro \ref errno
  is stored in \ref errno. 
*/
float strtof(const char *__nptr, char **__endptr);


/*! \brief Convert string to int \ingroup String to number conversions \synopsis

  \desc \b \this converts the initial portion of the string pointed to by \b nptr 
  to an \b int representation. 

  \b \this does not affect the value of \b errno on an error. If the value 
  of the result cannot be represented, the behavior is undefined. 

  Except for the behavior on error, \b \this is equivalent to
  \tt{(int)strtol(nptr, (char **)NULL, 10)}. 

  \b \this returns the converted value. 

  \sa \ref strtol
*/
int atoi(const char *__nptr);


/*! \brief Convert string to long \ingroup String to number conversions \synopsis

  \desc \b \this converts the initial portion of the string pointed to by \b nptr 
  \b to a \b{long int} representation. 

 \b atol does not affect the value of \b errno on an error. If the value 
  of the result cannot be represented, the behavior is undefined. 

  Except for the behavior on error, \b \this is equivalent to
  \tt{strtol(nptr, (char **)NULL, 10)}.

  \b \this returns the converted value. 

  \sa \ref strtol
*/
long int atol(const char *__nptr);


/*! \brief Convert string to long long \ingroup String to number conversions \synopsis

  \desc \b \this converts the initial portion of the string pointed to by \b nptr 
  to a \b{long long int} representation. 

  \b \this does not affect the value of \b errno 
  on an error. If the value of the result cannot be represented, the behavior 
  is undefined. 

  Except for the behavior on error, \b \this is equivalent to
  \tt{strtoll(nptr, (char **)NULL, 10)}.
   
  \b \this returns the converted value. 

\sa \ref strtoll
*/
long long int atoll(const char *__nptr);


/*! \brief Convert string to long \ingroup String to number conversions \synopsis

  \desc \b \this converts the initial portion of the string pointed to by \b nptr 
  to a \b{long int} representation. 

  First, \b strtol decomposes the input string into three parts: an initial, 
  possibly empty, sequence of white-space characters (as specified by \ref isspace),
  a subject sequence resembling an integer represented in some radix determined 
  by the value of \b base, and a final string of one or more unrecognized 
  characters, including the terminating null character of the input string. \b \this 
  then attempts to convert the subject sequence to an integer, and return the 
  result. 

  When converting, no integer suffix (such as U, L, UL, LL, ULL) is allowed. 

  If the value of \b base is zero, the expected form of the subject sequence 
  is an optional plus or minus sign followed by an integer constant. 

  If the value of \b base is between 2 and 36 (inclusive), the expected form 
  of the subject sequence is an optional plus or minus sign followed by a sequence 
  of letters and digits representing an integer with the radix specified by \b base. 
  The letters from a (or A) through z (or Z) represent the values 10 through 35; 
  only letters and digits whose ascribed values are less than that of \b base 
  are permitted. 

  If the value of \b base is 16, the characters \q{0x} or \q{0X} may optionally
  precede the sequence of letters and digits, following the optional sign. 

  The subject sequence is defined as the longest initial subsequence of the input 
  string, starting with the first non-white-space character, that is of the expected 
  form. The subject sequence contains no characters if the input string is empty 
  or consists entirely of white space, or if the first non-white-space character 
  is other than a sign or a permissible letter or digit. 

  If the subject sequence has the expected form and the value of \b base 
  is zero, the sequence of characters starting with the first digit is interpreted 
  as an integer constant. If the subject sequence has the expected form and the 
  value of \b base is between 2 and 36, it is used as the base for conversion. 

  If the subject sequence begins with a minus sign, the value resulting from 
  the conversion is negated. 

  A pointer to the final string is stored in the object pointed to by \b endptr, 
  provided that \b endptr is not a null pointer. 

  If the subject sequence is empty or does not have the expected form, no conversion 
  is performed, the value of \b nptr is stored in the object pointed to by 
  \b endptr, provided that \b endptr is not a null pointer. 

  \b \this returns the converted value, if any. If no conversion could be 
  performed, zero is returned. If the correct value is outside the range of representable 
  values, \ref LONG_MIN or \ref LONG_MAX
  is returned according to the sign of the value, if any, and the value of the 
  macro \ref errno is stored in \ref errno. 
*/
long int strtol(const char *__nptr, char **__endptr, int __base);


/*! \brief Convert string to long long \ingroup String to number conversions \synopsis

  \desc \b \this converts the initial portion of the string pointed to by \b nptr 
  to a \b{long int} representation. 

  First, \b \this decomposes the input string into three parts: an initial, 
  possibly empty, sequence of white-space characters (as specified by \ref isspace), 
  a subject sequence resembling an integer represented in some radix determined 
  by the value of \b base, and a final string of one or more unrecognized 
  characters, including the terminating null character of the input string. \b \this 
  then attempts to convert the subject sequence to an integer, and return the 
  result. 

  When converting, no integer suffix (such as U, L, UL, LL, ULL) is allowed. 

  If the value of \b base is zero, the expected form of the subject sequence 
  is an optional plus or minus sign followed by an integer constant. 

  If the value of \b base is between 2 and 36 (inclusive), the expected form 
  of the subject sequence is an optional plus or minus sign followed by a sequence 
  of letters and digits representing an integer with the radix specified by \b base. 
  The letters from a (or A) through z (or Z) represent the values 10 through 35; 
  only letters and digits whose ascribed values are less than that of \b base 
  are permitted. 

  If the value of \b base is 16, the characters \q{0x} or \q{0X} may optionally
  precede the sequence of letters and digits, following the optional sign.
  The subject sequence is defined as the longest initial subsequence of the input 
  string, starting with the first non-white-space character, that is of the expected 
  form. The subject sequence contains no characters if the input string is empty 
  or consists entirely of white space, or if the first non-white-space character 
  is other than a sign or a permissible letter or digit.

  If the subject sequence has the expected form and the value of \b base 
  is zero, the sequence of characters starting with the first digit is interpreted 
  as an integer constant. If the subject sequence has the expected form and the 
  value of \b base is between 2 and 36, it is used as the base for conversion. 

  If the subject sequence begins with a minus sign, the value resulting from 
  the conversion is negated. 

  A pointer to the final string is stored in the object pointed to by \b endptr, 
  provided that \b endptr is not a null pointer. 

  If the subject sequence is empty or does not have the expected form, no conversion 
  is performed, the value of \b nptr is stored in the object pointed to by 
  \b endptr, provided that \b endptr is not a null pointer. 

  \b \this returns the converted value, if any. If no conversion could 
  be performed, zero is returned. If the correct value is outside the range of 
  representable values, \ref LLONG_MIN or \ref LLONG_MAX is returned according
  to the sign of the value, if any, and the value of the macro \b ERANGE is 
  stored in \ref errno. 
*/
long long int strtoll(const char *__nptr, char **__endptr, int __base);


/*! \brief Convert string to unsigned long \ingroup String to number conversions \synopsis

  \desc \b \this converts the initial portion of the string pointed to by \b nptr 
  to a \b{long int} representation. 

  First, \b \this decomposes the input string into three parts: an initial, 
  possibly empty, sequence of white-space characters (as specified by \ref isspace), 
  a subject sequence resembling an integer represented in some radix determined 
  by the value of \b base, and a final string of one or more unrecognized 
  characters, including the terminating null character of the input string. \b strtoul 
  then attempts to convert the subject sequence to an integer, and return the 
  result. 

  When converting, no integer suffix (such as U, L, UL, LL, ULL) is allowed. 

  If the value of \b base is zero, the expected form of the subject sequence 
  is an optional plus or minus sign followed by an integer constant.
   
  If the value of \b base is between 2 and 36 (inclusive), the expected form 
  of the subject sequence is an optional plus or minus sign followed by a sequence 
  of letters and digits representing an integer with the radix specified by \b base. 
  The letters from a (or A) through z (or Z) represent the values 10 through 35; 
  only letters and digits whose ascribed values are less than that of \b base 
  are permitted. 

  If the value of \b base is 16, the characters \q{0x} or \q{0X} may optionally
  precede the sequence of letters and digits, following the optional sign. 

  The subject sequence is defined as the longest initial subsequence of the input 
  string, starting with the first non-white-space character, that is of the expected 
  form. The subject sequence contains no characters if the input string is empty 
  or consists entirely of white space, or if the first non-white-space character 
  is other than a sign or a permissible letter or digit. 

  If the subject sequence has the expected form and the value of \b base 
  is zero, the sequence of characters starting with the first digit is interpreted 
  as an integer constant. If the subject sequence has the expected form and the 
  value of \b base is between 2 and 36, it is used as the base for conversion. 

  If the subject sequence begins with a minus sign, the value resulting from 
  the conversion is negated. 

  A pointer to the final string is stored in the object pointed to by \b endptr, 
  provided that \b endptr is not a null pointer. 

  If the subject sequence is empty or does not have the expected form, no conversion 
  is performed, the value of \b nptr is stored in the object pointed to by 
  \b endptr, provided that \b endptr is not a null pointer. 

  \b \this returns the converted value, if any. If no conversion could 
  be performed, zero is returned. If the correct value is outside the range of 
  representable values, \ref LONG_MAX or \ref ULONG_MAX is returned according
  to the sign of the value, if any, and the value of the macro \b ERANGE is 
  stored in \ref errno. 
  */
unsigned long int strtoul(const char *__nptr, char **__endptr, int __base);


/*! \brief Convert string to unsigned long long \ingroup String to number conversions \synopsis

  \desc \b \this converts the initial portion of the string pointed to by \b nptr 
  to a \b{long int} representation. 

  First, \b strtoull decomposes the input string into three parts: an initial, 
  possibly empty, sequence of white-space characters (as specified by \ref isspace), 
  a subject sequence resembling an integer represented in some radix determined 
  by the value of \b base, and a final string of one or more unrecognized 
  characters, including the terminating null character of the input string. \b \this 
  then attempts to convert the subject sequence to an integer, and return the 
  result. 

  When converting, no integer suffix (such as U, L, UL, LL, ULL) is allowed. 

  If the value of \b base is zero, the expected form of the subject sequence 
  is an optional plus or minus sign followed by an integer constant. 

  If the value of \b base is between 2 and 36 (inclusive), the expected form 
  of the subject sequence is an optional plus or minus sign followed by a sequence 
  of letters and digits representing an integer with the radix specified by \b base. 
  The letters from a (or A) through z (or Z) represent the values 10 through 35; 
  only letters and digits whose ascribed values are less than that of \b base 
  are permitted. 

  If the value of \b base is 16, the characters \q{0x} or \q{0X} may optionally
  precede the sequence of letters and digits, following the optional sign. 
  The subject sequence is defined as the longest initial subsequence of the input 
  string, starting with the first non-white-space character, that is of the expected 
  form. The subject sequence contains no characters if the input string is empty 
  or consists entirely of white space, or if the first non-white-space character 
  is other than a sign or a permissible letter or digit. 

  If the subject sequence has the expected form and the value of \b base 
  is zero, the sequence of characters starting with the first digit is interpreted 
  as an integer constant. If the subject sequence has the expected form and the 
  value of \b base is between 2 and 36, it is used as the base for conversion. 

  If the subject sequence begins with a minus sign, the value resulting from 
  the conversion is negated. 
  
  A pointer to the final string is stored in the object pointed to by \b endptr, 
  provided that \b endptr is not a null pointer. 

  If the subject sequence is empty or does not have the expected form, no conversion 
  is performed, the value of \b nptr is stored in the object pointed to by 
  \b endptr, provided that \b endptr is not a null pointer. 

  \b \this returns the converted value, if any. If no conversion could 
  be performed, zero is returned. If the correct value is outside the range of 
  representable values, \ref LLONG_MAX or \ref ULLONG_MAX is returned according
  to the sign of the value, if any, and the value of the macro \b ERANGE is 
  stored in \ref errno.
*/
unsigned long long int strtoull(const char *__nptr, char **__endptr, int __base);


/*! \brief Return next random number in sequence \ingroup Pseudo-random sequence generation functions \synopsis

  \desc \b \this computes a sequence of pseudo-random integers in the range 0 to 
  \b RAND_MAX.

  \b \this returns the computed pseudo-random integer. 
*/
int rand(void);


/*! \brief Set seed of random number sequence \ingroup Pseudo-random sequence generation functions \synopsis

  \desc \b \this uses the argument \b seed as a seed for a new sequence of 
  pseudo-random numbers to be returned by subsequent calls to \b rand. If 
  \b \this is called with the same seed value, the same sequence of pseudo-random 
  numbers is generated. 

  If \b rand is called before any calls to \b \this have been made, a 
  sequence is generated as if \b \this is first called with a seed value of 
  1. 
 \sa \ref rand or 'ref rand_max
*/
void srand(unsigned int __seed);


/*! \brief Search a sorted array \ingroup Search and sort functions \synopsis

  \desc \b \this searches the array \a{*base} for the specified \b {*key} and returns a
  pointer to the first entry that matches or null if no match. The array should
  have \b num elements of \b size bytes and be sorted by the same algorithm as
  the \b compare function

  The \b compare function should return a negative value if the first parameter
  is less than second parameter, zero if the parameters are equal, and a positive
  value if the first parameter is greater than the second parameter.
*/
void *bsearch(const void *__key,
              const void *__buf,
              size_t __num,
              size_t __size,
              int (*__compare)(const void *, const void *));


/*! \brief Sort an array \ingroup Search and sort functions \synopsis

  \b qsort sorts the array \b *base using the \b compare algorithm. The
  array should have \b num elements of \b size bytes. The \b compare function
  should return a negative value if the first parameter is less than second
  parameter, zero if the parameters are equal and a positive value if the first
  parameter is greater than the second parameter.
*/
void qsort(void *__buf,
           size_t __num,
           size_t __size,
           int (*__compare)(const void *, const void *));

void abort(void);

/*! \brief Terminates the calling process \ingroup Environment \synopsis

  \desc \b \this returns to the startup code and performs the appropriate cleanup process.
*/
void exit(int __exit_code);

/*! \brief Set function to be execute on exit \ingroup Environment \synopsis

  \desc \b \this registers \b function to be called when the application has
  exited. The functions registered with \b \this are executed in reverse
  order of their registration. \b \this returns 0 on success and non-zero
  on failure.
*/
int atexit(void (*__func)(void));

char *getenv(const char *__name);
int system(const char *__command);

// Extensions

/*! \brief Convert int to string \ingroup Number to string conversions \synopsis

  \desc \b \this converts \b val to a string in base \b radix and places 
  the result in \b buf. 

  \b \this returns \b buf as the result. 

  If \b radix is greater than 36, the result is undefined.

  If \b val is negative and \b radix is 10, the string has a leading minus 
  sign (-); for all other values of \b radix, \b value is considered unsigned 
  and never has a leading minus sign.

 \sa \ref ltoa, \ref lltoa, \ref ultoa, \ref ulltoa, \ref utoa
*/
char *itoa(int __val, char *__buf, int __radix);


/*! \brief Convert unsigned to string \ingroup Number to string conversions \synopsis

  \desc \b \this converts \b val to a string in base \b radix and places 
  the result in \b buf. 

  \b \this returns \b buf as the result. 

  If \b radix is greater than 36, the result is undefined.

  \sa \ref itoa, \ref ltoa, \ref lltoa, \ref ultoa, \ref ulltoa
*/
char *utoa(unsigned val, char *buf, int radix);


/*! \brief Convert long to string \ingroup Number to string conversions \synopsis

  \desc \b \this converts \b val to a string in base \b radix and places 
  the result in \b buf.

  \b \this returns \b buf as the result. 

  If \b radix is greater than 36, the result is undefined.

  If \b val is negative and radix is 10, the string has a leading minus 
  sign (-); for all other values of \b radix, \b value is considered unsigned 
  and never has a leading minus sign.

  \sa \ref itoa, \ref lltoa, \ref ultoa, \ref ulltoa, \ref utoa
*/
char *ltoa(long __val, char *__buf, int __radix);


/*! \brief Convert unsigned long to string \ingroup Number to string conversions \synopsis

  \desc \b \this converts \b val to a string in base \b radix and places 
  the result in \b buf. 

  \b \this returns \b buf as the result.

  If \b radix is greater than 36, the result is undefined.

  \sa \ref itoa, \ref ltoa, \ref lltoa, \ref ulltoa, \ref utoa
*/
char *ultoa(unsigned long __val, char *__buf, int __radix);


/*! \brief Convert long long to string \ingroup Number to string conversions \synopsis

  \desc \b \this converts \b val to a string in base \b radix and places 
  the result in \b buf. 

  \b \this returns \b buf as the result. 

 If \b radix is greater than 36, the result is undefined.

 If \b val is negative and radix is 10, the string has a leading minus 
 sign (-); for all other values of \b radix, \b value is considered unsigned 
 and never has a leading minus sign.

  \sa \ref itoa, \ref ltoa, \ref ultoa, \ref ulltoa, \ref utoa
*/
char *lltoa(long long __val, char *__buf, int __radix);


/*! \brief Convert unsigned long long to string \ingroup Number to string conversions \synopsis

  \desc \b \this converts \b val to a string in base \b radix and places 
  the result in \b buf. 

  \b \this returns \b buf as the result. 

  If \b radix is greater than 36, the result is undefined.

  \sa \ref itoa, \ref ltoa, \ref lltoa, \ref ultoa, \ref utoa
*/
char *ulltoa(unsigned long long __val, char *__buf, int __radix);


#ifdef __cplusplus
}
#endif

#endif