* Introduced new header directory "config", which ATM contains HaikuConfig.h

and types.h. The idea is to provide a basic architecture/compiler
  abstraction by defining types and macros that allow the posix/ and os/
  headers to be mostly architecture/compiler agnostic. 
* Adjusted the posix/ and os/ headers accordingly.
* <SupportDefs.h>: Introduced B_PRI* and B_SCN* macros similar to the PRI*
  and SCN* macros defined in <inttypes.h>, just for the BeOS/Haiku [u]int*
  types and some POSIX types (e.g. off_t, dev_t, ino_t) that don't have POSIX
  macros. Also the B_PRI* and B_SCN* macros are available unconditionally,
  unlike the <inttypes.h> macros, which require __STDC_FORMAT_MACROS to be
  defined in C++ mode.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34214 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2009-11-24 19:44:07 +00:00
parent b5504a512c
commit 2222d0559d
27 changed files with 674 additions and 269 deletions
+76 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2007-2008, Ingo Weinhold, [email protected].
* Copyright 2007-2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef _FSSH_API_WRAPPER_H
@@ -1503,6 +1503,81 @@
#define gid_t fssh_gid_t
#define pid_t fssh_pid_t
#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS)
/* printf()/scanf() format strings for [u]int* types */
#define B_PRId8 FSSH_B_PRId8
#define B_PRIi8 FSSH_B_PRIi8
#define B_PRId16 FSSH_B_PRId16
#define B_PRIi16 FSSH_B_PRIi16
#define B_PRId32 FSSH_B_PRId32
#define B_PRIi32 FSSH_B_PRIi32
#define B_PRId64 FSSH_B_PRId64
#define B_PRIi64 FSSH_B_PRIi64
#define B_PRIu8 FSSH_B_PRIu8
#define B_PRIo8 FSSH_B_PRIo8
#define B_PRIx8 FSSH_B_PRIx8
#define B_PRIX8 FSSH_B_PRIX8
#define B_PRIu16 FSSH_B_PRIu16
#define B_PRIo16 FSSH_B_PRIo16
#define B_PRIx16 FSSH_B_PRIx16
#define B_PRIX16 FSSH_B_PRIX16
#define B_PRIu32 FSSH_B_PRIu32
#define B_PRIo32 FSSH_B_PRIo32
#define B_PRIx32 FSSH_B_PRIx32
#define B_PRIX32 FSSH_B_PRIX32
#define B_PRIu64 FSSH_B_PRIu64
#define B_PRIo64 FSSH_B_PRIo64
#define B_PRIx64 FSSH_B_PRIx64
#define B_PRIX64 FSSH_B_PRIX64
#define B_SCNd8 FSSH_B_SCNd8
#define B_SCNi8 FSSH_B_SCNi8
#define B_SCNd16 FSSH_B_SCNd16
#define B_SCNi16 FSSH_B_SCNi16
#define B_SCNd32 FSSH_B_SCNd32
#define B_SCNi32 FSSH_B_SCNi32
#define B_SCNd64 FSSH_B_SCNd64
#define B_SCNi64 FSSH_B_SCNi64
#define B_SCNu8 FSSH_B_SCNu8
#define B_SCNo8 FSSH_B_SCNo8
#define B_SCNx8 FSSH_B_SCNx8
#define B_SCNu16 FSSH_B_SCNu16
#define B_SCNu16 FSSH_B_SCNu16
#define B_SCNx16 FSSH_B_SCNx16
#define B_SCNu32 FSSH_B_SCNu32
#define B_SCNo32 FSSH_B_SCNo32
#define B_SCNx32 FSSH_B_SCNx32
#define B_SCNu64 FSSH_B_SCNu64
#define B_SCNo64 FSSH_B_SCNo64
#define B_SCNx64 FSSH_B_SCNx64
/* printf() format strings for some standard types */
/* size_t */
#define B_PRIuSIZE FSSH_B_PRIuSIZE
#define B_PRIoSIZE FSSH_B_PRIoSIZE
#define B_PRIxSIZE FSSH_B_PRIxSIZE
#define B_PRIXSIZE FSSH_B_PRIXSIZE
/* ssize_t */
#define B_PRIdSSIZE FSSH_B_PRIdSSIZE
#define B_PRIiSSIZE FSSH_B_PRIiSSIZE
/* addr_t */
#define B_PRIuADDR FSSH_B_PRIuADDR
#define B_PRIoADDR FSSH_B_PRIoADDR
#define B_PRIxADDR FSSH_B_PRIxADDR
#define B_PRIXADDR FSSH_B_PRIXADDR
/* off_t */
#define B_PRIdOFF FSSH_B_PRIdOFF
#define B_PRIiOFF FSSH_B_PRIiOFF
/* dev_t */
#define B_PRIdDEV FSSH_B_PRIdDEV
#define B_PRIiDEV FSSH_B_PRIiDEV
/* ino_t */
#define B_PRIdINO FSSH_B_PRIdINO
#define B_PRIiINO FSSH_B_PRIiINO
#endif /* !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) */
////////////////////////////////////////////////////////////////////////////////
// #pragma mark - fssh_uio.h
+6 -6
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2005-2007, Haiku Inc. All Rights Reserved.
* Copyright 2005-2009, Haiku Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _FSSH_TIME_H_
@@ -9,10 +9,10 @@
#include "fssh_defs.h"
typedef long fssh_clock_t;
typedef long fssh_time_t;
typedef long fssh_suseconds_t;
typedef unsigned long fssh_useconds_t;
typedef int32_t fssh_clock_t;
typedef int32_t fssh_time_t;
typedef int32_t fssh_suseconds_t;
typedef uint32_t fssh_useconds_t;
#define FSSH_CLOCKS_PER_SEC 1000
#define FSSH_CLK_TCK FSSH_CLOCKS_PER_SEC
@@ -66,7 +66,7 @@ extern char *fssh_ctime(const fssh_time_t *timer);
extern char *fssh_ctime_r(const fssh_time_t *timer, char *buffer);
extern struct fssh_tm *fssh_gmtime(const fssh_time_t *timer);
extern struct fssh_tm *fssh_gmtime_r(const fssh_time_t *timer,
struct fssh_tm *tm);
struct fssh_tm *tm);
extern struct fssh_tm *fssh_localtime(const fssh_time_t *timer);
extern struct fssh_tm *fssh_localtime_r(const fssh_time_t *timer,
struct fssh_tm *tm);
+90
View File
@@ -1,8 +1,14 @@
/*
* Copyright 2007-2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef _FSSH_TYPES_H
#define _FSSH_TYPES_H
#include <inttypes.h>
typedef uint32_t fssh_ulong;
typedef volatile int32_t vint32_t;
typedef volatile int64_t vint64_t;
@@ -35,4 +41,88 @@ typedef int32_t fssh_pid_t;
#define NULL (0)
#endif
// NOTE: For this to work the __STDC_FORMAT_MACROS feature macro must be
// defined.
/* printf()/scanf() format strings for [u]int* types */
#define FSSH_B_PRId8 PRId8
#define FSSH_B_PRIi8 PRIi8
#define FSSH_B_PRId16 PRId16
#define FSSH_B_PRIi16 PRIi16
#define FSSH_B_PRId32 PRId32
#define FSSH_B_PRIi32 PRIi32
#define FSSH_B_PRId64 PRId64
#define FSSH_B_PRIi64 PRIi64
#define FSSH_B_PRIu8 PRIu8
#define FSSH_B_PRIo8 PRIo8
#define FSSH_B_PRIx8 PRIx8
#define FSSH_B_PRIX8 PRIX8
#define FSSH_B_PRIu16 PRIu16
#define FSSH_B_PRIo16 PRIo16
#define FSSH_B_PRIx16 PRIx16
#define FSSH_B_PRIX16 PRIX16
#define FSSH_B_PRIu32 PRIu32
#define FSSH_B_PRIo32 PRIo32
#define FSSH_B_PRIx32 PRIx32
#define FSSH_B_PRIX32 PRIX32
#define FSSH_B_PRIu64 PRIu64
#define FSSH_B_PRIo64 PRIo64
#define FSSH_B_PRIx64 PRIx64
#define FSSH_B_PRIX64 PRIX64
#define FSSH_B_SCNd8 SCNd8
#define FSSH_B_SCNi8 SCNi8
#define FSSH_B_SCNd16 SCNd16
#define FSSH_B_SCNi16 SCNi16
#define FSSH_B_SCNd32 SCNd32
#define FSSH_B_SCNi32 SCNi32
#define FSSH_B_SCNd64 SCNd64
#define FSSH_B_SCNi64 SCNi64
#define FSSH_B_SCNu8 SCNu8
#define FSSH_B_SCNo8 SCNo8
#define FSSH_B_SCNx8 SCNx8
#define FSSH_B_SCNu16 SCNu16
#define FSSH_B_SCNu16 SCNu16
#define FSSH_B_SCNx16 SCNx16
#define FSSH_B_SCNu32 SCNu32
#define FSSH_B_SCNo32 SCNo32
#define FSSH_B_SCNx32 SCNx32
#define FSSH_B_SCNu64 SCNu64
#define FSSH_B_SCNo64 SCNo64
#define FSSH_B_SCNx64 SCNx64
/* printf() format strings for some standard types */
/* size_t */
#define FSSH_B_PRIuSIZE FSSH_B_PRIu32
#define FSSH_B_PRIoSIZE FSSH_B_PRIo32
#define FSSH_B_PRIxSIZE FSSH_B_PRIx32
#define FSSH_B_PRIXSIZE FSSH_B_PRIX32
/* ssize_t */
#define FSSH_B_PRIdSSIZE FSSH_B_PRId32
#define FSSH_B_PRIiSSIZE FSSH_B_PRIi32
/* addr_t */
#ifdef HAIKU_HOST_PLATFORM_64_BIT
# define FSSH_B_PRIuADDR FSSH_B_PRIu64
# define FSSH_B_PRIoADDR FSSH_B_PRIo64
# define FSSH_B_PRIxADDR FSSH_B_PRIx64
# define FSSH_B_PRIXADDR FSSH_B_PRIX64
#else
# define FSSH_B_PRIuADDR FSSH_B_PRIu32
# define FSSH_B_PRIoADDR FSSH_B_PRIo32
# define FSSH_B_PRIxADDR FSSH_B_PRIx32
# define FSSH_B_PRIXADDR FSSH_B_PRIX32
#endif
/* off_t */
#define FSSH_B_PRIdOFF FSSH_B_PRId64
#define FSSH_B_PRIiOFF FSSH_B_PRIi64
/* dev_t */
#define FSSH_B_PRIdDEV FSSH_B_PRId32
#define FSSH_B_PRIiDEV FSSH_B_PRIi32
/* ino_t */
#define FSSH_B_PRIdINO FSSH_B_PRId64
#define FSSH_B_PRIiINO FSSH_B_PRIi64
#endif // _FSSH_TYPES_H