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. #ifndef _CPP_CSTRING
  35. #define _CPP_CSTRING 1
  36.  
  37. # if defined __GLIBC__ && __GLIBC__ >= 2
  38. // We must not see the optimized string functions GNU libc defines.
  39. #  define __NO_STRING_INLINES
  40. # endif
  41.  
  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 <string.h>
  49.   }
  50.  
  51.   // We do inline captures of most of these in case they
  52.   // have been optimized with macros.  
  53.   inline void*
  54.   _CPP_memcpy_capture(void* __s1, void const* __s2, size_t __n)
  55.   { return memcpy(__s1, __s2, __n); }
  56.  
  57.   inline void*
  58.   _CPP_memmove_capture(void* __s1, void const* __s2, size_t __n)
  59.   { return memmove(__s1, __s2, __n); }
  60.  
  61.   inline void*
  62.   _CPP_strcpy_capture(char* __s1, char const* __s2)
  63.   { return strcpy(__s1, __s2); }
  64.  
  65.   inline char*
  66.   _CPP_strncpy_capture(char* __s1, char const* __s2, size_t __n)
  67.   { return strncpy(__s1, __s2, __n); }
  68.  
  69.   inline char*
  70.   _CPP_strcat_capture(char* __s1, char const* __s2)
  71.   { return strcat(__s1, __s2); }
  72.  
  73.   inline char*
  74.   _CPP_strncat_capture(char* __s1, char const* __s2, size_t __n)
  75.   { return strncat(__s1, __s2, __n); }
  76.  
  77.   inline int
  78.   _CPP_memcmp_capture(void const* __s1, void const* __s2, size_t __n)
  79.   { return memcmp(__s1, __s2, __n); }
  80.  
  81.   inline int
  82.   _CPP_strcmp_capture(char const* __s1, char const* __s2)
  83.   { return strcmp(__s1, __s2); }
  84.  
  85.   inline int
  86.   _CPP_strcoll_capture(char const* __s1, char const* __s2)
  87.   { return strcoll(__s1, __s2); }
  88.  
  89.   inline int
  90.   _CPP_strncmp_capture(char const* __s1, char const* __s2, size_t __n)
  91.   { return strncmp(__s1, __s2, __n); }
  92.  
  93.   inline size_t
  94.   _CPP_strxfrm_capture(char* __b, char const* __s, size_t __n)
  95.   { return strxfrm(__b, __s, __n); }
  96.  
  97.   inline void*
  98.   _CPP_memchr_capture(void const* __s1, int __c, size_t __n)
  99.   { return memchr(__s1, __c, __n); }
  100.  
  101.   inline char*
  102.   _CPP_strchr_capture(char const* __s1, int __c)
  103.   { return strchr(__s1, __c); }
  104.  
  105.   inline size_t
  106.   _CPP_strcspn_capture(char const* __s1, char const* __s2)
  107.   { return strcspn(__s1, __s2); }
  108.  
  109.   inline char*
  110.   _CPP_strpbrk_capture(char const* __s1, char const* __s2)
  111.   { return strpbrk(__s1, __s2); }
  112.  
  113.   inline char*
  114.   _CPP_strrchr_capture(char const* __s1, int __c)
  115.   { return strrchr(__s1, __c); }
  116.  
  117.   inline size_t
  118.   _CPP_strspn_capture(char const* __s1, char const* __s2)
  119.   { return strspn(__s1, __s2); }
  120.  
  121.   inline char*
  122.   _CPP_strstr_capture(char const* __s1, char const* __s2)
  123.   { return strstr(__s1, __s2); }
  124.  
  125.   inline char*
  126.   _CPP_strtok_capture(char* __s1, char const* __s2)
  127.   { return strtok(__s1, __s2); }
  128.  
  129.   inline void*
  130.   _CPP_memset_capture(void* __s, int __c, size_t __n)
  131.   { return memset(__s, __c, __n); }
  132.  
  133.   // inline char*
  134.   // _CPP_strerror_capture(int __num)
  135.   // { return strerror(__num); }
  136.  
  137.   inline size_t
  138.   _CPP_strlen_capture(char const* __s)
  139.   { return strlen(__s); }
  140. } // namespace _C_legacy
  141.  
  142. # undef memcpy
  143. # undef memmove
  144. # undef strcpy
  145. # undef strncpy
  146. # undef strcat
  147. # undef strncat
  148. # undef memcmp
  149. # undef strcmp
  150. # undef strcoll
  151. # undef strncmp
  152. # undef strxfrm
  153. # undef memchr
  154. # undef strchr
  155. # undef strcspn
  156. # undef strpbrk
  157. # undef strrchr
  158. # undef strspn
  159. # undef strstr
  160. # undef strtok
  161. # undef memset
  162. # undef strerror
  163. # undef strlen
  164.  
  165. namespace std {
  166.   // Redefine most of these inline.  Note that the
  167.   // C++ definition differs from C in some cases.
  168.   inline void*
  169.   memcpy(void* __s1, void const* __s2, size_t __n)
  170.   { return _C_legacy::_CPP_memcpy_capture(__s1, __s2, __n); }
  171.  
  172.   inline void*
  173.   memmove(void* __s1, void const* __s2, size_t __n)
  174.   { return _C_legacy::_CPP_memmove_capture(__s1, __s2, __n); }
  175.  
  176.   inline void*
  177.   strcpy(char* __s1, char const* __s2)
  178.   { return _C_legacy::_CPP_strcpy_capture(__s1, __s2); }
  179.  
  180.   inline char*
  181.   strncpy(char* __s1, char const* __s2, size_t __n)
  182.   { return _C_legacy::_CPP_strncpy_capture(__s1, __s2, __n); }
  183.  
  184.   inline char*
  185.   strcat(char* __s1, char const* __s2)
  186.   { return _C_legacy::_CPP_strcat_capture(__s1, __s2); }
  187.  
  188.   inline char*
  189.   strncat(char* __s1, char const* __s2, size_t __n)
  190.   { return _C_legacy::_CPP_strncat_capture(__s1, __s2, __n); }
  191.  
  192.   inline int
  193.   memcmp(void const* __s1, void const* __s2, size_t __n)
  194.   { return _C_legacy::_CPP_memcmp_capture(__s1, __s2, __n); }
  195.  
  196.   inline int
  197.   strcmp(char const* __s1, char const* __s2)
  198.   { return _C_legacy::_CPP_strcmp_capture(__s1, __s2); }
  199.  
  200.   inline int
  201.   strcoll(char const* __s1, char const* __s2)
  202.   { return _C_legacy::_CPP_strcoll_capture(__s1, __s2); }
  203.  
  204.   inline int
  205.   strncmp(char const* __s1, char const* __s2, size_t __n)
  206.   { return _C_legacy::_CPP_strncmp_capture(__s1, __s2, __n); }
  207.  
  208.   inline size_t
  209.   strxfrm(char* __b, char const* __s, size_t __n)
  210.   { return _C_legacy::_CPP_strxfrm_capture(__b, __s, __n); }
  211.  
  212.   inline void
  213.   const* memchr(void const* __s1, int __c, size_t __n)
  214.   { return _C_legacy::_CPP_memchr_capture(__s1, __c, __n); }
  215.  
  216.   inline void*
  217.   memchr(void* __s1, int __c, size_t __n)
  218.   { return _C_legacy::_CPP_memchr_capture(__s1, __c, __n); }
  219.  
  220.   inline char const*
  221.   strchr(char const* __s1, int __c)
  222.   { return _C_legacy::_CPP_strchr_capture(__s1, __c); }
  223.  
  224.   inline char*
  225.   strchr(char* __s1, int __c)
  226.   { return _C_legacy::_CPP_strchr_capture(__s1, __c); }
  227.  
  228.   inline size_t
  229.   strcspn(char const* __s1, char const* __s2)
  230.   { return _C_legacy::_CPP_strcspn_capture(__s1, __s2); }
  231.  
  232.   inline char const*
  233.   strpbrk(char const* __s1, char const* __s2)
  234.   { return _C_legacy::_CPP_strpbrk_capture(__s1, __s2); }
  235.  
  236.   inline char*
  237.   strpbrk(char* __s1, char const* __s2)
  238.   { return _C_legacy::_CPP_strpbrk_capture(__s1, __s2); }
  239.  
  240.   inline char const*
  241.   strrchr(char const* __s1, int __c)
  242.   { return _C_legacy::_CPP_strrchr_capture(__s1, __c); }
  243.  
  244.   inline char*
  245.   strrchr(char* __s1, int __c)
  246.   { return _C_legacy::_CPP_strrchr_capture(__s1, __c); }
  247.  
  248.   inline size_t
  249.   strspn(char const* __s1, char const* __s2)
  250.   { return _C_legacy::_CPP_strspn_capture(__s1, __s2); }
  251.  
  252.   inline char const*
  253.   strstr(char const* __s1, char const* __s2)
  254.   { return _C_legacy::_CPP_strstr_capture(__s1, __s2); }
  255.  
  256.   inline char*
  257.   strstr(char* __s1, char const* __s2)
  258.   { return _C_legacy::_CPP_strstr_capture(__s1, __s2); }
  259.  
  260.   inline char*
  261.   strtok(char* __s1, char const* __s2)
  262.   { return _C_legacy::_CPP_strtok_capture(__s1, __s2); }
  263.  
  264.   inline void*
  265.   memset(void* __s, int __c, size_t __n)
  266.   { return _C_legacy::_CPP_memset_capture(__s, __c, __n); }
  267.  
  268.   using _C_legacy::strerror;
  269.  
  270.   inline size_t
  271.   strlen(char const* __s)
  272.   { return _C_legacy::_CPP_strlen_capture(__s); }
  273.  
  274. } // namespace std
  275.  
  276. # undef _IN_C_LEGACY_
  277.  
  278. #endif
  279.  
  280.