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