// cstdlib standard header
#ifndef _CSTDLIB_
#define _CSTDLIB_

#if defined(__ghs) || defined(__SC3__)
#include <yvals.h>
#include <stdlib.h>

#if defined(__GHS_PRAGMAS)
#pragma ghs start_cxx_lib_header
#pragma ghs startdata
#endif
#if defined(__ghs) && defined(__ghs_max_pack_value)
#pragma pack (push, __ghs_max_pack_value)
#endif

#if !defined(__VXWORKS) && !defined(__OSE)
// These belong here and not in <stdlib.h>, according to ISO C++ standard
#if !defined(__windows) || defined(_MSC_EXTENSIONS)
inline long abs(long _X) 	    {return (labs(_X)); }
#endif
#if !defined (__MSVC_LIB_VERSION) || (__MSVC_LIB_VERSION < 9)
inline ldiv_t div(long _X, long _Y) {return (ldiv(_X, _Y)); }
#endif
#if defined(__LLONG_BIT)
inline long long abs(long long _X)  {return (llabs(_X)); }
inline lldiv_t div(long long _X, long long _Y) {return (lldiv(_X, _Y)); }
#endif
#endif

#if defined(__NAMESPACES) && !defined(__EMBEDDED_CXX_HEADERS)
namespace std {
    using ::size_t;
    using ::div_t;
    using ::ldiv_t;
#if defined(__LLONG_BIT) && !defined(OSE_STDLIB_H)
    using ::lldiv_t;
    using ::llabs;
    using ::lldiv;
    using ::atoll;
    using ::strtoll;
    using ::strtoull;
#endif
    using ::abort;
    using ::abs;
    using ::atexit;
    using ::atoi;
    using ::atol;
    using ::bsearch;
    using ::calloc;
    using ::div;
    using ::exit;
    using ::free;
    using ::getenv;
    using ::labs;
    using ::ldiv;
    using ::malloc;
    using ::mbstowcs;
    using ::qsort;
    using ::rand;
    using ::realloc;
    using ::srand;
    using ::strtol;
    using ::strtoul;
    using ::system;
#if !defined(__NoFloat)
    using ::atof;
    using ::strtod;
#if !(defined(_WIN32) && !defined(__GHS_USE_MINGW_LIBRARY)) && \
	!defined(OSE_STDLIB_H) && !defined(_MC_EXEC)
    using ::strtof;
#endif
#endif	// __NoFloat
    using ::mblen;
    using ::mbtowc;
    using ::wcstombs;
    using ::wctomb;
#if _HAS_CPP11 && defined(__GHS_HAVE_QUICK_EXIT)
    using ::at_quick_exit;
    using ::quick_exit;
#endif /* _HAS_CPP11 && defined(__GHS_HAVE_QUICK_EXIT) */
#if defined(__ghs) && _HAS_CPP17 && !defined(_WIN32)
    using ::aligned_alloc;
#endif
#if defined(__ghs) && !(defined(_WIN32) && \
			    !defined(__GHS_USE_MINGW_LIBRARY)) && \
		      !defined(__VXWORKS) && \
                      !defined(__OSE) && !defined(__sun) && !defined(__LINUX)
    using ::_Exit;
 #if !defined(__NoFloat) && !defined(__NoDouble)
    using ::strtold;
 #endif /* !defined(__NoFloat) && !defined(__NoDouble) */
#endif /* defined(__ghs) && !defined(_WIN32) && !defined(__VXWORKS) && ... */
}
#endif  // __NAMESPACES

#if defined(__ghs) && defined(__ghs_max_pack_value)
#pragma pack(pop)
#endif
#if defined(__GHS_PRAGMAS)
#pragma ghs enddata
#pragma ghs end_cxx_lib_header
#endif

#else /* !__ghs */

#include <yvals.h>

#ifdef _STD_USING
 #undef _STD_USING
  #include <stdlib.h>
 #define _STD_USING

#else /* _STD_USING */
 #include <stdlib.h>
#endif /* _STD_USING */

 #ifdef _GLOBAL_USING

 #if defined(__APPLE__)	/* compiler test */
_C_STD_BEGIN
_C_LIB_DECL
_NO_RETURN(abort(void));
_END_C_LIB_DECL
_C_STD_END
 #endif /* defined(__APPLE__) */

 #if defined(__BORLANDC__)	/* compiler test */
_C_STD_BEGIN
using _STD abs;
_C_STD_END
 #endif /* defined(__BORLANDC__) */

_STD_BEGIN
 #if defined(__SUNPRO_CC) && !defined(__sun)	/* compiler test */ \
	|| defined(__GLIBC__) || defined(__BORLANDC__) \
	|| defined(__MINGW32__) || defined(__APPLE__)
		/* long OVERLOADS */
inline long abs(long _Left)
	{	// compute abs
	return (labs(_Left));
	}

inline ldiv_t div(long _Left, long _Right)
	{	// compute quotient and remainder
	return (ldiv(_Left, _Right));
	}
 #endif /* defined(__SUNPRO_CC) etc. */

using _CSTD size_t; using _CSTD div_t; using _CSTD ldiv_t;

using _CSTD abort; using _CSTD abs; using _CSTD atexit;
using _CSTD atof; 
using _CSTD atoi; using _CSTD atol;
using _CSTD bsearch; using _CSTD calloc; using _CSTD div;
using _CSTD exit; using _CSTD free; using _CSTD getenv;
using _CSTD labs; using _CSTD ldiv; using _CSTD malloc;
using _CSTD mblen; using _CSTD mbstowcs; using _CSTD mbtowc;
using _CSTD qsort; using _CSTD rand; using _CSTD realloc;
using _CSTD srand; 
using _CSTD strtod; 
using _CSTD strtol;
using _CSTD strtoul; using _CSTD system;
using _CSTD wcstombs; using _CSTD wctomb;

using _CSTD lldiv_t;

using _CSTD atoll; using _CSTD llabs; using _CSTD lldiv;
using _CSTD strtof; using _CSTD strtold;
using _CSTD strtoll; using _CSTD strtoull;
using _CSTD _Exit;

 #if _HAS_CPP11
using _CSTD at_quick_exit;
using _CSTD quick_exit;
 #endif /* _HAS_CPP11 */

 #if defined(__ghs) && _HAS_CPP17
using _CSTD aligned_alloc;
 #endif /* _HAS_CPP17 */

_STD_END
 #endif /* _GLOBAL_USING */


#endif /* !__ghs */
#endif /* _CSTDLIB_ */

/*
 * Copyright (c) by P.J. Plauger. All rights reserved.
 * Consult your license regarding permissions and restrictions.
V8.03b/17:0063 */
