usb 1.7.2-prebuild

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.
Files changed (183) hide show
  1. package/.github/workflows/prebuild.yml +62 -0
  2. package/.gitmodules +3 -0
  3. package/LICENSE +7 -0
  4. package/Readme.md +339 -0
  5. package/binding.gyp +90 -0
  6. package/libusb/.gitattributes +11 -0
  7. package/libusb/.private/README.txt +5 -0
  8. package/libusb/.private/bd.cmd +89 -0
  9. package/libusb/.private/bm.sh +54 -0
  10. package/libusb/.private/bwince.cmd +57 -0
  11. package/libusb/.private/post-rewrite.sh +28 -0
  12. package/libusb/.private/pre-commit.sh +42 -0
  13. package/libusb/.private/wbs.txt +61 -0
  14. package/libusb/.private/wbs_wince.txt +42 -0
  15. package/libusb/AUTHORS +78 -0
  16. package/libusb/COPYING +504 -0
  17. package/libusb/ChangeLog +211 -0
  18. package/libusb/INSTALL +234 -0
  19. package/libusb/INSTALL_WIN.txt +73 -0
  20. package/libusb/Makefile.am +28 -0
  21. package/libusb/NEWS +2 -0
  22. package/libusb/PORTING +94 -0
  23. package/libusb/README +28 -0
  24. package/libusb/README.git +41 -0
  25. package/libusb/TODO +2 -0
  26. package/libusb/Xcode/common.xcconfig +49 -0
  27. package/libusb/Xcode/debug.xcconfig +29 -0
  28. package/libusb/Xcode/libusb.xcconfig +21 -0
  29. package/libusb/Xcode/libusb.xcodeproj/project.pbxproj +1 -0
  30. package/libusb/Xcode/libusb_debug.xcconfig +21 -0
  31. package/libusb/Xcode/libusb_release.xcconfig +21 -0
  32. package/libusb/Xcode/release.xcconfig +30 -0
  33. package/libusb/android/README +114 -0
  34. package/libusb/android/jni/Android.mk +23 -0
  35. package/libusb/android/jni/Application.mk +24 -0
  36. package/libusb/android/jni/examples.mk +134 -0
  37. package/libusb/android/jni/libusb.mk +54 -0
  38. package/libusb/android/jni/tests.mk +56 -0
  39. package/libusb/autogen.sh +8 -0
  40. package/libusb/bootstrap.sh +19 -0
  41. package/libusb/configure.ac +304 -0
  42. package/libusb/doc/Makefile.am +9 -0
  43. package/libusb/doc/doxygen.cfg.in +1288 -0
  44. package/libusb/doc/libusb.png +0 -0
  45. package/libusb/examples/Makefile.am +19 -0
  46. package/libusb/examples/dpfp.c +506 -0
  47. package/libusb/examples/dpfp_threaded.c +544 -0
  48. package/libusb/examples/ezusb.c +831 -0
  49. package/libusb/examples/ezusb.h +120 -0
  50. package/libusb/examples/fxload.c +287 -0
  51. package/libusb/examples/getopt/getopt.c +1060 -0
  52. package/libusb/examples/getopt/getopt.h +180 -0
  53. package/libusb/examples/getopt/getopt1.c +188 -0
  54. package/libusb/examples/hotplugtest.c +104 -0
  55. package/libusb/examples/listdevs.c +71 -0
  56. package/libusb/examples/sam3u_benchmark.c +193 -0
  57. package/libusb/examples/xusb.c +1129 -0
  58. package/libusb/libusb/Makefile.am +75 -0
  59. package/libusb/libusb/core.c +2342 -0
  60. package/libusb/libusb/descriptor.c +1199 -0
  61. package/libusb/libusb/hotplug.c +327 -0
  62. package/libusb/libusb/hotplug.h +82 -0
  63. package/libusb/libusb/io.c +2631 -0
  64. package/libusb/libusb/libusb-1.0.def +166 -0
  65. package/libusb/libusb/libusb-1.0.rc +61 -0
  66. package/libusb/libusb/libusb.h +1998 -0
  67. package/libusb/libusb/libusbi.h +1040 -0
  68. package/libusb/libusb/os/darwin_usb.c +2009 -0
  69. package/libusb/libusb/os/darwin_usb.h +162 -0
  70. package/libusb/libusb/os/linux_netlink.c +369 -0
  71. package/libusb/libusb/os/linux_udev.c +307 -0
  72. package/libusb/libusb/os/linux_usbfs.c +2695 -0
  73. package/libusb/libusb/os/linux_usbfs.h +192 -0
  74. package/libusb/libusb/os/netbsd_usb.c +738 -0
  75. package/libusb/libusb/os/openbsd_usb.c +832 -0
  76. package/libusb/libusb/os/poll_posix.c +51 -0
  77. package/libusb/libusb/os/poll_posix.h +11 -0
  78. package/libusb/libusb/os/poll_windows.c +796 -0
  79. package/libusb/libusb/os/poll_windows.h +131 -0
  80. package/libusb/libusb/os/threads_posix.c +82 -0
  81. package/libusb/libusb/os/threads_posix.h +50 -0
  82. package/libusb/libusb/os/threads_windows.c +212 -0
  83. package/libusb/libusb/os/threads_windows.h +87 -0
  84. package/libusb/libusb/os/wince_usb.c +1032 -0
  85. package/libusb/libusb/os/wince_usb.h +131 -0
  86. package/libusb/libusb/os/windows_common.h +108 -0
  87. package/libusb/libusb/os/windows_usb.c +5347 -0
  88. package/libusb/libusb/os/windows_usb.h +971 -0
  89. package/libusb/libusb/strerror.c +199 -0
  90. package/libusb/libusb/sync.c +307 -0
  91. package/libusb/libusb/version.h +18 -0
  92. package/libusb/libusb/version_nano.h +1 -0
  93. package/libusb/libusb-1.0.pc.in +11 -0
  94. package/libusb/msvc/config.h +50 -0
  95. package/libusb/msvc/ddk_build.cmd +175 -0
  96. package/libusb/msvc/errno.h +102 -0
  97. package/libusb/msvc/fxload_2010.vcxproj +170 -0
  98. package/libusb/msvc/fxload_2010.vcxproj.filters +25 -0
  99. package/libusb/msvc/fxload_2012.vcxproj +174 -0
  100. package/libusb/msvc/fxload_2012.vcxproj.filters +25 -0
  101. package/libusb/msvc/fxload_2013.vcxproj +174 -0
  102. package/libusb/msvc/fxload_sources +23 -0
  103. package/libusb/msvc/getopt_2005.vcproj +288 -0
  104. package/libusb/msvc/getopt_2010.vcxproj +131 -0
  105. package/libusb/msvc/getopt_2010.vcxproj.filters +26 -0
  106. package/libusb/msvc/getopt_2012.vcxproj +136 -0
  107. package/libusb/msvc/getopt_2012.vcxproj.filters +26 -0
  108. package/libusb/msvc/getopt_2013.vcxproj +136 -0
  109. package/libusb/msvc/getopt_sources +20 -0
  110. package/libusb/msvc/hotplugtest_2010.vcxproj +163 -0
  111. package/libusb/msvc/hotplugtest_2010.vcxproj.filters +14 -0
  112. package/libusb/msvc/hotplugtest_2012.vcxproj +167 -0
  113. package/libusb/msvc/hotplugtest_2012.vcxproj.filters +14 -0
  114. package/libusb/msvc/hotplugtest_2013.vcxproj +167 -0
  115. package/libusb/msvc/hotplugtest_sources +20 -0
  116. package/libusb/msvc/inttypes.h +295 -0
  117. package/libusb/msvc/libusb.dsw +71 -0
  118. package/libusb/msvc/libusb_2005.sln +95 -0
  119. package/libusb/msvc/libusb_2010.sln +94 -0
  120. package/libusb/msvc/libusb_2012.sln +94 -0
  121. package/libusb/msvc/libusb_2013.sln +100 -0
  122. package/libusb/msvc/libusb_2015.sln +100 -0
  123. package/libusb/msvc/libusb_dll.dsp +194 -0
  124. package/libusb/msvc/libusb_dll_2005.vcproj +436 -0
  125. package/libusb/msvc/libusb_dll_2010.vcxproj +170 -0
  126. package/libusb/msvc/libusb_dll_2010.vcxproj.filters +81 -0
  127. package/libusb/msvc/libusb_dll_2012.vcxproj +175 -0
  128. package/libusb/msvc/libusb_dll_2012.vcxproj.filters +84 -0
  129. package/libusb/msvc/libusb_dll_2013.vcxproj +175 -0
  130. package/libusb/msvc/libusb_dll_wince.vcproj +1243 -0
  131. package/libusb/msvc/libusb_sources +38 -0
  132. package/libusb/msvc/libusb_static.dsp +174 -0
  133. package/libusb/msvc/libusb_static_2005.vcproj +362 -0
  134. package/libusb/msvc/libusb_static_2010.vcxproj +156 -0
  135. package/libusb/msvc/libusb_static_2010.vcxproj.filters +74 -0
  136. package/libusb/msvc/libusb_static_2012.vcxproj +160 -0
  137. package/libusb/msvc/libusb_static_2012.vcxproj.filters +74 -0
  138. package/libusb/msvc/libusb_static_2013.vcxproj +160 -0
  139. package/libusb/msvc/libusb_static_wince.vcproj +1185 -0
  140. package/libusb/msvc/libusb_wince.sln +246 -0
  141. package/libusb/msvc/listdevs.dsp +103 -0
  142. package/libusb/msvc/listdevs_2005.vcproj +360 -0
  143. package/libusb/msvc/listdevs_2010.vcxproj +165 -0
  144. package/libusb/msvc/listdevs_2010.vcxproj.filters +14 -0
  145. package/libusb/msvc/listdevs_2012.vcxproj +169 -0
  146. package/libusb/msvc/listdevs_2012.vcxproj.filters +14 -0
  147. package/libusb/msvc/listdevs_2013.vcxproj +169 -0
  148. package/libusb/msvc/listdevs_sources +19 -0
  149. package/libusb/msvc/listdevs_wince.vcproj +1120 -0
  150. package/libusb/msvc/missing.c +80 -0
  151. package/libusb/msvc/missing.h +32 -0
  152. package/libusb/msvc/stdint.h +256 -0
  153. package/libusb/msvc/stress_2005.vcproj +390 -0
  154. package/libusb/msvc/stress_2010.vcxproj +167 -0
  155. package/libusb/msvc/stress_2010.vcxproj.filters +25 -0
  156. package/libusb/msvc/stress_2012.vcxproj +171 -0
  157. package/libusb/msvc/stress_2012.vcxproj.filters +25 -0
  158. package/libusb/msvc/stress_2013.vcxproj +171 -0
  159. package/libusb/msvc/stress_wince.vcproj +1128 -0
  160. package/libusb/msvc/xusb.dsp +102 -0
  161. package/libusb/msvc/xusb_2005.vcproj +344 -0
  162. package/libusb/msvc/xusb_2010.vcxproj +163 -0
  163. package/libusb/msvc/xusb_2010.vcxproj.filters +14 -0
  164. package/libusb/msvc/xusb_2012.vcxproj +167 -0
  165. package/libusb/msvc/xusb_2012.vcxproj.filters +14 -0
  166. package/libusb/msvc/xusb_2013.vcxproj +167 -0
  167. package/libusb/msvc/xusb_sources +20 -0
  168. package/libusb/msvc/xusb_wince.vcproj +1120 -0
  169. package/libusb/tests/Makefile.am +6 -0
  170. package/libusb/tests/libusb_testlib.h +107 -0
  171. package/libusb/tests/stress.c +160 -0
  172. package/libusb/tests/testlib.c +281 -0
  173. package/libusb.gypi +136 -0
  174. package/libusb_config/config.h +1 -0
  175. package/package.json +69 -0
  176. package/src/device.cc +412 -0
  177. package/src/helpers.h +64 -0
  178. package/src/node_usb.cc +319 -0
  179. package/src/node_usb.h +120 -0
  180. package/src/transfer.cc +148 -0
  181. package/src/uv_async_queue.h +33 -0
  182. package/test/usb.coffee +191 -0
  183. package/usb.js +524 -0
@@ -0,0 +1,80 @@
1
+ /*
2
+ * Source file for missing WinCE functionality
3
+ * Copyright © 2012 RealVNC Ltd.
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+ */
19
+
20
+ #include "missing.h"
21
+
22
+ #include <config.h>
23
+ #include <libusbi.h>
24
+
25
+ #include <windows.h>
26
+
27
+ // The registry path to store environment variables
28
+ #define ENVIRONMENT_REG_PATH _T("Software\\libusb\\environment")
29
+
30
+ /* Workaround getenv not being available on WinCE.
31
+ * Instead look in HKLM\Software\libusb\environment */
32
+ char *getenv(const char *name)
33
+ {
34
+ static char value[MAX_PATH];
35
+ TCHAR wValue[MAX_PATH];
36
+ WCHAR wName[MAX_PATH];
37
+ DWORD dwType, dwData;
38
+ HKEY hkey;
39
+ LONG rc;
40
+
41
+ if (!name)
42
+ return NULL;
43
+
44
+ if (MultiByteToWideChar(CP_UTF8, 0, name, -1, wName, MAX_PATH) <= 0) {
45
+ usbi_dbg("Failed to convert environment variable name to wide string");
46
+ return NULL;
47
+ }
48
+ wName[MAX_PATH - 1] = 0; // Be sure it's NUL terminated
49
+
50
+ rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, ENVIRONMENT_REG_PATH, 0, KEY_QUERY_VALUE, &hkey);
51
+ if (rc != ERROR_SUCCESS) {
52
+ usbi_dbg("Failed to open registry key for getenv with error %d", rc);
53
+ return NULL;
54
+ }
55
+
56
+ // Attempt to read the key
57
+ dwData = sizeof(wValue);
58
+ rc = RegQueryValueEx(hkey, wName, NULL, &dwType,
59
+ (LPBYTE)&wValue, &dwData);
60
+ RegCloseKey(hkey);
61
+ if (rc != ERROR_SUCCESS) {
62
+ usbi_dbg("Failed to read registry key value for getenv with error %d", rc);
63
+ return NULL;
64
+ }
65
+ if (dwType != REG_SZ) {
66
+ usbi_dbg("Registry value was of type %d instead of REG_SZ", dwType);
67
+ return NULL;
68
+ }
69
+
70
+ // Success in reading the key, convert from WCHAR to char
71
+ if (WideCharToMultiByte(CP_UTF8, 0,
72
+ wValue, dwData / sizeof(*wValue),
73
+ value, MAX_PATH,
74
+ NULL, NULL) <= 0) {
75
+ usbi_dbg("Failed to convert environment variable value to narrow string");
76
+ return NULL;
77
+ }
78
+ value[MAX_PATH - 1] = 0; // Be sure it's NUL terminated
79
+ return value;
80
+ }
@@ -0,0 +1,32 @@
1
+ /*
2
+ * Header file for missing WinCE functionality
3
+ * Copyright © 2012-2013 RealVNC Ltd.
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+ */
19
+
20
+ #ifndef MISSING_H
21
+ #define MISSING_H
22
+
23
+ /* Windows CE doesn't have SleepEx() - Fallback to Sleep() */
24
+ #define SleepEx(m, a) Sleep(m)
25
+
26
+ /* Windows CE doesn't have any APIs to query environment variables.
27
+ *
28
+ * This contains a registry based implementation of getenv.
29
+ */
30
+ char *getenv(const char *name);
31
+
32
+ #endif
@@ -0,0 +1,256 @@
1
+ /**
2
+ * This file has no copyright assigned and is placed in the Public Domain.
3
+ * This file was originally part of the w64 mingw-runtime package.
4
+ */
5
+
6
+ /* ISO C9x 7.18 Integer types <stdint.h>
7
+ * Based on ISO/IEC SC22/WG14 9899 Committee draft (SC22 N2794)
8
+ *
9
+ * THIS SOFTWARE IS NOT COPYRIGHTED
10
+ *
11
+ * Contributor: Danny Smith <danny_r_smith_2001@yahoo.co.nz>
12
+ * Modified for libusb/MSVC: Pete Batard <pbatard@gmail.com>
13
+ *
14
+ * This source code is offered for use in the public domain. You may
15
+ * use, modify or distribute it freely.
16
+ *
17
+ * This code is distributed in the hope that it will be useful but
18
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
19
+ * DISCLAIMED. This includes but is not limited to warranties of
20
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21
+ *
22
+ * Date: 2010-04-02
23
+ */
24
+
25
+ #ifndef _MSC_VER
26
+ #error This header should only be used with Microsoft compilers
27
+ #endif
28
+
29
+ #ifndef _STDINT_H
30
+ #define _STDINT_H
31
+
32
+ #ifndef _INTPTR_T_DEFINED
33
+ #define _INTPTR_T_DEFINED
34
+ #ifndef __intptr_t_defined
35
+ #define __intptr_t_defined
36
+ #undef intptr_t
37
+ #ifdef _WIN64
38
+ typedef __int64 intptr_t;
39
+ #else
40
+ typedef int intptr_t;
41
+ #endif /* _WIN64 */
42
+ #endif /* __intptr_t_defined */
43
+ #endif /* _INTPTR_T_DEFINED */
44
+
45
+ #ifndef _UINTPTR_T_DEFINED
46
+ #define _UINTPTR_T_DEFINED
47
+ #ifndef __uintptr_t_defined
48
+ #define __uintptr_t_defined
49
+ #undef uintptr_t
50
+ #ifdef _WIN64
51
+ typedef unsigned __int64 uintptr_t;
52
+ #else
53
+ typedef unsigned int uintptr_t;
54
+ #endif /* _WIN64 */
55
+ #endif /* __uintptr_t_defined */
56
+ #endif /* _UINTPTR_T_DEFINED */
57
+
58
+ #ifndef _PTRDIFF_T_DEFINED
59
+ #define _PTRDIFF_T_DEFINED
60
+ #ifndef _PTRDIFF_T_
61
+ #define _PTRDIFF_T_
62
+ #undef ptrdiff_t
63
+ #ifdef _WIN64
64
+ typedef __int64 ptrdiff_t;
65
+ #else
66
+ typedef int ptrdiff_t;
67
+ #endif /* _WIN64 */
68
+ #endif /* _PTRDIFF_T_ */
69
+ #endif /* _PTRDIFF_T_DEFINED */
70
+
71
+ #ifndef _WCHAR_T_DEFINED
72
+ #define _WCHAR_T_DEFINED
73
+ #ifndef __cplusplus
74
+ typedef unsigned short wchar_t;
75
+ #endif /* C++ */
76
+ #endif /* _WCHAR_T_DEFINED */
77
+
78
+ #ifndef _WCTYPE_T_DEFINED
79
+ #define _WCTYPE_T_DEFINED
80
+ #ifndef _WINT_T
81
+ #define _WINT_T
82
+ typedef unsigned short wint_t;
83
+ typedef unsigned short wctype_t;
84
+ #endif /* _WINT_T */
85
+ #endif /* _WCTYPE_T_DEFINED */
86
+
87
+ /* 7.18.1.1 Exact-width integer types */
88
+ typedef __int8 int8_t;
89
+ typedef unsigned __int8 uint8_t;
90
+ typedef __int16 int16_t;
91
+ typedef unsigned __int16 uint16_t;
92
+ typedef __int32 int32_t;
93
+ typedef unsigned __int32 uint32_t;
94
+ typedef __int64 int64_t;
95
+ typedef unsigned __int64 uint64_t;
96
+
97
+ /* 7.18.1.2 Minimum-width integer types */
98
+ typedef signed char int_least8_t;
99
+ typedef unsigned char uint_least8_t;
100
+ typedef short int_least16_t;
101
+ typedef unsigned short uint_least16_t;
102
+ typedef int int_least32_t;
103
+ typedef unsigned uint_least32_t;
104
+ typedef __int64 int_least64_t;
105
+ typedef unsigned __int64 uint_least64_t;
106
+
107
+ /* 7.18.1.3 Fastest minimum-width integer types
108
+ * Not actually guaranteed to be fastest for all purposes
109
+ * Here we use the exact-width types for 8 and 16-bit ints.
110
+ */
111
+ typedef __int8 int_fast8_t;
112
+ typedef unsigned __int8 uint_fast8_t;
113
+ typedef __int16 int_fast16_t;
114
+ typedef unsigned __int16 uint_fast16_t;
115
+ typedef __int32 int_fast32_t;
116
+ typedef unsigned __int32 uint_fast32_t;
117
+ typedef __int64 int_fast64_t;
118
+ typedef unsigned __int64 uint_fast64_t;
119
+
120
+ /* 7.18.1.5 Greatest-width integer types */
121
+ typedef __int64 intmax_t;
122
+ typedef unsigned __int64 uintmax_t;
123
+
124
+ /* 7.18.2 Limits of specified-width integer types */
125
+
126
+ /* 7.18.2.1 Limits of exact-width integer types */
127
+ #define INT8_MIN (-128)
128
+ #define INT16_MIN (-32768)
129
+ #define INT32_MIN (-2147483647 - 1)
130
+ #define INT64_MIN (-9223372036854775807LL - 1)
131
+
132
+ #define INT8_MAX 127
133
+ #define INT16_MAX 32767
134
+ #define INT32_MAX 2147483647
135
+ #define INT64_MAX 9223372036854775807LL
136
+
137
+ #define UINT8_MAX 255
138
+ #define UINT16_MAX 65535
139
+ #define UINT32_MAX 0xffffffffU /* 4294967295U */
140
+ #define UINT64_MAX 0xffffffffffffffffULL /* 18446744073709551615ULL */
141
+
142
+ /* 7.18.2.2 Limits of minimum-width integer types */
143
+ #define INT_LEAST8_MIN INT8_MIN
144
+ #define INT_LEAST16_MIN INT16_MIN
145
+ #define INT_LEAST32_MIN INT32_MIN
146
+ #define INT_LEAST64_MIN INT64_MIN
147
+
148
+ #define INT_LEAST8_MAX INT8_MAX
149
+ #define INT_LEAST16_MAX INT16_MAX
150
+ #define INT_LEAST32_MAX INT32_MAX
151
+ #define INT_LEAST64_MAX INT64_MAX
152
+
153
+ #define UINT_LEAST8_MAX UINT8_MAX
154
+ #define UINT_LEAST16_MAX UINT16_MAX
155
+ #define UINT_LEAST32_MAX UINT32_MAX
156
+ #define UINT_LEAST64_MAX UINT64_MAX
157
+
158
+ /* 7.18.2.3 Limits of fastest minimum-width integer types */
159
+ #define INT_FAST8_MIN INT8_MIN
160
+ #define INT_FAST16_MIN INT16_MIN
161
+ #define INT_FAST32_MIN INT32_MIN
162
+ #define INT_FAST64_MIN INT64_MIN
163
+
164
+ #define INT_FAST8_MAX INT8_MAX
165
+ #define INT_FAST16_MAX INT16_MAX
166
+ #define INT_FAST32_MAX INT32_MAX
167
+ #define INT_FAST64_MAX INT64_MAX
168
+
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
175
+ object pointers */
176
+ #ifdef _WIN64
177
+ #define INTPTR_MIN INT64_MIN
178
+ #define INTPTR_MAX INT64_MAX
179
+ #define UINTPTR_MAX UINT64_MAX
180
+ #else
181
+ #define INTPTR_MIN INT32_MIN
182
+ #define INTPTR_MAX INT32_MAX
183
+ #define UINTPTR_MAX UINT32_MAX
184
+ #endif
185
+
186
+ /* 7.18.2.5 Limits of greatest-width integer types */
187
+ #define INTMAX_MIN INT64_MIN
188
+ #define INTMAX_MAX INT64_MAX
189
+ #define UINTMAX_MAX UINT64_MAX
190
+
191
+ /* 7.18.3 Limits of other integer types */
192
+ #ifdef _WIN64
193
+ #define PTRDIFF_MIN INT64_MIN
194
+ #define PTRDIFF_MAX INT64_MAX
195
+ #else
196
+ #define PTRDIFF_MIN INT32_MIN
197
+ #define PTRDIFF_MAX INT32_MAX
198
+ #endif
199
+
200
+ #define SIG_ATOMIC_MIN INT32_MIN
201
+ #define SIG_ATOMIC_MAX INT32_MAX
202
+
203
+ #ifndef SIZE_MAX
204
+ #ifdef _WIN64
205
+ #define SIZE_MAX UINT64_MAX
206
+ #else
207
+ #define SIZE_MAX UINT32_MAX
208
+ #endif
209
+ #endif
210
+
211
+ #ifndef WCHAR_MIN /* also in wchar.h */
212
+ #define WCHAR_MIN 0U
213
+ #define WCHAR_MAX 0xffffU
214
+ #endif
215
+
216
+ /*
217
+ * wint_t is unsigned short for compatibility with MS runtime
218
+ */
219
+ #define WINT_MIN 0U
220
+ #define WINT_MAX 0xffffU
221
+
222
+
223
+ /* 7.18.4 Macros for integer constants */
224
+
225
+ /* 7.18.4.1 Macros for minimum-width integer constants
226
+
227
+ Accoding to Douglas Gwyn <gwyn@arl.mil>:
228
+ "This spec was changed in ISO/IEC 9899:1999 TC1; in ISO/IEC
229
+ 9899:1999 as initially published, the expansion was required
230
+ to be an integer constant of precisely matching type, which
231
+ is impossible to accomplish for the shorter types on most
232
+ platforms, because C99 provides no standard way to designate
233
+ an integer constant with width less than that of type int.
234
+ TC1 changed this to require just an integer constant
235
+ *expression* with *promoted* type."
236
+
237
+ The trick used here is from Clive D W Feather.
238
+ */
239
+
240
+ #define INT8_C(val) (INT_LEAST8_MAX-INT_LEAST8_MAX+(val))
241
+ #define INT16_C(val) (INT_LEAST16_MAX-INT_LEAST16_MAX+(val))
242
+ #define INT32_C(val) (INT_LEAST32_MAX-INT_LEAST32_MAX+(val))
243
+ /* The 'trick' doesn't work in C89 for long long because, without
244
+ suffix, (val) will be evaluated as int, not intmax_t */
245
+ #define INT64_C(val) val##i64
246
+
247
+ #define UINT8_C(val) (val)
248
+ #define UINT16_C(val) (val)
249
+ #define UINT32_C(val) (val##i32)
250
+ #define UINT64_C(val) val##ui64
251
+
252
+ /* 7.18.4.2 Macros for greatest-width integer constants */
253
+ #define INTMAX_C(val) val##i64
254
+ #define UINTMAX_C(val) val##ui64
255
+
256
+ #endif