Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

std_cstdlib.h

Go to the documentation of this file.
00001 // -*- C++ -*- forwarding header.
00002 
00003 // Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
00004 //
00005 // This file is part of the GNU ISO C++ Library.  This library is free
00006 // software; you can redistribute it and/or modify it under the
00007 // terms of the GNU General Public License as published by the
00008 // Free Software Foundation; either version 2, or (at your option)
00009 // any later version.
00010 
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 // GNU General Public License for more details.
00015 
00016 // You should have received a copy of the GNU General Public License along
00017 // with this library; see the file COPYING.  If not, write to the Free
00018 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
00019 // USA.
00020 
00021 // As a special exception, you may use this file as part of a free software
00022 // library without restriction.  Specifically, if other files instantiate
00023 // templates or use macros or inline functions from this file, or you compile
00024 // this file and link it with other files to produce an executable, this
00025 // file does not by itself cause the resulting executable to be covered by
00026 // the GNU General Public License.  This exception does not however
00027 // invalidate any other reasons why the executable file might be covered by
00028 // the GNU General Public License.
00029 
00030 //
00031 // ISO C++ 14882: 20.4.6  C library
00032 //
00033 
00034 // Note: This is not a conforming implementation.
00035 
00036 #ifndef _CPP_CSTDLIB
00037 #define _CPP_CSTDLIB 1
00038 
00039 #include <bits/c++config.h>
00040 #include <bits/std_cstddef.h>
00041 
00042 #pragma GCC system_header
00043 #include <stdlib.h>
00044 
00045 // Get rid of those macros defined in <stdlib.h> in lieu of real functions.
00046 #undef atof
00047 #undef atoi
00048 #undef atol
00049 #undef strtod
00050 #undef strtof
00051 #undef strtol
00052 #undef strtoul
00053 #undef rand
00054 #undef srand
00055 #undef calloc
00056 #undef free
00057 #undef malloc
00058 #undef realloc
00059 #undef abort
00060 #undef atexit
00061 #undef exit
00062 #undef _Exit
00063 #undef getenv
00064 #undef system
00065 #undef bsearch
00066 #undef qsort
00067 #undef abs
00068 #undef labs
00069 #undef llabs
00070 #undef div
00071 #undef ldiv
00072 #undef lldiv
00073 #undef mblen
00074 #undef mbtowc
00075 #undef wctomb
00076 #undef mbstowcs
00077 #undef wcstombs
00078 #undef atoll
00079 #undef strtoll
00080 #undef strtoull
00081 #undef strtold
00082 
00083 namespace std 
00084 {
00085   using ::div_t;
00086   using ::ldiv_t;
00087 
00088   extern "C" double atof(const char*); 
00089   extern "C" int atoi(const char*); 
00090   extern "C" long int atol(const char*); 
00091   extern "C" double strtod(const char*, char**); 
00092   extern "C" float strtof(const char*, char**); 
00093   extern "C" long int strtol(const char*, char**, int); 
00094   extern "C" unsigned long int strtoul(const char*, char**, int);
00095   extern "C" int rand(void); 
00096   extern "C" void srand(unsigned int); 
00097   extern "C" void* calloc(size_t, size_t); 
00098   extern "C" void free(void*); 
00099   extern "C" void* malloc(size_t); 
00100   extern "C" void* realloc(void*, size_t); 
00101   extern "C" void abort(void); 
00102   extern "C" int atexit(void (*func)(void)); 
00103   extern "C" void exit(int); 
00104   extern "C" void _Exit(int); 
00105   extern "C" char*getenv(const char*); 
00106   extern "C" int system(const char*); 
00107   extern "C" void* bsearch(const void*, const void*, size_t, size_t, 
00108                int (*comp)(const void *, const void *)); 
00109   extern "C" void qsort(void*, size_t, size_t, 
00110             int (*comp)(const void *, const void *)); 
00111   extern "C" int abs(int); 
00112   extern "C" long int labs(long int); 
00113   extern "C" div_t div(int, int); 
00114   extern "C" ldiv_t ldiv(long int, long int); 
00115   extern "C" int mblen(const char*, size_t); 
00116   extern "C" int mbtowc(wchar_t*, const char*, size_t); 
00117   extern "C" int wctomb(char*, wchar_t); 
00118   extern "C" size_t mbstowcs(wchar_t*, const char*, size_t); 
00119   extern "C" size_t wcstombs(char*, const wchar_t*, size_t);
00120 
00121   inline long 
00122   abs(long __i) { return ::labs(__i); }
00123 
00124   inline ldiv_t
00125   div(long __i, long __j) { return ::ldiv(__i, __j); }
00126 } // namespace std
00127 
00128 #if _GLIBCPP_USE_C99
00129 namespace c99
00130 {
00131   using ::lldiv_t;
00132 
00133   inline long long 
00134   abs(long long __x) { return __x >= 0 ? __x : -__x; }
00135 
00136   inline long long 
00137   llabs(long long __x) { return __x >= 0 ? __x : -__x; }
00138 
00139   inline lldiv_t 
00140   div(long long __n, long long __d)
00141   { lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
00142 
00143   inline lldiv_t 
00144   lldiv(long long __n, long long __d)
00145   { lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
00146 
00147   extern "C" long long int atoll(const char*); 
00148   extern "C" long long int strtoll(const char*, char**, int); 
00149   extern "C" unsigned long long int strtoull(const char*, char**, int); 
00150 
00151 #ifdef _GLIBCPP_HAVE_STRTOLD
00152   extern "C" long double strtold(const char*, char**); 
00153 #endif
00154 } // namespace c99
00155 
00156 namespace std
00157 {
00158   using c99::lldiv_t;
00159   using c99::abs;
00160   //using c99::llabs; // XXX ???
00161   using c99::div;
00162   using c99::lldiv;
00163   using c99::atoll;
00164   using c99::strtoll;
00165   using c99::strtoull;
00166 #ifdef _GLIBCPP_HAVE_STRTOLD
00167   using c99::strtold;
00168 #endif
00169 }
00170 #endif
00171 
00172 #endif 

Generated at Tue May 1 16:28:38 2001 for libstdc++-v3 by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001