blob: c39b8142443e773ee0f90179e1598576e8287c6a [file] [log] [blame]
Jeff Thompson86b6d642013-10-17 15:01:56 -07001/*
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: ndnboost/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
19#ifndef NDNBOOST_IOSTREAMS_DETAIL_CONFIG_RTL_HPP_INCLUDED
20#define NDNBOOST_IOSTREAMS_DETAIL_CONFIG_RTL_HPP_INCLUDED
21
22#include <ndnboost/config.hpp>
23#include <ndnboost/iostreams/detail/config/windows_posix.hpp>
24
25// Handle open, close, read, and write
26#ifdef __BORLANDC__
27# define NDNBOOST_IOSTREAMS_RTL(x) NDNBOOST_JOIN(_rtl_, x)
28#elif defined NDNBOOST_IOSTREAMS_WINDOWS
29# define NDNBOOST_IOSTREAMS_RTL(x) NDNBOOST_JOIN(_, x)
30#else
31# define NDNBOOST_IOSTREAMS_RTL(x) ::x // Distinguish from member function named x
32#endif
33#define NDNBOOST_IOSTREAMS_FD_OPEN NDNBOOST_IOSTREAMS_RTL(open)
34#define NDNBOOST_IOSTREAMS_FD_CLOSE NDNBOOST_IOSTREAMS_RTL(close)
35#define NDNBOOST_IOSTREAMS_FD_READ NDNBOOST_IOSTREAMS_RTL(read)
36#define NDNBOOST_IOSTREAMS_FD_WRITE NDNBOOST_IOSTREAMS_RTL(write)
37
38// Handle lseek, off_t, ftruncate, and stat
39#ifdef NDNBOOST_IOSTREAMS_WINDOWS
40# if defined(NDNBOOST_MSVC) || defined(__MSVCRT__) // MSVC, MinGW
41# define NDNBOOST_IOSTREAMS_FD_SEEK _lseeki64
42# define NDNBOOST_IOSTREAMS_FD_OFFSET __int64
43# else // Borland, Metrowerks, ...
44# define NDNBOOST_IOSTREAMS_FD_SEEK lseek
45# define NDNBOOST_IOSTREAMS_FD_OFFSET long
46# endif
47#else // Non-windows
48# if defined(_LARGEFILE64_SOURCE) && !defined(__APPLE__) && \
49 (!defined(_FILE_OFFSET_BITS) || _FILE_OFFSET_BITS != 64) || \
50 defined(_AIX) && !defined(_LARGE_FILES) || \
51 defined(NDNBOOST_IOSTREAMS_HAS_LARGE_FILE_EXTENSIONS)
52 /**/
53
54 /* Systems with transitional extensions for large file support */
55
56# define NDNBOOST_IOSTREAMS_FD_SEEK lseek64
57# define NDNBOOST_IOSTREAMS_FD_TRUNCATE ftruncate64
58# define NDNBOOST_IOSTREAMS_FD_MMAP mmap64
59# define NDNBOOST_IOSTREAMS_FD_STAT stat64
60# define NDNBOOST_IOSTREAMS_FD_FSTAT fstat64
61# define NDNBOOST_IOSTREAMS_FD_OFFSET off64_t
62# else
63# define NDNBOOST_IOSTREAMS_FD_SEEK lseek
64# define NDNBOOST_IOSTREAMS_FD_TRUNCATE ftruncate
65# define NDNBOOST_IOSTREAMS_FD_MMAP mmap
66# define NDNBOOST_IOSTREAMS_FD_STAT stat
67# define NDNBOOST_IOSTREAMS_FD_FSTAT fstat
68# define NDNBOOST_IOSTREAMS_FD_OFFSET off_t
69# endif
70#endif
71
72#endif // #ifndef NDNBOOST_IOSTREAMS_DETAIL_CONFIG_RTL_HPP_INCLUDED