epoc32/include/tools/stlport/stl/_cstdlib.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
/*
williamr@2
     2
 * Copyright (c) 1999
williamr@2
     3
 * Boris Fomitchev
williamr@2
     4
 *
williamr@2
     5
 * This material is provided "as is", with absolutely no warranty expressed
williamr@2
     6
 * or implied. Any use is at your own risk.
williamr@2
     7
 *
williamr@2
     8
 * Permission to use or copy this software for any purpose is hereby granted
williamr@2
     9
 * without fee, provided the above notices are retained on all copies.
williamr@2
    10
 * Permission to modify the code and to distribute modified code is granted,
williamr@2
    11
 * provided the above notices are retained, and a notice that the code was
williamr@2
    12
 * modified is included with the above copyright notice.
williamr@2
    13
 *
williamr@2
    14
 */
williamr@2
    15
williamr@2
    16
#ifndef _STLP_INTERNAL_CSTDLIB
williamr@2
    17
#define _STLP_INTERNAL_CSTDLIB
williamr@2
    18
williamr@2
    19
#if defined (_STLP_USE_NEW_C_HEADERS)
williamr@2
    20
#  include _STLP_NATIVE_CPP_C_HEADER(cstdlib)
williamr@2
    21
#else
williamr@2
    22
#  include <stdlib.h>
williamr@2
    23
#endif
williamr@2
    24
williamr@2
    25
#if defined (__BORLANDC__)
williamr@2
    26
/* Borland process.h header do not bring anything here and is just included
williamr@2
    27
 * in order to avoid inclusion later. This header cannot be included later
williamr@2
    28
 * because Borland compiler consider that for instance the abort function
williamr@2
    29
 * defined as extern "C" cannot be overloaded and it finds 2 "overloads",
williamr@2
    30
 * once in native std namespace and the other in STLport namespace...
williamr@2
    31
 */
williamr@2
    32
#  include <process.h>
williamr@2
    33
#endif
williamr@2
    34
williamr@2
    35
/* on evc3/evc4 including stdlib.h also defines setjmp macro */
williamr@2
    36
#if defined (_STLP_WCE)
williamr@2
    37
#  define _STLP_NATIVE_SETJMP_H_INCLUDED
williamr@2
    38
#endif
williamr@2
    39
williamr@2
    40
#if defined (__MSL__) && (__MSL__ <= 0x5003)
williamr@2
    41
namespace std {
williamr@2
    42
  typedef ::div_t div_t;
williamr@2
    43
  typedef ::ldiv_t ldiv_t;
williamr@2
    44
#  ifdef __MSL_LONGLONG_SUPPORT__
williamr@2
    45
  typedef ::lldiv_t lldiv_t;
williamr@2
    46
#  endif
williamr@2
    47
}
williamr@2
    48
#endif
williamr@2
    49
williamr@2
    50
#ifdef _STLP_IMPORT_VENDOR_CSTD
williamr@2
    51
_STLP_BEGIN_NAMESPACE
williamr@2
    52
using _STLP_VENDOR_CSTD::div_t;
williamr@2
    53
using _STLP_VENDOR_CSTD::ldiv_t;
williamr@2
    54
using _STLP_VENDOR_CSTD::size_t;
williamr@2
    55
williamr@2
    56
#  ifndef _STLP_NO_CSTD_FUNCTION_IMPORTS
williamr@2
    57
#    ifndef _STLP_WCE
williamr@2
    58
// these functions just don't exist on Windows CE
williamr@2
    59
using _STLP_VENDOR_CSTD::abort;
williamr@2
    60
using _STLP_VENDOR_CSTD::getenv;
williamr@2
    61
using _STLP_VENDOR_CSTD::mblen;
williamr@2
    62
using _STLP_VENDOR_CSTD::mbtowc;
williamr@2
    63
using _STLP_VENDOR_CSTD::system;
williamr@2
    64
using _STLP_VENDOR_CSTD::bsearch;
williamr@2
    65
#    endif
williamr@2
    66
using _STLP_VENDOR_CSTD::atexit;
williamr@2
    67
using _STLP_VENDOR_CSTD::exit;
williamr@2
    68
using _STLP_VENDOR_CSTD::calloc;
williamr@2
    69
using _STLP_VENDOR_CSTD::free;
williamr@2
    70
using _STLP_VENDOR_CSTD::malloc;
williamr@2
    71
using _STLP_VENDOR_CSTD::realloc;
williamr@2
    72
using _STLP_VENDOR_CSTD::atof;
williamr@2
    73
using _STLP_VENDOR_CSTD::atoi;
williamr@2
    74
using _STLP_VENDOR_CSTD::atol;
williamr@2
    75
using _STLP_VENDOR_CSTD::mbstowcs;
williamr@2
    76
using _STLP_VENDOR_CSTD::strtod;
williamr@2
    77
using _STLP_VENDOR_CSTD::strtol;
williamr@2
    78
using _STLP_VENDOR_CSTD::strtoul;
williamr@2
    79
williamr@2
    80
#    if !(defined (_STLP_NO_NATIVE_WIDE_STREAMS) || defined (_STLP_NO_MBSTATE_T))
williamr@2
    81
using _STLP_VENDOR_CSTD::wcstombs;
williamr@2
    82
#      ifndef _STLP_WCE
williamr@2
    83
using _STLP_VENDOR_CSTD::wctomb;
williamr@2
    84
#      endif
williamr@2
    85
#    endif
williamr@2
    86
using _STLP_VENDOR_CSTD::qsort;
williamr@2
    87
using _STLP_VENDOR_CSTD::labs;
williamr@2
    88
using _STLP_VENDOR_CSTD::ldiv;
williamr@2
    89
#    if defined (_STLP_LONG_LONG) && !defined (_STLP_NO_VENDOR_STDLIB_L)
williamr@2
    90
#      if !defined(__sun)
williamr@2
    91
using _STLP_VENDOR_CSTD::llabs;
williamr@2
    92
using _STLP_VENDOR_CSTD::lldiv_t;
williamr@2
    93
using _STLP_VENDOR_CSTD::lldiv;
williamr@2
    94
#      else
williamr@2
    95
using ::llabs;
williamr@2
    96
using ::lldiv_t;
williamr@2
    97
using ::lldiv;
williamr@2
    98
#      endif
williamr@2
    99
#    endif
williamr@2
   100
using _STLP_VENDOR_CSTD::rand;
williamr@2
   101
using _STLP_VENDOR_CSTD::srand;
williamr@2
   102
#  endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */
williamr@2
   103
_STLP_END_NAMESPACE
williamr@2
   104
#endif /* _STLP_IMPORT_VENDOR_CSTD */
williamr@2
   105
williamr@2
   106
#if defined (__BORLANDC__) && defined (_STLP_USE_NEW_C_HEADERS)
williamr@2
   107
//In this config bcc define everything in std namespace and not in
williamr@2
   108
//the global one.
williamr@2
   109
inline int abs(int __x) { return _STLP_VENDOR_CSTD::abs(__x); }
williamr@2
   110
inline _STLP_VENDOR_CSTD::div_t div(int __x, int __y) { return _STLP_VENDOR_CSTD::div(__x, __y); }
williamr@2
   111
#endif
williamr@2
   112
williamr@2
   113
#if defined(_MSC_EXTENSIONS) && defined(_STLP_MSVC) && (_STLP_MSVC <= 1300)
williamr@2
   114
#  define _STLP_RESTORE_FUNCTION_INTRINSIC
williamr@2
   115
#  pragma warning (push)
williamr@2
   116
#  pragma warning (disable: 4162)
williamr@2
   117
#  pragma function (abs)
williamr@2
   118
#endif
williamr@2
   119
williamr@2
   120
//HP-UX native lib has abs() and div() functions in global namespace
williamr@2
   121
#if !defined (__HP_aCC) || (__HP_aCC < 30000)
williamr@2
   122
williamr@2
   123
//MSVC starting with .Net 2003 already define all math functions in global namespace:
williamr@2
   124
#  if !defined (_STLP_MSVC_LIB) || (_STLP_MSVC_LIB < 1310) || defined(UNDER_CE)
williamr@2
   125
inline long abs(long __x) { return _STLP_VENDOR_CSTD::labs(__x); }
williamr@2
   126
#  endif
williamr@2
   127
williamr@2
   128
/** VC since version 8 has this, the platform SDK and CE SDKs hanging behind. */
williamr@2
   129
#  if !defined (_STLP_MSVC_LIB) || (_STLP_MSVC_LIB < 1400) || defined (_STLP_USING_PLATFORM_SDK_COMPILER) || defined(UNDER_CE)
williamr@2
   130
inline _STLP_VENDOR_CSTD::ldiv_t div(long __x, long __y) { return _STLP_VENDOR_CSTD::ldiv(__x, __y); }
williamr@2
   131
#  endif
williamr@2
   132
williamr@2
   133
#endif
williamr@2
   134
williamr@2
   135
#if defined (_STLP_RESTORE_FUNCTION_INTRINSIC)
williamr@2
   136
#  pragma intrinsic (abs)
williamr@2
   137
#  pragma warning (pop)
williamr@2
   138
#  undef _STLP_RESTORE_FUNCTION_INTRINSIC
williamr@2
   139
#endif
williamr@2
   140
williamr@2
   141
#if defined (_STLP_LONG_LONG)
williamr@2
   142
#  if !defined (_STLP_NO_VENDOR_STDLIB_L)
williamr@2
   143
#    if !defined (__sun)
williamr@2
   144
inline _STLP_LONG_LONG  abs(_STLP_LONG_LONG __x) { return _STLP_VENDOR_CSTD::llabs(__x); }
williamr@2
   145
inline lldiv_t div(_STLP_LONG_LONG __x, _STLP_LONG_LONG __y) { return _STLP_VENDOR_CSTD::lldiv(__x, __y); }
williamr@2
   146
#    else
williamr@2
   147
inline _STLP_LONG_LONG  abs(_STLP_LONG_LONG __x) { return ::llabs(__x); }
williamr@2
   148
inline lldiv_t div(_STLP_LONG_LONG __x, _STLP_LONG_LONG __y) { return ::lldiv(__x, __y); }
williamr@2
   149
#    endif
williamr@2
   150
#  else
williamr@2
   151
inline _STLP_LONG_LONG  abs(_STLP_LONG_LONG __x) { return __x < 0 ? -__x : __x; }
williamr@2
   152
#  endif
williamr@2
   153
#endif
williamr@2
   154
williamr@2
   155
/* C++ Standard is unclear about several call to 'using ::func' if new overloads
williamr@2
   156
 * of ::func appears between 2 successive 'using' calls. To avoid this potential
williamr@2
   157
 * problem we provide all abs overload before the 'using' call.
williamr@2
   158
 * Beware: This header inclusion has to be after all abs overload of this file.
williamr@2
   159
 *         The first 'using ::abs' call is going to be in the other header.
williamr@2
   160
 */
williamr@2
   161
#ifndef _STLP_INTERNAL_CMATH
williamr@2
   162
#  include <stl/_cmath.h>
williamr@2
   163
#endif
williamr@2
   164
williamr@2
   165
#if defined (_STLP_IMPORT_VENDOR_CSTD) && !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
williamr@2
   166
// ad hoc, don't replace with _STLP_VENDOR_CSTD::abs here! - ptr 2005-03-05
williamr@2
   167
_STLP_BEGIN_NAMESPACE
williamr@2
   168
using ::abs;
williamr@2
   169
#  if !defined (N_PLAT_NLM)
williamr@2
   170
using ::div;
williamr@2
   171
#  else
williamr@2
   172
// Don't use div from clib or libc on NetWare---buggy! - ptr 2005-06-06
williamr@2
   173
inline div_t div(int __x, int __y) { div_t d; d.quot = __x / __y; d.rem = __x % __y; return d; }
williamr@2
   174
inline ldiv_t div(long __x, long __y) { ldiv_t d; d.quot = __x / __y; d.rem = __x % __y; return d; }
williamr@2
   175
#  endif
williamr@2
   176
_STLP_END_NAMESPACE
williamr@2
   177
#endif
williamr@2
   178
williamr@2
   179
#endif /* _STLP_INTERNAL_CSTDLIB */