60#if !defined (PLIBSYS_H_INSIDE) && !defined (PLIBSYS_COMPILATION)
61# error "Header files shouldn't be included directly, consider using <plibsys.h> instead."
64#ifndef PLIBSYS_HEADER_PTYPES_H
65#define PLIBSYS_HEADER_PTYPES_H
67#include <plibsysconfig.h>
95#if defined (P_OS_WIN) && (defined (P_CC_MSVC) || defined (P_CC_BORLAND))
99# if PLIBSYS_SIZEOF_LONG == 8
100 typedef signed long pint64;
103 typedef signed long long pint64;
104 typedef unsigned long long puint64;
191#if PLIBSYS_SIZEOF_SIZE_T == 8
192# if defined (P_OS_WIN) && (defined (P_CC_MSVC) || defined (P_CC_BORLAND))
193 typedef signed __int64
pssize;
194 typedef unsigned __int64
psize;
195 #define PSIZE_MODIFIER "I64"
196 #define PSSIZE_FORMAT "I64d"
197 #define PSIZE_FORMAT "I64u"
198 #define P_MAXSIZE P_MAXUINT64
199 #define P_MINSSIZE P_MININT64
200 #define P_MAXSSIZE P_MAXINT64
202# if PLIBSYS_SIZEOF_LONG == 8
204 typedef unsigned long psize;
205 #define PSIZE_MODIFIER "l"
206 #define PSSIZE_FORMAT "li"
207 #define PSIZE_FORMAT "lu"
208 #define P_MAXSIZE P_MAXULONG
209 #define P_MINSSIZE P_MINLONG
210 #define P_MAXSSIZE P_MAXLONG
213 typedef unsigned long long psize;
214 #define PSIZE_MODIFIER "ll"
215 #define PSSIZE_FORMAT "lli"
216 #define PSIZE_FORMAT "llu"
217 #define P_MAXSIZE P_MAXUINT64
218 #define P_MINSSIZE P_MININT64
219 #define P_MAXSSIZE P_MAXINT64
225 #define PSIZE_MODIFIER ""
226 #define PSSIZE_FORMAT "i"
227 #define PSIZE_FORMAT "u"
228 #define P_MAXSIZE P_MAXUINT
229 #define P_MINSSIZE P_MININT
230 #define P_MAXSSIZE P_MAXINT
265#if PLIBSYS_SIZEOF_VOID_P == 8
266# if defined (P_OS_WIN) && (defined (P_CC_MSVC) || defined (P_CC_BORLAND))
267 typedef signed __int64
pintptr;
269 #define PINTPTR_MODIFIER "I64"
270 #define PINTPTR_FORMAT "I64i"
271 #define PUINTPTR_FORMAT "I64u"
273# if PLIBSYS_SIZEOF_LONG == 8
276 #define PINTPTR_MODIFIER "l"
277 #define PINTPTR_FORMAT "li"
278 #define PUINTPTR_FORMAT "lu"
281 typedef unsigned long long puintptr;
282 #define PINTPTR_MODIFIER "ll"
283 #define PINTPTR_FORMAT "lli"
284 #define PUINTPTR_FORMAT "llu"
290 #define PINTPTR_MODIFIER ""
291 #define PINTPTR_FORMAT "i"
292 #define PUINTPTR_FORMAT "u"
298#if PLIBSYS_SIZEOF_VOID_P == 8
299# define P_INT_TO_POINTER(i) ((void *) (long long) (i))
300# define P_POINTER_TO_INT(p) ((int) (long long) (p))
301# define PPOINTER_TO_INT(p) ((pint) ((pint64) (p)))
302# define PPOINTER_TO_UINT(p) ((puint) ((puint64) (p)))
303# define PINT_TO_POINTER(i) ((ppointer) (pint64) (i))
304# define PUINT_TO_POINTER(u) ((ppointer) (puint64) (u))
306# define P_INT_TO_POINTER(i) ((void *) (long) (i))
307# define P_POINTER_TO_INT(p) ((int) (long) (p))
308# define PPOINTER_TO_INT(p) ((pint) ((plong) (p)))
309# define PPOINTER_TO_UINT(p) ((puint) ((pulong) (p)))
310# define PINT_TO_POINTER(i) ((ppointer) (plong) (i))
311# define PUINT_TO_POINTER(u) ((ppointer) (pulong) (u))
363#define PSIZE_TO_POINTER(i) ((ppointer) ((psize) (i)))
365#define PPOINTER_TO_PSIZE(p) ((psize) (p))
368#define P_MININT8 ((pint8) 0x80)
370#define P_MAXINT8 ((pint8) 0x7F)
372#define P_MAXUINT8 ((puint8) 0xFF)
375#define P_MININT16 ((pint16) 0x8000)
377#define P_MAXINT16 ((pint16) 0x7FFF)
379#define P_MAXUINT16 ((puint16) 0xFFFF)
382#define P_MININT32 ((pint32) 0x80000000)
384#define P_MAXINT32 ((pint32) 0x7FFFFFFF)
386#define P_MAXUINT32 ((puint32) 0xFFFFFFFF)
389#define P_MININT64 ((pint64) 0x8000000000000000LL)
391#define P_MAXINT64 ((pint64) 0x7FFFFFFFFFFFFFFFLL)
393#define P_MAXUINT64 ((puint64) 0xFFFFFFFFFFFFFFFFULL)
469#if defined (P_OS_WIN) && (defined (P_CC_MSVC) || defined (P_CC_BORLAND))
470 #define PINT16_MODIFIER "h"
472 #define PINT16_MODIFIER ""
475#define PINT16_FORMAT "hi"
476#define PUINT16_FORMAT "hu"
478#define PINT32_MODIFIER ""
479#define PINT32_FORMAT "i"
480#define PUINT32_FORMAT "u"
482#if defined (P_OS_WIN) && (defined (P_CC_MSVC) || defined (P_CC_BORLAND))
483 #define PINT64_MODIFIER "I64"
484 #define PINT64_FORMAT "I64i"
485 #define PUINT64_FORMAT "I64u"
487# if PLIBSYS_SIZEOF_LONG == 8
488 #define PINT64_MODIFIER "l"
489 #define PINT64_FORMAT "li"
490 #define PUINT64_FORMAT "lu"
492 #define PINT64_MODIFIER "ll"
493 #define PINT64_FORMAT "lli"
494 #define PUINT64_FORMAT "llu"
498#define POFFSET_MODIFIER PINT64_MODIFIER
499#define POFFSET_FORMAT PINT64_FORMAT
504#define P_LITTLE_ENDIAN 1234
506#define P_BIG_ENDIAN 4321
700#if P_BYTE_ORDER == P_LITTLE_ENDIAN
701 #define PINT16_TO_LE(val) ((pint16) (val))
702 #define PUINT16_TO_LE(val) ((puint16) (val))
703 #define PINT16_TO_BE(val) ((pint16) PUINT16_SWAP_BYTES (val))
704 #define PUINT16_TO_BE(val) (PUINT16_SWAP_BYTES (val))
705 #define PINT32_TO_LE(val) ((pint32) (val))
706 #define PUINT32_TO_LE(val) ((puint32) (val))
707 #define PINT32_TO_BE(val) ((pint32) PUINT32_SWAP_BYTES (val))
708 #define PUINT32_TO_BE(val) (PUINT32_SWAP_BYTES (val))
709 #define PINT64_TO_LE(val) ((pint64) (val))
710 #define PUINT64_TO_LE(val) ((puint64) (val))
711 #define PINT64_TO_BE(val) ((pint64) PUINT64_SWAP_BYTES (val))
712 #define PUINT64_TO_BE(val) (PUINT64_SWAP_BYTES (val))
713# if PLIBSYS_SIZEOF_LONG == 8
714 #define PLONG_TO_LE(val) ((plong) PINT64_TO_LE (val))
715 #define PULONG_TO_LE(val) ((pulong) PUINT64_TO_LE (val))
716 #define PLONG_TO_BE(val) ((plong) PINT64_TO_BE (val))
717 #define PULONG_TO_BE(val) ((pulong) PUINT64_TO_BE (val))
719 #define PLONG_TO_LE(val) ((plong) PINT32_TO_LE (val))
720 #define PULONG_TO_LE(val) ((pulong) PUINT32_TO_LE (val))
721 #define PLONG_TO_BE(val) ((plong) PINT32_TO_BE (val))
722 #define PULONG_TO_BE(val) ((pulong) PUINT32_TO_BE (val))
724# if PLIBSYS_SIZEOF_SIZE_T == 8
725 #define PSIZE_TO_LE(val) ((psize) PUINT64_TO_LE (val))
726 #define PSSIZE_TO_LE(val) ((pssize) PINT64_TO_LE (val))
727 #define PSIZE_TO_BE(val) ((psize) PUINT64_TO_BE (val))
728 #define PSSIZE_TO_BE(val) ((pssize) PINT64_TO_BE (val))
730 #define PSIZE_TO_LE(val) ((psize) PUINT32_TO_LE (val))
731 #define PSSIZE_TO_LE(val) ((pssize) PINT32_TO_LE (val))
732 #define PSIZE_TO_BE(val) ((psize) PUINT32_TO_BE (val))
733 #define PSSIZE_TO_BE(val) ((pssize) PINT32_TO_BE (val))
735 #define PINT_TO_LE(val) ((pint) PINT32_TO_LE (val))
736 #define PUINT_TO_LE(val) ((puint) PUINT32_TO_LE (val))
737 #define PINT_TO_BE(val) ((pint) PINT32_TO_BE (val))
738 #define PUINT_TO_BE(val) ((puint) PUINT32_TO_BE (val))
741 #define PINT16_TO_LE(val) ((pint16) PUINT16_SWAP_BYTES (val))
742 #define PUINT16_TO_LE(val) (PUINT16_SWAP_BYTES (val))
743 #define PINT16_TO_BE(val) ((pint16) (val))
744 #define PUINT16_TO_BE(val) ((puint16) (val))
745 #define PINT32_TO_LE(val) ((pint32) PUINT32_SWAP_BYTES (val))
746 #define PUINT32_TO_LE(val) (PUINT32_SWAP_BYTES (val))
747 #define PINT32_TO_BE(val) ((pint32) (val))
748 #define PUINT32_TO_BE(val) ((puint32) (val))
749 #define PINT64_TO_LE(val) ((pint64) PUINT64_SWAP_BYTES (val))
750 #define PUINT64_TO_LE(val) (PUINT64_SWAP_BYTES (val))
751 #define PINT64_TO_BE(val) ((pint64) (val))
752 #define PUINT64_TO_BE(val) ((puint64) (val))
753# if PLIBSYS_SIZEOF_LONG == 8
754 #define PLONG_TO_LE(val) ((plong) PINT64_TO_LE (val))
755 #define PULONG_TO_LE(val) ((pulong) PUINT64_TO_LE (val))
756 #define PLONG_TO_BE(val) ((plong) PINT64_TO_BE (val))
757 #define PULONG_TO_BE(val) ((pulong) PUINT64_TO_BE (val))
759 #define PLONG_TO_LE(val) ((plong) PINT32_TO_LE (val))
760 #define PULONG_TO_LE(val) ((pulong) PUINT32_TO_LE (val))
761 #define PLONG_TO_BE(val) ((plong) PINT32_TO_BE (val))
762 #define PULONG_TO_BE(val) ((pulong) PUINT32_TO_BE (val))
764# if PLIBSYS_SIZEOF_SIZE_T == 8
765 #define PSIZE_TO_LE(val) ((psize) PUINT64_TO_LE (val))
766 #define PSSIZE_TO_LE(val) ((pssize) PINT64_TO_LE (val))
767 #define PSIZE_TO_BE(val) ((psize) PUINT64_TO_BE (val))
768 #define PSSIZE_TO_BE(val) ((pssize) PINT64_TO_BE (val))
770 #define PSIZE_TO_LE(val) ((psize) PUINT32_TO_LE (val))
771 #define PSSIZE_TO_LE(val) ((pssize) PINT32_TO_LE (val))
772 #define PSIZE_TO_BE(val) ((psize) PUINT32_TO_BE (val))
773 #define PSSIZE_TO_BE(val) ((pssize) PINT32_TO_BE (val))
775 #define PINT_TO_LE(val) ((pint) PINT32_TO_LE (val))
776 #define PUINT_TO_LE(val) ((puint) PUINT32_TO_LE (val))
777 #define PINT_TO_BE(val) ((pint) PINT32_TO_BE (val))
778 #define PUINT_TO_BE(val) ((puint) PUINT32_TO_BE (val))
789#define PUINT16_SWAP_BYTES(val) \
790 ((puint16) (((puint16) (val)) >> 8 | ((puint16) (val)) << 8))
798#define PUINT32_SWAP_BYTES(val) ((puint32) ( \
799 (((puint32) (val)) >> 24) | \
800 ((((puint32) (val)) << 8) & ((puint32) 0x00FF0000U)) | \
801 ((((puint32) (val)) >> 8) & ((puint32) 0x0000FF00U)) | \
802 (((puint32) (val)) << 24)))
810#define PUINT64_SWAP_BYTES(val) ((puint64) ( \
811 (((puint64) (val)) >> 56) | \
812 ((((puint64) (val)) << 40) & ((puint64) 0x00FF000000000000ULL)) | \
813 ((((puint64) (val)) << 24) & ((puint64) 0x0000FF0000000000ULL)) | \
814 ((((puint64) (val)) << 8) & ((puint64) 0x000000FF00000000ULL)) | \
815 ((((puint64) (val)) >> 8) & ((puint64) 0x00000000FF000000ULL)) | \
816 ((((puint64) (val)) >> 24) & ((puint64) 0x0000000000FF0000ULL)) | \
817 ((((puint64) (val)) >> 40) & ((puint64) 0x000000000000FF00ULL)) | \
818 (((puint64) (val)) << 56)))
828#define PINT16_FROM_LE(val) (PINT16_TO_LE (val))
837#define PUINT16_FROM_LE(val) (PUINT16_TO_LE (val))
845#define PINT16_FROM_BE(val) (PINT16_TO_BE (val))
854#define PUINT16_FROM_BE(val) (PUINT16_TO_BE (val))
863#define PINT32_FROM_LE(val) (PINT32_TO_LE (val))
872#define PUINT32_FROM_LE(val) (PUINT32_TO_LE (val))
880#define PINT32_FROM_BE(val) (PINT32_TO_BE (val))
889#define PUINT32_FROM_BE(val) (PUINT32_TO_BE (val))
897#define PINT64_FROM_LE(val) (PINT64_TO_LE (val))
906#define PUINT64_FROM_LE(val) (PUINT64_TO_LE (val))
914#define PINT64_FROM_BE(val) (PINT64_TO_BE (val))
923#define PUINT64_FROM_BE(val) (PUINT64_TO_BE (val))
931#define PLONG_FROM_LE(val) (PLONG_TO_LE (val))
940#define PULONG_FROM_LE(val) (PULONG_TO_LE (val))
948#define PLONG_FROM_BE(val) (PLONG_TO_BE (val))
957#define PULONG_FROM_BE(val) (PULONG_TO_BE (val))
965#define PINT_FROM_LE(val) (PINT_TO_LE (val))
973#define PUINT_FROM_LE(val) (PUINT_TO_LE (val))
981#define PINT_FROM_BE(val) (PINT_TO_BE (val))
989#define PUINT_FROM_BE(val) (PUINT_TO_BE (val))
997#define PSIZE_FROM_LE(val) (PSIZE_TO_LE (val))
1005#define PSSIZE_FROM_LE(val) (PSSIZE_TO_LE (val))
1013#define PSIZE_FROM_BE(val) (PSIZE_TO_BE (val))
1021#define PSSIZE_FROM_BE(val) (PSSIZE_TO_BE (val))
1031#define p_ntohl(val) (PUINT32_FROM_BE (val))
1039#define p_ntohs(val) (PUINT16_FROM_BE (val))
1047#define p_htonl(val) (PUINT32_TO_BE (val))
1055#define p_htons(val) (PUINT16_TO_BE (val))
1064# define TRUE (!FALSE)
#define P_BEGIN_DECLS
Starts .h file declarations to be exported as C functions.
#define P_END_DECLS
Closes .h file declarations to be exported as C functions, should be always used after P_BEGIN_DECLS.
void(* PFunc)(ppointer data, ppointer user_data)
General purpose function.
signed int pssize
Type for a platform independent signed size_t.
unsigned char puint8
Type for unsigned 8 bit.
void(* PDestroyFunc)(ppointer data)
Object destroy notification function.
signed __int64 pint64
Type for signed 64 bit.
unsigned short puint16
Type for unsigned 16 bit.
short pshort
Type for a short.
char pchar
Type for a char.
unsigned int psize
Type for a platform independent size_t.
pint(* PCompareDataFunc)(pconstpointer a, pconstpointer b, ppointer data)
Compares two values with additional data.
const void * pconstpointer
Type for a const pointer.
void * P_HANDLE
Platform independent system handle.
void * ppointer
Type for a pointer.
unsigned short pushort
Type for an unsigned short.
signed char pint8
Type for signed 8 bit.
float pfloat
Type for a float.
unsigned int puint
Type for an unsigned int.
signed int pint32
Type for signed 32 bit.
unsigned int puintptr
Type for a platform independent unsigned pointer represented by an integer.
unsigned long pulong
Type for an unsigned long.
pint64 poffset
Platform independent offset_t definition.
pint(* PCompareFunc)(pconstpointer a, pconstpointer b)
Compares two values.
long plong
Type for a long.
unsigned __int64 puint64
Type for unsigned 64 bit.
signed int pintptr
Type for a platform independent signed pointer represented by an integer.
double pdouble
Type for a double precision float.
unsigned char puchar
Type for an unsigned char.
pboolean(* PTraverseFunc)(ppointer key, ppointer value, ppointer user_data)
Function to traverse through a key-value container.
signed short pint16
Type for signed 16 bit.
signed int pboolean
Type for a bool.
unsigned int puint32
Type for unsigned 32 bit.