From 54bdf0c7e5d689da76d41ccbbf2c9dc830fd8c4e Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Fri, 14 Apr 2017 13:55:48 -0500 Subject: rtems/inttypes.h: New file. Uses contents from cpukit Provide extentions to PRIxxx constants for more POSIX types. Start with existing definitions found in RTEMS Project owned code in cpukit/. updates #2983. --- cpukit/include/rtems/inttypes.h | 78 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 cpukit/include/rtems/inttypes.h (limited to 'cpukit/include/rtems/inttypes.h') diff --git a/cpukit/include/rtems/inttypes.h b/cpukit/include/rtems/inttypes.h new file mode 100644 index 0000000000..19022afc54 --- /dev/null +++ b/cpukit/include/rtems/inttypes.h @@ -0,0 +1,78 @@ +/** + * @file rtems/inttypes.h + * + * @brief Provide printf() PRIxxx Constante Beyond Standards + * + * This include file defines PRIxxx constants beyond those in + * the C and POSIX standards. These are used to write portable + * printf() format strings for POSIX and RTEMS types not in + * + */ + +/* + * COPYRIGHT (c) 2017 On-Line Applications Research Corporation. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +#ifndef _RTEMS_INTTYPES_H +#define _RTEMS_INTTYPES_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @defgroup RTEMS inttypes.h Extensions + * + * This module defines portable PRIxxx constants beyond those + * in the C and POSIX standard. + */ + +/** Helper macro to print "modet" in octal */ +#if SIZEOF_MODE_T == 8 +#define PRIomode_t PRIo64 +#elif SIZEOF_MODE_T == 4 +#define PRIomode_t PRIo32 +#else +#error "PRIomode_t: unsupport size of mode_t" +#endif + +/** Helper macro to print "off_t" in octal */ +#if SIZEOF_OFF_T == 8 +#define PRIooff_t PRIo64 +#elif SIZEOF_OFF_T == 4 +#define PRIooff_t PRIo32 +#else +#error "PRIooff_t: unsupported size of off_t" +#endif + +/** Helper macro to print "off_t" in decimal */ +#if SIZEOF_OFF_T == 8 +#define PRIdoff_t PRId64 +#elif SIZEOF_OFF_T == 4 +#define PRIdoff_t PRId32 +#else +#error "PRIdoff_t: unsupported size of off_t" +#endif + +/** Helper macro to print "time_t" in decimal */ +#if SIZEOF_TIME_T == 8 +#define PRIdtime_t PRId64 +#elif SIZEOF_TIME_T == 4 +#define PRIdtime_t PRId32 +#else +#error "PRIdtime_t: unsupported size of time_t" +#endif + +/**@}*/ + +#ifdef __cplusplus +} +#endif + +#endif -- cgit v1.2.3