Loading...
Searching...
No Matches
Macros | Functions | Variables
SupportDefs.h File Reference

Defines basic types and definitions for the Haiku API. More...

Macros

#define B_COUNT_OF(a)   (sizeof(a) / sizeof(a[0]))
 Count items in an array.
 
#define max_c(a, b)   ((a)>(b)?(a):(b))
 Returns the maximum of values a and b.
 
#define min_c(a, b)   ((a)>(b)?(b):(a))
 Returns the minimum of the values a and b.
 
#define NULL   (0)
 Defines the constant NULL if it hasn't already been defined.
 
Format strings for printf() and scanf() for integer types
#define B_PRId16   "d"
 printf() constant for i16 as decimal
 
#define B_PRId32   __HAIKU_PRI_PREFIX_32 "d"
 printf() constant for i32 as decimal
 
#define B_PRId64   __HAIKU_PRI_PREFIX_64 "d"
 printf() constant for i64 as decimal
 
#define B_PRId8   "d"
 printf() constant for i8 as decimal
 
#define B_PRIi16   "i"
 printf() constant for i16 as decimal
 
#define B_PRIi32   __HAIKU_PRI_PREFIX_32 "i"
 printf() constant for i32 as decimal
 
#define B_PRIi64   __HAIKU_PRI_PREFIX_64 "i"
 printf() constant for i64 as decimal
 
#define B_PRIi8   "i"
 printf() constant for i8 as decimal
 
#define B_PRIo16   "o"
 printf() constant for u16 as octal
 
#define B_PRIo32   __HAIKU_PRI_PREFIX_32 "o"
 printf() constant for u32 as octal
 
#define B_PRIo64   __HAIKU_PRI_PREFIX_64 "o"
 printf() constant for u64 as octal
 
#define B_PRIo8   "o"
 printf() constant for u8 as octal
 
#define B_PRIu16   "u"
 printf() constant for u16 as decimal
 
#define B_PRIu32   __HAIKU_PRI_PREFIX_32 "u"
 printf() constant for u32 as decimal
 
#define B_PRIu64   __HAIKU_PRI_PREFIX_64 "u"
 printf() constant for u64 as decimal
 
#define B_PRIu8   "u"
 printf() constant for u8 as decimal
 
#define B_PRIx16   "x"
 printf() constant for u16 as lowercase hexadecimal
 
#define B_PRIX16   "X"
 printf() constant for u16 as uppercase hexadecimal
 
#define B_PRIx32   __HAIKU_PRI_PREFIX_32 "x"
 printf() constant for u32 as lowercase hexadecimal
 
#define B_PRIX32   __HAIKU_PRI_PREFIX_32 "X"
 printf() constant for u32 as uppercase hexadecimal
 
#define B_PRIx64   __HAIKU_PRI_PREFIX_64 "x"
 printf() constant for u64 as lowercase hexadecimal
 
#define B_PRIX64   __HAIKU_PRI_PREFIX_64 "X"
 printf() constant for u64 as uppercase hexadecimal
 
#define B_PRIx8   "x"
 printf() constant for u8 as lowercase hexadecimal
 
#define B_PRIX8   "X"
 printf() constant for u8 as uppercase hexadecimal
 
#define B_SCNd16   "hd"
 scanf() constant for i16 as decimal
 
#define B_SCNd32   __HAIKU_PRI_PREFIX_32 "d"
 scanf() constant for i32 as decimal
 
#define B_SCNd64   __HAIKU_PRI_PREFIX_64 "d"
 scanf() constant for i64 as decimal
 
#define B_SCNd8   "hhd"
 scanf() constant for i8 as decimal
 
#define B_SCNi16   "hi"
 scanf() constant for i16 as decimal, octal or hexadecimal
 
#define B_SCNi32   __HAIKU_PRI_PREFIX_32 "i"
 scanf() constant for i32 as decimal, octal or hexadecimal
 
#define B_SCNi64   __HAIKU_PRI_PREFIX_64 "i"
 scanf() constant for i64 as decimal, octal or hexadecimal
 
#define B_SCNi8   "hhi"
 scanf() constant for i8 as decimal, octal or hexadecimal
 
#define B_SCNo16   "ho"
 scanf() constant for u16 as decimal, octal or hexadecimal
 
#define B_SCNo32   __HAIKU_PRI_PREFIX_32 "o"
 scanf() constant for u32 as decimal, octal or hexadecimal
 
#define B_SCNo64   __HAIKU_PRI_PREFIX_64 "o"
 scanf() constant for u64 as decimal, octal or hexadecimal
 
#define B_SCNo8   "hho"
 scanf() constant for u8 as decimal, octal or hexadecimal
 
#define B_SCNu16   "hu"
 scanf() constant for u16 as decimal
 
#define B_SCNu32   __HAIKU_PRI_PREFIX_32 "u"
 scanf() constant for u32 as decimal
 
#define B_SCNu64   __HAIKU_PRI_PREFIX_64 "u"
 scanf() constant for u64 as decimal
 
#define B_SCNu8   "hhu"
 scanf() constant for u8 as decimal
 
#define B_SCNx16   "hx"
 scanf() constant for u16 as hexadecimal
 
#define B_SCNx32   __HAIKU_PRI_PREFIX_32 "x"
 scanf() constant for u32 as hexadecimal
 
#define B_SCNx64   __HAIKU_PRI_PREFIX_64 "x"
 scanf() constant for u64 as hexadecimal
 
#define B_SCNx8   "hhx"
 scanf() constant for u8 as hexadecimal
 
Format strings for several standard types
#define B_PRIdBIGTIME   B_PRId64
 printf() constant for bigtime_t as decimal
 
#define B_PRIdDEV   B_PRId32
 printf() constant for dev_t as decimal
 
#define B_PRIdINO   B_PRId64
 printf() constant for ino_t as decimal
 
#define B_PRIdOFF   B_PRId64
 printf() constant for off_t as decimal
 
#define B_PRIdSSIZE   __HAIKU_PRI_PREFIX_ADDR "d"
 printf() constant for ssize_t as decimal
 
#define B_PRIdTIME   B_PRId64
 printf() constant for time_t as decimal
 
#define B_PRIiBIGTIME   B_PRIi64
 printf() constant for bigtime_t as decimal
 
#define B_PRIiDEV   B_PRIi32
 printf() constant for dev_t as decimal
 
#define B_PRIiINO   B_PRIi64
 printf() constant for ino_t as decimal
 
#define B_PRIiOFF   B_PRIi64
 printf() constant for off_t as decimal
 
#define B_PRIiSSIZE   __HAIKU_PRI_PREFIX_ADDR "i"
 printf() constant for ssize_t as decimal
 
#define B_PRIiTIME   B_PRIi64
 printf() constant for time_t as decimal
 
#define B_PRINTF_POINTER_WIDTH   8
 printf() argument for printed width of a pointer with the p format (minus 0x prefix).
 
#define B_PRIoADDR   __HAIKU_PRI_PREFIX_ADDR "o"
 printf() constant for addr_t as octal
 
#define B_PRIoGENADDR   __HAIKU_PRI_PREFIX_GENERIC_ADDR "o"
 printf() constant for generic_addr_t as octal
 
#define B_PRIoPHYSADDR   __HAIKU_PRI_PREFIX_PHYS_ADDR "o"
 printf() constant for phys_addr_t as octal
 
#define B_PRIoSIZE   __HAIKU_PRI_PREFIX_ADDR "o"
 printf() constant for size_t as octal
 
#define B_PRIuADDR   __HAIKU_PRI_PREFIX_ADDR "u"
 printf() constant for addr_t as decimal
 
#define B_PRIuGENADDR   __HAIKU_PRI_PREFIX_GENERIC_ADDR "u"
 printf() constant for generic_addr_t as decimal
 
#define B_PRIuPHYSADDR   __HAIKU_PRI_PREFIX_PHYS_ADDR "u"
 printf() constant for phys_addr_t as decimal
 
#define B_PRIuSIZE   __HAIKU_PRI_PREFIX_ADDR "u"
 printf() constant for size_t as decimal
 
#define B_PRIxADDR   __HAIKU_PRI_PREFIX_ADDR "x"
 printf() constant for addr_t as lowercase hexadecimal
 
#define B_PRIXADDR   __HAIKU_PRI_PREFIX_ADDR "X"
 printf() constant for addr_t as uppercase hexadecimal
 
#define B_PRIxGENADDR   __HAIKU_PRI_PREFIX_GENERIC_ADDR "x"
 printf() constant for generic_addr_t as lowercase hexadecimal
 
#define B_PRIXGENADDR   __HAIKU_PRI_PREFIX_GENERIC_ADDR "X"
 printf() constant for generic_addr_t as uppercase hexadecimal
 
#define B_PRIxOFF   B_PRIx64
 printf() constant for off_t as lowercase hexadecimal
 
#define B_PRIxPHYSADDR   __HAIKU_PRI_PREFIX_PHYS_ADDR "x"
 printf() constant for phys_addr_t as lowercase hexadecimal
 
#define B_PRIXPHYSADDR   __HAIKU_PRI_PREFIX_PHYS_ADDR "X"
 printf() constant for phys_addr_t as uppercase hexadecimal
 
#define B_PRIxSIZE   __HAIKU_PRI_PREFIX_ADDR "x"
 printf() constant for size_t as lowercase hexadecimal
 
#define B_PRIXSIZE   __HAIKU_PRI_PREFIX_ADDR "X"
 printf() constant for size_t as uppercase hexadecimal
 
#define B_SCNdOFF   B_SCNd64
 scanf() constant for off_t as decimal
 
#define B_SCNdSSIZE   __HAIKU_PRI_PREFIX_ADDR "d"
 scanf() constant for ssize_t as decimal
 
#define B_SCNiOFF   B_SCNi64
 scanf() constant for off_t as decimal, octal or hexadecimal
 
#define B_SCNiSSIZE   __HAIKU_PRI_PREFIX_ADDR "i"
 scanf() constant for ssize_t as decimal, octal or hexadecimal
 
#define B_SCNoADDR   __HAIKU_PRI_PREFIX_ADDR "o"
 scanf() constant for addr_t as decimal, octal or hexadecimal
 
#define B_SCNoGENADDR   __HAIKU_PRI_PREFIX_GENERIC_ADDR "o"
 scanf() constant for generic_addr_t as decimal, octal or hexadecimal
 
#define B_SCNoPHYSADDR   __HAIKU_PRI_PREFIX_PHYS_ADDR "o"
 scanf() constant for phys_addr_t as decimal, octal or hexadecimal
 
#define B_SCNoSIZE   __HAIKU_PRI_PREFIX_ADDR "o"
 scanf() constant for size_t as decimal, octal or hexadecimal
 
#define B_SCNuADDR   __HAIKU_PRI_PREFIX_ADDR "u"
 scanf() constant for addr_t as decimal
 
#define B_SCNuGENADDR   __HAIKU_PRI_PREFIX_GENERIC_ADDR "u"
 scanf() constant for generic_addr_t as decimal
 
#define B_SCNuPHYSADDR   __HAIKU_PRI_PREFIX_PHYS_ADDR "u"
 scanf() constant for phys_addr_t as decimal
 
#define B_SCNuSIZE   __HAIKU_PRI_PREFIX_ADDR "u"
 scanf() constant for size_t as decimal
 
#define B_SCNxADDR   __HAIKU_PRI_PREFIX_ADDR "x"
 scanf() constant for addr_t as hexadecimal
 
#define B_SCNxGENADDR   __HAIKU_PRI_PREFIX_GENERIC_ADDR "x"
 scanf() constant for generic_addr_t as hexadecimal
 
#define B_SCNxOFF   B_SCNx64
 scanf() constant for off_t as octal
 
#define B_SCNxPHYSADDR   __HAIKU_PRI_PREFIX_PHYS_ADDR "x"
 scanf() constant for phys_addr_t as hexadecimal
 
#define B_SCNxSIZE   __HAIKU_PRI_PREFIX_ADDR "x"
 scanf() constant for size_t as hexadecimal
 
Deprecated defines
#define FALSE   0
 Obsolete. Use false.
 
#define TRUE   1
 Obsolete. Use true.
 

Typedefs

Fixed-Size Integer Types
typedef __haiku_int16 int16
 2-bytes signed integer.
 
typedef __haiku_int32 int32
 4-bytes signed integer.
 
typedef __haiku_int64 int64
 8-bytes signed integer.
 
typedef __haiku_int8 int8
 1-byte signed integer.
 
typedef __haiku_uint16 uint16
 2-bytes unsigned integer.
 
typedef __haiku_uint32 uint32
 4-bytes unsigned integer.
 
typedef __haiku_uint64 uint64
 8-bytes unsigned integer.
 
typedef __haiku_uint8 uint8
 1-byte unsigned integer.
 
Fixed-size Volatile Types
typedef volatile int16 vint16
 2-bytes volatile signed integer.
 
typedef volatile int32 vint32
 4-bytes volatile signed integer.
 
typedef volatile int64 vint64
 8-bytes volatile signed integer.
 
typedef volatile int8 vint8
 1-byte volatile signed integer.
 
typedef volatile uint16 vuint16
 2-bytes volatile unsigned integer.
 
typedef volatile uint32 vuint32
 4-bytes volatile unsigned integer.
 
typedef volatile uint64 vuint64
 8-bytes volatile unsigned integer.
 
typedef volatile uint8 vuint8
 1-byte volatile unsigned integer.
 
Short-hand Volatile Type Names
typedef volatile char vchar
 Volatile signed char.
 
typedef volatile int vint
 Volatile signed int.
 
typedef volatile long vlong
 Volatile signed long.
 
typedef volatile short vshort
 Volatile signed short.
 
typedef volatile unsigned char vuchar
 Volatile unsigned char.
 
typedef volatile unsigned int vuint
 Volatile unsigned int.
 
typedef volatile unsigned long vulong
 Volatile unsigned long.
 
typedef volatile unsigned short vushort
 Volatile unsigned short.
 
Character Type Formats
typedef unsigned char uchar
 Unsigned 1-byte wide character.
 
Descriptive Type Formats
typedef int64 bigtime_t
 Represents time in microseconds.
 
typedef __haiku_generic_addr_t generic_addr_t
 Represents a generic address.
 
typedef generic_addr_t generic_size_t
 Represents a size of generic memory.
 
typedef int64 nanotime_t
 Represents time in nanoseconds.
 
typedef uint32 perform_code
 Defined to support 'hidden' commands or extensions to classes.
 
typedef __haiku_phys_addr_t phys_addr_t
 Represents a physical address.
 
typedef phys_addr_t phys_size_t
 Represents a size of physical memory.
 
typedef int32 status_t
 Represents one of the status codes defined in Errors.h.
 
typedef uint32 type_code
 Represents a certain type of data. See TypeConstants.h for possible values.
 

Functions

int32 atomic_add (int32 *value, int32 addValue)
 Atomically add the value of addValue to value.
 
int64 atomic_add64 (int64 *value, int64 addValue)
 Atomically add the value of addValue to value.
 
int32 atomic_and (int32 *value, int32 andValue)
 Atomically perform a bitwise AND operation of andValue to the variable andValue.
 
int64 atomic_and64 (int64 *value, int64 andValue)
 Atomically perform a bitwise AND operation of andValue to the variable andValue.
 
int32 atomic_get (int32 *value)
 Atomically return the value of value.
 
int64 atomic_get64 (int64 *value)
 Atomically return the value of value.
 
int32 atomic_get_and_set (int32 *value, int32 newValue)
 Atomically set the variable value to newvalue and return the old value.
 
int64 atomic_get_and_set64 (int64 *value, int64 newValue)
 Atomically set the variable value to newvalue and return the old value.
 
int32 atomic_or (int32 *value, int32 orValue)
 Atomically perform a bitwise OR operation of orValue to the variable andValue.
 
int64 atomic_or64 (int64 *value, int64 orValue)
 Atomically perform a bitwise OR operation of orValue to the variable andValue.
 
void atomic_set (int32 *value, int32 newValue)
 Atomically set the variable value to newvalue.
 
void atomic_set64 (int64 *value, int64 newValue)
 Atomically set the variable value to newvalue.
 
int32 atomic_test_and_set (int32 *value, int32 newValue, int32 testAgainst)
 Atomically set the variable value to newValue if the current value is testAgainst.
 
int64 atomic_test_and_set64 (int64 *value, int64 newValue, int64 testAgainst)
 Atomically set the variable value to newValue if the current value is testAgainst.
 
void * get_stack_frame (void)
 Internal function.
 

Variables

const char * B_EMPTY_STRING
 Defines an empty string. Currently defined as the string "".
 

Detailed Description

Defines basic types and definitions for the Haiku API.

Macro Definition Documentation

◆ B_COUNT_OF

#define B_COUNT_OF (   a)    (sizeof(a) / sizeof(a[0]))

Count items in an array.

Set to (sizeof(a) / sizeof(a[0])).

Since
Haiku R1

◆ B_SCNoSIZE

#define B_SCNoSIZE   __HAIKU_PRI_PREFIX_ADDR "o"

scanf() constant for size_t as decimal, octal or hexadecimal

◆ FALSE

#define FALSE   0

Obsolete. Use false.

Since
BeOS R3

◆ max_c

#define max_c (   a,
 
)    ((a)>(b)?(a):(b))

Returns the maximum of values a and b.

Note
When including this header in a C file, use the C equivalent called max(a,b).
Since
Haiku R1

◆ min_c

#define min_c (   a,
 
)    ((a)>(b)?(b):(a))

Returns the minimum of the values a and b.

Note
When including this header in a C file, use the C equivalent called min(a,b).
Since
Haiku R1

◆ NULL

#define NULL   (0)

Defines the constant NULL if it hasn't already been defined.

Since
BeOS R3

◆ TRUE

#define TRUE   1

Obsolete. Use true.

Since
BeOS R3

Typedef Documentation

◆ bigtime_t

typedef int64 bigtime_t

Represents time in microseconds.

Since
BeOS R3

◆ generic_addr_t

typedef __haiku_generic_addr_t generic_addr_t

Represents a generic address.

A generic address is wide enough to store both physical and virtual addresses.

Since
Haiku R1

◆ generic_size_t

Represents a size of generic memory.

A generic address is wide enough to store both physical and virtual addresses.

Since
Haiku R1

◆ perform_code

Defined to support 'hidden' commands or extensions to classes.

The Haiku API has none of these.

Since
Haiku R1

◆ phys_addr_t

typedef __haiku_phys_addr_t phys_addr_t

Represents a physical address.

This has the length of 4 bytes on a 32 bit platform, and 8 bytes on a 64 bit platform.

Since
Haiku R1

◆ phys_size_t

Represents a size of physical memory.

This has the length of 4 bytes on a 32 bit platform, and 8 bytes on a 64 bit platform.

Since
Haiku R1

◆ status_t

typedef int32 status_t

Represents one of the status codes defined in Errors.h.

Since
BeOS R3

◆ type_code

typedef uint32 type_code

Represents a certain type of data. See TypeConstants.h for possible values.

Since
Haiku R1

Variable Documentation

◆ B_EMPTY_STRING

const char * B_EMPTY_STRING
extern

Defines an empty string. Currently defined as the string "".

Since
BeOS R3