mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-02-05 05:01:38 +00:00
rtems/inttypes.h: New file. Uses contents from cpukit
Provide extentions to <inttpes.h> PRIxxx constants for more POSIX types. Start with existing definitions found in RTEMS Project owned code in cpukit/. updates #2983.
This commit is contained in:
@@ -111,6 +111,7 @@ include_rtems_debugger_HEADERS += libdebugger/rtems-debugger-remote.h
|
||||
endif
|
||||
|
||||
include_rtems_HEADERS += include/rtems/bspIo.h
|
||||
include_rtems_HEADERS += include/rtems/inttypes.h
|
||||
include_rtems_HEADERS += include/rtems/print.h
|
||||
include_rtems_HEADERS += include/rtems/printer.h
|
||||
include_rtems_HEADERS += include/rtems/userenv.h
|
||||
|
||||
78
cpukit/include/rtems/inttypes.h
Normal file
78
cpukit/include/rtems/inttypes.h
Normal file
@@ -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
|
||||
* <inttypes.h>
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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 <inttypes.h>
|
||||
|
||||
#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
|
||||
@@ -20,16 +20,7 @@
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
/*
|
||||
* Flag the targets where off_t is 32 bits. This is not a compiler type
|
||||
* so we can't rely on prerdefines.
|
||||
*/
|
||||
#if defined(__moxie__)
|
||||
#define PRIdoff_t PRIo32
|
||||
#else
|
||||
#define PRIdoff_t PRIo64
|
||||
#endif
|
||||
#include <rtems/inttypes.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -70,22 +70,7 @@
|
||||
#include <limits.h> /* PATH_MAX */
|
||||
|
||||
#include <inttypes.h> /* PRI* */
|
||||
|
||||
#if SIZEOF_MODE_T == 8
|
||||
#define PRIomode_t PRIo64
|
||||
#elif SIZEOF_MODE_T == 4
|
||||
#define PRIomode_t PRIo32
|
||||
#else
|
||||
#error "unsupport size of mode_t"
|
||||
#endif
|
||||
|
||||
#if SIZEOF_OFF_T == 8
|
||||
#define PRIdoff_t PRIo64
|
||||
#elif SIZEOF_OFF_T == 4
|
||||
#define PRIdoff_t PRIo32
|
||||
#else
|
||||
#error "unsupported size of off_t"
|
||||
#endif
|
||||
#include <rtems/inttypes.h> /* extended PRI* */
|
||||
|
||||
#ifdef HAVE_CEXP
|
||||
#include <cexpHelp.h>
|
||||
@@ -142,7 +127,7 @@ char *t;
|
||||
t = "@"; break;
|
||||
}
|
||||
|
||||
printf("%10li, %10" PRIdoff_t "b, %5i.%-5i 0%04" PRIomode_t " %s%s\n",
|
||||
printf("%10li, %10" PRIooff_t "b, %5i.%-5i 0%04" PRIomode_t " %s%s\n",
|
||||
buf->st_ino,
|
||||
buf->st_size,
|
||||
buf->st_uid,
|
||||
|
||||
@@ -28,16 +28,9 @@
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <rtems/inttypes.h>
|
||||
#include <string.h>
|
||||
|
||||
#if SIZEOF_OFF_T == 8
|
||||
#define PRIooff_t PRIo64
|
||||
#elif SIZEOF_OFF_T == 4
|
||||
#define PRIooff_t PRIo32
|
||||
#else
|
||||
#error "unsupported size of off_t"
|
||||
#endif
|
||||
|
||||
#include <rtems/rfs/rtems-rfs-block.h>
|
||||
#include <rtems/rfs/rtems-rfs-buffer.h>
|
||||
#include <rtems/rfs/rtems-rfs-file-system.h>
|
||||
|
||||
@@ -21,16 +21,9 @@
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <rtems/inttypes.h>
|
||||
#include <string.h>
|
||||
|
||||
#if SIZEOF_OFF_T == 8
|
||||
#define PRIdoff_t PRId64
|
||||
#elif SIZEOF_OFF_T == 4
|
||||
#define PRIdoff_t PRId32
|
||||
#else
|
||||
#error "unsupported size of off_t"
|
||||
#endif
|
||||
|
||||
#include <rtems/rfs/rtems-rfs-file.h>
|
||||
#include "rtems-rfs-rtems.h"
|
||||
|
||||
|
||||
@@ -25,13 +25,7 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if SIZEOF_MODE_T == 8
|
||||
#define PRIomode_t PRIo64
|
||||
#elif SIZEOF_MODE_T == 4
|
||||
#define PRIomode_t PRIo32
|
||||
#else
|
||||
#error "unsupport size of mode_t"
|
||||
#endif
|
||||
#include <rtems/inttypes.h>
|
||||
|
||||
#include <rtems/rfs/rtems-rfs-file.h>
|
||||
#include <rtems/rfs/rtems-rfs-dir.h>
|
||||
|
||||
@@ -22,17 +22,9 @@
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/shell.h>
|
||||
#include <rtems/inttypes.h>
|
||||
#include "internal.h"
|
||||
|
||||
/* Helper macro to print "time_t" */
|
||||
#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
|
||||
|
||||
static int rtems_shell_main_time(
|
||||
int argc,
|
||||
char *argv[]
|
||||
|
||||
@@ -263,6 +263,10 @@ $(PROJECT_INCLUDE)/rtems/bspIo.h: include/rtems/bspIo.h $(PROJECT_INCLUDE)/rtems
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/bspIo.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/bspIo.h
|
||||
|
||||
$(PROJECT_INCLUDE)/rtems/inttypes.h: include/rtems/inttypes.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/inttypes.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/inttypes.h
|
||||
|
||||
$(PROJECT_INCLUDE)/rtems/print.h: include/rtems/print.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/print.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/print.h
|
||||
|
||||
Reference in New Issue
Block a user