AVR Libc Home Page AVRs AVR Libc Development Pages
Main Page User Manual Library Reference FAQ Alphabetical Index Example Projects

inttypes.h

このファイルのドキュメントを参照する
00001 /* Copyright (c) 2004,2005,2007 Joerg Wunsch
00002    Copyright (c) 2005, Carlos Lamas
00003    All rights reserved.
00004 
00005    Redistribution and use in source and binary forms, with or without
00006    modification, are permitted provided that the following conditions are met:
00007 
00008    * Redistributions of source code must retain the above copyright
00009      notice, this list of conditions and the following disclaimer.
00010 
00011    * Redistributions in binary form must reproduce the above copyright
00012      notice, this list of conditions and the following disclaimer in
00013      the documentation and/or other materials provided with the
00014      distribution.
00015 
00016    * Neither the name of the copyright holders nor the names of
00017      contributors may be used to endorse or promote products derived
00018      from this software without specific prior written permission.
00019 
00020   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00021   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00022   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00023   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00024   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00025   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00026   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00027   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00028   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00029   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00030   POSSIBILITY OF SUCH DAMAGE. */
00031 
00032 /* $Id: inttypes.h 1766 2008-10-17 21:33:57Z arcanum $ */
00033 
00034 #ifndef __INTTYPES_H_
00035 #define __INTTYPES_H_
00036 
00037 #include <stdint.h>
00038 
00039 /** \file */
00040 /** \defgroup avr_inttypes <inttypes.h>: Integer Type conversions
00041     \code #include <inttypes.h> \endcode
00042 
00043     This header file includes the exact-width integer definitions from
00044     <tt><stdint.h></tt>, and extends them with additional facilities
00045     provided by the implementation.
00046 
00047     Currently, the extensions include two additional integer types
00048     that could hold a "far" pointer (i.e. a code pointer that can
00049     address more than 64 KB), as well as standard names for all printf
00050     and scanf formatting options that are supported by the \ref avr_stdio.
00051     As the library does not support the full range of conversion
00052     specifiers from ISO 9899:1999, only those conversions that are
00053     actually implemented will be listed here.
00054 
00055     The idea behind these conversion macros is that, for each of the
00056     types defined by <stdint.h>, a macro will be supplied that portably
00057     allows formatting an object of that type in printf() or scanf()
00058     operations.  Example:
00059 
00060     \code
00061     #include <inttypes.h>
00062 
00063     uint8_t smallval;
00064     int32_t longval;
00065     ...
00066     printf("The hexadecimal value of smallval is %" PRIx8
00067            ", the decimal value of longval is %" PRId32 ".\n",
00068            smallval, longval);
00069     \endcode
00070 */
00071 
00072 /** \name Far pointers for memory access >64K */
00073 
00074 /*@{*/
00075 /** \ingroup avr_inttypes
00076     signed integer type that can hold a pointer > 64 KB */
00077 typedef int32_t int_farptr_t;
00078 
00079 /** \ingroup avr_inttypes
00080     unsigned integer type that can hold a pointer > 64 KB */
00081 typedef uint32_t uint_farptr_t;
00082 /*@}*/
00083 
00084 #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
00085 
00086 
00087 /** \name macros for printf and scanf format specifiers
00088 
00089     For C++, these are only included if __STDC_LIMIT_MACROS
00090     is defined before including <inttypes.h>.
00091  */
00092 
00093 /*@{*/
00094 /** \ingroup avr_inttypes
00095     decimal printf format for int8_t */
00096 #define         PRId8                   "d"
00097 /** \ingroup avr_inttypes
00098     decimal printf format for int_least8_t */
00099 #define         PRIdLEAST8              "d"
00100 /** \ingroup avr_inttypes
00101     decimal printf format for int_fast8_t */
00102 #define         PRIdFAST8               "d"
00103 
00104 /** \ingroup avr_inttypes
00105     integer printf format for int8_t */
00106 #define         PRIi8                   "i"
00107 /** \ingroup avr_inttypes
00108     integer printf format for int_least8_t */
00109 #define         PRIiLEAST8              "i"
00110 /** \ingroup avr_inttypes
00111     integer printf format for int_fast8_t */
00112 #define         PRIiFAST8               "i"
00113 
00114 
00115 /** \ingroup avr_inttypes
00116     decimal printf format for int16_t */
00117 #define         PRId16                  "d"
00118 /** \ingroup avr_inttypes
00119     decimal printf format for int_least16_t */
00120 #define         PRIdLEAST16             "d"
00121 /** \ingroup avr_inttypes
00122     decimal printf format for int_fast16_t */
00123 #define         PRIdFAST16              "d"
00124 
00125 /** \ingroup avr_inttypes
00126     integer printf format for int16_t */
00127 #define         PRIi16                  "i"
00128 /** \ingroup avr_inttypes
00129     integer printf format for int_least16_t */
00130 #define         PRIiLEAST16             "i"
00131 /** \ingroup avr_inttypes
00132     integer printf format for int_fast16_t */
00133 #define         PRIiFAST16              "i"
00134 
00135 
00136 /** \ingroup avr_inttypes
00137     decimal printf format for int32_t */
00138 #define         PRId32                  "ld"
00139 /** \ingroup avr_inttypes
00140     decimal printf format for int_least32_t */
00141 #define         PRIdLEAST32             "ld"
00142 /** \ingroup avr_inttypes
00143     decimal printf format for int_fast32_t */
00144 #define         PRIdFAST32              "ld"
00145 
00146 /** \ingroup avr_inttypes
00147     integer printf format for int32_t */
00148 #define         PRIi32                  "li"
00149 /** \ingroup avr_inttypes
00150     integer printf format for int_least32_t */
00151 #define         PRIiLEAST32             "li"
00152 /** \ingroup avr_inttypes
00153     integer printf format for int_fast32_t */
00154 #define         PRIiFAST32              "li"
00155 
00156 
00157 #ifdef __avr_libc_does_not_implement_long_long_in_printf_or_scanf
00158 
00159 #define         PRId64                  "lld"
00160 #define         PRIdLEAST64             "lld"
00161 #define         PRIdFAST64              "lld"
00162 
00163 #define         PRIi64                  "lli"
00164 #define         PRIiLEAST64             "lli"
00165 #define         PRIiFAST64              "lli"
00166 
00167 
00168 #define         PRIdMAX                 "lld"
00169 #define         PRIiMAX                 "lli"
00170 
00171 #endif
00172 
00173 /** \ingroup avr_inttypes
00174     decimal printf format for intptr_t */
00175 #define         PRIdPTR                 PRId16
00176 /** \ingroup avr_inttypes
00177     integer printf format for intptr_t */
00178 #define         PRIiPTR                 PRIi16
00179 
00180 /** \ingroup avr_inttypes
00181     octal printf format for uint8_t */
00182 #define         PRIo8                   "o"
00183 /** \ingroup avr_inttypes
00184     octal printf format for uint_least8_t */
00185 #define         PRIoLEAST8              "o"
00186 /** \ingroup avr_inttypes
00187     octal printf format for uint_fast8_t */
00188 #define         PRIoFAST8               "o"
00189 
00190 /** \ingroup avr_inttypes
00191     decimal printf format for uint8_t */
00192 #define         PRIu8                   "u"
00193 /** \ingroup avr_inttypes
00194     decimal printf format for uint_least8_t */
00195 #define         PRIuLEAST8              "u"
00196 /** \ingroup avr_inttypes
00197     decimal printf format for uint_fast8_t */
00198 #define         PRIuFAST8               "u"
00199 
00200 /** \ingroup avr_inttypes
00201     hexadecimal printf format for uint8_t */
00202 #define         PRIx8                   "x"
00203 /** \ingroup avr_inttypes
00204     hexadecimal printf format for uint_least8_t */
00205 #define         PRIxLEAST8              "x"
00206 /** \ingroup avr_inttypes
00207     hexadecimal printf format for uint_fast8_t */
00208 #define         PRIxFAST8               "x"
00209 
00210 /** \ingroup avr_inttypes
00211     uppercase hexadecimal printf format for uint8_t */
00212 #define         PRIX8                   "X"
00213 /** \ingroup avr_inttypes
00214     uppercase hexadecimal printf format for uint_least8_t */
00215 #define         PRIXLEAST8              "X"
00216 /** \ingroup avr_inttypes
00217     uppercase hexadecimal printf format for uint_fast8_t */
00218 #define         PRIXFAST8               "X"
00219 
00220 
00221 /** \ingroup avr_inttypes
00222     octal printf format for uint16_t */
00223 #define         PRIo16                  "o"
00224 /** \ingroup avr_inttypes
00225     octal printf format for uint_least16_t */
00226 #define         PRIoLEAST16             "o"
00227 /** \ingroup avr_inttypes
00228     octal printf format for uint_fast16_t */
00229 #define         PRIoFAST16              "o"
00230 
00231 /** \ingroup avr_inttypes
00232     decimal printf format for uint16_t */
00233 #define         PRIu16                  "u"
00234 /** \ingroup avr_inttypes
00235     decimal printf format for uint_least16_t */
00236 #define         PRIuLEAST16             "u"
00237 /** \ingroup avr_inttypes
00238     decimal printf format for uint_fast16_t */
00239 #define         PRIuFAST16              "u"
00240 
00241 /** \ingroup avr_inttypes
00242     hexadecimal printf format for uint16_t */
00243 #define         PRIx16                  "x"
00244 /** \ingroup avr_inttypes
00245     hexadecimal printf format for uint_least16_t */
00246 #define         PRIxLEAST16             "x"
00247 /** \ingroup avr_inttypes
00248     hexadecimal printf format for uint_fast16_t */
00249 #define         PRIxFAST16              "x"
00250 
00251 /** \ingroup avr_inttypes
00252     uppercase hexadecimal printf format for uint16_t */
00253 #define         PRIX16                  "X"
00254 /** \ingroup avr_inttypes
00255     uppercase hexadecimal printf format for uint_least16_t */
00256 #define         PRIXLEAST16             "X"
00257 /** \ingroup avr_inttypes
00258     uppercase hexadecimal printf format for uint_fast16_t */
00259 #define         PRIXFAST16              "X"
00260 
00261 
00262 /** \ingroup avr_inttypes
00263     octal printf format for uint32_t */
00264 #define         PRIo32                  "lo"
00265 /** \ingroup avr_inttypes
00266     octal printf format for uint_least32_t */
00267 #define         PRIoLEAST32             "lo"
00268 /** \ingroup avr_inttypes
00269     octal printf format for uint_fast32_t */
00270 #define         PRIoFAST32              "lo"
00271 
00272 /** \ingroup avr_inttypes
00273     decimal printf format for uint32_t */
00274 #define         PRIu32                  "lu"
00275 /** \ingroup avr_inttypes
00276     decimal printf format for uint_least32_t */
00277 #define         PRIuLEAST32             "lu"
00278 /** \ingroup avr_inttypes
00279     decimal printf format for uint_fast32_t */
00280 #define         PRIuFAST32              "lu"
00281 
00282 /** \ingroup avr_inttypes
00283     hexadecimal printf format for uint32_t */
00284 #define         PRIx32                  "lx"
00285 /** \ingroup avr_inttypes
00286     hexadecimal printf format for uint_least32_t */
00287 #define         PRIxLEAST32             "lx"
00288 /** \ingroup avr_inttypes
00289     hexadecimal printf format for uint_fast32_t */
00290 #define         PRIxFAST32              "lx"
00291 
00292 /** \ingroup avr_inttypes
00293     uppercase hexadecimal printf format for uint32_t */
00294 #define         PRIX32                  "lX"
00295 /** \ingroup avr_inttypes
00296     uppercase hexadecimal printf format for uint_least32_t */
00297 #define         PRIXLEAST32             "lX"
00298 /** \ingroup avr_inttypes
00299     uppercase hexadecimal printf format for uint_fast32_t */
00300 #define         PRIXFAST32              "lX"
00301 
00302 
00303 #ifdef __avr_libc_does_not_implement_long_long_in_printf_or_scanf
00304 
00305 #define         PRIo64                  "llo"
00306 #define         PRIoLEAST64             "llo"
00307 #define         PRIoFAST64              "llo"
00308 
00309 #define         PRIu64                  "llu"
00310 #define         PRIuLEAST64             "llu"
00311 #define         PRIuFAST64              "llu"
00312 
00313 #define         PRIx64                  "llx"
00314 #define         PRIxLEAST64             "llx"
00315 #define         PRIxFAST64              "llx"
00316 
00317 #define         PRIX64                  "llX"
00318 #define         PRIXLEAST64             "llX"
00319 #define         PRIXFAST64              "llX"
00320 
00321 #define         PRIoMAX                 "llo"
00322 #define         PRIuMAX                 "llu"
00323 #define         PRIxMAX                 "llx"
00324 #define         PRIXMAX                 "llX"
00325 
00326 #endif
00327 
00328 /** \ingroup avr_inttypes
00329     octal printf format for uintptr_t */
00330 #define         PRIoPTR                 PRIo16
00331 /** \ingroup avr_inttypes
00332     decimal printf format for uintptr_t */
00333 #define         PRIuPTR                 PRIu16
00334 /** \ingroup avr_inttypes
00335     hexadecimal printf format for uintptr_t */
00336 #define         PRIxPTR                 PRIx16
00337 /** \ingroup avr_inttypes
00338     uppercase hexadecimal printf format for uintptr_t */
00339 #define         PRIXPTR                 PRIX16
00340 
00341 
00342 #ifdef __avr_libc_does_not_implement_hh_in_scanf
00343 
00344 #define         SCNd8                   "hhd"
00345 #define         SCNdLEAST8              "hhd"
00346 #define         SCNdFAST8               "hhd"
00347 
00348 #define         SCNi8                   "hhi"
00349 #define         SCNiLEAST8              "hhi"
00350 #define         SCNiFAST8               "hhi"
00351 
00352 #endif
00353 
00354 
00355 /** \ingroup avr_inttypes
00356     decimal scanf format for int16_t */
00357 #define         SCNd16                  "d"
00358 /** \ingroup avr_inttypes
00359     decimal scanf format for int_least16_t */
00360 #define         SCNdLEAST16             "d"
00361 /** \ingroup avr_inttypes
00362     decimal scanf format for int_fast16_t */
00363 #define         SCNdFAST16              "d"
00364 
00365 /** \ingroup avr_inttypes
00366     generic-integer scanf format for int16_t */
00367 #define         SCNi16                  "i"
00368 /** \ingroup avr_inttypes
00369     generic-integer scanf format for int_least16_t */
00370 #define         SCNiLEAST16             "i"
00371 /** \ingroup avr_inttypes
00372     generic-integer scanf format for int_fast16_t */
00373 #define         SCNiFAST16              "i"
00374 
00375 
00376 /** \ingroup avr_inttypes
00377     decimal scanf format for int32_t */
00378 #define         SCNd32                  "ld"
00379 /** \ingroup avr_inttypes
00380     decimal scanf format for int_least32_t */
00381 #define         SCNdLEAST32             "ld"
00382 /** \ingroup avr_inttypes
00383     decimal scanf format for int_fast32_t */
00384 #define         SCNdFAST32              "ld"
00385 
00386 /** \ingroup avr_inttypes
00387     generic-integer scanf format for int32_t */
00388 #define         SCNi32                  "li"
00389 /** \ingroup avr_inttypes
00390     generic-integer scanf format for int_least32_t */
00391 #define         SCNiLEAST32             "li"
00392 /** \ingroup avr_inttypes
00393     generic-integer scanf format for int_fast32_t */
00394 #define         SCNiFAST32              "li"
00395 
00396 
00397 #ifdef __avr_libc_does_not_implement_long_long_in_printf_or_scanf
00398 
00399 #define         SCNd64                  "lld"
00400 #define         SCNdLEAST64             "lld"
00401 #define         SCNdFAST64              "lld"
00402 
00403 #define         SCNi64                  "lli"
00404 #define         SCNiLEAST64             "lli"
00405 #define         SCNiFAST64              "lli"
00406 
00407 #define         SCNdMAX                 "lld"
00408 #define         SCNiMAX                 "lli"
00409 
00410 #endif
00411 
00412 /** \ingroup avr_inttypes
00413     decimal scanf format for intptr_t */
00414 #define         SCNdPTR                 SCNd16
00415 /** \ingroup avr_inttypes
00416     generic-integer scanf format for intptr_t */
00417 #define         SCNiPTR                 SCNi16
00418 
00419 #ifdef __avr_libc_does_not_implement_hh_in_scanf
00420 
00421 #define         SCNo8                   "hho"
00422 #define         SCNoLEAST8              "hho"
00423 #define         SCNoFAST8               "hho"
00424 
00425 #define         SCNu8                   "hhu"
00426 #define         SCNuLEAST8              "hhu"
00427 #define         SCNuFAST8               "hhu"
00428 
00429 #define         SCNx8                   "hhx"
00430 #define         SCNxLEAST8              "hhx"
00431 #define         SCNxFAST8               "hhx"
00432 
00433 #endif
00434 
00435 /** \ingroup avr_inttypes
00436     octal scanf format for uint16_t */
00437 #define         SCNo16                  "o"
00438 /** \ingroup avr_inttypes
00439     octal scanf format for uint_least16_t */
00440 #define         SCNoLEAST16             "o"
00441 /** \ingroup avr_inttypes
00442     octal scanf format for uint_fast16_t */
00443 #define         SCNoFAST16              "o"
00444 
00445 /** \ingroup avr_inttypes
00446     decimal scanf format for uint16_t */
00447 #define         SCNu16                  "u"
00448 /** \ingroup avr_inttypes
00449     decimal scanf format for uint_least16_t */
00450 #define         SCNuLEAST16             "u"
00451 /** \ingroup avr_inttypes
00452     decimal scanf format for uint_fast16_t */
00453 #define         SCNuFAST16              "u"
00454 
00455 /** \ingroup avr_inttypes
00456     hexadecimal scanf format for uint16_t */
00457 #define         SCNx16                  "x"
00458 /** \ingroup avr_inttypes
00459     hexadecimal scanf format for uint_least16_t */
00460 #define         SCNxLEAST16             "x"
00461 /** \ingroup avr_inttypes
00462     hexadecimal scanf format for uint_fast16_t */
00463 #define         SCNxFAST16              "x"
00464 
00465 
00466 /** \ingroup avr_inttypes
00467     octal scanf format for uint32_t */
00468 #define         SCNo32                  "lo"
00469 /** \ingroup avr_inttypes
00470     octal scanf format for uint_least32_t */
00471 #define         SCNoLEAST32             "lo"
00472 /** \ingroup avr_inttypes
00473     octal scanf format for uint_fast32_t */
00474 #define         SCNoFAST32              "lo"
00475 
00476 /** \ingroup avr_inttypes
00477     decimal scanf format for uint32_t */
00478 #define         SCNu32                  "lu"
00479 /** \ingroup avr_inttypes
00480     decimal scanf format for uint_least32_t */
00481 #define         SCNuLEAST32             "lu"
00482 /** \ingroup avr_inttypes
00483     decimal scanf format for uint_fast32_t */
00484 #define         SCNuFAST32              "lu"
00485 
00486 /** \ingroup avr_inttypes
00487     hexadecimal scanf format for uint32_t */
00488 #define         SCNx32                  "lx"
00489 /** \ingroup avr_inttypes
00490     hexadecimal scanf format for uint_least32_t */
00491 #define         SCNxLEAST32             "lx"
00492 /** \ingroup avr_inttypes
00493     hexadecimal scanf format for uint_fast32_t */
00494 #define         SCNxFAST32              "lx"
00495 
00496 
00497 #ifdef __avr_libc_does_not_implement_long_long_in_printf_or_scanf
00498 
00499 #define         SCNo64                  "llo"
00500 #define         SCNoLEAST64             "llo"
00501 #define         SCNoFAST64              "llo"
00502 
00503 #define         SCNu64                  "llu"
00504 #define         SCNuLEAST64             "llu"
00505 #define         SCNuFAST64              "llu"
00506 
00507 #define         SCNx64                  "llx"
00508 #define         SCNxLEAST64             "llx"
00509 #define         SCNxFAST64              "llx"
00510 
00511 #define         SCNoMAX                 "llo"
00512 #define         SCNuMAX                 "llu"
00513 #define         SCNxMAX                 "llx"
00514 
00515 #endif
00516 
00517 /** \ingroup avr_inttypes
00518     octal scanf format for uintptr_t */
00519 #define         SCNoPTR                 SCNo16
00520 /** \ingroup avr_inttypes
00521     decimal scanf format for uintptr_t */
00522 #define         SCNuPTR                 SCNu16
00523 /** \ingroup avr_inttypes
00524     hexadecimal scanf format for uintptr_t */
00525 #define         SCNxPTR                 SCNx16
00526 
00527 /*@}*/
00528 
00529 
00530 #endif  /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */
00531 
00532 
00533 #endif /* __INTTYPES_H_ */

Automatically generated by Doxygen 1.7.2 on Wed Feb 16 2011.

翻訳更新:2011年10月8日 by cega