#ifndef __STDLIB_LOADED #define __STDLIB_LOADED 1 #ifndef __STDLIB_PROCESSED #define __STDLIB_PROCESSED /**************************************************************************** ** ** - General Utilities ** ***************************************************************************** ** Header introduced by the ANSI C Standard ***************************************************************************** ** ** Copyright 2005 Hewlett-Packard Development Company, L.P. ** ** Confidential computer software. Valid license from HP and/or ** its subsidiaries required for possession, use, or copying. ** ** Consistent with FAR 12.211 and 12.212, Commercial Computer Software, ** Computer Software Documentation, and Technical Data for Commercial ** Items are licensed to the U.S. Government under vendor's standard ** commercial license. ** ** Neither HP nor any of its subsidiaries shall be liable for technical ** or editorial errors or omissions contained herein. The information ** in this document is provided "as is" without warranty of any kind and ** is subject to change without notice. The warranties for HP products ** are set forth in the express limited warranty statements accompanying ** such products. Nothing herein should be construed as constituting an ** additional warranty. ** ***************************************************************************** */ #pragma __nostandard #include #ifdef __cplusplus extern "C" { #endif /* ** X/Open specifies that WNOHANG, WUNTRACED, WEXITSTATUS, WIFEXITED, ** WIFSIGNALED, WIFSTOPPED, WSTOPSIG and WTRERMSIG are defined here, and that ** inclusion of may make visible all symbols from ** and . */ #if defined _XOPEN_SOURCE || (!defined _ANSI_C_SOURCE && !defined _DECC_V4_SOURCE) # include # include #endif #if __INITIAL_POINTER_SIZE # pragma __pointer_size __save # pragma __pointer_size 32 #endif /* ** Member align structures */ #pragma __member_alignment __save #pragma __member_alignment /* ** Create 'public' typedefs that are sensitive to pointer size and must ** use 32 bit pointers. Create other declarations which are not sensitive ** to pointer size. */ #ifndef NULL # define NULL __NULL #endif #ifdef __NAMESPACE_STD namespace std { #endif #ifndef __SIZE_T # define __SIZE_T 1 typedef __size_t size_t; #endif typedef struct { int quot, rem; } div_t; typedef struct { long int quot, rem; } ldiv_t; #ifdef __NAMESPACE_STD } /* namespace std */ #endif #ifndef __WCHAR_T # define __WCHAR_T typedef __wchar_t wchar_t; #endif /* ** mode_t is needed for a DEC C RTL Extension */ #ifndef _ANSI_C_SOURCE # if !defined __MODE_T && !defined _DECC_V4_SOURCE # define __MODE_T 1 typedef __mode_t mode_t; # endif #endif /* ** Define constant values */ /* ** Exit function failure definition changes corresponding to ** V7.0 "UNIX"-like exit function behavior. */ #if __CRTL_VER >= 70000000 && defined(_POSIX_EXIT) # define EXIT_FAILURE (1) #else # define EXIT_FAILURE 0x10000002 #endif #define EXIT_SUCCESS 0 #define RAND_MAX 2147483647 /* ** Beginning in OpenVMS V6.2, MB_CUR_MAX is no longer a literal value */ #if __CRTL_VER < 60200000 # define MB_CUR_MAX 1 #else # pragma __extern_model __save # pragma __extern_model __strict_refdef extern int decc$$gl___mb_cur_max; # pragma __extern_model __restore # define MB_CUR_MAX (decc$$gl___mb_cur_max) #endif /**************************************************************************** ** ** Functions which do not support 64 bit pointers ** ****************************************************************************/ #ifdef __NAMESPACE_STD namespace std { #endif /* ** ANSI functions */ int atexit(void(*__func)(void)); #ifdef __NAMESPACE_STD } /* namespace std */ #endif /* ** X/Open functions */ #if defined _XOPEN_SOURCE || !defined _ANSI_C_SOURCE # if __CRTL_VER >= 70000000 int putenv (const char *__string); # endif #endif /* ** X/Open Extended functions */ #if defined _XOPEN_SOURCE_EXTENDED || !defined _ANSI_C_SOURCE && __CRTL_VER >= 70000000 char *setstate(char *); char *initstate(unsigned int, char *, int); #endif /* ** We are done defining things which must always be 32 bit pointers. If the ** user has used /pointer_size=32 or /pointer_size=64, we will allow 64 bit ** pointers to be used in function calls. */ #if __INITIAL_POINTER_SIZE # pragma __pointer_size 64 #endif /**************************************************************************** ** ** Functions which accept either 32 bit or 64 bit pointers ** ****************************************************************************/ #ifdef __NAMESPACE_STD namespace std { #endif /* ** ANSI functions */ void abort (void); int abs (int __j); double atof (const char *__nptr); int atoi (const char *__nptr); long int atol (const char *__nptr); div_t div (int __numer, int __denom); void free (void *__ptr); long int labs (long int __j); ldiv_t ldiv (long int __numer, long int __denom); int mblen (const char *__s, __size_t __n); __size_t mbstowcs (__wchar_t *__pwcs, const char *__s, __size_t __n); int mbtowc (__wchar_t *__pwc, const char *__s, __size_t __n); int rand (void); void srand (unsigned int __seed); __size_t wcstombs (char *__s, const __wchar_t *__pwcs, __size_t __n); int wctomb (char *__s, __wchar_t __wchar); #if __CRTL_VER >= 70000000 && defined(_POSIX_EXIT) # if __CAN_USE_EXTERN_PREFIX # pragma __extern_prefix __save # pragma __extern_prefix "__posix_" # else # define exit(__p1) __posix_exit(__p1) # define system(__p1) __posix_system(__p1) # endif #endif void exit (int __status); int system (const char *__string); #if __CRTL_VER >= 70000000 && defined(_POSIX_EXIT) # if __CAN_USE_EXTERN_PREFIX # pragma __extern_prefix __restore # endif #endif #ifdef __NAMESPACE_STD } /* namespace std */ #endif /* ** X/Open functions */ #if defined _XOPEN_SOURCE || !defined _ANSI_C_SOURCE # if __CRTL_VER >= 70000000 double drand48 (void); double erand48 (unsigned short int __xsubi[3]); long int jrand48 (unsigned short int __xsubi[3]); void lcong48 (unsigned short int __param[7]); long int lrand48 (void); long int mrand48 (void); long int nrand48 (unsigned short int __xsubi[3]); void srand48 (long int __seedval); # endif # if __CRTL_VER >= 80300000 void setkey(const char *__key); #endif #endif /* ** X/Open Extended functions */ #if defined _XOPEN_SOURCE_EXTENDED || !defined _ANSI_C_SOURCE # if __CRTL_VER >= 70000000 int mkstemp (char *path); long int random (void); void srandom (unsigned int); # endif # if __CRTL_VER >= 70320000 int rand_r (unsigned int *__seed_ptr); __char_ptr32 l64a (long __val); long int a64l (__const_char_ptr64 __s); # if !defined _POSIX_C_SOURCE int l64a_r (long int __val, __char_ptr64 __s, int __len); # endif /* not defined while building for posix */ # endif #endif /* ** DEC C extensions */ #ifndef _ANSI_C_SOURCE int nice (int __increment); /* */ __mode_t umask (__mode_t __old_mask); /* */ void cfree (void *__ptr); # if !defined(__VAX) typedef struct { __int64 quot, rem; } __qdiv_t, __lldiv_t; __int64 atoll (const char *__nptr); __int64 atoq (const char *__nptr); __int64 llabs (__int64 __j); __lldiv_t lldiv (__int64 __numer, __int64 __denom); __int64 qabs (__int64 __j); __lldiv_t qdiv (__int64 __numer, __int64 __denom); # endif # if __CRTL_VER >= 70000000 int setenv (const char *__name, const char *__value, int __overwrite); void unsetenv (const char *__name); # endif #if __CRTL_VER >= 70000000 && defined(_POSIX_EXIT) # if __CAN_USE_EXTERN_PREFIX # pragma __extern_prefix __save # pragma __extern_prefix "__posix_" # else # define _exit(__p1) __posix__exit(__p1) # endif #endif void _exit (int __status); /* */ #if __CRTL_VER >= 70000000 && defined(_POSIX_EXIT) # if __CAN_USE_EXTERN_PREFIX # pragma __extern_prefix __restore # endif #endif #endif /**************************************************************************** ** ** Functions which accept either 32 bit or 64 bit pointers, but always ** return 32 bit pointers. ** ****************************************************************************/ #ifdef __NAMESPACE_STD namespace std { #endif /* ** ANSI functions */ __char_ptr32 getenv (const char *__name); #ifdef __NAMESPACE_STD } /* namespace std */ #endif /* ** X/Open functions */ #if defined _XOPEN_SOURCE || !defined _ANSI_C_SOURCE # if __CRTL_VER >= 70000000 __unsigned_short_ptr32 seed48(unsigned short __seed16v[3]); # endif #endif /* ** X/Open Extended functions */ #if defined _XOPEN_SOURCE_EXTENDED || !defined _ANSI_C_SOURCE __char_ptr32 ecvt (double __value, int __ndigit, int *__decpt, int *__sign); __char_ptr32 fcvt (double __value, int __ndigit, int *__decpt, int *__sign); #endif /* ** DEC C extensions. */ #ifndef _ANSI_C_SOURCE __void_ptr32 brk (unsigned long int __addr); /* */ __void_ptr32 sbrk (long int __incr); /* */ #endif /**************************************************************************** ** ** Functions which have separate implementations for 32 bit and 64 bit ** pointers. The implementation defaults to that corresponding to the ** default pointer size used in the /POINTER_SIZE qualifier. The 32 bit ** interface is used with no /POINTER_SIZE qualifier is present. Later ** in this header file we will define additional function prototypes ** which allow you to call the non-default form of the implementation. ** ****************************************************************************/ #if __INITIAL_POINTER_SIZE == 32 # pragma __pointer_size 32 #endif #ifdef __NAMESPACE_STD namespace std { #endif /* ** ANSI functions */ void * calloc (__size_t __nmemb, __size_t __size); void * malloc (__size_t __size); void * realloc (__void_ptr64 __ptr, __size_t __size); void * bsearch (const void *, const void *, __size_t, __size_t, int (*__compar)(const void *, const void *)); void qsort (void *, __size_t, __size_t, int (*__compar)(const void *, const void *)); double strtod (const char *__nptr, char **__endptr); long int strtol (const char *__nptr, char **__endptr, int __base); unsigned long int strtoul (const char *__nptr, char **__endptr, int __base); #ifdef __NAMESPACE_STD } /* namespace std */ #endif /* ** X/Open Extended functions */ #if defined _XOPEN_SOURCE_EXTENDED || !defined _ANSI_C_SOURCE char * gcvt (double __value, int __ndigit, char *__buffer); char * mktemp (char *__template); #endif /* ** DEC C extensions (Alpha only) */ #if !defined(_ANSI_C_SOURCE) && !defined(__VAX) __int64 strtoll(const char *__nptr, char **__endptr, int __base); __int64 strtoq (const char *__nptr, char **__endptr, int __base); unsigned __int64 strtoull(const char *__nptr, char **__endptr, int __base); unsigned __int64 strtouq (const char *__nptr, char **__endptr, int __base); #endif /* ** realpath() ** Not in ANSI standard. ** Optional parameters not in X/Open or Posix specifications. */ #if __CRTL_VER >=80300000 # if defined _POSIX_C_SOURCE || !defined _ANSI_C_SOURCE # if defined _POSIX_C_SOURCE char * realpath (const char * __XOPEN_RESTRICT __file_name, char * __XOPEN_RESTRICT __resolved_name); # else char * realpath (const char * __XOPEN_RESTRICT __file_name, char * __XOPEN_RESTRICT __resolved_name, ...); # endif # if __INITIAL_POINTER_SIZE # pragma __pointer_size 32 char * _realpath32 (const char * __XOPEN_RESTRICT __file_name, char * __XOPEN_RESTRICT __resolved_name, ...); # pragma __pointer_size 64 char * _realpath64 (const char * __XOPEN_RESTRICT __file_name, char * __XOPEN_RESTRICT __resolved_name, ...); # endif /* /POINTER_SIZE */ # endif /* realpath() */ #endif /* __CRTL_VER >=80300000 */ /**************************************************************************** ** ** In addition to the function prototypes above, two additional function ** prototypes are defined. These prototypes are prefixed with "_" and ** have a suffix of either "32" or "64" depending on whether you want to ** use the 32 bit pointer form or the 64 bit pointer form. These ** functions can be used if you have used the /POINTER_SIZE qualifier, ** and you need to explitly call either the 32 or 64 bit pointer form of ** the function. ** ****************************************************************************/ #if __INITIAL_POINTER_SIZE && !defined _ANSI_C_SOURCE /************************************************************************ ** ** 32 Bit Interfaces ** ************************************************************************/ # pragma __pointer_size 32 /* ** ANSI functions */ void * _calloc32 (__size_t, __size_t); void * _malloc32 (__size_t); void * _realloc32 (void *, __size_t); void * _bsearch32 (const void *, const void *, __size_t, __size_t, int (*__compar)(const void *, const void *)); void _qsort32 (void *, __size_t, __size_t, int (*__compar)(const void *, const void *)); double _strtod32 (const char *, char **); long int _strtol32 (const char *, char **, int); unsigned long int _strtoul32 (const char *, char **, int); /* ** X/Open Extended functions */ char * _gcvt32 (double __value, int __ndigit, char *__buffer); char * _mktemp32 (char *); /* ** DEC C extensions (Alpha only) */ __int64 _strtoll32 (const char *, char **, int); __int64 _strtoq32 (const char *, char **, int); unsigned __int64 _strtoull32 (const char *, char **, int); unsigned __int64 _strtouq32 (const char *, char **, int); #if __INITIAL_POINTER_SIZE == 32 #pragma __pointer_size 64 #endif /************************************************************************ ** ** 64 Bit Interfaces ** ************************************************************************/ # pragma __pointer_size 64 /* ** ANSI functions */ void * _calloc64 (__size_t, __size_t); void * _malloc64 (__size_t); void * _realloc64 (void *, __size_t); void * _bsearch64 (const void *, const void *, __size_t, __size_t, int (*__compar)(const void *, const void *)); void _qsort64 (void *, __size_t, __size_t, int (*__compar)(const void *, const void *)); double _strtod64 (const char *, char **); long int _strtol64 (const char *, char **, int); unsigned long int _strtoul64 (const char *, char **, int); /* ** X/Open Extended functions */ char * _gcvt64 (double __value, int __ndigit, char *__buffer); char * _mktemp64 (char *); /* ** DEC C extensions (Alpha only) */ __int64 _strtoll64 (const char *, char **, int); __int64 _strtoq64 (const char *, char **, int); unsigned __int64 _strtoull64 (const char *, char **, int); unsigned __int64 _strtouq64 (const char *, char **, int); #endif /* ** DEC C Performance ** ** Certain DEC C functions are available as compiler builtins. Using ** the builtins offer performance improvements and are enabled here ** for all programs including this header file. */ #if !defined(__VAX) && defined(__DECC) int __ABS (int __j); long int __LABS (long int __j); # define abs(__x) __ABS(__x) # define labs(__x) __LABS(__x) #endif /* ** Restore the users pointer context */ #if __INITIAL_POINTER_SIZE # pragma __pointer_size __restore #endif #ifdef __cplusplus } #endif #pragma __member_alignment __restore #pragma __standard #endif /* __STDLIB_PROCESSED */ #if defined(__NAMESPACE_STD) && !defined(__NAMESPACE_STD_ONLY) # ifndef __USING_STDLIB_NAMES # define __USING_STDLIB_NAMES using std::abort; using std::abs; using std::atexit; using std::atof; using std::atoi; using std::atol; using std::bsearch; using std::calloc; using std::div; using std::div_t; using std::exit; using std::free; using std::getenv; using std::labs; using std::ldiv; using std::ldiv_t; using std::malloc; using std::mblen; using std::mbstowcs; using std::mbtowc; using std::qsort; using std::rand; using std::realloc; using std::size_t; using std::srand; using std::strtod; using std::strtol; using std::strtoul; using std::system; using std::wcstombs; using std::wctomb; # endif #endif #endif /* __STDLIB_LOADED */