Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. // -*- C++ -*- header wrapper
  2.  
  3. // Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
  4. //
  5. // This file is part of the GNU ISO C++ Library.  This library is free
  6. // software; you can redistribute it and/or modify it under the
  7. // terms of the GNU General Public License as published by the
  8. // Free Software Foundation; either version 2, or (at your option)
  9. // any later version.
  10.  
  11. // This library is distributed in the hope that it will be useful,
  12. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. // GNU General Public License for more details.
  15.  
  16. // You should have received a copy of the GNU General Public License along
  17. // with this library; see the file COPYING.  If not, write to the Free
  18. // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  19. // USA.
  20.  
  21. // As a special exception, you may use this file as part of a free software
  22. // library without restriction.  Specifically, if other files instantiate
  23. // templates or use macros or inline functions from this file, or you compile
  24. // this file and link it with other files to produce an executable, this
  25. // file does not by itself cause the resulting executable to be covered by
  26. // the GNU General Public License.  This exception does not however
  27. // invalidate any other reasons why the executable file might be covered by
  28. // the GNU General Public License.
  29.  
  30. //
  31. // ISO C++ 14882: 20.4.6  C library
  32. //
  33.  
  34. // Function decls in this header are overloaded on the
  35. // extern "C"-ness of arguments.  This is a rich ground
  36. // for compiler bugs.
  37.  
  38. #ifndef _CPP_CSTDLIB
  39. #define _CPP_CSTDLIB 1
  40.  
  41. # include <bits/c++config.h>
  42. # include <bits/std_cstddef.h>  
  43.  
  44. namespace _C_legacy {
  45.   extern "C" {
  46. #     define _IN_C_LEGACY_
  47. #     pragma GCC system_header
  48. #     include_next <stdlib.h>
  49.       typedef int (*_C_cmp_fun_ptr)(const void*, const void*);  // C fn ptr
  50.     }
  51.  
  52.   typedef div_t   _CPP_div_t_capture;
  53.   typedef ldiv_t  _CPP_ldiv_t_capture;
  54.  
  55. # if _GLIBCPP_HAVE_LLDIV_T
  56.   typedef lldiv_t  _CPP_lldiv_t_capture;
  57. # endif
  58. } // namespace _C_legacy
  59.  
  60. #  undef wchar_t
  61. #  undef div_t
  62. #  undef ldiv_t
  63.  
  64. #  undef atof
  65. #  undef atoi
  66. #  undef atol
  67. #  undef strtod
  68. #  undef strtol
  69. #  undef strtoul
  70. #ifdef _GLIBCPP_HAVE_STRTOLD
  71. #  undef strtold
  72. #endif
  73. #  undef rand
  74. #  undef srand
  75. #  undef calloc
  76. #  undef free
  77. #  undef malloc
  78. #  undef realloc
  79. #  undef abort
  80. #  undef atexit
  81. #  undef exit
  82. #  undef getenv
  83. #  undef system
  84. #  undef bsearch
  85. #  undef qsort
  86. #  undef abs
  87. #  undef div
  88. #  undef labs
  89. #  undef ldiv
  90. #ifdef _GLIBCPP_USE_LONG_LONG
  91. #  undef llabs
  92. #  undef lldiv
  93. #endif
  94. #  undef mblen
  95. #  undef mbtowc
  96. #  undef wctomb
  97. #  undef mbstowcs
  98. #  undef wcstombs
  99.  
  100. namespace std {
  101.   struct div_t : _C_legacy::_CPP_div_t_capture { };
  102.   struct ldiv_t : _C_legacy::_CPP_ldiv_t_capture { };
  103.  
  104. #ifdef _GLIBCPP_USE_LONG_LONG
  105. # ifdef _GLIBCPP_HAVE_LLDIV_T
  106.   struct lldiv_t : _C_legacy::_CPP_lldiv_t_capture { };
  107. # else
  108.   struct lldiv_t
  109.   {
  110.     long long quot;
  111.     long long rem;
  112.   };
  113. # endif
  114. #endif
  115.  
  116.   using _C_legacy::atof;
  117.   using _C_legacy::atoi;
  118.   using _C_legacy::atol;
  119.   using _C_legacy::strtod;
  120.   using _C_legacy::strtol;
  121.   using _C_legacy::strtoul;
  122.   using _C_legacy::rand;
  123.   using _C_legacy::srand;
  124.   using _C_legacy::calloc;
  125.   using _C_legacy::free;
  126.   using _C_legacy::malloc;
  127.   using _C_legacy::realloc;
  128.  
  129.   //  using _C_legacy::abort;
  130.   using _C_legacy::atexit;
  131.   //  using _C_legacy::exit;
  132.   using _C_legacy::bsearch;
  133.   using _C_legacy::qsort;
  134.  
  135.   using _C_legacy::getenv;
  136.   using _C_legacy::system;
  137.   using _C_legacy::mbtowc;
  138.   using _C_legacy::wctomb;
  139.   using _C_legacy::mbstowcs;
  140.   using _C_legacy::wcstombs;
  141.  
  142.   using _C_legacy::strtof;
  143.  
  144. #ifdef _GLIBCPP_USE_LONG_LONG
  145.   using _C_legacy::strtoll;
  146.   using _C_legacy::strtoull;
  147. #endif
  148.  
  149. #ifdef _GLIBCPP_HAVE_STRTOLD
  150.   using _C_legacy::strtold;
  151. #endif
  152.  
  153.   using _C_legacy::mblen;
  154.  
  155.   inline int
  156.   abs(int __x) { return __x >= 0 ? __x : -__x; }
  157.  
  158.   inline div_t
  159.   div(int __n, int __d)
  160.   { div_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
  161.  
  162.   inline long
  163.   labs(long __x) { return __x >= 0 ? __x : -__x; }
  164.  
  165.   inline long
  166.   abs(long __x) { return __x >= 0 ? __x : -__x; }
  167.  
  168.   inline ldiv_t
  169.   ldiv(long __n, long __d)
  170.   { ldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
  171.  
  172.   inline ldiv_t
  173.   div(long __n, long __d)
  174.   { ldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
  175.  
  176. #ifdef _GLIBCPP_USE_LONG_LONG
  177.   inline long long
  178.   llabs(long long __x) { return __x >= 0 ? __x : -__x; }
  179.  
  180.   inline long long
  181.   abs(long long __x) { return __x >= 0 ? __x : -__x; }
  182.  
  183.   inline lldiv_t
  184.   lldiv(long long __n, long long __d)
  185.   { lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
  186.  
  187.   inline lldiv_t
  188.   div(long long __n, long long __d)
  189.   { lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
  190. #endif
  191. } // namespace std
  192.  
  193. # undef _IN_C_LEGACY_
  194.  
  195. #endif
  196.  
  197.  
  198.