1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://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 https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://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 3 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 3 requirements
23 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24 **
25 ** GNU General Public License Usage
26 ** Alternatively, this file may be used under the terms of the GNU
27 ** General Public License version 2.0 or (at your option) the GNU General
28 ** Public license version 3 or any later version approved by the KDE Free
29 ** Qt Foundation. The licenses are as published by the Free Software
30 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31 ** included in the packaging of this file. Please review the following
32 ** information to ensure the GNU General Public License requirements will
33 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34 ** https://www.gnu.org/licenses/gpl-3.0.html.
35 **
36 ** $QT_END_LICENSE$
37 **
38 ****************************************************************************/
39 
40 #ifndef QPLATFORMDEFS_H
41 #define QPLATFORMDEFS_H
42 
43 #ifdef UNICODE
44 #ifndef _UNICODE
45 #define _UNICODE
46 #endif
47 #endif
48 
49 // Get Qt defines/settings
50 
51 #include "qglobal.h"
52 
53 #include <tchar.h>
54 #include <io.h>
55 #include <direct.h>
56 #include <stdio.h>
57 #include <fcntl.h>
58 #include <errno.h>
59 #include <sys/stat.h>
60 #include <stdlib.h>
61 #include <limits.h>
62 
63 #if !defined(_WIN32_WINNT) || (_WIN32_WINNT-0 < 0x0500)
64 typedef enum {
65     NameUnknown           = 0,
66     NameFullyQualifiedDN  = 1,
67     NameSamCompatible     = 2,
68     NameDisplay           = 3,
69     NameUniqueId          = 6,
70     NameCanonical         = 7,
71     NameUserPrincipal     = 8,
72     NameCanonicalEx       = 9,
73     NameServicePrincipal  = 10,
74     NameDnsDomain         = 12
75 } EXTENDED_NAME_FORMAT, *PEXTENDED_NAME_FORMAT;
76 #endif
77 
78 #ifdef QT_LARGEFILE_SUPPORT
79 #define QT_STATBUF              struct _stati64         // non-ANSI defs
80 #define QT_STATBUF4TSTAT        struct _stati64         // non-ANSI defs
81 #define QT_STAT                 ::_stati64
82 #define QT_FSTAT                ::_fstati64
83 #else
84 #define QT_STATBUF              struct _stat            // non-ANSI defs
85 #define QT_STATBUF4TSTAT        struct _stat            // non-ANSI defs
86 #define QT_STAT                 ::_stat
87 #define QT_FSTAT                ::_fstat
88 #endif
89 #define QT_STAT_REG             _S_IFREG
90 #define QT_STAT_DIR             _S_IFDIR
91 #define QT_STAT_MASK            _S_IFMT
92 #if defined(_S_IFLNK)
93 #  define QT_STAT_LNK           _S_IFLNK
94 #endif
95 #define QT_FILENO               _fileno
96 #define QT_OPEN                 ::_open
97 #define QT_CLOSE                ::_close
98 #ifdef QT_LARGEFILE_SUPPORT
99 #define QT_LSEEK                ::_lseeki64
100 #ifndef UNICODE
101 #define QT_TSTAT                ::_stati64
102 #else
103 #define QT_TSTAT                ::_wstati64
104 #endif
105 #else
106 #define QT_LSEEK                ::_lseek
107 #ifndef UNICODE
108 #define QT_TSTAT                ::_stat
109 #else
110 #define QT_TSTAT                ::_wstat
111 #endif
112 #endif
113 #define QT_READ                 ::_read
114 #define QT_WRITE                ::_write
115 #define QT_ACCESS               ::_access
116 #define QT_GETCWD               ::_getcwd
117 #define QT_CHDIR                ::_chdir
118 #define QT_MKDIR                ::_mkdir
119 #define QT_RMDIR                ::_rmdir
120 #define QT_OPEN_LARGEFILE       0
121 #define QT_OPEN_RDONLY          _O_RDONLY
122 #define QT_OPEN_WRONLY          _O_WRONLY
123 #define QT_OPEN_RDWR            _O_RDWR
124 #define QT_OPEN_CREAT           _O_CREAT
125 #define QT_OPEN_TRUNC           _O_TRUNC
126 #define QT_OPEN_APPEND          _O_APPEND
127 #if defined(O_TEXT)
128 # define QT_OPEN_TEXT           _O_TEXT
129 # define QT_OPEN_BINARY         _O_BINARY
130 #endif
131 
132 #include "../common/c89/qplatformdefs.h"
133 
134 #ifdef QT_LARGEFILE_SUPPORT
135 #undef QT_FSEEK
136 #undef QT_FTELL
137 #undef QT_OFF_T
138 
139 #define QT_FSEEK                ::fseeko64
140 #define QT_FTELL                ::ftello64
141 #define QT_OFF_T                off64_t
142 #endif
143 
144 #define QT_SIGNAL_ARGS          int
145 
146 #define QT_VSNPRINTF            ::_vsnprintf
147 #define QT_SNPRINTF             ::_snprintf
148 
149 # define F_OK   0
150 # define X_OK   1
151 # define W_OK   2
152 # define R_OK   4
153 
154 
155 #endif // QPLATFORMDEFS_H
156