qplatformdefs.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. #ifndef QPLATFORMDEFS_H
  40. #define QPLATFORMDEFS_H
  41. #ifdef UNICODE
  42. #ifndef _UNICODE
  43. #define _UNICODE
  44. #endif
  45. #endif
  46. // Get Qt defines/settings
  47. #include "qglobal.h"
  48. #define _POSIX_
  49. #include <limits.h>
  50. #undef _POSIX_
  51. #include <tchar.h>
  52. #include <io.h>
  53. #include <direct.h>
  54. #include <stdio.h>
  55. #include <fcntl.h>
  56. #include <errno.h>
  57. #include <sys/stat.h>
  58. #include <stdlib.h>
  59. #ifdef QT_LARGEFILE_SUPPORT
  60. #define QT_STATBUF struct _stati64 // non-ANSI defs
  61. #define QT_STATBUF4TSTAT struct _stati64 // non-ANSI defs
  62. #define QT_STAT ::_stati64
  63. #define QT_FSTAT ::_fstati64
  64. #else
  65. #define QT_STATBUF struct _stat // non-ANSI defs
  66. #define QT_STATBUF4TSTAT struct _stat // non-ANSI defs
  67. #define QT_STAT ::_stat
  68. #define QT_FSTAT ::_fstat
  69. #endif
  70. #define QT_STAT_REG _S_IFREG
  71. #define QT_STAT_DIR _S_IFDIR
  72. #define QT_STAT_MASK _S_IFMT
  73. #if defined(_S_IFLNK)
  74. # define QT_STAT_LNK _S_IFLNK
  75. #else
  76. # define QT_STAT_LNK 0120000
  77. #endif
  78. #define QT_FILENO _fileno
  79. #define QT_OPEN ::_open
  80. #define QT_CLOSE ::_close
  81. #ifdef QT_LARGEFILE_SUPPORT
  82. #define QT_LSEEK ::_lseeki64
  83. #define QT_TSTAT ::_tstati64
  84. #else
  85. #define QT_LSEEK ::_lseek
  86. #define QT_TSTAT ::_tstat
  87. #endif
  88. #define QT_READ ::_read
  89. #define QT_WRITE ::_write
  90. #define QT_ACCESS ::_access
  91. #define QT_GETCWD ::_getcwd
  92. #define QT_CHDIR ::_chdir
  93. #define QT_MKDIR ::_mkdir
  94. #define QT_RMDIR ::_rmdir
  95. #define QT_OPEN_LARGEFILE 0
  96. #define QT_OPEN_RDONLY _O_RDONLY
  97. #define QT_OPEN_WRONLY _O_WRONLY
  98. #define QT_OPEN_RDWR _O_RDWR
  99. #define QT_OPEN_CREAT _O_CREAT
  100. #define QT_OPEN_TRUNC _O_TRUNC
  101. #define QT_OPEN_APPEND _O_APPEND
  102. #if defined(O_TEXT)
  103. # define QT_OPEN_TEXT _O_TEXT
  104. # define QT_OPEN_BINARY _O_BINARY
  105. #endif
  106. #include "../common/c89/qplatformdefs.h"
  107. #ifdef QT_LARGEFILE_SUPPORT
  108. #undef QT_FSEEK
  109. #undef QT_FTELL
  110. #undef QT_OFF_T
  111. #define QT_FSEEK ::_fseeki64
  112. #define QT_FTELL ::_ftelli64
  113. #define QT_OFF_T __int64
  114. #endif
  115. #define QT_SIGNAL_ARGS int
  116. #define QT_VSNPRINTF(buffer, count, format, arg) \
  117. vsnprintf_s(buffer, count, count-1, format, arg)
  118. #define QT_SNPRINTF ::_snprintf
  119. # define F_OK 0
  120. # define X_OK 1
  121. # define W_OK 2
  122. # define R_OK 4
  123. typedef int mode_t;
  124. #endif // QPLATFORMDEFS_H