GNU Radio 3.7.1 C++ API
|
00001 // ISO C9x compliant inttypes.h for Microsoft Visual Studio 00002 // Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 00003 // 00004 // Copyright (c) 2006 Alexander Chemeris 00005 // 00006 // Redistribution and use in source and binary forms, with or without 00007 // modification, are permitted provided that the following conditions are met: 00008 // 00009 // 1. Redistributions of source code must retain the above copyright notice, 00010 // this list of conditions and the following disclaimer. 00011 // 00012 // 2. Redistributions in binary form must reproduce the above copyright 00013 // notice, this list of conditions and the following disclaimer in the 00014 // documentation and/or other materials provided with the distribution. 00015 // 00016 // 3. The name of the author may be used to endorse or promote products 00017 // derived from this software without specific prior written permission. 00018 // 00019 // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 00020 // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00021 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 00022 // EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00023 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00024 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 00025 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 00026 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 00027 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 00028 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00029 // 00030 /////////////////////////////////////////////////////////////////////////////// 00031 00032 #ifndef _MSC_VER // [ 00033 #error "Use this header only with Microsoft Visual C++ compilers!" 00034 #endif // _MSC_VER ] 00035 00036 #ifndef _MSC_INTTYPES_H_ // [ 00037 #define _MSC_INTTYPES_H_ 00038 00039 #if _MSC_VER > 1000 00040 #pragma once 00041 #endif 00042 00043 #include <stdint.h> 00044 00045 // 7.8 Format conversion of integer types 00046 00047 typedef struct { 00048 intmax_t quot; 00049 intmax_t rem; 00050 } imaxdiv_t; 00051 00052 // 7.8.1 Macros for format specifiers 00053 00054 // The fprintf macros for signed integers are: 00055 #define PRId8 "d" 00056 #define PRIi8 "i" 00057 #define PRIdLEAST8 "d" 00058 #define PRIiLEAST8 "i" 00059 #define PRIdFAST8 "d" 00060 #define PRIiFAST8 "i" 00061 00062 #define PRId16 "hd" 00063 #define PRIi16 "hi" 00064 #define PRIdLEAST16 "hd" 00065 #define PRIiLEAST16 "hi" 00066 #define PRIdFAST16 "hd" 00067 #define PRIiFAST16 "hi" 00068 00069 #define PRId32 "I32d" 00070 #define PRIi32 "I32i" 00071 #define PRIdLEAST32 "I32d" 00072 #define PRIiLEAST32 "I32i" 00073 #define PRIdFAST32 "I32d" 00074 #define PRIiFAST32 "I32i" 00075 00076 #define PRId64 "I64d" 00077 #define PRIi64 "I64i" 00078 #define PRIdLEAST64 "I64d" 00079 #define PRIiLEAST64 "I64i" 00080 #define PRIdFAST64 "I64d" 00081 #define PRIiFAST64 "I64i" 00082 00083 #define PRIdMAX "I64d" 00084 #define PRIiMAX "I64i" 00085 00086 #define PRIdPTR "Id" 00087 #define PRIiPTR "Ii" 00088 00089 // The fprintf macros for unsigned integers are: 00090 #define PRIo8 "o" 00091 #define PRIu8 "u" 00092 #define PRIx8 "x" 00093 #define PRIX8 "X" 00094 #define PRIoLEAST8 "o" 00095 #define PRIuLEAST8 "u" 00096 #define PRIxLEAST8 "x" 00097 #define PRIXLEAST8 "X" 00098 #define PRIoFAST8 "o" 00099 #define PRIuFAST8 "u" 00100 #define PRIxFAST8 "x" 00101 #define PRIXFAST8 "X" 00102 00103 #define PRIo16 "ho" 00104 #define PRIu16 "hu" 00105 #define PRIx16 "hx" 00106 #define PRIX16 "hX" 00107 #define PRIoLEAST16 "ho" 00108 #define PRIuLEAST16 "hu" 00109 #define PRIxLEAST16 "hx" 00110 #define PRIXLEAST16 "hX" 00111 #define PRIoFAST16 "ho" 00112 #define PRIuFAST16 "hu" 00113 #define PRIxFAST16 "hx" 00114 #define PRIXFAST16 "hX" 00115 00116 #define PRIo32 "I32o" 00117 #define PRIu32 "I32u" 00118 #define PRIx32 "I32x" 00119 #define PRIX32 "I32X" 00120 #define PRIoLEAST32 "I32o" 00121 #define PRIuLEAST32 "I32u" 00122 #define PRIxLEAST32 "I32x" 00123 #define PRIXLEAST32 "I32X" 00124 #define PRIoFAST32 "I32o" 00125 #define PRIuFAST32 "I32u" 00126 #define PRIxFAST32 "I32x" 00127 #define PRIXFAST32 "I32X" 00128 00129 #define PRIo64 "I64o" 00130 #define PRIu64 "I64u" 00131 #define PRIx64 "I64x" 00132 #define PRIX64 "I64X" 00133 #define PRIoLEAST64 "I64o" 00134 #define PRIuLEAST64 "I64u" 00135 #define PRIxLEAST64 "I64x" 00136 #define PRIXLEAST64 "I64X" 00137 #define PRIoFAST64 "I64o" 00138 #define PRIuFAST64 "I64u" 00139 #define PRIxFAST64 "I64x" 00140 #define PRIXFAST64 "I64X" 00141 00142 #define PRIoMAX "I64o" 00143 #define PRIuMAX "I64u" 00144 #define PRIxMAX "I64x" 00145 #define PRIXMAX "I64X" 00146 00147 #define PRIoPTR "Io" 00148 #define PRIuPTR "Iu" 00149 #define PRIxPTR "Ix" 00150 #define PRIXPTR "IX" 00151 00152 // The fscanf macros for signed integers are: 00153 #define SCNd8 "d" 00154 #define SCNi8 "i" 00155 #define SCNdLEAST8 "d" 00156 #define SCNiLEAST8 "i" 00157 #define SCNdFAST8 "d" 00158 #define SCNiFAST8 "i" 00159 00160 #define SCNd16 "hd" 00161 #define SCNi16 "hi" 00162 #define SCNdLEAST16 "hd" 00163 #define SCNiLEAST16 "hi" 00164 #define SCNdFAST16 "hd" 00165 #define SCNiFAST16 "hi" 00166 00167 #define SCNd32 "ld" 00168 #define SCNi32 "li" 00169 #define SCNdLEAST32 "ld" 00170 #define SCNiLEAST32 "li" 00171 #define SCNdFAST32 "ld" 00172 #define SCNiFAST32 "li" 00173 00174 #define SCNd64 "I64d" 00175 #define SCNi64 "I64i" 00176 #define SCNdLEAST64 "I64d" 00177 #define SCNiLEAST64 "I64i" 00178 #define SCNdFAST64 "I64d" 00179 #define SCNiFAST64 "I64i" 00180 00181 #define SCNdMAX "I64d" 00182 #define SCNiMAX "I64i" 00183 00184 #ifdef _WIN64 // [ 00185 # define SCNdPTR "I64d" 00186 # define SCNiPTR "I64i" 00187 #else // _WIN64 ][ 00188 # define SCNdPTR "ld" 00189 # define SCNiPTR "li" 00190 #endif // _WIN64 ] 00191 00192 // The fscanf macros for unsigned integers are: 00193 #define SCNo8 "o" 00194 #define SCNu8 "u" 00195 #define SCNx8 "x" 00196 #define SCNX8 "X" 00197 #define SCNoLEAST8 "o" 00198 #define SCNuLEAST8 "u" 00199 #define SCNxLEAST8 "x" 00200 #define SCNXLEAST8 "X" 00201 #define SCNoFAST8 "o" 00202 #define SCNuFAST8 "u" 00203 #define SCNxFAST8 "x" 00204 #define SCNXFAST8 "X" 00205 00206 #define SCNo16 "ho" 00207 #define SCNu16 "hu" 00208 #define SCNx16 "hx" 00209 #define SCNX16 "hX" 00210 #define SCNoLEAST16 "ho" 00211 #define SCNuLEAST16 "hu" 00212 #define SCNxLEAST16 "hx" 00213 #define SCNXLEAST16 "hX" 00214 #define SCNoFAST16 "ho" 00215 #define SCNuFAST16 "hu" 00216 #define SCNxFAST16 "hx" 00217 #define SCNXFAST16 "hX" 00218 00219 #define SCNo32 "lo" 00220 #define SCNu32 "lu" 00221 #define SCNx32 "lx" 00222 #define SCNX32 "lX" 00223 #define SCNoLEAST32 "lo" 00224 #define SCNuLEAST32 "lu" 00225 #define SCNxLEAST32 "lx" 00226 #define SCNXLEAST32 "lX" 00227 #define SCNoFAST32 "lo" 00228 #define SCNuFAST32 "lu" 00229 #define SCNxFAST32 "lx" 00230 #define SCNXFAST32 "lX" 00231 00232 #define SCNo64 "I64o" 00233 #define SCNu64 "I64u" 00234 #define SCNx64 "I64x" 00235 #define SCNX64 "I64X" 00236 #define SCNoLEAST64 "I64o" 00237 #define SCNuLEAST64 "I64u" 00238 #define SCNxLEAST64 "I64x" 00239 #define SCNXLEAST64 "I64X" 00240 #define SCNoFAST64 "I64o" 00241 #define SCNuFAST64 "I64u" 00242 #define SCNxFAST64 "I64x" 00243 #define SCNXFAST64 "I64X" 00244 00245 #define SCNoMAX "I64o" 00246 #define SCNuMAX "I64u" 00247 #define SCNxMAX "I64x" 00248 #define SCNXMAX "I64X" 00249 00250 #ifdef _WIN64 // [ 00251 # define SCNoPTR "I64o" 00252 # define SCNuPTR "I64u" 00253 # define SCNxPTR "I64x" 00254 # define SCNXPTR "I64X" 00255 #else // _WIN64 ][ 00256 # define SCNoPTR "lo" 00257 # define SCNuPTR "lu" 00258 # define SCNxPTR "lx" 00259 # define SCNXPTR "lX" 00260 #endif // _WIN64 ] 00261 00262 // 7.8.2 Functions for greatest-width integer types 00263 00264 // 7.8.2.1 The imaxabs function 00265 #define imaxabs _abs64 00266 00267 // 7.8.2.2 The imaxdiv function 00268 00269 // This is modified version of div() function from Microsoft's div.c found 00270 // in %MSVC.NET%\crt\src\div.c 00271 #ifdef STATIC_IMAXDIV // [ 00272 static 00273 #else // STATIC_IMAXDIV ][ 00274 _inline 00275 #endif // STATIC_IMAXDIV ] 00276 imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom) 00277 { 00278 imaxdiv_t result; 00279 00280 result.quot = numer / denom; 00281 result.rem = numer % denom; 00282 00283 if (numer < 0 && result.rem > 0) { 00284 // did division wrong; must fix up 00285 ++result.quot; 00286 result.rem -= denom; 00287 } 00288 00289 return result; 00290 } 00291 00292 // 7.8.2.3 The strtoimax and strtoumax functions 00293 #define strtoimax _strtoi64 00294 #define strtoumax _strtoui64 00295 00296 // 7.8.2.4 The wcstoimax and wcstoumax functions 00297 #define wcstoimax _wcstoi64 00298 #define wcstoumax _wcstoui64 00299 00300 00301 #endif // _MSC_INTTYPES_H_ ]