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

Typedefs

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

Functions

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

Variables

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

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

◆ 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)

◆ 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

typedef uint32 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

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

Since
BeOS R3