home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / stl453up.zip / stl453fx / stlport / cstdlib < prev    next >
Text File  |  2002-04-29  |  3KB  |  115 lines

  1. /*
  2.  * Copyright (c) 1999 
  3.  * Boris Fomitchev
  4.  *
  5.  * This material is provided "as is", with absolutely no warranty expressed
  6.  * or implied. Any use is at your own risk.
  7.  *
  8.  * Permission to use or copy this software for any purpose is hereby granted 
  9.  * without fee, provided the above notices are retained on all copies.
  10.  * Permission to modify the code and to distribute modified code is granted,
  11.  * provided the above notices are retained, and a notice that the code was
  12.  * modified is included with the above copyright notice.
  13.  *
  14.  */
  15.  
  16. #ifndef _STLP_CSTDLIB
  17. # define _STLP_CSTDLIB
  18.  
  19. # ifndef _STLP_OUTERMOST_HEADER_ID
  20. #  define _STLP_OUTERMOST_HEADER_ID 0x116
  21. #  include <stl/_prolog.h>
  22. # endif
  23.  
  24. # if defined (_STLP_USE_NEW_C_HEADERS)
  25. #  include _STLP_NATIVE_CPP_C_HEADER(cstdlib)
  26. # else
  27. #  include _STLP_NATIVE_C_HEADER(stdlib.h)
  28. # endif
  29.  
  30. # if defined( __MSL__ ) && __MSL__ <= 0x5003
  31. namespace std {
  32.     typedef ::div_t div_t;
  33.     typedef ::ldiv_t ldiv_t;
  34. #  ifdef __MSL_LONGLONG_SUPPORT__
  35.     typedef ::lldiv_t lldiv_t;
  36. #  endif
  37. }
  38. # endif
  39.  
  40. # ifdef _STLP_IMPORT_VENDOR_CSTD 
  41. _STLP_BEGIN_NAMESPACE
  42. using _STLP_VENDOR_CSTD::div_t;
  43. using _STLP_VENDOR_CSTD::ldiv_t;
  44. using _STLP_VENDOR_CSTD::size_t;
  45.  
  46. #  ifndef _STLP_NO_CSTD_FUNCTION_IMPORTS
  47. using _STLP_VENDOR_CSTD::abort;
  48. using _STLP_VENDOR_CSTD::atexit;
  49. using _STLP_VENDOR_CSTD::exit;
  50. using _STLP_VENDOR_CSTD::getenv;
  51. using _STLP_VENDOR_CSTD::calloc;
  52. using _STLP_VENDOR_CSTD::free;
  53. using _STLP_VENDOR_CSTD::malloc;
  54. using _STLP_VENDOR_CSTD::realloc;
  55. using _STLP_VENDOR_CSTD::atof;
  56. using _STLP_VENDOR_CSTD::atoi;
  57. using _STLP_VENDOR_CSTD::atol;
  58. using _STLP_VENDOR_CSTD::mblen;
  59. using _STLP_VENDOR_CSTD::mbstowcs;
  60. using _STLP_VENDOR_CSTD::mbtowc;
  61. using _STLP_VENDOR_CSTD::strtod;
  62. using _STLP_VENDOR_CSTD::strtol;
  63. using _STLP_VENDOR_CSTD::strtoul;
  64. using _STLP_VENDOR_CSTD::system;
  65.  
  66. #if ! (defined (_STLP_NO_NATIVE_WIDE_STREAMS) || defined (_STLP_NO_MBSTATE_T) )
  67. using _STLP_VENDOR_CSTD::wcstombs;
  68. using _STLP_VENDOR_CSTD::wctomb;
  69. #endif
  70. using _STLP_VENDOR_CSTD::bsearch;
  71. using _STLP_VENDOR_CSTD::qsort;
  72. // boris : if we do not have native float abs, we define ours; then we cannot do "using" for "other" abs 
  73. # ifdef _STLP_HAS_NATIVE_FLOAT_ABS 
  74. using _STLP_VENDOR_CSTD::abs;
  75. # endif
  76. using _STLP_VENDOR_CSTD::div;
  77. using _STLP_VENDOR_CSTD::labs;
  78. using _STLP_VENDOR_CSTD::ldiv;
  79. using _STLP_VENDOR_CSTD::rand;
  80. using _STLP_VENDOR_CSTD::srand;
  81. #  endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */
  82. _STLP_END_NAMESPACE
  83. #endif /* _STLP_IMPORT_VENDOR_CSTD */
  84.  
  85. _STLP_BEGIN_NAMESPACE
  86.  
  87. # ifdef _STLP_HAS_NO_NEW_C_HEADERS
  88. # if !defined ( _STLP_LABS )
  89. inline long   abs(long __x) { return _STLP_VENDOR_CSTD::labs(__x); }
  90. # endif
  91. # if !defined ( _STLP_LDIV )
  92. inline ldiv_t div(long __x, long __y) { return _STLP_VENDOR_CSTD::ldiv(__x, __y); } 
  93. # endif
  94. # endif
  95.  
  96. #  if defined ( _STLP_LLABS )
  97. _STLP_LONG_LONG   abs(_STLP_LONG_LONG __x) { return _STLP_VENDOR_CSTD::_STLP_LLABS(__x); }
  98. #  endif
  99. #  if defined ( _STLP_LLDIV )
  100. _STLP_LLDIV_T div(_STLP_LONG_LONG __x, _STLP_LONG_LONG __y) { return _STLP_VENDOR_CSTD::_STLP_LLDIV(__x, __y); } 
  101. #  endif
  102.  
  103. _STLP_END_NAMESPACE
  104.  
  105. # if (_STLP_OUTERMOST_HEADER_ID == 0x116)
  106. #  include <stl/_epilog.h>
  107. #  undef _STLP_OUTERMOST_HEADER_ID
  108. # endif
  109.  
  110. #endif /* _STLP_CSTDLIB */
  111.  
  112. // Local Variables:
  113. // mode:C++
  114. // End:
  115.