quickfix_ruby_ud 2.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/ext/quickfix/Acceptor.cpp +257 -0
- data/ext/quickfix/Acceptor.h +127 -0
- data/ext/quickfix/Allocator.h +9 -0
- data/ext/quickfix/Application.h +137 -0
- data/ext/quickfix/DOMDocument.h +70 -0
- data/ext/quickfix/DataDictionary.cpp +679 -0
- data/ext/quickfix/DataDictionary.h +607 -0
- data/ext/quickfix/DataDictionaryProvider.cpp +66 -0
- data/ext/quickfix/DataDictionaryProvider.h +67 -0
- data/ext/quickfix/DatabaseConnectionID.h +98 -0
- data/ext/quickfix/DatabaseConnectionPool.h +84 -0
- data/ext/quickfix/Dictionary.cpp +157 -0
- data/ext/quickfix/Dictionary.h +89 -0
- data/ext/quickfix/Event.h +89 -0
- data/ext/quickfix/Except.h +39 -0
- data/ext/quickfix/Exceptions.h +257 -0
- data/ext/quickfix/Field.h +654 -0
- data/ext/quickfix/FieldConvertors.cpp +86 -0
- data/ext/quickfix/FieldConvertors.h +800 -0
- data/ext/quickfix/FieldMap.cpp +254 -0
- data/ext/quickfix/FieldMap.h +327 -0
- data/ext/quickfix/FieldNumbers.h +44 -0
- data/ext/quickfix/FieldTypes.cpp +62 -0
- data/ext/quickfix/FieldTypes.h +817 -0
- data/ext/quickfix/Fields.h +30 -0
- data/ext/quickfix/FileLog.cpp +176 -0
- data/ext/quickfix/FileLog.h +110 -0
- data/ext/quickfix/FileStore.cpp +369 -0
- data/ext/quickfix/FileStore.h +131 -0
- data/ext/quickfix/FixCommonFields.h +13 -0
- data/ext/quickfix/FixFieldNumbers.h +6132 -0
- data/ext/quickfix/FixFields.h +6133 -0
- data/ext/quickfix/FixValues.h +5790 -0
- data/ext/quickfix/Group.cpp +44 -0
- data/ext/quickfix/Group.h +78 -0
- data/ext/quickfix/HostDetailsProvider.cpp +79 -0
- data/ext/quickfix/HostDetailsProvider.h +44 -0
- data/ext/quickfix/HtmlBuilder.h +178 -0
- data/ext/quickfix/HttpConnection.cpp +914 -0
- data/ext/quickfix/HttpConnection.h +74 -0
- data/ext/quickfix/HttpMessage.cpp +229 -0
- data/ext/quickfix/HttpMessage.h +112 -0
- data/ext/quickfix/HttpParser.cpp +49 -0
- data/ext/quickfix/HttpParser.h +49 -0
- data/ext/quickfix/HttpServer.cpp +152 -0
- data/ext/quickfix/HttpServer.h +76 -0
- data/ext/quickfix/Initiator.cpp +310 -0
- data/ext/quickfix/Initiator.h +151 -0
- data/ext/quickfix/Log.cpp +71 -0
- data/ext/quickfix/Log.h +254 -0
- data/ext/quickfix/Message.cpp +617 -0
- data/ext/quickfix/Message.h +419 -0
- data/ext/quickfix/MessageCracker.h +171 -0
- data/ext/quickfix/MessageSorters.cpp +101 -0
- data/ext/quickfix/MessageSorters.h +185 -0
- data/ext/quickfix/MessageStore.cpp +182 -0
- data/ext/quickfix/MessageStore.h +164 -0
- data/ext/quickfix/Mutex.h +120 -0
- data/ext/quickfix/MySQLConnection.h +187 -0
- data/ext/quickfix/MySQLLog.cpp +262 -0
- data/ext/quickfix/MySQLLog.h +158 -0
- data/ext/quickfix/MySQLStore.cpp +323 -0
- data/ext/quickfix/MySQLStore.h +161 -0
- data/ext/quickfix/MySQLStubs.h +203 -0
- data/ext/quickfix/NullStore.cpp +40 -0
- data/ext/quickfix/NullStore.h +89 -0
- data/ext/quickfix/OdbcConnection.h +241 -0
- data/ext/quickfix/OdbcLog.cpp +230 -0
- data/ext/quickfix/OdbcLog.h +109 -0
- data/ext/quickfix/OdbcStore.cpp +313 -0
- data/ext/quickfix/OdbcStore.h +124 -0
- data/ext/quickfix/PUGIXML_DOMDocument.cpp +112 -0
- data/ext/quickfix/PUGIXML_DOMDocument.h +81 -0
- data/ext/quickfix/Parser.cpp +111 -0
- data/ext/quickfix/Parser.h +50 -0
- data/ext/quickfix/PostgreSQLConnection.h +163 -0
- data/ext/quickfix/PostgreSQLLog.cpp +263 -0
- data/ext/quickfix/PostgreSQLLog.h +157 -0
- data/ext/quickfix/PostgreSQLStore.cpp +327 -0
- data/ext/quickfix/PostgreSQLStore.h +160 -0
- data/ext/quickfix/PostgreSQLStubs.h +203 -0
- data/ext/quickfix/Queue.h +66 -0
- data/ext/quickfix/QuickfixRuby.cpp +131900 -0
- data/ext/quickfix/QuickfixRuby.h +56 -0
- data/ext/quickfix/Responder.h +41 -0
- data/ext/quickfix/SSLSocketAcceptor.cpp +409 -0
- data/ext/quickfix/SSLSocketAcceptor.h +186 -0
- data/ext/quickfix/SSLSocketConnection.cpp +434 -0
- data/ext/quickfix/SSLSocketConnection.h +221 -0
- data/ext/quickfix/SSLSocketInitiator.cpp +558 -0
- data/ext/quickfix/SSLSocketInitiator.h +203 -0
- data/ext/quickfix/SSLStubs.h +129 -0
- data/ext/quickfix/Session.cpp +1437 -0
- data/ext/quickfix/Session.h +343 -0
- data/ext/quickfix/SessionFactory.cpp +314 -0
- data/ext/quickfix/SessionFactory.h +84 -0
- data/ext/quickfix/SessionID.h +136 -0
- data/ext/quickfix/SessionSettings.cpp +165 -0
- data/ext/quickfix/SessionSettings.h +283 -0
- data/ext/quickfix/SessionState.h +260 -0
- data/ext/quickfix/Settings.cpp +160 -0
- data/ext/quickfix/Settings.h +56 -0
- data/ext/quickfix/SharedArray.h +274 -0
- data/ext/quickfix/SocketAcceptor.cpp +216 -0
- data/ext/quickfix/SocketAcceptor.h +77 -0
- data/ext/quickfix/SocketConnection.cpp +256 -0
- data/ext/quickfix/SocketConnection.h +102 -0
- data/ext/quickfix/SocketConnector.cpp +112 -0
- data/ext/quickfix/SocketConnector.h +76 -0
- data/ext/quickfix/SocketInitiator.cpp +241 -0
- data/ext/quickfix/SocketInitiator.h +76 -0
- data/ext/quickfix/SocketMonitor.h +26 -0
- data/ext/quickfix/SocketMonitor_UNIX.cpp +238 -0
- data/ext/quickfix/SocketMonitor_UNIX.h +101 -0
- data/ext/quickfix/SocketMonitor_WIN32.cpp +248 -0
- data/ext/quickfix/SocketMonitor_WIN32.h +99 -0
- data/ext/quickfix/SocketServer.cpp +163 -0
- data/ext/quickfix/SocketServer.h +100 -0
- data/ext/quickfix/ThreadedSSLSocketAcceptor.cpp +436 -0
- data/ext/quickfix/ThreadedSSLSocketAcceptor.h +209 -0
- data/ext/quickfix/ThreadedSSLSocketConnection.cpp +364 -0
- data/ext/quickfix/ThreadedSSLSocketConnection.h +191 -0
- data/ext/quickfix/ThreadedSSLSocketInitiator.cpp +434 -0
- data/ext/quickfix/ThreadedSSLSocketInitiator.h +193 -0
- data/ext/quickfix/ThreadedSocketAcceptor.cpp +242 -0
- data/ext/quickfix/ThreadedSocketAcceptor.h +95 -0
- data/ext/quickfix/ThreadedSocketConnection.cpp +227 -0
- data/ext/quickfix/ThreadedSocketConnection.h +89 -0
- data/ext/quickfix/ThreadedSocketInitiator.cpp +238 -0
- data/ext/quickfix/ThreadedSocketInitiator.h +78 -0
- data/ext/quickfix/TimeRange.cpp +227 -0
- data/ext/quickfix/TimeRange.h +215 -0
- data/ext/quickfix/Utility.cpp +639 -0
- data/ext/quickfix/Utility.h +255 -0
- data/ext/quickfix/UtilitySSL.cpp +1612 -0
- data/ext/quickfix/UtilitySSL.h +274 -0
- data/ext/quickfix/Values.h +63 -0
- data/ext/quickfix/config-all.h +10 -0
- data/ext/quickfix/config.h +10 -0
- data/ext/quickfix/config_unix.h +178 -0
- data/ext/quickfix/config_windows.h +0 -0
- data/ext/quickfix/dirent_windows.h +838 -0
- data/ext/quickfix/double-conversion/bignum-dtoa.cc +641 -0
- data/ext/quickfix/double-conversion/bignum-dtoa.h +84 -0
- data/ext/quickfix/double-conversion/bignum.cc +766 -0
- data/ext/quickfix/double-conversion/bignum.h +144 -0
- data/ext/quickfix/double-conversion/cached-powers.cc +176 -0
- data/ext/quickfix/double-conversion/cached-powers.h +64 -0
- data/ext/quickfix/double-conversion/diy-fp.cc +57 -0
- data/ext/quickfix/double-conversion/diy-fp.h +118 -0
- data/ext/quickfix/double-conversion/double-conversion.cc +994 -0
- data/ext/quickfix/double-conversion/double-conversion.h +543 -0
- data/ext/quickfix/double-conversion/fast-dtoa.cc +665 -0
- data/ext/quickfix/double-conversion/fast-dtoa.h +88 -0
- data/ext/quickfix/double-conversion/fixed-dtoa.cc +404 -0
- data/ext/quickfix/double-conversion/fixed-dtoa.h +56 -0
- data/ext/quickfix/double-conversion/ieee.h +402 -0
- data/ext/quickfix/double-conversion/strtod.cc +557 -0
- data/ext/quickfix/double-conversion/strtod.h +45 -0
- data/ext/quickfix/double-conversion/utils.h +374 -0
- data/ext/quickfix/extconf.rb +76 -0
- data/ext/quickfix/index.h +37 -0
- data/ext/quickfix/pugiconfig.hpp +77 -0
- data/ext/quickfix/pugixml.cpp +13237 -0
- data/ext/quickfix/pugixml.hpp +1516 -0
- data/ext/quickfix/scope_guard.hpp +215 -0
- data/ext/quickfix/stdint_msvc.h +254 -0
- data/ext/quickfix/strptime.h +7 -0
- data/lib/quickfix40.rb +274 -0
- data/lib/quickfix41.rb +351 -0
- data/lib/quickfix42.rb +1184 -0
- data/lib/quickfix43.rb +3504 -0
- data/lib/quickfix44.rb +14040 -0
- data/lib/quickfix50.rb +20051 -0
- data/lib/quickfix50sp1.rb +23596 -0
- data/lib/quickfix50sp2.rb +412444 -0
- data/lib/quickfix_fields.rb +79393 -0
- data/lib/quickfix_ruby.rb +82 -0
- data/lib/quickfixt11.rb +65 -0
- data/spec/FIX40.xml +862 -0
- data/spec/FIX41.xml +1282 -0
- data/spec/FIX42.xml +2743 -0
- data/spec/FIX43.xml +4230 -0
- data/spec/FIX44.xml +6600 -0
- data/spec/FIX50.xml +8142 -0
- data/spec/FIX50SP1.xml +9506 -0
- data/spec/FIX50SP2.xml +26069 -0
- data/spec/FIXT11.xml +252 -0
- data/test/DataDictionaryTestCase.rb +268 -0
- data/test/DictionaryTestCase.rb +112 -0
- data/test/FieldBaseTestCase.rb +24 -0
- data/test/MessageStoreTestCase.rb +19 -0
- data/test/MessageTestCase.rb +368 -0
- data/test/SessionSettingsTestCase.rb +41 -0
- metadata +236 -0
@@ -0,0 +1,215 @@
|
|
1
|
+
/*
|
2
|
+
* Created on: 13/02/2018
|
3
|
+
* Author: ricab
|
4
|
+
*
|
5
|
+
* See README.md for documentation of this header's public interface.
|
6
|
+
*/
|
7
|
+
|
8
|
+
// This is free and unencumbered software released into the public domain.
|
9
|
+
|
10
|
+
// Anyone is free to copy, modify, publish, use, compile, sell, or
|
11
|
+
// distribute this software, either in source code form or as a compiled
|
12
|
+
// binary, for any purpose, commercial or non-commercial, and by any
|
13
|
+
// means.
|
14
|
+
|
15
|
+
// In jurisdictions that recognize copyright laws, the author or authors
|
16
|
+
// of this software dedicate any and all copyright interest in the
|
17
|
+
// software to the public domain. We make this dedication for the benefit
|
18
|
+
// of the public at large and to the detriment of our heirs and
|
19
|
+
// successors. We intend this dedication to be an overt act of
|
20
|
+
// relinquishment in perpetuity of all present and future rights to this
|
21
|
+
// software under copyright law.
|
22
|
+
|
23
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
24
|
+
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
25
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
26
|
+
// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
27
|
+
// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
28
|
+
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
29
|
+
// OTHER DEALINGS IN THE SOFTWARE.
|
30
|
+
|
31
|
+
// For more information, please refer to <http://unlicense.org>
|
32
|
+
|
33
|
+
#ifndef SCOPE_GUARD_HPP_
|
34
|
+
#define SCOPE_GUARD_HPP_
|
35
|
+
|
36
|
+
#include <type_traits>
|
37
|
+
#include <utility>
|
38
|
+
|
39
|
+
#if __cplusplus >= 201703L
|
40
|
+
#define SG_NODISCARD [[nodiscard]]
|
41
|
+
#ifdef SG_REQUIRE_NOEXCEPT_IN_CPP17
|
42
|
+
#define SG_REQUIRE_NOEXCEPT
|
43
|
+
#endif
|
44
|
+
#else
|
45
|
+
#define SG_NODISCARD
|
46
|
+
#endif
|
47
|
+
|
48
|
+
namespace sg
|
49
|
+
{
|
50
|
+
namespace detail
|
51
|
+
{
|
52
|
+
/* --- Some custom type traits --- */
|
53
|
+
|
54
|
+
// Type trait determining whether a type is callable with no arguments
|
55
|
+
template<typename T, typename = void>
|
56
|
+
struct is_noarg_callable_t
|
57
|
+
: public std::false_type
|
58
|
+
{}; // in general, false
|
59
|
+
|
60
|
+
template<typename T>
|
61
|
+
struct is_noarg_callable_t<T, decltype(std::declval<T&&>()())>
|
62
|
+
: public std::true_type
|
63
|
+
{}; // only true when call expression valid
|
64
|
+
|
65
|
+
// Type trait determining whether a no-argument callable returns void
|
66
|
+
template<typename T>
|
67
|
+
struct returns_void_t
|
68
|
+
: public std::is_same<void, decltype(std::declval<T&&>()())>
|
69
|
+
{};
|
70
|
+
|
71
|
+
/* Type trait determining whether a no-arg callable is nothrow invocable if
|
72
|
+
required. This is where SG_REQUIRE_NOEXCEPT logic is encapsulated. */
|
73
|
+
template<typename T>
|
74
|
+
struct is_nothrow_invocable_if_required_t
|
75
|
+
: public
|
76
|
+
#ifdef SG_REQUIRE_NOEXCEPT
|
77
|
+
std::is_nothrow_invocable<T> /* Note: _r variants not enough to
|
78
|
+
confirm void return: any return can be
|
79
|
+
discarded so all returns are
|
80
|
+
compatible with void */
|
81
|
+
#else
|
82
|
+
std::true_type
|
83
|
+
#endif
|
84
|
+
{};
|
85
|
+
|
86
|
+
// logic AND of two or more type traits
|
87
|
+
template<typename A, typename B, typename... C>
|
88
|
+
struct and_t : public and_t<A, and_t<B, C...>>
|
89
|
+
{}; // for more than two arguments
|
90
|
+
|
91
|
+
template<typename A, typename B>
|
92
|
+
struct and_t<A, B> : public std::conditional<A::value, B, A>::type
|
93
|
+
{}; // for two arguments
|
94
|
+
|
95
|
+
// Type trait determining whether a type is a proper scope_guard callback.
|
96
|
+
template<typename T>
|
97
|
+
struct is_proper_sg_callback_t
|
98
|
+
: public and_t<is_noarg_callable_t<T>,
|
99
|
+
returns_void_t<T>,
|
100
|
+
is_nothrow_invocable_if_required_t<T>,
|
101
|
+
std::is_nothrow_destructible<T>>
|
102
|
+
{};
|
103
|
+
|
104
|
+
|
105
|
+
/* --- The actual scope_guard template --- */
|
106
|
+
|
107
|
+
template<typename Callback,
|
108
|
+
typename = typename std::enable_if<
|
109
|
+
is_proper_sg_callback_t<Callback>::value>::type>
|
110
|
+
class scope_guard;
|
111
|
+
|
112
|
+
|
113
|
+
/* --- Now the friend maker --- */
|
114
|
+
|
115
|
+
template<typename Callback>
|
116
|
+
detail::scope_guard<Callback> make_scope_guard(Callback&& callback)
|
117
|
+
noexcept(std::is_nothrow_constructible<Callback, Callback&&>::value); /*
|
118
|
+
we need this in the inner namespace due to MSVC bugs preventing
|
119
|
+
sg::detail::scope_guard from befriending a sg::make_scope_guard
|
120
|
+
template instance in the parent namespace (see https://is.gd/xFfFhE). */
|
121
|
+
|
122
|
+
|
123
|
+
/* --- The template specialization that actually defines the class --- */
|
124
|
+
|
125
|
+
template<typename Callback>
|
126
|
+
class SG_NODISCARD scope_guard<Callback> final
|
127
|
+
{
|
128
|
+
public:
|
129
|
+
typedef Callback callback_type;
|
130
|
+
|
131
|
+
scope_guard(scope_guard&& other)
|
132
|
+
noexcept(std::is_nothrow_constructible<Callback, Callback&&>::value);
|
133
|
+
|
134
|
+
~scope_guard() noexcept; // highlight noexcept dtor
|
135
|
+
|
136
|
+
void dismiss() noexcept;
|
137
|
+
|
138
|
+
public:
|
139
|
+
scope_guard() = delete;
|
140
|
+
scope_guard(const scope_guard&) = delete;
|
141
|
+
scope_guard& operator=(const scope_guard&) = delete;
|
142
|
+
scope_guard& operator=(scope_guard&&) = delete;
|
143
|
+
|
144
|
+
private:
|
145
|
+
explicit scope_guard(Callback&& callback)
|
146
|
+
noexcept(std::is_nothrow_constructible<Callback, Callback&&>::value); /*
|
147
|
+
meant for friends only */
|
148
|
+
|
149
|
+
friend scope_guard<Callback> make_scope_guard<Callback>(Callback&&)
|
150
|
+
noexcept(std::is_nothrow_constructible<Callback, Callback&&>::value); /*
|
151
|
+
only make_scope_guard can create scope_guards from scratch (i.e. non-move)
|
152
|
+
*/
|
153
|
+
|
154
|
+
private:
|
155
|
+
Callback m_callback;
|
156
|
+
bool m_active;
|
157
|
+
|
158
|
+
};
|
159
|
+
|
160
|
+
} // namespace detail
|
161
|
+
|
162
|
+
|
163
|
+
/* --- Now the single public maker function --- */
|
164
|
+
|
165
|
+
using detail::make_scope_guard; // see comment on declaration above
|
166
|
+
|
167
|
+
} // namespace sg
|
168
|
+
|
169
|
+
////////////////////////////////////////////////////////////////////////////////
|
170
|
+
template<typename Callback>
|
171
|
+
sg::detail::scope_guard<Callback>::scope_guard(Callback&& callback)
|
172
|
+
noexcept(std::is_nothrow_constructible<Callback, Callback&&>::value)
|
173
|
+
: m_callback(std::forward<Callback>(callback)) /* use () instead of {} because
|
174
|
+
of DR 1467 (https://is.gd/WHmWuo), which still impacts older compilers
|
175
|
+
(e.g. GCC 4.x and clang <=3.6, see https://godbolt.org/g/TE9tPJ and
|
176
|
+
https://is.gd/Tsmh8G) */
|
177
|
+
, m_active{true}
|
178
|
+
{}
|
179
|
+
|
180
|
+
////////////////////////////////////////////////////////////////////////////////
|
181
|
+
template<typename Callback>
|
182
|
+
sg::detail::scope_guard<Callback>::scope_guard::~scope_guard() noexcept /*
|
183
|
+
need the extra injected-class-name here to make different compilers happy */
|
184
|
+
{
|
185
|
+
if(m_active)
|
186
|
+
m_callback();
|
187
|
+
}
|
188
|
+
|
189
|
+
////////////////////////////////////////////////////////////////////////////////
|
190
|
+
template<typename Callback>
|
191
|
+
sg::detail::scope_guard<Callback>::scope_guard(scope_guard&& other)
|
192
|
+
noexcept(std::is_nothrow_constructible<Callback, Callback&&>::value)
|
193
|
+
: m_callback(std::forward<Callback>(other.m_callback)) // idem
|
194
|
+
, m_active{std::move(other.m_active)}
|
195
|
+
{
|
196
|
+
other.m_active = false;
|
197
|
+
}
|
198
|
+
|
199
|
+
////////////////////////////////////////////////////////////////////////////////
|
200
|
+
template<typename Callback>
|
201
|
+
inline void sg::detail::scope_guard<Callback>::dismiss() noexcept
|
202
|
+
{
|
203
|
+
m_active = false;
|
204
|
+
}
|
205
|
+
|
206
|
+
////////////////////////////////////////////////////////////////////////////////
|
207
|
+
template<typename Callback>
|
208
|
+
inline auto sg::detail::make_scope_guard(Callback&& callback)
|
209
|
+
noexcept(std::is_nothrow_constructible<Callback, Callback&&>::value)
|
210
|
+
-> detail::scope_guard<Callback>
|
211
|
+
{
|
212
|
+
return detail::scope_guard<Callback>{std::forward<Callback>(callback)};
|
213
|
+
}
|
214
|
+
|
215
|
+
#endif /* SCOPE_GUARD_HPP_ */
|
@@ -0,0 +1,254 @@
|
|
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-2013 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. Neither the name of the product nor the names of its contributors may
|
17
|
+
// be used to endorse or promote products derived from this software
|
18
|
+
// without specific prior written permission.
|
19
|
+
//
|
20
|
+
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
21
|
+
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
22
|
+
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
23
|
+
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
24
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
25
|
+
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
26
|
+
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
27
|
+
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
28
|
+
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
29
|
+
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
|
+
//
|
31
|
+
///////////////////////////////////////////////////////////////////////////////
|
32
|
+
|
33
|
+
#ifndef _MSC_VER // [
|
34
|
+
#error "Use this header only with Microsoft Visual C++ compilers!"
|
35
|
+
#endif // _MSC_VER ]
|
36
|
+
|
37
|
+
#ifndef _MSC_STDINT_H_ // [
|
38
|
+
#define _MSC_STDINT_H_
|
39
|
+
|
40
|
+
#if _MSC_VER > 1000
|
41
|
+
#pragma once
|
42
|
+
#endif
|
43
|
+
|
44
|
+
#include <limits.h>
|
45
|
+
|
46
|
+
// For Visual Studio 6 in C++ mode and for many Visual Studio versions when
|
47
|
+
// compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}'
|
48
|
+
// or compiler give many errors like this:
|
49
|
+
// error C2733: second C linkage of overloaded function 'wmemchr' not allowed
|
50
|
+
#ifdef __cplusplus
|
51
|
+
extern "C" {
|
52
|
+
#endif
|
53
|
+
# include <wchar.h>
|
54
|
+
#ifdef __cplusplus
|
55
|
+
}
|
56
|
+
#endif
|
57
|
+
|
58
|
+
// Define _W64 macros to mark types changing their size, like intptr_t.
|
59
|
+
#ifndef _W64
|
60
|
+
# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
|
61
|
+
# define _W64 __w64
|
62
|
+
# else
|
63
|
+
# define _W64
|
64
|
+
# endif
|
65
|
+
#endif
|
66
|
+
|
67
|
+
|
68
|
+
// 7.18.1 Integer types
|
69
|
+
|
70
|
+
// 7.18.1.1 Exact-width integer types
|
71
|
+
|
72
|
+
// Visual Studio 6 and Embedded Visual C++ 4 doesn't
|
73
|
+
// realize that, e.g. char has the same size as __int8
|
74
|
+
// so we give up on __intX for them.
|
75
|
+
#if (_MSC_VER < 1300)
|
76
|
+
typedef signed char int8_t;
|
77
|
+
typedef signed short int16_t;
|
78
|
+
typedef signed int int32_t;
|
79
|
+
typedef unsigned char uint8_t;
|
80
|
+
typedef unsigned short uint16_t;
|
81
|
+
typedef unsigned int uint32_t;
|
82
|
+
#else
|
83
|
+
typedef signed __int8 int8_t;
|
84
|
+
typedef signed __int16 int16_t;
|
85
|
+
typedef signed __int32 int32_t;
|
86
|
+
typedef unsigned __int8 uint8_t;
|
87
|
+
typedef unsigned __int16 uint16_t;
|
88
|
+
typedef unsigned __int32 uint32_t;
|
89
|
+
#endif
|
90
|
+
typedef signed __int64 int64_t;
|
91
|
+
typedef unsigned __int64 uint64_t;
|
92
|
+
|
93
|
+
|
94
|
+
// 7.18.1.2 Minimum-width integer types
|
95
|
+
typedef int8_t int_least8_t;
|
96
|
+
typedef int16_t int_least16_t;
|
97
|
+
typedef int32_t int_least32_t;
|
98
|
+
typedef int64_t int_least64_t;
|
99
|
+
typedef uint8_t uint_least8_t;
|
100
|
+
typedef uint16_t uint_least16_t;
|
101
|
+
typedef uint32_t uint_least32_t;
|
102
|
+
typedef uint64_t uint_least64_t;
|
103
|
+
|
104
|
+
// 7.18.1.3 Fastest minimum-width integer types
|
105
|
+
typedef int8_t int_fast8_t;
|
106
|
+
typedef int16_t int_fast16_t;
|
107
|
+
typedef int32_t int_fast32_t;
|
108
|
+
typedef int64_t int_fast64_t;
|
109
|
+
typedef uint8_t uint_fast8_t;
|
110
|
+
typedef uint16_t uint_fast16_t;
|
111
|
+
typedef uint32_t uint_fast32_t;
|
112
|
+
typedef uint64_t uint_fast64_t;
|
113
|
+
|
114
|
+
// 7.18.1.4 Integer types capable of holding object pointers
|
115
|
+
#ifdef _WIN64 // [
|
116
|
+
typedef signed __int64 intptr_t;
|
117
|
+
typedef unsigned __int64 uintptr_t;
|
118
|
+
#else // _WIN64 ][
|
119
|
+
typedef _W64 signed int intptr_t;
|
120
|
+
typedef _W64 unsigned int uintptr_t;
|
121
|
+
#endif // _WIN64 ]
|
122
|
+
|
123
|
+
// 7.18.1.5 Greatest-width integer types
|
124
|
+
typedef int64_t intmax_t;
|
125
|
+
typedef uint64_t uintmax_t;
|
126
|
+
|
127
|
+
|
128
|
+
// 7.18.2 Limits of specified-width integer types
|
129
|
+
|
130
|
+
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259
|
131
|
+
|
132
|
+
// 7.18.2.1 Limits of exact-width integer types
|
133
|
+
#define INT8_MIN ((int8_t)_I8_MIN)
|
134
|
+
#define INT8_MAX _I8_MAX
|
135
|
+
#define INT16_MIN ((int16_t)_I16_MIN)
|
136
|
+
#define INT16_MAX _I16_MAX
|
137
|
+
#define INT32_MIN ((int32_t)_I32_MIN)
|
138
|
+
#define INT32_MAX _I32_MAX
|
139
|
+
#define INT64_MIN ((int64_t)_I64_MIN)
|
140
|
+
#define INT64_MAX _I64_MAX
|
141
|
+
#define UINT8_MAX _UI8_MAX
|
142
|
+
#define UINT16_MAX _UI16_MAX
|
143
|
+
#define UINT32_MAX _UI32_MAX
|
144
|
+
#define UINT64_MAX _UI64_MAX
|
145
|
+
|
146
|
+
// 7.18.2.2 Limits of minimum-width integer types
|
147
|
+
#define INT_LEAST8_MIN INT8_MIN
|
148
|
+
#define INT_LEAST8_MAX INT8_MAX
|
149
|
+
#define INT_LEAST16_MIN INT16_MIN
|
150
|
+
#define INT_LEAST16_MAX INT16_MAX
|
151
|
+
#define INT_LEAST32_MIN INT32_MIN
|
152
|
+
#define INT_LEAST32_MAX INT32_MAX
|
153
|
+
#define INT_LEAST64_MIN INT64_MIN
|
154
|
+
#define INT_LEAST64_MAX INT64_MAX
|
155
|
+
#define UINT_LEAST8_MAX UINT8_MAX
|
156
|
+
#define UINT_LEAST16_MAX UINT16_MAX
|
157
|
+
#define UINT_LEAST32_MAX UINT32_MAX
|
158
|
+
#define UINT_LEAST64_MAX UINT64_MAX
|
159
|
+
|
160
|
+
// 7.18.2.3 Limits of fastest minimum-width integer types
|
161
|
+
#define INT_FAST8_MIN INT8_MIN
|
162
|
+
#define INT_FAST8_MAX INT8_MAX
|
163
|
+
#define INT_FAST16_MIN INT16_MIN
|
164
|
+
#define INT_FAST16_MAX INT16_MAX
|
165
|
+
#define INT_FAST32_MIN INT32_MIN
|
166
|
+
#define INT_FAST32_MAX INT32_MAX
|
167
|
+
#define INT_FAST64_MIN INT64_MIN
|
168
|
+
#define INT_FAST64_MAX INT64_MAX
|
169
|
+
#define UINT_FAST8_MAX UINT8_MAX
|
170
|
+
#define UINT_FAST16_MAX UINT16_MAX
|
171
|
+
#define UINT_FAST32_MAX UINT32_MAX
|
172
|
+
#define UINT_FAST64_MAX UINT64_MAX
|
173
|
+
|
174
|
+
// 7.18.2.4 Limits of integer types capable of holding object pointers
|
175
|
+
#ifdef _WIN64 // [
|
176
|
+
# define INTPTR_MIN INT64_MIN
|
177
|
+
# define INTPTR_MAX INT64_MAX
|
178
|
+
# define UINTPTR_MAX UINT64_MAX
|
179
|
+
#else // _WIN64 ][
|
180
|
+
# define INTPTR_MIN INT32_MIN
|
181
|
+
# define INTPTR_MAX INT32_MAX
|
182
|
+
# define UINTPTR_MAX UINT32_MAX
|
183
|
+
#endif // _WIN64 ]
|
184
|
+
|
185
|
+
// 7.18.2.5 Limits of greatest-width integer types
|
186
|
+
#define INTMAX_MIN INT64_MIN
|
187
|
+
#define INTMAX_MAX INT64_MAX
|
188
|
+
#define UINTMAX_MAX UINT64_MAX
|
189
|
+
|
190
|
+
// 7.18.3 Limits of other integer types
|
191
|
+
|
192
|
+
#ifdef _WIN64 // [
|
193
|
+
# define PTRDIFF_MIN _I64_MIN
|
194
|
+
# define PTRDIFF_MAX _I64_MAX
|
195
|
+
#else // _WIN64 ][
|
196
|
+
# define PTRDIFF_MIN _I32_MIN
|
197
|
+
# define PTRDIFF_MAX _I32_MAX
|
198
|
+
#endif // _WIN64 ]
|
199
|
+
|
200
|
+
#define SIG_ATOMIC_MIN INT_MIN
|
201
|
+
#define SIG_ATOMIC_MAX INT_MAX
|
202
|
+
|
203
|
+
#ifndef SIZE_MAX // [
|
204
|
+
# ifdef _WIN64 // [
|
205
|
+
# define SIZE_MAX _UI64_MAX
|
206
|
+
# else // _WIN64 ][
|
207
|
+
# define SIZE_MAX _UI32_MAX
|
208
|
+
# endif // _WIN64 ]
|
209
|
+
#endif // SIZE_MAX ]
|
210
|
+
|
211
|
+
// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
|
212
|
+
#ifndef WCHAR_MIN // [
|
213
|
+
# define WCHAR_MIN 0
|
214
|
+
#endif // WCHAR_MIN ]
|
215
|
+
#ifndef WCHAR_MAX // [
|
216
|
+
# define WCHAR_MAX _UI16_MAX
|
217
|
+
#endif // WCHAR_MAX ]
|
218
|
+
|
219
|
+
#define WINT_MIN 0
|
220
|
+
#define WINT_MAX _UI16_MAX
|
221
|
+
|
222
|
+
#endif // __STDC_LIMIT_MACROS ]
|
223
|
+
|
224
|
+
|
225
|
+
// 7.18.4 Limits of other integer types
|
226
|
+
|
227
|
+
#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260
|
228
|
+
|
229
|
+
// 7.18.4.1 Macros for minimum-width integer constants
|
230
|
+
|
231
|
+
#define INT8_C(val) val##i8
|
232
|
+
#define INT16_C(val) val##i16
|
233
|
+
#define INT32_C(val) val##i32
|
234
|
+
#define INT64_C(val) val##i64
|
235
|
+
|
236
|
+
#define UINT8_C(val) val##ui8
|
237
|
+
#define UINT16_C(val) val##ui16
|
238
|
+
#define UINT32_C(val) val##ui32
|
239
|
+
#define UINT64_C(val) val##ui64
|
240
|
+
|
241
|
+
// 7.18.4.2 Macros for greatest-width integer constants
|
242
|
+
// These #ifndef's are needed to prevent collisions with <boost/cstdint.hpp>.
|
243
|
+
// Check out Issue 9 for the details.
|
244
|
+
#ifndef INTMAX_C // [
|
245
|
+
#define INTMAX_C INT64_C
|
246
|
+
#endif // INTMAX_C ]
|
247
|
+
#ifndef UINTMAX_C // [
|
248
|
+
#define UINTMAX_C UINT64_C
|
249
|
+
#endif // UINTMAX_C ]
|
250
|
+
|
251
|
+
#endif // __STDC_CONSTANT_MACROS ]
|
252
|
+
|
253
|
+
|
254
|
+
#endif // _MSC_STDINT_H_ ]
|