PalmTypes.h
defines a number of basic types and constants used throughout Palm OS, along with a number of macros to do byte-swapping (for endianness) and time interval conversion.
The contents of this chapter is organized as follows:
Palm Types Structures and Types
Palm Types Constants
Palm Types Functions and Macros
Palm Types Structures and Types
Boolean Typedef
Purpose
Declared In
PalmTypes.h
Prototype
typedef unsigned char Boolean
Comments
Use the TRUE
and FALSE
, or true
and false
, constants with Boolean variables.
coord Typedef
Purpose
A single floating-point coordinate type.
Declared In
PalmTypes.h
Prototype
typedef float coord
See Also
Coord Typedef
Purpose
A single fixed-point coordinate type, used for screen and window coordinates.
Declared In
PalmTypes.h
Prototype
typedef int16_t Coord
See Also
Enum16 Typedef
Purpose
An enum type that can have up to 65,535 enumerated constants.
Declared In
PalmTypes.h
Prototype
typedef uint16_t Enum16
See Also
Enum8 Typedef
Purpose
An enum type that can have up to 255 enumerated constants.
Declared In
PalmTypes.h
Prototype
typedef uint8_t Enum8
See Also
fcoord_t Typedef
Purpose
A single floating-point coordinate type, used in conjunction with the graphics context drawing functions.
Declared In
PalmTypes.h
Prototype
typedef float fcoord_t
See Also
MemHandle Struct
Purpose
A handle to a location in memory. Unlike a pointer, a handle can be used to reference memory that may be relocated.
Declared In
PalmTypes.h
Prototype
typedef struct _opaque *MemHandle
Fields
See Also
MemPtr Typedef
Purpose
A pointer to a location in memory.
Declared In
PalmTypes.h
Prototype
typedef void *MemPtr
See Also
ProcPtr Typedef
Purpose
Pointer to a function that returns a 32-bit integer.
Declared In
PalmTypes.h
Prototype
int32_t (*ProcPtr) ()
SignedEnum16 Typedef
Purpose
An enum type whose enumerated constant values can range from
-32,768 to +32,767.
Declared In
PalmTypes.h
Prototype
typedef int16_t SignedEnum16
See Also
SignedEnum8 Typedef
Purpose
An enum type whose enumerated constant values can range from
-128 to +127.
Declared In
PalmTypes.h
Prototype
typedef int8_t SignedEnum8
See Also
SysHandle Typedef
Purpose
Declared In
PalmTypes.h
Prototype
typedef uint32_t SysHandle
VAddr Typedef
Purpose
A virtual address, used by the ErrThrow()
/ErrCatch()
exception-handling mechanism.
Declared In
PalmTypes.h
Prototype
typedef uint32_t VAddr
wchar16_t Typedef
Purpose
Declared In
PalmTypes.h
Prototype
typedef uint16_t wchar16_t
See Also
wchar32_t Typedef
Purpose
A 32-bit "wide" character type.
Declared In
PalmTypes.h
Prototype
typedef uint32_t wchar32_t
Comments
Palm Types Constants
Time Constants
Purpose
Various multiples of one nanosecond. These constants are used by the nanosecond conversion macros documented in "Palm Types Functions and Macros."
Declared In
PalmTypes.h
Constants
-
#define P_ONE_MICROSECOND (P_ONE_NANOSECOND*1000)
- One microsecond.
-
#define P_ONE_MILLISECOND (P_ONE_MICROSECOND*1000)
- One millisecond.
-
#define P_ONE_NANOSECOND ((nsecs_t)1)
- One nanosecond.
-
#define P_ONE_SECOND (P_ONE_MILLISECOND*1000)
- One second.
Boolean Values Enum
Purpose
Defines values that can be used with Boolean variables.
Declared In
PalmTypes.h
Constants
-
false
- A "false" value that can be used with Boolean variables.
-
true
- A "true" value that can be used with Boolean variables.
Miscellaneous Constants
Purpose
PalmTypes.h
also defines these constants.
Declared In
PalmTypes.h
Constants
-
#define FALSE (0)
- A "false" value that can be used with Boolean variables.
-
#define NULL 0
- A null value that can be used with pointers.
-
#define TRUE (1)
- A "true" value that can be used with Boolean variables.
Palm Types Functions and Macros
EndianSwap16 Macro
Purpose
Swaps the bytes in a 16-bit value to switch between big-endian byte order and little-endian byte order.
Declared In
PalmTypes.h
Prototype
#define EndianSwap16 (
n
)
Parameters
Returns
Evaluates to a 16-bit value with endianness opposite that of the supplied value.
See Also
EndianSwap32
, RsrcEndianSwap16()
EndianSwap32 Macro
Purpose
Swaps the bytes in a 32-bit value to switch between big-endian byte order and little-endian byte order.
Declared In
PalmTypes.h
Prototype
#define EndianSwap32 (
n
)
Parameters
Returns
Evaluates to a 32-bit value with endianness opposite that of the supplied value.
See Also
EndianSwap16
, RsrcEndianSwap32()
ErrConvertFrom68k Macro
Purpose
Converts a 16-bit error value, of the type produced by many Palm OS functions when called through PACE, to a status_t
value, as produced by many ARM-native operating system functions.
Declared In
PalmTypes.h
Prototype
#define ErrConvertFrom68k (
x
)
Parameters
Returns
The status_t
value that corresponds to the supplied error code.
See Also
ErrConvertTo68k Macro
Purpose
Converts a status_t
value, of the type produced by many ARM-native operating system functions, to a 16-bit error value, as produced by many operating system functions when called through PACE.
Declared In
PalmTypes.h
Prototype
#define ErrConvertTo68k (
x
)
Parameters
Returns
The 16-bit error code that corresponds to the supplied status_t
value.
See Also
P_MICROSECONDS_TO_NANOSECONDS Macro
Purpose
Converts from microseconds to nanoseconds.
Declared In
PalmTypes.h
Prototype
#define P_MICROSECONDS_TO_NANOSECONDS (
us
)
Parameters
Returns
Evaluates to the supplied amount of time, in nanoseconds.
Comments
This macro is equivalent to P_US2NS()
.
See Also
P_MILLISECONDS_TO_NANOSECONDS()
, P_SECONDS_TO_NANOSECONDS()
, P_NANOSECONDS_TO_MICROSECONDS()
P_MILLISECONDS_TO_NANOSECONDS Macro
Purpose
Converts from milliseconds to nanoseconds.
Declared In
PalmTypes.h
Prototype
#define P_MILLISECONDS_TO_NANOSECONDS (
ms
)
Parameters
Returns
Evaluates to the supplied amount of time, in nanoseconds.
Comments
This macro is equivalent to P_MS2NS()
.
See Also
P_MICROSECONDS_TO_NANOSECONDS()
, P_SECONDS_TO_NANOSECONDS()
, P_NANOSECONDS_TO_MILLISECONDS()
P_MS2NS Macro
Purpose
Converts from milliseconds to nanoseconds.
Declared In
PalmTypes.h
Prototype
#define P_MS2NS (
ms
)
Parameters
Returns
Evaluates to the supplied amount of time, in nanoseconds.
Comments
This macro is equivalent to P_MILLISECONDS_TO_NANOSECONDS()
.
See Also
P_S2NS()
, P_US2NS()
, P_NS2MS()
P_NANOSECONDS_TO_MICROSECONDS Macro
Purpose
Converts from nanoseconds to microseconds.
Declared In
PalmTypes.h
Prototype
#define P_NANOSECONDS_TO_MICROSECONDS (
ns
)
Parameters
Returns
Evaluates to the supplied amount of time, in microseconds.
Comments
This macro is equivalent to P_NS2US()
.
See Also
P_NANOSECONDS_TO_MILLISECONDS()
, P_NANOSECONDS_TO_SECONDS()
, P_MICROSECONDS_TO_NANOSECONDS()
P_NANOSECONDS_TO_MILLISECONDS Macro
Purpose
Converts from nanoseconds to milliseconds.
Declared In
PalmTypes.h
Prototype
#define P_NANOSECONDS_TO_MILLISECONDS (
ns
)
Parameters
Returns
Evaluates to the supplied amount of time, in milliseconds.
Comments
This macro is equivalent to P_NS2MS()
.
See Also
P_NANOSECONDS_TO_MICROSECONDS()
, P_NANOSECONDS_TO_SECONDS()
, P_MILLISECONDS_TO_NANOSECONDS()
P_NANOSECONDS_TO_SECONDS Macro
Purpose
Converts from nanoseconds to seconds.
Declared In
PalmTypes.h
Prototype
#define P_NANOSECONDS_TO_SECONDS (
ns
)
Parameters
Returns
Evaluates to the supplied amount of time, in seconds.
Comments
This macro is equivalent to P_NS2S()
.
See Also
P_NANOSECONDS_TO_MICROSECONDS()
, P_NANOSECONDS_TO_MILLISECONDS()
, P_SECONDS_TO_NANOSECONDS()
P_NS2MS Macro
Purpose
Converts from nanoseconds to milliseconds.
Declared In
PalmTypes.h
Prototype
#define P_NS2MS (
ns
)
Parameters
Returns
Evaluates to the supplied amount of time, in milliseconds.
Comments
This macro is equivalent to P_NANOSECONDS_TO_MILLISECONDS()
.
See Also
P_NS2US()
, P_NS2S()
, P_MS2NS()
P_NS2S Macro
Purpose
Converts from nanoseconds to seconds.
Declared In
PalmTypes.h
Prototype
#define P_NS2S (
ns
)
Parameters
Returns
Evaluates to the supplied amount of time, in seconds..
Comments
This macro is equivalent to P_NANOSECONDS_TO_SECONDS()
.
See Also
P_NS2MS()
, P_NS2US()
, P_S2NS()
P_NS2US Macro
Purpose
Converts from nanoseconds to microseconds.
Declared In
PalmTypes.h
Prototype
#define P_NS2US (
ns
)
Parameters
Returns
Evaluates to the supplied amount of time, in microseconds.
Comments
This macro is equivalent to P_NANOSECONDS_TO_MICROSECONDS()
.
See Also
P_NS2MS()
, P_NS2S()
, P_US2NS()
P_S2NS Macro
Purpose
Converts from seconds to nanoseconds.
Declared In
PalmTypes.h
Prototype
#define P_S2NS (
s
)
Parameters
Returns
Evaluates to the supplied amount of time, in seconds..
Comments
This macro is equivalent to P_SECONDS_TO_NANOSECONDS()
.
See Also
P_MS2NS()
, P_US2NS()
, P_NS2S()
P_SECONDS_TO_NANOSECONDS Macro
Purpose
Converts from seconds to nanoseconds.
Declared In
PalmTypes.h
Prototype
#define P_SECONDS_TO_NANOSECONDS (
s
)
Parameters
Returns
Evaluates to the supplied amount of time, in seconds..
Comments
This macro is equivalent to P_S2NS()
.
See Also
P_MICROSECONDS_TO_NANOSECONDS()
, P_MILLISECONDS_TO_NANOSECONDS()
, P_NANOSECONDS_TO_SECONDS()
P_US2NS Macro
Purpose
Converts from microseconds to nanoseconds.
Declared In
PalmTypes.h
Prototype
#define P_US2NS (
us
)
Parameters
Returns
Evaluates to the supplied amount of time, in nanoseconds.
Comments
This macro is equivalent to P_MICROSECONDS_TO_NANOSECONDS()
.
See Also
P_MS2NS()
, P_US2NS()
, P_NS2US()
RsrcEndianSwap16 Macro
Purpose
Swaps the bytes in a 16-bit value within a resource to switch between big-endian byte order and little-endian byte order.
Declared In
PalmTypes.h
Prototype
#define RsrcEndianSwap16 (
x
)
Parameters
Returns
Evaluates to a 16-bit value with endianness opposite that of the supplied value.
See Also
EndianSwap16
, RsrcEndianSwap32()
RsrcEndianSwap32 Macro
Purpose
Swaps the bytes in a 32-bit value within a resource to switch between big-endian byte order and little-endian byte order.
Declared In
PalmTypes.h
Prototype
#define RsrcEndianSwap32 (
x
)
Parameters
Returns
Evaluates to a 32-bit value with endianness opposite that of the supplied value.
See Also
EndianSwap32
, RsrcEndianSwap16()