1 /****************************************************************************
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd.
4 ** Contact: http://www.qt.io/licensing/
5 **
6 ** This file is part of the qmake spec of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see http://www.qt.io/terms-conditions. For further
15 ** information use the contact form at http://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 or version 3 as published by the Free
20 ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
21 ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
22 ** following information to ensure the GNU Lesser General Public License
23 ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
24 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 **
26 ** As a special exception, The Qt Company gives you certain additional
27 ** rights. These rights are described in The Qt Company LGPL Exception
28 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 **
30 ** GNU General Public License Usage
31 ** Alternatively, this file may be used under the terms of the GNU
32 ** General Public License version 3.0 as published by the Free Software
33 ** Foundation and appearing in the file LICENSE.GPL included in the
34 ** packaging of this file.  Please review the following information to
35 ** ensure the GNU General Public License version 3.0 requirements will be
36 ** met: http://www.gnu.org/copyleft/gpl.html.
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef QPLATFORMDEFS_H
43 #define QPLATFORMDEFS_H
44 
45 #ifdef UNICODE
46 #ifndef _UNICODE
47 #define _UNICODE
48 #endif
49 #endif
50 
51 // Get Qt defines/settings
52 
53 #include "qglobal.h"
54 #define Q_FS_FAT
55 
56 #define _POSIX_
57 #include <limits.h>
58 #undef _POSIX_
59 
60 #include <tchar.h>
61 #include <io.h>
62 #include <direct.h>
63 #include <stdio.h>
64 #include <fcntl.h>
65 #include <errno.h>
66 #include <sys/stat.h>
67 #include <dos.h>
68 #include <stdlib.h>
69 #include <search.h>
70 #include <windows.h>
71 
72 #if __BORLANDC__ >= 0x550
73 // Borland Builder 6
74 
75 #ifdef QT_LARGEFILE_SUPPORT
76 #  define QT_STATBUF		struct stati64		// non-ANSI defs
77 #  define QT_STATBUF4TSTAT	struct stati64		// non-ANSI defs
78 #  define QT_STAT		::_stati64
79 #  define QT_FSTAT		::fstati64
80 #  define QT_LSEEK		::_lseeki64
81 #  define QT_TSTAT		::_tstati64
82 #else
83 #  define QT_STATBUF		struct stat		// non-ANSI defs
84 #  define QT_STATBUF4TSTAT	struct _stat		// non-ANSI defs
85 #  define QT_STAT		::stat
86 #  define QT_FSTAT		::fstat
87 #  define QT_LSEEK		::_lseek
88 #  define QT_TSTAT		::_tstat
89 #endif
90 
91 #define QT_STAT_REG		_S_IFREG
92 #define QT_STAT_DIR		_S_IFDIR
93 #define QT_STAT_MASK		_S_IFMT
94 
95 #if defined(_S_IFLNK)
96 #  define QT_STAT_LNK		_S_IFLNK
97 #endif
98 
99 #include "../common/c89/qplatformdefs.h"
100 
101 #ifdef QT_LARGEFILE_SUPPORT
102 #undef QT_FSEEK
103 #undef QT_FTELL
104 #undef QT_OFF_T
105 
106 #define QT_FSEEK                ::_fseeki64
107 #define QT_FTELL                ::_ftelli64
108 #define QT_OFF_T                __int64
109 #endif
110 
111 #define QT_FILENO		_fileno
112 #define QT_OPEN			::open
113 #define QT_CLOSE		::_close
114 
115 #define QT_READ			::_read
116 #define QT_WRITE		::_write
117 #define QT_ACCESS		::_access
118 #define QT_GETCWD		::_getcwd
119 #define QT_CHDIR		::chdir
120 #define QT_MKDIR		::_mkdir
121 #define QT_RMDIR		::_rmdir
122 #define QT_OPEN_LARGEFILE       O_LARGEFILE
123 #define QT_OPEN_RDONLY		_O_RDONLY
124 #define QT_OPEN_WRONLY		_O_WRONLY
125 #define QT_OPEN_RDWR		_O_RDWR
126 #define QT_OPEN_CREAT		_O_CREAT
127 #define QT_OPEN_TRUNC		_O_TRUNC
128 #define QT_OPEN_APPEND		_O_APPEND
129 
130 #if defined(O_TEXT)
131 #  define QT_OPEN_TEXT		_O_TEXT
132 #  define QT_OPEN_BINARY	_O_BINARY
133 #endif
134 
135 #else
136 // Borland Builder 5
137 
138 #ifdef QT_LARGEFILE_SUPPORT
139 #  define QT_STATBUF		struct stati64		// non-ANSI defs
140 #  define QT_STATBUF4TSTAT	struct stati64		// non-ANSI defs
141 #  define QT_STAT		::stati64
142 #  define QT_FSTAT		::fstati64
143 #  define QT_LSEEK		::lseeki64
144 #  define QT_TSTAT		::tstati64
145 #else
146 #  define QT_STATBUF		struct stat		// non-ANSI defs
147 #  define QT_STATBUF4TSTAT	struct stat		// non-ANSI defs
148 #  define QT_STAT		::stat
149 #  define QT_FSTAT		::fstat
150 #  define QT_LSEEK		::lseek
151 #  define QT_TSTAT		::tstat
152 #endif
153 
154 #define QT_STAT_REG		S_IFREG
155 #define QT_STAT_DIR		S_IFDIR
156 #define QT_STAT_MASK		S_IFMT
157 
158 #if defined(S_IFLNK)
159 #  define QT_STAT_LNK		S_IFLNK
160 #endif
161 
162 #define QT_FILENO		fileno
163 #define QT_OPEN			::open
164 #define QT_CLOSE		::close
165 
166 #define QT_READ			::read
167 #define QT_WRITE		::write
168 #define QT_ACCESS		::access
169 
170 #if defined(Q_OS_OS2EMX)
171     // This is documented in the un*x to OS/2-EMX Porting FAQ:
172     // http://homepages.tu-darmstadt.de/~st002279/os2/porting.html
173 #  define QT_GETCWD		::_getcwd2
174 #  define QT_CHDIR		::_chdir2
175 #else
176 #  define QT_GETCWD		::getcwd
177 #  define QT_CHDIR		::chdir
178 #endif
179 
180 #define QT_MKDIR		::mkdir
181 #define QT_RMDIR		::rmdir
182 #define QT_OPEN_LARGEFILE       O_LARGEFILE
183 #define QT_OPEN_RDONLY		O_RDONLY
184 #define QT_OPEN_WRONLY		O_WRONLY
185 #define QT_OPEN_RDWR		O_RDWR
186 #define QT_OPEN_CREAT		O_CREAT
187 #define QT_OPEN_TRUNC		O_TRUNC
188 #define QT_OPEN_APPEND		O_APPEND
189 
190 #if defined(O_TEXT)
191 #  define QT_OPEN_TEXT		O_TEXT
192 #  define QT_OPEN_BINARY	O_BINARY
193 #endif
194 
195 #endif // __BORLANDC__ >= 0x550
196 
197 // Borland Builder 5 and 6
198 
199 #define QT_SIGNAL_ARGS		int
200 
201 #define QT_VSNPRINTF		::_vsnprintf
202 #define QT_SNPRINTF		::_snprintf
203 
204 # define F_OK	0
205 # define X_OK	1
206 # define W_OK	2
207 # define R_OK	4
208 
209 
210 #endif // QPLATFORMDEFS_H
211