#ifndef _PLATFORM_DOT_H_ #define _PLATFORM_DOT_H_ //======================================================================== // // platform.h - common usefull defines // // // // $Date: 2003/10/23 19:41:38 $ // $Revision: 1.2 $ // // // // // HISTORY: // $Log: platform.h,v $ // Revision 1.2 2003/10/23 19:41:38 billf // needed two ' to get a single ' in the #error lines // // Revision 1.1.1.1 2003/03/17 15:27:03 billf // Initial import // // // //======================================================================== #include //================================================================ #ifdef __GNUC__ // ------- for GNU cc ------------------------- #define __PACKED__ __attribute__ ((packed)) // used by complilers which specifiy a pragma for packing #define __STRUCT_PACKED__ //================================================================ #else // ------- for other c compilers ------------------------- // this needs updating if we want to use another compiler // such as Microsoft or Borland // define packed to nothing #define __PACKED__ #define __STRUCT_PACKED__ #pragma(packed) #endif //================================================================ #ifdef S_SPLINT_S #ifndef UCHAR_MAX #define UCHAR_MAX 255 #endif #ifndef USHRT_MAX #define USHRT_MAX 65535UL #endif #ifndef UINT_MAX #define UINT_MAX 4294967295UL #endif #endif // common typedef's // using a char would save room, but an int will align better typedef int bool; typedef unsigned char byte; #if (UCHAR_MAX == 255) typedef unsigned char U8; #elif (USHRT_MAX == 255) typedef unsigned short U8; #elif (UINT_MAX == 255) typedef unsigned int U8; #elif (ULONG_MAX == 255) typedef unsigned long U8; #else #error (platform.h) can''t find a 8-bit data type #endif // define a type for unsigned 16-bits #if (UCHAR_MAX == 65535UL) typedef unsigned char U16; #elif (USHRT_MAX == 65535UL) typedef unsigned short U16; #elif (UINT_MAX == 65535UL) typedef unsigned int U16; #elif (ULONG_MAX == 65535UL) typedef unsigned long U16; #else #error (platform.h) can''t find a 16-bit data type #endif // define a type for unsigned 32-bits #if (UCHAR_MAX == 4294967295UL) typedef unsigned char U32; #elif (USHRT_MAX == 4294967295UL) typedef unsigned short U32; #elif (UINT_MAX == 4294967295UL) typedef unsigned int U32; #elif (ULONG_MAX == 4294967295UL) typedef unsigned long U32; #else #error (platform.h) can''t find a 32-bit data type #endif #ifndef FALSE #define FALSE (0) #endif #ifndef TRUE #define TRUE (1) #endif #ifndef NULL #define NULL (0) #endif #define ELEMENTSOF(x) (sizeof((x))/sizeof(((x)[0]))) #endif