plibsys
Macros | Typedefs | Variables
ptypes.h File Reference

Types definitions. More...

#include <plibsysconfig.h>
#include <pmacros.h>
Include dependency graph for ptypes.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PSIZE_MODIFIER   ""
 Platform dependent length modifier for conversion specifiers of psize or pssize type for printing and scanning values. More...
 
#define PSSIZE_FORMAT   "i"
 Platform dependent conversion specifier of pssize type for printing and scanning values. More...
 
#define PSIZE_FORMAT   "u"
 Platform dependent conversion specifier of psize type for printing and scanning values.
 
#define P_MAXSIZE   P_MAXUINT
 Maximum value of a psize type.
 
#define P_MINSSIZE   P_MININT
 Minimum value of a pssize type.
 
#define P_MAXSSIZE   P_MAXINT
 Maximum value of a pssize type.
 
#define PINTPTR_MODIFIER   ""
 Platform dependent length modifier for conversion specifiers of pintptr or puintptr type for printing and scanning values. More...
 
#define PINTPTR_FORMAT   "i"
 Platform dependent conversion specifier of pintptr type for printing and scanning values.
 
#define PUINTPTR_FORMAT   "u"
 Platform dependent conversion specifier of puintptr type for printing and scanning values.
 
#define P_INT_TO_POINTER(i)   ((void *) (long) (i))
 Casts an int to a pointer. More...
 
#define P_POINTER_TO_INT(p)   ((int) (long) (p))
 Casts a pointer to an int. More...
 
#define PPOINTER_TO_INT(p)   ((pint) ((plong) (p)))
 Casts a ppointer to a pint value. More...
 
#define PPOINTER_TO_UINT(p)   ((puint) ((pulong) (p)))
 Casts a ppointer to a pint value. More...
 
#define PINT_TO_POINTER(i)   ((ppointer) (plong) (i))
 Casts a pint value to a ppointer. More...
 
#define PUINT_TO_POINTER(u)   ((ppointer) (pulong) (u))
 Casts a puint value to a ppointer. More...
 
#define PSIZE_TO_POINTER(i)   ((ppointer) ((psize) (i)))
 Casts a psize value to a ppointer. More...
 
#define PPOINTER_TO_PSIZE(p)   ((psize) (p))
 Casts a ppointer to a psize value. More...
 
#define P_MININT8   ((pint8) 0x80)
 Min value for a 8-bit int. More...
 
#define P_MAXINT8   ((pint8) 0x7F)
 Max value for a 8-bit int. More...
 
#define P_MAXUINT8   ((puint8) 0xFF)
 Max value for a 8-bit unsigned int. More...
 
#define P_MININT16   ((pint16) 0x8000)
 Min value for a 16-bit int. More...
 
#define P_MAXINT16   ((pint16) 0x7FFF)
 Max value for a 16-bit int. More...
 
#define P_MAXUINT16   ((puint16) 0xFFFF)
 Max value for a 16-bit unsigned int. More...
 
#define P_MININT32   ((pint32) 0x80000000)
 Min value for a 32-bit int. More...
 
#define P_MAXINT32   ((pint32) 0x7FFFFFFF)
 Max value for a 32-bit int. More...
 
#define P_MAXUINT32   ((puint32) 0xFFFFFFFF)
 Max value for a 32-bit unsigned int. More...
 
#define P_MININT64   ((pint64) 0x8000000000000000LL)
 Min value for a 64-bit int. More...
 
#define P_MAXINT64   ((pint64) 0x7FFFFFFFFFFFFFFFLL)
 Max value for a 64-bit int. More...
 
#define P_MAXUINT64   ((puint64) 0xFFFFFFFFFFFFFFFFULL)
 Max value for a 64-bit unsigned int. More...
 
#define PINT16_MODIFIER   ""
 Platform dependent length modifier for conversion specifiers of pint16 or puint16 type for printing and scanning values. More...
 
#define PINT16_FORMAT   "hi"
 Platform dependent conversion specifier of pint16 type for printing and scanning values.
 
#define PUINT16_FORMAT   "hu"
 Platform dependent conversion specifier of puint16 type for printing and scanning values.
 
#define PINT32_MODIFIER   ""
 Platform dependent length modifier for conversion specifiers of pint32 or puint32 type for printing and scanning values. More...
 
#define PINT32_FORMAT   "i"
 Platform dependent conversion specifier of pint32 type for printing and scanning values.
 
#define PUINT32_FORMAT   "u"
 Platform dependent conversion specifier of puint32 type for printing and scanning values.
 
#define PINT64_MODIFIER   "ll"
 Platform dependent length modifier for conversion specifiers of pint64 or puint64 type for printing and scanning values. More...
 
#define PINT64_FORMAT   "lli"
 Platform dependent conversion specifier of pint64 type for printing and scanning values.
 
#define PUINT64_FORMAT   "llu"
 Platform dependent conversion specifier of puint64 type for printing and scanning values.
 
#define POFFSET_MODIFIER   PINT64_MODIFIER
 Platform dependent length modifier for conversion specifiers of poffset type for printing and scanning values. More...
 
#define POFFSET_FORMAT   PINT64_FORMAT
 Platform dependent conversion specifier of poffset type for printing and scanning values.
 
#define P_LITTLE_ENDIAN   1234
 Little endian mark. More...
 
#define P_BIG_ENDIAN   4321
 Big endian mark. More...
 
#define PINT16_TO_LE(val)   ((pint16) PUINT16_SWAP_BYTES (val))
 Swaps a pint16 variable from the host to the little endian order. More...
 
#define PUINT16_TO_LE(val)   (PUINT16_SWAP_BYTES (val))
 Swaps a puint16 variable from the host to the little the endian order. More...
 
#define PINT16_TO_BE(val)   ((pint16) (val))
 Swaps a pint16 variable from the host to the big endian order. More...
 
#define PUINT16_TO_BE(val)   ((puint16) (val))
 Swaps a puint16 variable from the host to the big endian order. More...
 
#define PINT32_TO_LE(val)   ((pint32) PUINT32_SWAP_BYTES (val))
 Swaps a pint32 variable from the host to the little endian order. More...
 
#define PUINT32_TO_LE(val)   (PUINT32_SWAP_BYTES (val))
 Swaps a puint32 variable from the host to the little endian order. More...
 
#define PINT32_TO_BE(val)   ((pint32) (val))
 Swaps a pint32 variable from the host to the big endian order. More...
 
#define PUINT32_TO_BE(val)   ((puint32) (val))
 Swaps a puint32 variable from the host to the big endian order. More...
 
#define PINT64_TO_LE(val)   ((pint64) PUINT64_SWAP_BYTES (val))
 Swaps a pint64 variable from the host to the little endian order. More...
 
#define PUINT64_TO_LE(val)   (PUINT64_SWAP_BYTES (val))
 Swaps a puint64 variable from the host to the little endian order. More...
 
#define PINT64_TO_BE(val)   ((pint64) (val))
 Swaps a pint64 variable from the host to the big endian order. More...
 
#define PUINT64_TO_BE(val)   ((puint64) (val))
 Swaps a puint64 variable from the host to the big endian order. More...
 
#define PLONG_TO_LE(val)   ((plong) PINT32_TO_LE (val))
 Swaps a plong variable from the host to the little endian order. More...
 
#define PULONG_TO_LE(val)   ((pulong) PUINT32_TO_LE (val))
 Swaps a pulong variable from the host to the little endian order. More...
 
#define PLONG_TO_BE(val)   ((plong) PINT32_TO_BE (val))
 Swaps a plong variable from the host to the big endian order. More...
 
#define PULONG_TO_BE(val)   ((pulong) PUINT32_TO_BE (val))
 Swaps a pulong variable from the host to the big endian order. More...
 
#define PSIZE_TO_LE(val)   ((psize) PUINT32_TO_LE (val))
 Swaps a psize variable from the host to the little endian order. More...
 
#define PSSIZE_TO_LE(val)   ((pssize) PINT32_TO_LE (val))
 Swaps a pssize variable from the host to the little endian order. More...
 
#define PSIZE_TO_BE(val)   ((psize) PUINT32_TO_BE (val))
 Swaps a psize variable from the host to the big endian order. More...
 
#define PSSIZE_TO_BE(val)   ((pssize) PINT32_TO_BE (val))
 Swaps a pssize variable from the host to the big endian order. More...
 
#define PINT_TO_LE(val)   ((pint) PINT32_TO_LE (val))
 Swaps a pint variable from the host to the little endian order. More...
 
#define PUINT_TO_LE(val)   ((puint) PUINT32_TO_LE (val))
 Swaps a puint variable from the host to the little endian order. More...
 
#define PINT_TO_BE(val)   ((pint) PINT32_TO_BE (val))
 Swaps a pint variable from the host to the big endian order. More...
 
#define PUINT_TO_BE(val)   ((puint) PUINT32_TO_BE (val))
 Swaps a puint variable from the host to the big endian order. More...
 
#define PUINT16_SWAP_BYTES(val)   ((puint16) (((puint16) (val)) >> 8 | ((puint16) (val)) << 8))
 Swaps a 16-bit unsigned int. More...
 
#define PUINT32_SWAP_BYTES(val)
 Swaps a 32-bit unsigned int. More...
 
#define PUINT64_SWAP_BYTES(val)
 Swaps a 64-bit unsigned int. More...
 
#define PINT16_FROM_LE(val)   (PINT16_TO_LE (val))
 Swaps a 16-bit int from the little endian byte order to the host one. More...
 
#define PUINT16_FROM_LE(val)   (PUINT16_TO_LE (val))
 Swaps a 16-bit unsigned int from the little endian byte order to the host one. More...
 
#define PINT16_FROM_BE(val)   (PINT16_TO_BE (val))
 Swaps a 16-bit int from the big endian byte order to the host one. More...
 
#define PUINT16_FROM_BE(val)   (PUINT16_TO_BE (val))
 Swaps a 16-bit unsigned int from the big endian byte order to the host one. More...
 
#define PINT32_FROM_LE(val)   (PINT32_TO_LE (val))
 Swaps a 32-bit int from the little endian byte order to the host one. More...
 
#define PUINT32_FROM_LE(val)   (PUINT32_TO_LE (val))
 Swaps a 32-bit unsigned int from the little endian byte order to the host one. More...
 
#define PINT32_FROM_BE(val)   (PINT32_TO_BE (val))
 Swaps a 32-bit int from the big endian byte order to the host one. More...
 
#define PUINT32_FROM_BE(val)   (PUINT32_TO_BE (val))
 Swaps a 32-bit unsigned int from the big endian byte order to the host one. More...
 
#define PINT64_FROM_LE(val)   (PINT64_TO_LE (val))
 Swaps a 64-bit int from the little endian byte order to the host one. More...
 
#define PUINT64_FROM_LE(val)   (PUINT64_TO_LE (val))
 Swaps a 64-bit unsigned int from the little endian byte order to the host one. More...
 
#define PINT64_FROM_BE(val)   (PINT64_TO_BE (val))
 Swaps a 64-bit int from the big endian byte order to the host one. More...
 
#define PUINT64_FROM_BE(val)   (PUINT64_TO_BE (val))
 Swaps a 64-bit unsigned int from the big endian byte order to the host one. More...
 
#define PLONG_FROM_LE(val)   (PLONG_TO_LE (val))
 Swaps a long int from the little endian byte order to the host one. More...
 
#define PULONG_FROM_LE(val)   (PULONG_TO_LE (val))
 Swaps an unsigned long int from the little endian byte order to the host one. More...
 
#define PLONG_FROM_BE(val)   (PLONG_TO_BE (val))
 Swaps a long int from the big endian byte order to the host one. More...
 
#define PULONG_FROM_BE(val)   (PULONG_TO_BE (val))
 Swaps an unsigned long int from the big endian byte order to the host one. More...
 
#define PINT_FROM_LE(val)   (PINT_TO_LE (val))
 Swaps a pint from the little endian byte order to the host one. More...
 
#define PUINT_FROM_LE(val)   (PUINT_TO_LE (val))
 Swaps a puint from the little endian byte order to the host one. More...
 
#define PINT_FROM_BE(val)   (PINT_TO_BE (val))
 Swaps a pint from the big endian byte order to the host one. More...
 
#define PUINT_FROM_BE(val)   (PUINT_TO_BE (val))
 Swaps a puint from the big endian byte order to the host one. More...
 
#define PSIZE_FROM_LE(val)   (PSIZE_TO_LE (val))
 Swaps a psize from the little endian byte order to the host one. More...
 
#define PSSIZE_FROM_LE(val)   (PSSIZE_TO_LE (val))
 Swaps a pssize from the little endian byte order to the host one. More...
 
#define PSIZE_FROM_BE(val)   (PSIZE_TO_BE (val))
 Swaps a psize from the big endian byte order to the host one. More...
 
#define PSSIZE_FROM_BE(val)   (PSSIZE_TO_BE (val))
 Swaps a pssize from the big endian byte order to the host one. More...
 
#define p_ntohl(val)   (PUINT32_FROM_BE (val))
 Swaps a long int from the network byte order to the host one. More...
 
#define p_ntohs(val)   (PUINT16_FROM_BE (val))
 Swaps a short int from the network byte order to the host one. More...
 
#define p_htonl(val)   (PUINT32_TO_BE (val))
 Swaps a long int from the host byte order to the network one. More...
 
#define p_htons(val)   (PUINT16_TO_BE (val))
 Swaps a short int from the host byte order to the network one. More...
 
#define FALSE   (0)
 Type definition for a false boolean value. More...
 
#define TRUE   (!FALSE)
 Type definition for a true boolean value. More...
 

Typedefs

typedef unsigned char puint8
 Type for unsigned 8 bit. More...
 
typedef signed short pint16
 Type for signed 16 bit. More...
 
typedef unsigned short puint16
 Type for unsigned 16 bit. More...
 
typedef signed int pint32
 Type for signed 32 bit. More...
 
typedef unsigned int puint32
 Type for unsigned 32 bit. More...
 
typedef signed long long pint64
 Type for signed 64 bit.
 
typedef unsigned long long puint64
 Type for unsigned 64 bit.
 
typedef void * ppointer
 Type for a pointer. More...
 
typedef const void * pconstpointer
 Type for a const pointer. More...
 
typedef signed int pboolean
 Type for a bool. More...
 
typedef char pchar
 Type for a char. More...
 
typedef short pshort
 Type for a short. More...
 
typedef int pint
 Type for an int. More...
 
typedef long plong
 Type for a long. More...
 
typedef unsigned char puchar
 Type for an unsigned char. More...
 
typedef unsigned short pushort
 Type for an unsigned short. More...
 
typedef unsigned int puint
 Type for an unsigned int. More...
 
typedef unsigned long pulong
 Type for an unsigned long. More...
 
typedef float pfloat
 Type for a float. More...
 
typedef double pdouble
 Type for a double precision float. More...
 
typedef signed int pssize
 Type for a platform independent signed size_t.
 
typedef unsigned int psize
 Type for a platform independent size_t.
 
typedef signed int pintptr
 Type for a platform independent signed pointer represented by an integer.
 
typedef unsigned int puintptr
 Type for a platform independent unsigned pointer represented by an integer.
 
typedef pint64 poffset
 Platform independent offset_t definition. More...
 
typedef void * P_HANDLE
 Platform independent system handle.
 
typedef pboolean(* PTraverseFunc) (ppointer key, ppointer value, ppointer user_data)
 Function to traverse through a key-value container. More...
 
typedef void(* PFunc) (ppointer data, ppointer user_data)
 General purpose function. More...
 
typedef void(* PDestroyFunc) (ppointer data)
 Object destroy notification function. More...
 
typedef pint(* PCompareFunc) (pconstpointer a, pconstpointer b)
 Compares two values. More...
 
typedef pint(* PCompareDataFunc) (pconstpointer a, pconstpointer b, ppointer data)
 Compares two values with additional data. More...
 

Variables

P_BEGIN_DECLS typedef signed char pint8
 Type for signed 8 bit. More...
 

Detailed Description

Types definitions.

Author
Alexander Saprykin

Every operating system in pair with a compiler has its own set of data types. Here you can find unified platform independent data types which guarantee the same bit-size on every supported platform: pint8, pint16, pint32, pint64 and their unsigned variants. Also other types are defined for convinience: ppointer, pboolean, pint, plong, pdouble and more.

Along with the types, length and format modifiers are defined. They can be used to print and scan data from/to a variable.

Sometimes it is useful to use an integer variable as a pointer, i.e. to prevent memory allocation when using hash tables or trees. Use special macros for that case: PINT_TO_POINTER, PPOINTER_TO_INT and their variants. Note that it will not work with 64-bit data types.

To check data type limits use P_MIN* and P_MAX* macros.

If you need to check system endianness compare the P_BYTE_ORDER definition with the P_LITTLE_ENDIAN or P_BIG_ENDIAN macro.

To convert between the little and big endian byte orders use the Px_TO_LE, Px_TO_BE, Px_FROM_LE and Px_FROM_BE macros. Macros for the network<->host byte order conversion are also provided: p_ntohl, p_ntohs, p_ntohs and p_ntohl. All the described above macros depend on the target system endianness. Use PUINTx_SWAP_BYTES to manually swap data types independently from the endianness.

You can also find some of the function definitions used within the library.

Macro Definition Documentation

◆ FALSE

#define FALSE   (0)

Type definition for a false boolean value.

◆ P_BIG_ENDIAN

#define P_BIG_ENDIAN   4321

Big endian mark.

◆ p_htonl

#define p_htonl (   val)    (PUINT32_TO_BE (val))

Swaps a long int from the host byte order to the network one.

Parameters
valValue to swap.
Returns
Swapped long int.
Since
0.0.1

◆ p_htons

#define p_htons (   val)    (PUINT16_TO_BE (val))

Swaps a short int from the host byte order to the network one.

Parameters
valValue to swap.
Returns
Swapped short int.
Since
0.0.1

◆ P_INT_TO_POINTER

#define P_INT_TO_POINTER (   i)    ((void *) (long) (i))

Casts an int to a pointer.

Parameters
iVariable to cast.
Returns
Casted variable.
Since
0.0.1

◆ P_LITTLE_ENDIAN

#define P_LITTLE_ENDIAN   1234

Little endian mark.

◆ P_MAXINT16

#define P_MAXINT16   ((pint16) 0x7FFF)

Max value for a 16-bit int.

◆ P_MAXINT32

#define P_MAXINT32   ((pint32) 0x7FFFFFFF)

Max value for a 32-bit int.

◆ P_MAXINT64

#define P_MAXINT64   ((pint64) 0x7FFFFFFFFFFFFFFFLL)

Max value for a 64-bit int.

◆ P_MAXINT8

#define P_MAXINT8   ((pint8) 0x7F)

Max value for a 8-bit int.

◆ P_MAXUINT16

#define P_MAXUINT16   ((puint16) 0xFFFF)

Max value for a 16-bit unsigned int.

◆ P_MAXUINT32

#define P_MAXUINT32   ((puint32) 0xFFFFFFFF)

Max value for a 32-bit unsigned int.

◆ P_MAXUINT64

#define P_MAXUINT64   ((puint64) 0xFFFFFFFFFFFFFFFFULL)

Max value for a 64-bit unsigned int.

◆ P_MAXUINT8

#define P_MAXUINT8   ((puint8) 0xFF)

Max value for a 8-bit unsigned int.

◆ P_MININT16

#define P_MININT16   ((pint16) 0x8000)

Min value for a 16-bit int.

◆ P_MININT32

#define P_MININT32   ((pint32) 0x80000000)

Min value for a 32-bit int.

◆ P_MININT64

#define P_MININT64   ((pint64) 0x8000000000000000LL)

Min value for a 64-bit int.

◆ P_MININT8

#define P_MININT8   ((pint8) 0x80)

Min value for a 8-bit int.

◆ p_ntohl

#define p_ntohl (   val)    (PUINT32_FROM_BE (val))

Swaps a long int from the network byte order to the host one.

Parameters
valValue to swap.
Returns
Swapped long int.
Since
0.0.1

◆ p_ntohs

#define p_ntohs (   val)    (PUINT16_FROM_BE (val))

Swaps a short int from the network byte order to the host one.

Parameters
valValue to swap.
Returns
Swapped short int.
Since
0.0.1

◆ P_POINTER_TO_INT

#define P_POINTER_TO_INT (   p)    ((int) (long) (p))

Casts a pointer to an int.

Parameters
pPointer to cast.
Returns
Casted pointer.
Since
0.0.1

◆ PINT16_FROM_BE

#define PINT16_FROM_BE (   val)    (PINT16_TO_BE (val))

Swaps a 16-bit int from the big endian byte order to the host one.

Parameters
valValue to swap.
Returns
Swapped 16-bit int.
Since
0.0.1

◆ PINT16_FROM_LE

#define PINT16_FROM_LE (   val)    (PINT16_TO_LE (val))

Swaps a 16-bit int from the little endian byte order to the host one.

Parameters
valValue to swap.
Returns
Swapped 16-bit int.
Since
0.0.1

◆ PINT16_MODIFIER

#define PINT16_MODIFIER   ""

Platform dependent length modifier for conversion specifiers of pint16 or puint16 type for printing and scanning values.

It is a string literal, but doesn't include the percent sign so you can add precision and length modifiers and append a conversion specifier.

◆ PINT16_TO_BE

#define PINT16_TO_BE (   val)    ((pint16) (val))

Swaps a pint16 variable from the host to the big endian order.

Parameters
valValue to swap.
Returns
Swapped value.
Since
0.0.1

◆ PINT16_TO_LE

#define PINT16_TO_LE (   val)    ((pint16) PUINT16_SWAP_BYTES (val))

Swaps a pint16 variable from the host to the little endian order.

Parameters
valValue to swap.
Returns
Swapped value.
Since
0.0.1

◆ PINT32_FROM_BE

#define PINT32_FROM_BE (   val)    (PINT32_TO_BE (val))

Swaps a 32-bit int from the big endian byte order to the host one.

Parameters
valValue to swap.
Returns
Swapped 32-bit int.
Since
0.0.1

◆ PINT32_FROM_LE

#define PINT32_FROM_LE (   val)    (PINT32_TO_LE (val))

Swaps a 32-bit int from the little endian byte order to the host one.

Parameters
valValue to swap.
Returns
Swapped 32-bit int.
Since
0.0.1

◆ PINT32_MODIFIER

#define PINT32_MODIFIER   ""

Platform dependent length modifier for conversion specifiers of pint32 or puint32 type for printing and scanning values.

It is a string literal, but doesn't include the percent sign so you can add precision and length modifiers and append a conversion specifier.

◆ PINT32_TO_BE

#define PINT32_TO_BE (   val)    ((pint32) (val))

Swaps a pint32 variable from the host to the big endian order.

Parameters
valValue to swap.
Returns
Swapped value.
Since
0.0.1

◆ PINT32_TO_LE

#define PINT32_TO_LE (   val)    ((pint32) PUINT32_SWAP_BYTES (val))

Swaps a pint32 variable from the host to the little endian order.

Parameters
valValue to swap.
Returns
Swapped value.
Since
0.0.1

◆ PINT64_FROM_BE

#define PINT64_FROM_BE (   val)    (PINT64_TO_BE (val))

Swaps a 64-bit int from the big endian byte order to the host one.

Parameters
valValue to swap.
Returns
Swapped 64-bit int.
Since
0.0.1

◆ PINT64_FROM_LE

#define PINT64_FROM_LE (   val)    (PINT64_TO_LE (val))

Swaps a 64-bit int from the little endian byte order to the host one.

Parameters
valValue to swap.
Returns
Swapped 64-bit int.
Since
0.0.1

◆ PINT64_MODIFIER

#define PINT64_MODIFIER   "ll"

Platform dependent length modifier for conversion specifiers of pint64 or puint64 type for printing and scanning values.

It is a string literal, but doesn't include the percent sign so you can add precision and length modifiers and append a conversion specifier.

◆ PINT64_TO_BE

#define PINT64_TO_BE (   val)    ((pint64) (val))

Swaps a pint64 variable from the host to the big endian order.

Parameters
valValue to swap.
Returns
Swapped value.
Since
0.0.1

◆ PINT64_TO_LE

#define PINT64_TO_LE (   val)    ((pint64) PUINT64_SWAP_BYTES (val))

Swaps a pint64 variable from the host to the little endian order.

Parameters
valValue to swap.
Returns
Swapped value.
Since
0.0.1

◆ PINT_FROM_BE

#define PINT_FROM_BE (   val)    (PINT_TO_BE (val))

Swaps a pint from the big endian byte order to the host one.

Parameters
valValue to swap.
Returns
Swapped pint.
Since
0.0.1

◆ PINT_FROM_LE

#define PINT_FROM_LE (   val)    (PINT_TO_LE (val))

Swaps a pint from the little endian byte order to the host one.

Parameters
valValue to swap.
Returns
Swapped pint.
Since
0.0.1

◆ PINT_TO_BE

#define PINT_TO_BE (   val)    ((pint) PINT32_TO_BE (val))

Swaps a pint variable from the host to the big endian order.

Parameters
valValue to swap.
Returns
Swapped value.
Since
0.0.1

◆ PINT_TO_LE

#define PINT_TO_LE (   val)    ((pint) PINT32_TO_LE (val))

Swaps a pint variable from the host to the little endian order.

Parameters
valValue to swap.
Returns
Swapped value.
Since
0.0.1

◆ PINT_TO_POINTER

#define PINT_TO_POINTER (   i)    ((ppointer) (plong) (i))

Casts a pint value to a ppointer.

Parameters
ipint to cast.
Returns
Casted pint.
Since
0.0.1

◆ PINTPTR_MODIFIER

#define PINTPTR_MODIFIER   ""

Platform dependent length modifier for conversion specifiers of pintptr or puintptr type for printing and scanning values.

It is a string literal, but doesn't include the percent sign so you can add precision and length modifiers and append a conversion specifier.

◆ PLONG_FROM_BE

#define PLONG_FROM_BE (   val)    (PLONG_TO_BE (val))

Swaps a long int from the big endian byte order to the host one.

Parameters
valValue to swap.
Returns
Swapped long int.
Since
0.0.1

◆ PLONG_FROM_LE

#define PLONG_FROM_LE (   val)    (PLONG_TO_LE (val))

Swaps a long int from the little endian byte order to the host one.

Parameters
valValue to swap.
Returns
Swapped long int.
Since
0.0.1

◆ PLONG_TO_BE

#define PLONG_TO_BE (   val)    ((plong) PINT32_TO_BE (val))

Swaps a plong variable from the host to the big endian order.

Parameters
valValue to swap.
Returns
Swapped value.
Since
0.0.1

◆ PLONG_TO_LE

#define PLONG_TO_LE (   val)    ((plong) PINT32_TO_LE (val))

Swaps a plong variable from the host to the little endian order.

Parameters
valValue to swap.
Returns
Swapped value.
Since
0.0.1

◆ POFFSET_MODIFIER

#define POFFSET_MODIFIER   PINT64_MODIFIER

Platform dependent length modifier for conversion specifiers of poffset type for printing and scanning values.

It is a string literal, but doesn't include the percent sign so you can add precision and length modifiers and append a conversion specifier.

◆ PPOINTER_TO_INT

#define PPOINTER_TO_INT (   p)    ((pint) ((plong) (p)))

Casts a ppointer to a pint value.

Parameters
pppointer to cast.
Returns
Casted ppointer.
Since
0.0.1

◆ PPOINTER_TO_PSIZE

#define PPOINTER_TO_PSIZE (   p)    ((psize) (p))

Casts a ppointer to a psize value.

◆ PPOINTER_TO_UINT

#define PPOINTER_TO_UINT (   p)    ((puint) ((pulong) (p)))

Casts a ppointer to a pint value.

Parameters
pppointer to cast.
Returns
Casted ppointer.
Since
0.0.1

◆ PSIZE_FROM_BE

#define PSIZE_FROM_BE (   val)    (PSIZE_TO_BE (val))

Swaps a psize from the big endian byte order to the host one.

Parameters
valValue to swap.
Returns
Swapped psize.
Since
0.0.1

◆ PSIZE_FROM_LE

#define PSIZE_FROM_LE (   val)    (PSIZE_TO_LE (val))

Swaps a psize from the little endian byte order to the host one.

Parameters
valValue to swap.
Returns
Swapped psize.
Since
0.0.1

◆ PSIZE_MODIFIER

#define PSIZE_MODIFIER   ""

Platform dependent length modifier for conversion specifiers of psize or pssize type for printing and scanning values.

It is a string literal, but doesn't include the percent sign so you can add precision and length modifiers and append a conversion specifier.

psize size_val = 256;
printf ("%#" PSIZE_MODIFIER "x", size_val);

◆ PSIZE_TO_BE

#define PSIZE_TO_BE (   val)    ((psize) PUINT32_TO_BE (val))

Swaps a psize variable from the host to the big endian order.

Parameters
valValue to swap.
Returns
Swapped value.
Since
0.0.1

◆ PSIZE_TO_LE

#define PSIZE_TO_LE (   val)    ((psize) PUINT32_TO_LE (val))

Swaps a psize variable from the host to the little endian order.

Parameters
valValue to swap.
Returns
Swapped value.
Since
0.0.1

◆ PSIZE_TO_POINTER

#define PSIZE_TO_POINTER (   i)    ((ppointer) ((psize) (i)))

Casts a psize value to a ppointer.

◆ PSSIZE_FORMAT

#define PSSIZE_FORMAT   "i"

Platform dependent conversion specifier of pssize type for printing and scanning values.

pssize size_val = 100;
printf ("%" PSSIZE_FORMAT, size_val);

◆ PSSIZE_FROM_BE

#define PSSIZE_FROM_BE (   val)    (PSSIZE_TO_BE (val))

Swaps a pssize from the big endian byte order to the host one.

Parameters
valValue to swap.
Returns
Swapped pssize.
Since
0.0.1

◆ PSSIZE_FROM_LE

#define PSSIZE_FROM_LE (   val)    (PSSIZE_TO_LE (val))

Swaps a pssize from the little endian byte order to the host one.

Parameters
valValue to swap.
Returns
Swapped pssize.
Since
0.0.1

◆ PSSIZE_TO_BE

#define PSSIZE_TO_BE (   val)    ((pssize) PINT32_TO_BE (val))

Swaps a pssize variable from the host to the big endian order.

Parameters
valValue to swap.
Returns
Swapped value.
Since
0.0.1

◆ PSSIZE_TO_LE

#define PSSIZE_TO_LE (   val)    ((pssize) PINT32_TO_LE (val))

Swaps a pssize variable from the host to the little endian order.

Parameters
valValue to swap.
Returns
Swapped value.
Since
0.0.1

◆ PUINT16_FROM_BE

#define PUINT16_FROM_BE (   val)    (PUINT16_TO_BE (val))

Swaps a 16-bit unsigned int from the big endian byte order to the host one.

Parameters
valValue to swap.
Returns
Swapped 16-bit unsigned int.
Since
0.0.1

◆ PUINT16_FROM_LE

#define PUINT16_FROM_LE (   val)    (PUINT16_TO_LE (val))

Swaps a 16-bit unsigned int from the little endian byte order to the host one.

Parameters
valValue to swap.
Returns
Swapped 16-bit unsigned int.
Since
0.0.1

◆ PUINT16_SWAP_BYTES

#define PUINT16_SWAP_BYTES (   val)    ((puint16) (((puint16) (val)) >> 8 | ((puint16) (val)) << 8))

Swaps a 16-bit unsigned int.

Parameters
valValue to swap.
Returns
Swapped 16-bit unsigned int.
Since
0.0.1

◆ PUINT16_TO_BE

#define PUINT16_TO_BE (   val)    ((puint16) (val))

Swaps a puint16 variable from the host to the big endian order.

Parameters
valValue to swap.
Returns
Swapped value.
Since
0.0.1

◆ PUINT16_TO_LE

#define PUINT16_TO_LE (   val)    (PUINT16_SWAP_BYTES (val))

Swaps a puint16 variable from the host to the little the endian order.

Parameters
valValue to swap.
Returns
Swapped value.
Since
0.0.1

◆ PUINT32_FROM_BE

#define PUINT32_FROM_BE (   val)    (PUINT32_TO_BE (val))

Swaps a 32-bit unsigned int from the big endian byte order to the host one.

Parameters
valValue to swap.
Returns
Swapped 32-bit unsigned int.
Since
0.0.1

◆ PUINT32_FROM_LE

#define PUINT32_FROM_LE (   val)    (PUINT32_TO_LE (val))

Swaps a 32-bit unsigned int from the little endian byte order to the host one.

Parameters
valValue to swap.
Returns
Swapped 32-bit unsigned int.
Since
0.0.1

◆ PUINT32_SWAP_BYTES

#define PUINT32_SWAP_BYTES (   val)
Value:
((puint32) ( \
(((puint32) (val)) >> 24) | \
((((puint32) (val)) << 8) & ((puint32) 0x00FF0000U)) | \
((((puint32) (val)) >> 8) & ((puint32) 0x0000FF00U)) | \
(((puint32) (val)) << 24)))
unsigned int puint32
Type for unsigned 32 bit.
Definition: ptypes.h:83

Swaps a 32-bit unsigned int.

Parameters
valValue to swap.
Returns
Swapped 32-bit unsigned int.
Since
0.0.1

◆ PUINT32_TO_BE

#define PUINT32_TO_BE (   val)    ((puint32) (val))

Swaps a puint32 variable from the host to the big endian order.

Parameters
valValue to swap.
Returns
Swapped value.
Since
0.0.1

◆ PUINT32_TO_LE

#define PUINT32_TO_LE (   val)    (PUINT32_SWAP_BYTES (val))

Swaps a puint32 variable from the host to the little endian order.

Parameters
valValue to swap.
Returns
Swapped value.
Since
0.0.1

◆ PUINT64_FROM_BE

#define PUINT64_FROM_BE (   val)    (PUINT64_TO_BE (val))

Swaps a 64-bit unsigned int from the big endian byte order to the host one.

Parameters
valValue to swap.
Returns
Swapped 64-bit unsigned int.
Since
0.0.1

◆ PUINT64_FROM_LE

#define PUINT64_FROM_LE (   val)    (PUINT64_TO_LE (val))

Swaps a 64-bit unsigned int from the little endian byte order to the host one.

Parameters
valValue to swap.
Returns
Swapped 64-bit unsigned int.
Since
0.0.1

◆ PUINT64_SWAP_BYTES

#define PUINT64_SWAP_BYTES (   val)
Value:
((puint64) ( \
(((puint64) (val)) >> 56) | \
((((puint64) (val)) << 40) & ((puint64) 0x00FF000000000000ULL)) | \
((((puint64) (val)) << 24) & ((puint64) 0x0000FF0000000000ULL)) | \
((((puint64) (val)) << 8) & ((puint64) 0x000000FF00000000ULL)) | \
((((puint64) (val)) >> 8) & ((puint64) 0x00000000FF000000ULL)) | \
((((puint64) (val)) >> 24) & ((puint64) 0x0000000000FF0000ULL)) | \
((((puint64) (val)) >> 40) & ((puint64) 0x000000000000FF00ULL)) | \
(((puint64) (val)) << 56)))
unsigned long long puint64
Type for unsigned 64 bit.
Definition: ptypes.h:104

Swaps a 64-bit unsigned int.

Parameters
valValue to swap.
Returns
Swapped 64-bit unsigned int.
Since
0.0.1

◆ PUINT64_TO_BE

#define PUINT64_TO_BE (   val)    ((puint64) (val))

Swaps a puint64 variable from the host to the big endian order.

Parameters
valValue to swap.
Returns
Swapped value.
Since
0.0.1

◆ PUINT64_TO_LE

#define PUINT64_TO_LE (   val)    (PUINT64_SWAP_BYTES (val))

Swaps a puint64 variable from the host to the little endian order.

Parameters
valValue to swap.
Returns
Swapped value.
Since
0.0.1

◆ PUINT_FROM_BE

#define PUINT_FROM_BE (   val)    (PUINT_TO_BE (val))

Swaps a puint from the big endian byte order to the host one.

Parameters
valValue to swap.
Returns
Swapped puint.
Since
0.0.1

◆ PUINT_FROM_LE

#define PUINT_FROM_LE (   val)    (PUINT_TO_LE (val))

Swaps a puint from the little endian byte order to the host one.

Parameters
valValue to swap.
Returns
Swapped puint.
Since
0.0.1

◆ PUINT_TO_BE

#define PUINT_TO_BE (   val)    ((puint) PUINT32_TO_BE (val))

Swaps a puint variable from the host to the big endian order.

Parameters
valValue to swap.
Returns
Swapped value.
Since
0.0.1

◆ PUINT_TO_LE

#define PUINT_TO_LE (   val)    ((puint) PUINT32_TO_LE (val))

Swaps a puint variable from the host to the little endian order.

Parameters
valValue to swap.
Returns
Swapped value.
Since
0.0.1

◆ PUINT_TO_POINTER

#define PUINT_TO_POINTER (   u)    ((ppointer) (pulong) (u))

Casts a puint value to a ppointer.

Parameters
upuint to cast.
Returns
Casted puint.
Since
0.0.1

◆ PULONG_FROM_BE

#define PULONG_FROM_BE (   val)    (PULONG_TO_BE (val))

Swaps an unsigned long int from the big endian byte order to the host one.

Parameters
valValue to swap.
Returns
Swapped unsigned long int.
Since
0.0.1

◆ PULONG_FROM_LE

#define PULONG_FROM_LE (   val)    (PULONG_TO_LE (val))

Swaps an unsigned long int from the little endian byte order to the host one.

Parameters
valValue to swap.
Returns
Swapped unsigned long int.
Since
0.0.1

◆ PULONG_TO_BE

#define PULONG_TO_BE (   val)    ((pulong) PUINT32_TO_BE (val))

Swaps a pulong variable from the host to the big endian order.

Parameters
valValue to swap.
Returns
Swapped value.
Since
0.0.1

◆ PULONG_TO_LE

#define PULONG_TO_LE (   val)    ((pulong) PUINT32_TO_LE (val))

Swaps a pulong variable from the host to the little endian order.

Parameters
valValue to swap.
Returns
Swapped value.
Since
0.0.1

◆ TRUE

#define TRUE   (!FALSE)

Type definition for a true boolean value.

Typedef Documentation

◆ pboolean

typedef signed int pboolean

Type for a bool.

◆ pchar

typedef char pchar

Type for a char.

◆ PCompareDataFunc

typedef pint(* PCompareDataFunc) (pconstpointer a, pconstpointer b, ppointer data)

Compares two values with additional data.

Parameters
aFirst value to compare.
bSecond value to compare.
dataAddition data, may be NULL.
Returns
-1 if the first value is less than the second, 1 if the first value is greater than the second, 0 otherwise.
Since
0.0.1

◆ PCompareFunc

typedef pint(* PCompareFunc) (pconstpointer a, pconstpointer b)

Compares two values.

Parameters
aFirst value to compare.
bSecond value to compare.
Returns
-1 if the first value is less than the second, 1 if the first value is greater than the second, 0 otherwise.
Since
0.0.1

◆ pconstpointer

typedef const void* pconstpointer

Type for a const pointer.

◆ PDestroyFunc

typedef void(* PDestroyFunc) (ppointer data)

Object destroy notification function.

Parameters
dataPointer to an object to be destroyed.
Since
0.0.1

◆ pdouble

typedef double pdouble

Type for a double precision float.

◆ pfloat

typedef float pfloat

Type for a float.

◆ PFunc

typedef void(* PFunc) (ppointer data, ppointer user_data)

General purpose function.

Parameters
dataMain argument related to a context value.
user_dataAdditional (maybe NULL) user-provided data.
Since
0.0.1

◆ pint

typedef int pint

Type for an int.

◆ pint16

typedef signed short pint16

Type for signed 16 bit.

◆ pint32

typedef signed int pint32

Type for signed 32 bit.

◆ plong

typedef long plong

Type for a long.

◆ poffset

typedef pint64 poffset

Platform independent offset_t definition.

◆ ppointer

typedef void* ppointer

Type for a pointer.

◆ pshort

typedef short pshort

Type for a short.

◆ PTraverseFunc

typedef pboolean(* PTraverseFunc) (ppointer key, ppointer value, ppointer user_data)

Function to traverse through a key-value container.

Parameters
keyThe key of an item.
valueThe value of the item.
user_dataData provided by a user, maybe NULL.
Returns
FALSE to continue traversing, TRUE to stop it.
Since
0.0.1

◆ puchar

typedef unsigned char puchar

Type for an unsigned char.

◆ puint

typedef unsigned int puint

Type for an unsigned int.

◆ puint16

typedef unsigned short puint16

Type for unsigned 16 bit.

◆ puint32

typedef unsigned int puint32

Type for unsigned 32 bit.

◆ puint8

typedef unsigned char puint8

Type for unsigned 8 bit.

◆ pulong

typedef unsigned long pulong

Type for an unsigned long.

◆ pushort

typedef unsigned short pushort

Type for an unsigned short.

Variable Documentation

◆ pint8

P_BEGIN_DECLS typedef signed char pint8

Type for signed 8 bit.