rtl.hpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * Distributed under the Boost Software License, Version 1.0.(See accompanying
  3. * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
  4. *
  5. * See http://www.boost.org/libs/iostreams for documentation.
  6. *
  7. * Defines preprocessor symbols expanding to the names of functions in the
  8. * C runtime library used to access file descriptors and to the type used
  9. * to store file offsets for seeking.
  10. *
  11. * File: boost/iostreams/detail/config/rtl.hpp
  12. * Date: Wed Dec 26 11:58:11 MST 2007
  13. *
  14. * Copyright: 2007-2008 CodeRage, LLC
  15. * Author: Jonathan Turkanis
  16. * Contact: turkanis at coderage dot com
  17. */
  18. #ifndef BOOST_IOSTREAMS_DETAIL_CONFIG_RTL_HPP_INCLUDED
  19. #define BOOST_IOSTREAMS_DETAIL_CONFIG_RTL_HPP_INCLUDED
  20. #include <boost/config.hpp>
  21. #include <boost/iostreams/detail/config/windows_posix.hpp>
  22. // Handle open, close, read, and write
  23. #ifdef BOOST_BORLANDC
  24. # define BOOST_IOSTREAMS_RTL(x) BOOST_JOIN(_rtl_, x)
  25. #elif defined BOOST_IOSTREAMS_WINDOWS
  26. # define BOOST_IOSTREAMS_RTL(x) BOOST_JOIN(_, x)
  27. #else
  28. # define BOOST_IOSTREAMS_RTL(x) ::x // Distinguish from member function named x
  29. #endif
  30. #define BOOST_IOSTREAMS_FD_OPEN BOOST_IOSTREAMS_RTL(open)
  31. #define BOOST_IOSTREAMS_FD_CLOSE BOOST_IOSTREAMS_RTL(close)
  32. #define BOOST_IOSTREAMS_FD_READ BOOST_IOSTREAMS_RTL(read)
  33. #define BOOST_IOSTREAMS_FD_WRITE BOOST_IOSTREAMS_RTL(write)
  34. // Handle lseek, off_t, ftruncate, and stat
  35. #ifdef BOOST_IOSTREAMS_WINDOWS
  36. # if defined(BOOST_MSVC) || defined(__MSVCRT__) // MSVC, MinGW
  37. # define BOOST_IOSTREAMS_FD_SEEK _lseeki64
  38. # define BOOST_IOSTREAMS_FD_OFFSET __int64
  39. # else // Borland, Metrowerks, ...
  40. # define BOOST_IOSTREAMS_FD_SEEK lseek
  41. # define BOOST_IOSTREAMS_FD_OFFSET long
  42. # endif
  43. #else // Non-windows
  44. # if defined(_LARGEFILE64_SOURCE) && !defined(__APPLE__) && \
  45. (!defined(_FILE_OFFSET_BITS) || _FILE_OFFSET_BITS != 64) || \
  46. defined(_AIX) && !defined(_LARGE_FILES) || \
  47. defined(BOOST_IOSTREAMS_HAS_LARGE_FILE_EXTENSIONS)
  48. /**/
  49. /* Systems with transitional extensions for large file support */
  50. # define BOOST_IOSTREAMS_FD_SEEK lseek64
  51. # define BOOST_IOSTREAMS_FD_TRUNCATE ftruncate64
  52. # define BOOST_IOSTREAMS_FD_MMAP mmap64
  53. # define BOOST_IOSTREAMS_FD_STAT stat64
  54. # define BOOST_IOSTREAMS_FD_FSTAT fstat64
  55. # define BOOST_IOSTREAMS_FD_OFFSET off64_t
  56. # else
  57. # define BOOST_IOSTREAMS_FD_SEEK lseek
  58. # define BOOST_IOSTREAMS_FD_TRUNCATE ftruncate
  59. # define BOOST_IOSTREAMS_FD_MMAP mmap
  60. # define BOOST_IOSTREAMS_FD_STAT stat
  61. # define BOOST_IOSTREAMS_FD_FSTAT fstat
  62. # define BOOST_IOSTREAMS_FD_OFFSET off_t
  63. # endif
  64. #endif
  65. #endif // #ifndef BOOST_IOSTREAMS_DETAIL_CONFIG_RTL_HPP_INCLUDED