|
#define | PSIZE_MODIFIER "" |
| Platform dependent length modifier for conversion specifiers of psize or pssize type for printing and scanning values.
|
|
#define | PSSIZE_FORMAT "i" |
| Platform dependent conversion specifier of pssize type for printing and scanning values.
|
|
#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.
|
|
#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) |
| Casts an int to a pointer.
|
|
#define | P_POINTER_TO_INT(p) |
| Casts a pointer to an int.
|
|
#define | PPOINTER_TO_INT(p) |
| Casts a ppointer to a pint value.
|
|
#define | PPOINTER_TO_UINT(p) |
| Casts a ppointer to a pint value.
|
|
#define | PINT_TO_POINTER(i) |
| Casts a pint value to a ppointer.
|
|
#define | PUINT_TO_POINTER(u) |
| Casts a puint value to a ppointer.
|
|
#define | PSIZE_TO_POINTER(i) |
| Casts a psize value to a ppointer.
|
|
#define | PPOINTER_TO_PSIZE(p) |
| Casts a ppointer to a psize value.
|
|
#define | P_MININT8 ((pint8) 0x80) |
| Min value for a 8-bit int.
|
|
#define | P_MAXINT8 ((pint8) 0x7F) |
| Max value for a 8-bit int.
|
|
#define | P_MAXUINT8 ((puint8) 0xFF) |
| Max value for a 8-bit unsigned int.
|
|
#define | P_MININT16 ((pint16) 0x8000) |
| Min value for a 16-bit int.
|
|
#define | P_MAXINT16 ((pint16) 0x7FFF) |
| Max value for a 16-bit int.
|
|
#define | P_MAXUINT16 ((puint16) 0xFFFF) |
| Max value for a 16-bit unsigned int.
|
|
#define | P_MININT32 ((pint32) 0x80000000) |
| Min value for a 32-bit int.
|
|
#define | P_MAXINT32 ((pint32) 0x7FFFFFFF) |
| Max value for a 32-bit int.
|
|
#define | P_MAXUINT32 ((puint32) 0xFFFFFFFF) |
| Max value for a 32-bit unsigned int.
|
|
#define | P_MININT64 ((pint64) 0x8000000000000000LL) |
| Min value for a 64-bit int.
|
|
#define | P_MAXINT64 ((pint64) 0x7FFFFFFFFFFFFFFFLL) |
| Max value for a 64-bit int.
|
|
#define | P_MAXUINT64 ((puint64) 0xFFFFFFFFFFFFFFFFULL) |
| Max value for a 64-bit unsigned int.
|
|
#define | PINT16_MODIFIER "h" |
| Platform dependent length modifier for conversion specifiers of pint16 or puint16 type for printing and scanning values.
|
|
#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.
|
|
#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 "I64" |
| Platform dependent length modifier for conversion specifiers of pint64 or puint64 type for printing and scanning values.
|
|
#define | PINT64_FORMAT "I64i" |
| Platform dependent conversion specifier of pint64 type for printing and scanning values.
|
|
#define | PUINT64_FORMAT "I64u" |
| 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.
|
|
#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.
|
|
#define | P_BIG_ENDIAN 4321 |
| Big endian mark.
|
|
#define | PINT16_TO_LE(val) |
| Swaps a pint16 variable from the host to the little endian order.
|
|
#define | PUINT16_TO_LE(val) |
| Swaps a puint16 variable from the host to the little the endian order.
|
|
#define | PINT16_TO_BE(val) |
| Swaps a pint16 variable from the host to the big endian order.
|
|
#define | PUINT16_TO_BE(val) |
| Swaps a puint16 variable from the host to the big endian order.
|
|
#define | PINT32_TO_LE(val) |
| Swaps a pint32 variable from the host to the little endian order.
|
|
#define | PUINT32_TO_LE(val) |
| Swaps a puint32 variable from the host to the little endian order.
|
|
#define | PINT32_TO_BE(val) |
| Swaps a pint32 variable from the host to the big endian order.
|
|
#define | PUINT32_TO_BE(val) |
| Swaps a puint32 variable from the host to the big endian order.
|
|
#define | PINT64_TO_LE(val) |
| Swaps a pint64 variable from the host to the little endian order.
|
|
#define | PUINT64_TO_LE(val) |
| Swaps a puint64 variable from the host to the little endian order.
|
|
#define | PINT64_TO_BE(val) |
| Swaps a pint64 variable from the host to the big endian order.
|
|
#define | PUINT64_TO_BE(val) |
| Swaps a puint64 variable from the host to the big endian order.
|
|
#define | PLONG_TO_LE(val) |
| Swaps a plong variable from the host to the little endian order.
|
|
#define | PULONG_TO_LE(val) |
| Swaps a pulong variable from the host to the little endian order.
|
|
#define | PLONG_TO_BE(val) |
| Swaps a plong variable from the host to the big endian order.
|
|
#define | PULONG_TO_BE(val) |
| Swaps a pulong variable from the host to the big endian order.
|
|
#define | PSIZE_TO_LE(val) |
| Swaps a psize variable from the host to the little endian order.
|
|
#define | PSSIZE_TO_LE(val) |
| Swaps a pssize variable from the host to the little endian order.
|
|
#define | PSIZE_TO_BE(val) |
| Swaps a psize variable from the host to the big endian order.
|
|
#define | PSSIZE_TO_BE(val) |
| Swaps a pssize variable from the host to the big endian order.
|
|
#define | PINT_TO_LE(val) |
| Swaps a pint variable from the host to the little endian order.
|
|
#define | PUINT_TO_LE(val) |
| Swaps a puint variable from the host to the little endian order.
|
|
#define | PINT_TO_BE(val) |
| Swaps a pint variable from the host to the big endian order.
|
|
#define | PUINT_TO_BE(val) |
| Swaps a puint variable from the host to the big endian order.
|
|
#define | PUINT16_SWAP_BYTES(val) |
| Swaps a 16-bit unsigned int.
|
|
#define | PUINT32_SWAP_BYTES(val) |
| Swaps a 32-bit unsigned int.
|
|
#define | PUINT64_SWAP_BYTES(val) |
| Swaps a 64-bit unsigned int.
|
|
#define | PINT16_FROM_LE(val) |
| Swaps a 16-bit int from the little endian byte order to the host one.
|
|
#define | PUINT16_FROM_LE(val) |
| Swaps a 16-bit unsigned int from the little endian byte order to the host one.
|
|
#define | PINT16_FROM_BE(val) |
| Swaps a 16-bit int from the big endian byte order to the host one.
|
|
#define | PUINT16_FROM_BE(val) |
| Swaps a 16-bit unsigned int from the big endian byte order to the host one.
|
|
#define | PINT32_FROM_LE(val) |
| Swaps a 32-bit int from the little endian byte order to the host one.
|
|
#define | PUINT32_FROM_LE(val) |
| Swaps a 32-bit unsigned int from the little endian byte order to the host one.
|
|
#define | PINT32_FROM_BE(val) |
| Swaps a 32-bit int from the big endian byte order to the host one.
|
|
#define | PUINT32_FROM_BE(val) |
| Swaps a 32-bit unsigned int from the big endian byte order to the host one.
|
|
#define | PINT64_FROM_LE(val) |
| Swaps a 64-bit int from the little endian byte order to the host one.
|
|
#define | PUINT64_FROM_LE(val) |
| Swaps a 64-bit unsigned int from the little endian byte order to the host one.
|
|
#define | PINT64_FROM_BE(val) |
| Swaps a 64-bit int from the big endian byte order to the host one.
|
|
#define | PUINT64_FROM_BE(val) |
| Swaps a 64-bit unsigned int from the big endian byte order to the host one.
|
|
#define | PLONG_FROM_LE(val) |
| Swaps a long int from the little endian byte order to the host one.
|
|
#define | PULONG_FROM_LE(val) |
| Swaps an unsigned long int from the little endian byte order to the host one.
|
|
#define | PLONG_FROM_BE(val) |
| Swaps a long int from the big endian byte order to the host one.
|
|
#define | PULONG_FROM_BE(val) |
| Swaps an unsigned long int from the big endian byte order to the host one.
|
|
#define | PINT_FROM_LE(val) |
| Swaps a pint from the little endian byte order to the host one.
|
|
#define | PUINT_FROM_LE(val) |
| Swaps a puint from the little endian byte order to the host one.
|
|
#define | PINT_FROM_BE(val) |
| Swaps a pint from the big endian byte order to the host one.
|
|
#define | PUINT_FROM_BE(val) |
| Swaps a puint from the big endian byte order to the host one.
|
|
#define | PSIZE_FROM_LE(val) |
| Swaps a psize from the little endian byte order to the host one.
|
|
#define | PSSIZE_FROM_LE(val) |
| Swaps a pssize from the little endian byte order to the host one.
|
|
#define | PSIZE_FROM_BE(val) |
| Swaps a psize from the big endian byte order to the host one.
|
|
#define | PSSIZE_FROM_BE(val) |
| Swaps a pssize from the big endian byte order to the host one.
|
|
#define | p_ntohl(val) |
| Swaps a long int from the network byte order to the host one.
|
|
#define | p_ntohs(val) |
| Swaps a short int from the network byte order to the host one.
|
|
#define | p_htonl(val) |
| Swaps a long int from the host byte order to the network one.
|
|
#define | p_htons(val) |
| Swaps a short int from the host byte order to the network one.
|
|
#define | FALSE (0) |
| Type definition for a false boolean value.
|
|
#define | TRUE (!FALSE) |
| Type definition for a true boolean value.
|
|
|
typedef signed char | pint8 |
| Type for signed 8 bit.
|
|
typedef unsigned char | puint8 |
| Type for unsigned 8 bit.
|
|
typedef signed short | pint16 |
| Type for signed 16 bit.
|
|
typedef unsigned short | puint16 |
| Type for unsigned 16 bit.
|
|
typedef signed int | pint32 |
| Type for signed 32 bit.
|
|
typedef unsigned int | puint32 |
| Type for unsigned 32 bit.
|
|
typedef signed __int64 | pint64 |
| Type for signed 64 bit.
|
|
typedef unsigned __int64 | puint64 |
| Type for unsigned 64 bit.
|
|
typedef void * | ppointer |
| Type for a pointer.
|
|
typedef const void * | pconstpointer |
| Type for a const pointer.
|
|
typedef signed int | pboolean |
| Type for a bool.
|
|
typedef char | pchar |
| Type for a char.
|
|
typedef short | pshort |
| Type for a short.
|
|
typedef int | pint |
| Type for an int.
|
|
typedef long | plong |
| Type for a long.
|
|
typedef unsigned char | puchar |
| Type for an unsigned char.
|
|
typedef unsigned short | pushort |
| Type for an unsigned short.
|
|
typedef unsigned int | puint |
| Type for an unsigned int.
|
|
typedef unsigned long | pulong |
| Type for an unsigned long.
|
|
typedef float | pfloat |
| Type for a float.
|
|
typedef double | pdouble |
| Type for a double precision float.
|
|
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.
|
|
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.
|
|
typedef void(* | PFunc) (ppointer data, ppointer user_data) |
| General purpose function.
|
|
typedef void(* | PDestroyFunc) (ppointer data) |
| Object destroy notification function.
|
|
typedef pint(* | PCompareFunc) (pconstpointer a, pconstpointer b) |
| Compares two values.
|
|
typedef pint(* | PCompareDataFunc) (pconstpointer a, pconstpointer b, ppointer data) |
| Compares two values with additional data.
|
|
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.
Definition in file ptypes.h.