summaryrefslogtreecommitdiff
path: root/utils/rbutilqt/msvc
diff options
context:
space:
mode:
Diffstat (limited to 'utils/rbutilqt/msvc')
-rw-r--r--utils/rbutilqt/msvc/Makefile61
-rw-r--r--utils/rbutilqt/msvc/README106
-rw-r--r--utils/rbutilqt/msvc/inttypes.h305
-rw-r--r--utils/rbutilqt/msvc/stdbool.h38
-rw-r--r--utils/rbutilqt/msvc/stdint.h247
5 files changed, 757 insertions, 0 deletions
diff --git a/utils/rbutilqt/msvc/Makefile b/utils/rbutilqt/msvc/Makefile
new file mode 100644
index 0000000000..014e7c87a2
--- /dev/null
+++ b/utils/rbutilqt/msvc/Makefile
@@ -0,0 +1,61 @@
1# __________ __ ___.
2# Open \______ \ ____ ____ | | _\_ |__ _______ ___
3# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6#
7
8ifndef V
9SILENT = @
10endif
11# The rbspeex Makefile has problems with msys' path mangling as well as running
12# MSVC's lib tool. Use TOP instead of pwd. This means the resulting files will
13# always be placed in this folder.
14# On Linux use the current folder instead.
15TOP := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
16
17LIBS = ipodpatcher sansapatcher chinachippatcher \
18 mkamsboot mkimxboot mkmpioboot mktccboot \
19 ucl rbspeex
20
21# on Windows uname is not available. However, the environment variable OS holds
22# Windows_NT so check that instead.
23ifneq ($(OS),Windows_NT)
24PWD=$(shell pwd)
25RM=rm -rf
26all: dll
27else
28PWD=$(abspath $(TOP))
29RM=del /q /f
30all: lib
31endif
32
33CC=gcc
34dll: $(addsuffix .dll,$(LIBS))
35
36ucl.dll:
37 $(SILENT)$(MAKE) -C ../../../tools/ucl/src \
38 TARGET_DIR=$(PWD)/ OBJDIR=$(PWD)/build-dll/$(basename $@) \
39 CROSS=$(CROSS) CC=$(CC) APPVERSION=dll dll
40rbspeex.dll:
41 $(SILENT)$(MAKE) -C ../../../tools/rbspeex \
42 TARGET_DIR=$(PWD)/ BUILD_DIR=$(PWD)/build-dll/$(basename $@) \
43 CROSS=$(CROSS) CC=$(CC) STATIC=1 APPVERSION=dll dll
44
45%.dll:
46 $(SILENT)$(MAKE) -C ../../$(basename $@) \
47 TARGET_DIR=$(PWD)/ BUILD_DIR=$(PWD)/build-dll/$(basename $@) \
48 CROSS=$(CROSS) CC=$(CC) APPVERSION=dll dll
49
50lib: $(addsuffix .lib,$(LIBS))
51
52%.lib: %.dll
53 @echo LIB $@
54 @lib /machine:x86 /nologo /def:$(basename $<).def
55
56clean:
57 $(RM) $(addsuffix .dll,$(LIBS))
58 $(RM) $(addsuffix .def,$(LIBS))
59 $(RM) $(addsuffix .exp,$(LIBS))
60 $(RM) $(addsuffix .lib,$(LIBS))
61 $(RM) build-dll
diff --git a/utils/rbutilqt/msvc/README b/utils/rbutilqt/msvc/README
new file mode 100644
index 0000000000..eedec271a1
--- /dev/null
+++ b/utils/rbutilqt/msvc/README
@@ -0,0 +1,106 @@
1Rockbox Utility with Visual Studio
2==================================
3
4This document describes how to build Rockbox Utility using Visual Studio.
5
6*Note*: building with Visual Studio is only useful for debugging / development.
7Since several parts used by Rockbox Utility can't be compiled using Visual
8Studio at all using DLLs is required. For distributing we want a statically
9linked binary, which does not work this way. Building with MinGW is much easier
10in general, since using VS requires the use of MinGW as well.
11
12All of the steps described below are to be performed in the folder this file is
13located in on a command prompt (cmd.exe on Windows). All paths stated are the
14default paths on an english Windows XP setup. You might need to adjust them to
15your system.
16
17Steps
18-----
19Building with VS requires several steps:
201. Prepare your build environment
212. Build DLLs using MinGW for the parts that cannot be compiled with VS and
22 create LIB files from the DLLs. This requires using tools from VS.
233. Create a VS project file
244. Build the remaining code using VS.
25
26Preparing the build environment
27-------------------------------
28The DLLs can be cross compiled on Linux. Everything else has to be done on
29Windows. If you decide to cross compile, you need to install:
30- Linux
31 - MinGW toolchain
32- Windows
33 - MinGW with (at least) the mingw32-make package.
34 - Visual Studio 2008 (other versions might work but are not tested. Express
35 version is sufficient).
36 - Windows Platform SDK (in case you're using the Express version of VS,
37 otherwise this is included in VS)
38 - Qt SDK for VS.
39
40If you decide to not cross compile the DLLs you need to install additionally to
41the programs listed above on Windows:
42- MinGW with the following packages (and their dependencies):
43 - mingw32-gcc
44 - mingw32-make
45 - msys-coreutils
46 - msys-sed
47 - msys-bash
48 - msys-grep
49
50On Windows, open a command prompt and set up your path:
51
52 set PATH=c:\MinGW\bin;c:\MinGW\msys\1.0\bin;%PATH%
53 c:\Program Files\Microsoft Visual Studio 9\Common7\Tools\vsvars.bat
54
55
56Building DLLs and LIBs
57----------------------
58On Linux, run
59
60 make CROSS=i686-pc-mingw32-
61
62Adjust the CROSS variable to the prefix of your cross compiler. This will
63create the DLL files only. Copy the resulting DLL and DEF files to the Windows
64machine, then proceed with the Windows instructions below. The Makefile will
65not remake the DLLs if they are already present.
66
67On Windows, run
68
69 mingw32-make
70
71This will build the DLL files (if missing) and create LIB files from them.
72
73
74Create translations
75-------------------
76Create the translations .qm files. This is only necessary if qmake has been
77called without -config dbg (in which case translations will be left out and not
78compiled into the binary)
79
80 c:\QtSDK\Desktop\Qt\4.7.4\msvc2008\bin\lrelease.exe ..\rbutilqt.pro
81
82
83Create a VS project file
84------------------------
85To create a project file for VS, run
86
87 c:\QtSDK\Desktop\Qt\4.7.4\msvc2008\bin\qmake.exe -tp vc ..
88
89This creates a file RockboxUtility.vcproj.
90
91
92Build using VS
93--------------
94Open the generated project file and build as usual with VS.
95
96
97LICENSE INFORMATION
98===================
99This folder contains additional files necessary for building.
100
101- stdbool.h: taken form clang 2.8
102- stdint.h, inttypes.h: taken from the msinttypes project
103 (http://code.google.com/p/msinttypes) r26.
104
105See the source files for detailed license information.
106
diff --git a/utils/rbutilqt/msvc/inttypes.h b/utils/rbutilqt/msvc/inttypes.h
new file mode 100644
index 0000000000..4b3828a216
--- /dev/null
+++ b/utils/rbutilqt/msvc/inttypes.h
@@ -0,0 +1,305 @@
1// ISO C9x compliant inttypes.h for Microsoft Visual Studio
2// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
3//
4// Copyright (c) 2006 Alexander Chemeris
5//
6// Redistribution and use in source and binary forms, with or without
7// modification, are permitted provided that the following conditions are met:
8//
9// 1. Redistributions of source code must retain the above copyright notice,
10// this list of conditions and the following disclaimer.
11//
12// 2. Redistributions in binary form must reproduce the above copyright
13// notice, this list of conditions and the following disclaimer in the
14// documentation and/or other materials provided with the distribution.
15//
16// 3. The name of the author may be used to endorse or promote products
17// derived from this software without specific prior written permission.
18//
19// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
20// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
22// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29//
30///////////////////////////////////////////////////////////////////////////////
31
32#ifndef _MSC_VER // [
33#error "Use this header only with Microsoft Visual C++ compilers!"
34#endif // _MSC_VER ]
35
36#ifndef _MSC_INTTYPES_H_ // [
37#define _MSC_INTTYPES_H_
38
39#if _MSC_VER > 1000
40#pragma once
41#endif
42
43#include "stdint.h"
44
45// 7.8 Format conversion of integer types
46
47typedef struct {
48 intmax_t quot;
49 intmax_t rem;
50} imaxdiv_t;
51
52// 7.8.1 Macros for format specifiers
53
54#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) // [ See footnote 185 at page 198
55
56// The fprintf macros for signed integers are:
57#define PRId8 "d"
58#define PRIi8 "i"
59#define PRIdLEAST8 "d"
60#define PRIiLEAST8 "i"
61#define PRIdFAST8 "d"
62#define PRIiFAST8 "i"
63
64#define PRId16 "hd"
65#define PRIi16 "hi"
66#define PRIdLEAST16 "hd"
67#define PRIiLEAST16 "hi"
68#define PRIdFAST16 "hd"
69#define PRIiFAST16 "hi"
70
71#define PRId32 "I32d"
72#define PRIi32 "I32i"
73#define PRIdLEAST32 "I32d"
74#define PRIiLEAST32 "I32i"
75#define PRIdFAST32 "I32d"
76#define PRIiFAST32 "I32i"
77
78#define PRId64 "I64d"
79#define PRIi64 "I64i"
80#define PRIdLEAST64 "I64d"
81#define PRIiLEAST64 "I64i"
82#define PRIdFAST64 "I64d"
83#define PRIiFAST64 "I64i"
84
85#define PRIdMAX "I64d"
86#define PRIiMAX "I64i"
87
88#define PRIdPTR "Id"
89#define PRIiPTR "Ii"
90
91// The fprintf macros for unsigned integers are:
92#define PRIo8 "o"
93#define PRIu8 "u"
94#define PRIx8 "x"
95#define PRIX8 "X"
96#define PRIoLEAST8 "o"
97#define PRIuLEAST8 "u"
98#define PRIxLEAST8 "x"
99#define PRIXLEAST8 "X"
100#define PRIoFAST8 "o"
101#define PRIuFAST8 "u"
102#define PRIxFAST8 "x"
103#define PRIXFAST8 "X"
104
105#define PRIo16 "ho"
106#define PRIu16 "hu"
107#define PRIx16 "hx"
108#define PRIX16 "hX"
109#define PRIoLEAST16 "ho"
110#define PRIuLEAST16 "hu"
111#define PRIxLEAST16 "hx"
112#define PRIXLEAST16 "hX"
113#define PRIoFAST16 "ho"
114#define PRIuFAST16 "hu"
115#define PRIxFAST16 "hx"
116#define PRIXFAST16 "hX"
117
118#define PRIo32 "I32o"
119#define PRIu32 "I32u"
120#define PRIx32 "I32x"
121#define PRIX32 "I32X"
122#define PRIoLEAST32 "I32o"
123#define PRIuLEAST32 "I32u"
124#define PRIxLEAST32 "I32x"
125#define PRIXLEAST32 "I32X"
126#define PRIoFAST32 "I32o"
127#define PRIuFAST32 "I32u"
128#define PRIxFAST32 "I32x"
129#define PRIXFAST32 "I32X"
130
131#define PRIo64 "I64o"
132#define PRIu64 "I64u"
133#define PRIx64 "I64x"
134#define PRIX64 "I64X"
135#define PRIoLEAST64 "I64o"
136#define PRIuLEAST64 "I64u"
137#define PRIxLEAST64 "I64x"
138#define PRIXLEAST64 "I64X"
139#define PRIoFAST64 "I64o"
140#define PRIuFAST64 "I64u"
141#define PRIxFAST64 "I64x"
142#define PRIXFAST64 "I64X"
143
144#define PRIoMAX "I64o"
145#define PRIuMAX "I64u"
146#define PRIxMAX "I64x"
147#define PRIXMAX "I64X"
148
149#define PRIoPTR "Io"
150#define PRIuPTR "Iu"
151#define PRIxPTR "Ix"
152#define PRIXPTR "IX"
153
154// The fscanf macros for signed integers are:
155#define SCNd8 "d"
156#define SCNi8 "i"
157#define SCNdLEAST8 "d"
158#define SCNiLEAST8 "i"
159#define SCNdFAST8 "d"
160#define SCNiFAST8 "i"
161
162#define SCNd16 "hd"
163#define SCNi16 "hi"
164#define SCNdLEAST16 "hd"
165#define SCNiLEAST16 "hi"
166#define SCNdFAST16 "hd"
167#define SCNiFAST16 "hi"
168
169#define SCNd32 "ld"
170#define SCNi32 "li"
171#define SCNdLEAST32 "ld"
172#define SCNiLEAST32 "li"
173#define SCNdFAST32 "ld"
174#define SCNiFAST32 "li"
175
176#define SCNd64 "I64d"
177#define SCNi64 "I64i"
178#define SCNdLEAST64 "I64d"
179#define SCNiLEAST64 "I64i"
180#define SCNdFAST64 "I64d"
181#define SCNiFAST64 "I64i"
182
183#define SCNdMAX "I64d"
184#define SCNiMAX "I64i"
185
186#ifdef _WIN64 // [
187# define SCNdPTR "I64d"
188# define SCNiPTR "I64i"
189#else // _WIN64 ][
190# define SCNdPTR "ld"
191# define SCNiPTR "li"
192#endif // _WIN64 ]
193
194// The fscanf macros for unsigned integers are:
195#define SCNo8 "o"
196#define SCNu8 "u"
197#define SCNx8 "x"
198#define SCNX8 "X"
199#define SCNoLEAST8 "o"
200#define SCNuLEAST8 "u"
201#define SCNxLEAST8 "x"
202#define SCNXLEAST8 "X"
203#define SCNoFAST8 "o"
204#define SCNuFAST8 "u"
205#define SCNxFAST8 "x"
206#define SCNXFAST8 "X"
207
208#define SCNo16 "ho"
209#define SCNu16 "hu"
210#define SCNx16 "hx"
211#define SCNX16 "hX"
212#define SCNoLEAST16 "ho"
213#define SCNuLEAST16 "hu"
214#define SCNxLEAST16 "hx"
215#define SCNXLEAST16 "hX"
216#define SCNoFAST16 "ho"
217#define SCNuFAST16 "hu"
218#define SCNxFAST16 "hx"
219#define SCNXFAST16 "hX"
220
221#define SCNo32 "lo"
222#define SCNu32 "lu"
223#define SCNx32 "lx"
224#define SCNX32 "lX"
225#define SCNoLEAST32 "lo"
226#define SCNuLEAST32 "lu"
227#define SCNxLEAST32 "lx"
228#define SCNXLEAST32 "lX"
229#define SCNoFAST32 "lo"
230#define SCNuFAST32 "lu"
231#define SCNxFAST32 "lx"
232#define SCNXFAST32 "lX"
233
234#define SCNo64 "I64o"
235#define SCNu64 "I64u"
236#define SCNx64 "I64x"
237#define SCNX64 "I64X"
238#define SCNoLEAST64 "I64o"
239#define SCNuLEAST64 "I64u"
240#define SCNxLEAST64 "I64x"
241#define SCNXLEAST64 "I64X"
242#define SCNoFAST64 "I64o"
243#define SCNuFAST64 "I64u"
244#define SCNxFAST64 "I64x"
245#define SCNXFAST64 "I64X"
246
247#define SCNoMAX "I64o"
248#define SCNuMAX "I64u"
249#define SCNxMAX "I64x"
250#define SCNXMAX "I64X"
251
252#ifdef _WIN64 // [
253# define SCNoPTR "I64o"
254# define SCNuPTR "I64u"
255# define SCNxPTR "I64x"
256# define SCNXPTR "I64X"
257#else // _WIN64 ][
258# define SCNoPTR "lo"
259# define SCNuPTR "lu"
260# define SCNxPTR "lx"
261# define SCNXPTR "lX"
262#endif // _WIN64 ]
263
264#endif // __STDC_FORMAT_MACROS ]
265
266// 7.8.2 Functions for greatest-width integer types
267
268// 7.8.2.1 The imaxabs function
269#define imaxabs _abs64
270
271// 7.8.2.2 The imaxdiv function
272
273// This is modified version of div() function from Microsoft's div.c found
274// in %MSVC.NET%\crt\src\div.c
275#ifdef STATIC_IMAXDIV // [
276static
277#else // STATIC_IMAXDIV ][
278_inline
279#endif // STATIC_IMAXDIV ]
280imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom)
281{
282 imaxdiv_t result;
283
284 result.quot = numer / denom;
285 result.rem = numer % denom;
286
287 if (numer < 0 && result.rem > 0) {
288 // did division wrong; must fix up
289 ++result.quot;
290 result.rem -= denom;
291 }
292
293 return result;
294}
295
296// 7.8.2.3 The strtoimax and strtoumax functions
297#define strtoimax _strtoi64
298#define strtoumax _strtoui64
299
300// 7.8.2.4 The wcstoimax and wcstoumax functions
301#define wcstoimax _wcstoi64
302#define wcstoumax _wcstoui64
303
304
305#endif // _MSC_INTTYPES_H_ ]
diff --git a/utils/rbutilqt/msvc/stdbool.h b/utils/rbutilqt/msvc/stdbool.h
new file mode 100644
index 0000000000..e44a1f9a97
--- /dev/null
+++ b/utils/rbutilqt/msvc/stdbool.h
@@ -0,0 +1,38 @@
1/*===---- stdbool.h - Standard header for booleans -------------------------===
2 *
3 * Copyright (c) 2008 Eli Friedman
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 * THE SOFTWARE.
22 *
23 *===-----------------------------------------------------------------------===
24 */
25
26#ifndef __STDBOOL_H
27#define __STDBOOL_H
28
29/* Don't define bool, true, and false in C++ */
30#ifndef __cplusplus
31#define bool _Bool
32#define true 1
33#define false 0
34#endif
35
36#define __bool_true_false_are_defined 1
37
38#endif /* __STDBOOL_H */
diff --git a/utils/rbutilqt/msvc/stdint.h b/utils/rbutilqt/msvc/stdint.h
new file mode 100644
index 0000000000..d02608a597
--- /dev/null
+++ b/utils/rbutilqt/msvc/stdint.h
@@ -0,0 +1,247 @@
1// ISO C9x compliant stdint.h for Microsoft Visual Studio
2// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
3//
4// Copyright (c) 2006-2008 Alexander Chemeris
5//
6// Redistribution and use in source and binary forms, with or without
7// modification, are permitted provided that the following conditions are met:
8//
9// 1. Redistributions of source code must retain the above copyright notice,
10// this list of conditions and the following disclaimer.
11//
12// 2. Redistributions in binary form must reproduce the above copyright
13// notice, this list of conditions and the following disclaimer in the
14// documentation and/or other materials provided with the distribution.
15//
16// 3. The name of the author may be used to endorse or promote products
17// derived from this software without specific prior written permission.
18//
19// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
20// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
22// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29//
30///////////////////////////////////////////////////////////////////////////////
31
32#ifndef _MSC_VER // [
33#error "Use this header only with Microsoft Visual C++ compilers!"
34#endif // _MSC_VER ]
35
36#ifndef _MSC_STDINT_H_ // [
37#define _MSC_STDINT_H_
38
39#if _MSC_VER > 1000
40#pragma once
41#endif
42
43#include <limits.h>
44
45// For Visual Studio 6 in C++ mode and for many Visual Studio versions when
46// compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}'
47// or compiler give many errors like this:
48// error C2733: second C linkage of overloaded function 'wmemchr' not allowed
49#ifdef __cplusplus
50extern "C" {
51#endif
52# include <wchar.h>
53#ifdef __cplusplus
54}
55#endif
56
57// Define _W64 macros to mark types changing their size, like intptr_t.
58#ifndef _W64
59# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
60# define _W64 __w64
61# else
62# define _W64
63# endif
64#endif
65
66
67// 7.18.1 Integer types
68
69// 7.18.1.1 Exact-width integer types
70
71// Visual Studio 6 and Embedded Visual C++ 4 doesn't
72// realize that, e.g. char has the same size as __int8
73// so we give up on __intX for them.
74#if (_MSC_VER < 1300)
75 typedef signed char int8_t;
76 typedef signed short int16_t;
77 typedef signed int int32_t;
78 typedef unsigned char uint8_t;
79 typedef unsigned short uint16_t;
80 typedef unsigned int uint32_t;
81#else
82 typedef signed __int8 int8_t;
83 typedef signed __int16 int16_t;
84 typedef signed __int32 int32_t;
85 typedef unsigned __int8 uint8_t;
86 typedef unsigned __int16 uint16_t;
87 typedef unsigned __int32 uint32_t;
88#endif
89typedef signed __int64 int64_t;
90typedef unsigned __int64 uint64_t;
91
92
93// 7.18.1.2 Minimum-width integer types
94typedef int8_t int_least8_t;
95typedef int16_t int_least16_t;
96typedef int32_t int_least32_t;
97typedef int64_t int_least64_t;
98typedef uint8_t uint_least8_t;
99typedef uint16_t uint_least16_t;
100typedef uint32_t uint_least32_t;
101typedef uint64_t uint_least64_t;
102
103// 7.18.1.3 Fastest minimum-width integer types
104typedef int8_t int_fast8_t;
105typedef int16_t int_fast16_t;
106typedef int32_t int_fast32_t;
107typedef int64_t int_fast64_t;
108typedef uint8_t uint_fast8_t;
109typedef uint16_t uint_fast16_t;
110typedef uint32_t uint_fast32_t;
111typedef uint64_t uint_fast64_t;
112
113// 7.18.1.4 Integer types capable of holding object pointers
114#ifdef _WIN64 // [
115 typedef signed __int64 intptr_t;
116 typedef unsigned __int64 uintptr_t;
117#else // _WIN64 ][
118 typedef _W64 signed int intptr_t;
119 typedef _W64 unsigned int uintptr_t;
120#endif // _WIN64 ]
121
122// 7.18.1.5 Greatest-width integer types
123typedef int64_t intmax_t;
124typedef uint64_t uintmax_t;
125
126
127// 7.18.2 Limits of specified-width integer types
128
129#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259
130
131// 7.18.2.1 Limits of exact-width integer types
132#define INT8_MIN ((int8_t)_I8_MIN)
133#define INT8_MAX _I8_MAX
134#define INT16_MIN ((int16_t)_I16_MIN)
135#define INT16_MAX _I16_MAX
136#define INT32_MIN ((int32_t)_I32_MIN)
137#define INT32_MAX _I32_MAX
138#define INT64_MIN ((int64_t)_I64_MIN)
139#define INT64_MAX _I64_MAX
140#define UINT8_MAX _UI8_MAX
141#define UINT16_MAX _UI16_MAX
142#define UINT32_MAX _UI32_MAX
143#define UINT64_MAX _UI64_MAX
144
145// 7.18.2.2 Limits of minimum-width integer types
146#define INT_LEAST8_MIN INT8_MIN
147#define INT_LEAST8_MAX INT8_MAX
148#define INT_LEAST16_MIN INT16_MIN
149#define INT_LEAST16_MAX INT16_MAX
150#define INT_LEAST32_MIN INT32_MIN
151#define INT_LEAST32_MAX INT32_MAX
152#define INT_LEAST64_MIN INT64_MIN
153#define INT_LEAST64_MAX INT64_MAX
154#define UINT_LEAST8_MAX UINT8_MAX
155#define UINT_LEAST16_MAX UINT16_MAX
156#define UINT_LEAST32_MAX UINT32_MAX
157#define UINT_LEAST64_MAX UINT64_MAX
158
159// 7.18.2.3 Limits of fastest minimum-width integer types
160#define INT_FAST8_MIN INT8_MIN
161#define INT_FAST8_MAX INT8_MAX
162#define INT_FAST16_MIN INT16_MIN
163#define INT_FAST16_MAX INT16_MAX
164#define INT_FAST32_MIN INT32_MIN
165#define INT_FAST32_MAX INT32_MAX
166#define INT_FAST64_MIN INT64_MIN
167#define INT_FAST64_MAX INT64_MAX
168#define UINT_FAST8_MAX UINT8_MAX
169#define UINT_FAST16_MAX UINT16_MAX
170#define UINT_FAST32_MAX UINT32_MAX
171#define UINT_FAST64_MAX UINT64_MAX
172
173// 7.18.2.4 Limits of integer types capable of holding object pointers
174#ifdef _WIN64 // [
175# define INTPTR_MIN INT64_MIN
176# define INTPTR_MAX INT64_MAX
177# define UINTPTR_MAX UINT64_MAX
178#else // _WIN64 ][
179# define INTPTR_MIN INT32_MIN
180# define INTPTR_MAX INT32_MAX
181# define UINTPTR_MAX UINT32_MAX
182#endif // _WIN64 ]
183
184// 7.18.2.5 Limits of greatest-width integer types
185#define INTMAX_MIN INT64_MIN
186#define INTMAX_MAX INT64_MAX
187#define UINTMAX_MAX UINT64_MAX
188
189// 7.18.3 Limits of other integer types
190
191#ifdef _WIN64 // [
192# define PTRDIFF_MIN _I64_MIN
193# define PTRDIFF_MAX _I64_MAX
194#else // _WIN64 ][
195# define PTRDIFF_MIN _I32_MIN
196# define PTRDIFF_MAX _I32_MAX
197#endif // _WIN64 ]
198
199#define SIG_ATOMIC_MIN INT_MIN
200#define SIG_ATOMIC_MAX INT_MAX
201
202#ifndef SIZE_MAX // [
203# ifdef _WIN64 // [
204# define SIZE_MAX _UI64_MAX
205# else // _WIN64 ][
206# define SIZE_MAX _UI32_MAX
207# endif // _WIN64 ]
208#endif // SIZE_MAX ]
209
210// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
211#ifndef WCHAR_MIN // [
212# define WCHAR_MIN 0
213#endif // WCHAR_MIN ]
214#ifndef WCHAR_MAX // [
215# define WCHAR_MAX _UI16_MAX
216#endif // WCHAR_MAX ]
217
218#define WINT_MIN 0
219#define WINT_MAX _UI16_MAX
220
221#endif // __STDC_LIMIT_MACROS ]
222
223
224// 7.18.4 Limits of other integer types
225
226#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260
227
228// 7.18.4.1 Macros for minimum-width integer constants
229
230#define INT8_C(val) val##i8
231#define INT16_C(val) val##i16
232#define INT32_C(val) val##i32
233#define INT64_C(val) val##i64
234
235#define UINT8_C(val) val##ui8
236#define UINT16_C(val) val##ui16
237#define UINT32_C(val) val##ui32
238#define UINT64_C(val) val##ui64
239
240// 7.18.4.2 Macros for greatest-width integer constants
241#define INTMAX_C INT64_C
242#define UINTMAX_C UINT64_C
243
244#endif // __STDC_CONSTANT_MACROS ]
245
246
247#endif // _MSC_STDINT_H_ ]