1/** 2 * This file has no copyright assigned and is placed in the Public Domain. 3 * This file was original part of the w64 mingw-runtime package. 4 */ 5 6/* 7 * THIS SOFTWARE IS NOT COPYRIGHTED 8 * 9 * Modified for libusb/MSVC: Pete Batard <pbatard@gmail.com> 10 * 11 * This source code is offered for use in the public domain. You may 12 * use, modify or distribute it freely. 13 * 14 * This code is distributed in the hope that it will be useful but 15 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY 16 * DISCLAIMED. This includes but is not limited to warranties of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 * 19 * Date: 2010-04-02 20 */ 21 22#ifndef _MSC_VER 23#error This header should only be used with Microsoft compilers 24#endif 25 26/* 7.8 Format conversion of integer types <inttypes.h> */ 27 28#ifndef _INTTYPES_H_ 29#define _INTTYPES_H_ 30 31#include <stdint.h> 32 33#ifdef __cplusplus 34extern "C" { 35#endif 36 37typedef struct { 38 intmax_t quot; 39 intmax_t rem; 40 } imaxdiv_t; 41 42 43/* 7.8.1 Macros for format specifiers 44 * 45 * MS runtime does not yet understand C9x standard "ll" 46 * length specifier. It appears to treat "ll" as "l". 47 * The non-standard I64 length specifier causes warning in GCC, 48 * but understood by MS runtime functions. 49 */ 50 51/* fprintf macros for signed types */ 52#define PRId8 "d" 53#define PRId16 "d" 54#define PRId32 "d" 55#define PRId64 "I64d" 56 57#define PRIdLEAST8 "d" 58#define PRIdLEAST16 "d" 59#define PRIdLEAST32 "d" 60#define PRIdLEAST64 "I64d" 61 62#define PRIdFAST8 "d" 63#define PRIdFAST16 "d" 64#define PRIdFAST32 "d" 65#define PRIdFAST64 "I64d" 66 67#define PRIdMAX "I64d" 68 69#define PRIi8 "i" 70#define PRIi16 "i" 71#define PRIi32 "i" 72#define PRIi64 "I64i" 73 74#define PRIiLEAST8 "i" 75#define PRIiLEAST16 "i" 76#define PRIiLEAST32 "i" 77#define PRIiLEAST64 "I64i" 78 79#define PRIiFAST8 "i" 80#define PRIiFAST16 "i" 81#define PRIiFAST32 "i" 82#define PRIiFAST64 "I64i" 83 84#define PRIiMAX "I64i" 85 86#define PRIo8 "o" 87#define PRIo16 "o" 88#define PRIo32 "o" 89#define PRIo64 "I64o" 90 91#define PRIoLEAST8 "o" 92#define PRIoLEAST16 "o" 93#define PRIoLEAST32 "o" 94#define PRIoLEAST64 "I64o" 95 96#define PRIoFAST8 "o" 97#define PRIoFAST16 "o" 98#define PRIoFAST32 "o" 99#define PRIoFAST64 "I64o" 100 101#define PRIoMAX "I64o" 102 103/* fprintf macros for unsigned types */ 104#define PRIu8 "u" 105#define PRIu16 "u" 106#define PRIu32 "u" 107#define PRIu64 "I64u" 108 109 110#define PRIuLEAST8 "u" 111#define PRIuLEAST16 "u" 112#define PRIuLEAST32 "u" 113#define PRIuLEAST64 "I64u" 114 115#define PRIuFAST8 "u" 116#define PRIuFAST16 "u" 117#define PRIuFAST32 "u" 118#define PRIuFAST64 "I64u" 119 120#define PRIuMAX "I64u" 121 122#define PRIx8 "x" 123#define PRIx16 "x" 124#define PRIx32 "x" 125#define PRIx64 "I64x" 126 127#define PRIxLEAST8 "x" 128#define PRIxLEAST16 "x" 129#define PRIxLEAST32 "x" 130#define PRIxLEAST64 "I64x" 131 132#define PRIxFAST8 "x" 133#define PRIxFAST16 "x" 134#define PRIxFAST32 "x" 135#define PRIxFAST64 "I64x" 136 137#define PRIxMAX "I64x" 138 139#define PRIX8 "X" 140#define PRIX16 "X" 141#define PRIX32 "X" 142#define PRIX64 "I64X" 143 144#define PRIXLEAST8 "X" 145#define PRIXLEAST16 "X" 146#define PRIXLEAST32 "X" 147#define PRIXLEAST64 "I64X" 148 149#define PRIXFAST8 "X" 150#define PRIXFAST16 "X" 151#define PRIXFAST32 "X" 152#define PRIXFAST64 "I64X" 153 154#define PRIXMAX "I64X" 155 156/* 157 * fscanf macros for signed int types 158 * NOTE: if 32-bit int is used for int_fast8_t and int_fast16_t 159 * (see stdint.h, 7.18.1.3), FAST8 and FAST16 should have 160 * no length identifiers 161 */ 162 163#define SCNd16 "hd" 164#define SCNd32 "d" 165#define SCNd64 "I64d" 166 167#define SCNdLEAST16 "hd" 168#define SCNdLEAST32 "d" 169#define SCNdLEAST64 "I64d" 170 171#define SCNdFAST16 "hd" 172#define SCNdFAST32 "d" 173#define SCNdFAST64 "I64d" 174 175#define SCNdMAX "I64d" 176 177#define SCNi16 "hi" 178#define SCNi32 "i" 179#define SCNi64 "I64i" 180 181#define SCNiLEAST16 "hi" 182#define SCNiLEAST32 "i" 183#define SCNiLEAST64 "I64i" 184 185#define SCNiFAST16 "hi" 186#define SCNiFAST32 "i" 187#define SCNiFAST64 "I64i" 188 189#define SCNiMAX "I64i" 190 191#define SCNo16 "ho" 192#define SCNo32 "o" 193#define SCNo64 "I64o" 194 195#define SCNoLEAST16 "ho" 196#define SCNoLEAST32 "o" 197#define SCNoLEAST64 "I64o" 198 199#define SCNoFAST16 "ho" 200#define SCNoFAST32 "o" 201#define SCNoFAST64 "I64o" 202 203#define SCNoMAX "I64o" 204 205#define SCNx16 "hx" 206#define SCNx32 "x" 207#define SCNx64 "I64x" 208 209#define SCNxLEAST16 "hx" 210#define SCNxLEAST32 "x" 211#define SCNxLEAST64 "I64x" 212 213#define SCNxFAST16 "hx" 214#define SCNxFAST32 "x" 215#define SCNxFAST64 "I64x" 216 217#define SCNxMAX "I64x" 218 219/* fscanf macros for unsigned int types */ 220 221#define SCNu16 "hu" 222#define SCNu32 "u" 223#define SCNu64 "I64u" 224 225#define SCNuLEAST16 "hu" 226#define SCNuLEAST32 "u" 227#define SCNuLEAST64 "I64u" 228 229#define SCNuFAST16 "hu" 230#define SCNuFAST32 "u" 231#define SCNuFAST64 "I64u" 232 233#define SCNuMAX "I64u" 234 235#ifdef _WIN64 236#define PRIdPTR "I64d" 237#define PRIiPTR "I64i" 238#define PRIoPTR "I64o" 239#define PRIuPTR "I64u" 240#define PRIxPTR "I64x" 241#define PRIXPTR "I64X" 242#define SCNdPTR "I64d" 243#define SCNiPTR "I64i" 244#define SCNoPTR "I64o" 245#define SCNxPTR "I64x" 246#define SCNuPTR "I64u" 247#else 248#define PRIdPTR "d" 249#define PRIiPTR "i" 250#define PRIoPTR "o" 251#define PRIuPTR "u" 252#define PRIxPTR "x" 253#define PRIXPTR "X" 254#define SCNdPTR "d" 255#define SCNiPTR "i" 256#define SCNoPTR "o" 257#define SCNxPTR "x" 258 #define SCNuPTR "u" 259#endif 260 261#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 262/* 263 * no length modifier for char types prior to C9x 264 * MS runtime scanf appears to treat "hh" as "h" 265 */ 266 267/* signed char */ 268#define SCNd8 "hhd" 269#define SCNdLEAST8 "hhd" 270#define SCNdFAST8 "hhd" 271 272#define SCNi8 "hhi" 273#define SCNiLEAST8 "hhi" 274#define SCNiFAST8 "hhi" 275 276#define SCNo8 "hho" 277#define SCNoLEAST8 "hho" 278#define SCNoFAST8 "hho" 279 280#define SCNx8 "hhx" 281#define SCNxLEAST8 "hhx" 282#define SCNxFAST8 "hhx" 283 284/* unsigned char */ 285#define SCNu8 "hhu" 286#define SCNuLEAST8 "hhu" 287#define SCNuFAST8 "hhu" 288#endif /* __STDC_VERSION__ >= 199901 */ 289 290 291#ifdef __cplusplus 292} 293#endif 294 295#endif /* ndef _INTTYPES_H */ 296