API Guide Home
(Online version only)

PalmNative.h

Go to the documentation of this file.
00001 /******************************************************************************
00002  * Copyright (c) 2005 palmOne, Inc. or its subsidiaries.
00003  * All rights reserved.
00004  *****************************************************************************/
00005 /** 
00006  *@ingroup System
00007  *
00008  */
00009  
00010 /**
00011  * @file    PalmNative.h
00012  * @version 1.0
00013  * @date    10/28/2002
00014  *
00015  * @brief Functions and macros to help building ARM code.
00016  * 
00017  *
00018  * <hr>
00019  */
00020 
00021 
00022 #ifndef PALM_NATIVE_H_
00023 #define PALM_NATIVE_H_
00024 
00025 #ifdef WIN32
00026 #define NATIVE_CODE __declspec(dllexport)   /**<        */
00027 #define INLINE                  /**<        */
00028 #else
00029     
00030 #define NATIVE_CODE             /**<        */
00031 #define INLINE      inline          /**<        */
00032 
00033 #endif // WIN32
00034 
00035 
00036 #ifndef __PALMTYPES_H__
00037 /**
00038  * @name 
00039  *
00040  */
00041 /*@{*/
00042 #define false  0                /**<        */
00043 #define true   1                /**<        */
00044 /*@}*/
00045 
00046 #ifndef NULL
00047 #define NULL    0               /**<        */
00048 #endif  // NULL
00049 
00050 typedef unsigned char   UInt8;          /**<        */
00051 typedef unsigned short  UInt16;         /**<        */
00052 typedef unsigned long   UInt32;         /**<        */
00053 
00054 typedef signed char     Int8;           /**<        */
00055 typedef signed short    Int16;          /**<        */
00056 typedef signed long     Int32;          /**<        */
00057 typedef signed char     Char;           /**<        */
00058 
00059 typedef unsigned char   Boolean;        /**<        */
00060 typedef UInt16          Err;            /**<        */
00061 
00062 static INLINE UInt16 SwapUInt16(UInt16 u)
00063 {
00064   return
00065     (u & 0x00FF) << 8 |
00066     (u >> 8);
00067 }
00068 
00069 static INLINE Int16 SwapInt16(Int16 i)
00070 {
00071   return (Int16)SwapUInt16((UInt16) i);
00072 }
00073 
00074 static INLINE UInt32 SwapUInt32(UInt32 u)
00075 {
00076   return
00077     (u & 0x0000FFL) << 24 |
00078     (u & 0x00FF00L) << 8  |
00079     (u & 0xFF0000L) >> 8  |
00080     (u >> 24) & 0xFF;
00081 }
00082 
00083 static INLINE Int32 SwapInt32(Int32 i)
00084 {
00085   return (Int32)SwapInt32((UInt32)i);
00086 }
00087 
00088 static INLINE void* SwapPtr(void* p)
00089 {
00090   return (void*)SwapUInt32((UInt32)p);
00091 }
00092 
00093 #endif  // __PALMTYPES_H__
00094 
00095 #endif // PALM_NATIVE_H_

Top Palm Developer Network
© 2004-2008, Palm, Inc. All rights reserved.
Generated on Fri Jun 13 10:06:54 2008 for Palm API Guide