home *** CD-ROM | disk | FTP | other *** search
- /*************************************************************************
- * SOLAR.H
- * Sat Oct 24 3:23:43 1992
- * (c) 1992-1994 STAR DIVISION
- *************************************************************************/
-
- #ifndef _SOLAR_H
- #define _SOLAR_H
-
- #ifndef TRUE
- #define TRUE 1
- #endif
- #ifndef FALSE
- #define FALSE 0
- #endif
-
- #undef NULL
- #define NULL 0
-
- typedef unsigned char BOOL;
- typedef unsigned char BYTE;
- typedef unsigned short USHORT;
- typedef unsigned long ULONG;
-
- #ifndef _SOLAR_NOUINT
-
- #if defined( ALPHA ) && !defined( WNT )
- typedef long INT64;
- typedef unsigned long UINT64;
- typedef int INT32;
- typedef unsigned int UINT32;
- typedef short INT16;
- typedef unsigned short UINT16;
- typedef char INT8;
- typedef unsigned char UINT8;
- #else
- typedef void INT64;
- typedef void UINT64;
- typedef long INT32;
- typedef unsigned long UINT32;
- typedef short INT16;
- typedef unsigned short UINT16;
- #ifdef AViiON
- typedef signed char INT8;
- #else
- typedef char INT8;
- #endif
- typedef unsigned char UINT8;
- #endif
- #endif
-
- #ifndef _SOLAR_NOSVBT
-
- typedef BYTE SVBT8[1];
- typedef BYTE SVBT16[2];
- typedef BYTE SVBT32[4];
- typedef BYTE SVBT64[8];
- #endif
-
- #ifndef _SOLAR_NODESCRIPTION
-
- #if defined( ALPHA ) && !defined( WNT )
- #define __LITTLEENDIAN
- #define __ALIGNMENT2 2
- #define __ALIGNMENT4 4
- #define __ALIGNMENT8 8
- #define __STACKALIGNMENT 8
- #define __STACKDIRECTION -1
- #define __SIZEOFCHAR 1
- #define __SIZEOFSHORT 2
- #define __SIZEOFINT 4
- #define __SIZEOFLONG 8
- #define __SIZEOFPOINTER 8
- #elif defined( SUN ) || defined( AViiON )
- #define __BIGENDIAN
- #define __ALIGNMENT2 2
- #define __ALIGNMENT4 4
- #define __ALIGNMENT8 4
- #define __STACKALIGNMENT 4
- #define __STACKDIRECTION -1
- #define __SIZEOFCHAR 1
- #define __SIZEOFSHORT 2
- #define __SIZEOFINT 4
- #define __SIZEOFLONG 4
- #define __SIZEOFPOINTER 4
- #elif defined( HP9000 )
- #define __BIGENDIAN
- #define __ALIGNMENT2 2
- #define __ALIGNMENT4 4
- #define __ALIGNMENT8 4
- #define __STACKALIGNMENT 4
- #define __STACKDIRECTION 1
- #define __SIZEOFCHAR 1
- #define __SIZEOFSHORT 2
- #define __SIZEOFINT 4
- #define __SIZEOFLONG 4
- #define __SIZEOFPOINTER 4
- #elif defined( RS6000 ) || defined( MAC )
- #define __BIGENDIAN
- #define __ALIGNMENT2 1
- #define __ALIGNMENT4 1
- #define __ALIGNMENT8 1
- #define __STACKALIGNMENT 4
- #define __STACKDIRECTION -1
- #define __SIZEOFCHAR 1
- #define __SIZEOFSHORT 2
- #define __SIZEOFINT 4
- #define __SIZEOFLONG 4
- #define __SIZEOFPOINTER 4
- #elif defined( PM2 ) || defined( WNT )
- #define __LITTLEENDIAN
- #define __ALIGNMENT2 1
- #define __ALIGNMENT4 1
- #define __ALIGNMENT8 1
- #define __STACKALIGNMENT 4
- #define __STACKDIRECTION -1
- #define __SIZEOFCHAR 1
- #define __SIZEOFSHORT 2
- #define __SIZEOFINT 4
- #define __SIZEOFLONG 4
- #define __SIZEOFPOINTER 4
- #else
- #define __LITTLEENDIAN
- #define __ALIGNMENT2 1
- #define __ALIGNMENT4 1
- #define __ALIGNMENT8 1
- #define __STACKALIGNMENT 2
- #define __STACKDIRECTION -1
- #define __SIZEOFCHAR 1
- #define __SIZEOFSHORT 2
- #define __SIZEOFINT 2
- #define __SIZEOFLONG 4
- #define __SIZEOFPOINTER 4
- #endif
- #endif
-
- #define SWAPSHORT(x) ((((x) >> 8) & 0x00FF) | (((x) & 0x00FF) << 8))
- #define SWAPLONG(x) ((((x) >> 24) & 0x000000FF) | (((x) & 0x00FF0000) >> 8) | \
- (((x) & 0x0000FF00) << 8) | (((x) & 0x000000FF) << 24))
-
- #ifndef min
- #define min(a,b) (((a) < (b)) ? (a) : (b))
- #endif
- #ifndef max
- #define max(a,b) (((a) > (b)) ? (a) : (b))
- #endif
-
- #if !defined( _SOLAR_NOSVBT ) && !defined( _SOLAR_NODESCRIPTION )
- inline BYTE SVBT8ToByte ( SVBT8 p ) { return p[0]; }
- #if defined( __LITTLEENDIAN ) && __ALLIGNMENT2 == 1
- inline USHORT SVBT16ToShort( SVBT16 p ) { return *(USHORT*)p; }
- #else
- inline USHORT SVBT16ToShort( SVBT16 p ) { return (USHORT)p[0]
- + ((USHORT)p[1] << 8); }
- #endif
- #if defined( __LITTLEENDIAN ) && __ALLIGNMENT4 == 1
- inline ULONG SVBT32ToLong ( SVBT32 p ) { return *(ULONG*)p; }
- #else
- inline ULONG SVBT32ToLong ( SVBT32 p ) { return (ULONG)p[0]
- + ((ULONG)p[1] << 8)
- + ((ULONG)p[2] << 16)
- + ((ULONG)p[3] << 24); }
- #endif
-
- inline void ByteToSVBT8 ( BYTE n, SVBT8 p ) { p[0] = n; }
- #if defined( __LITTLEENDIAN ) && __ALLIGNMENT2 == 1
- inline void ShortToSVBT16( USHORT n, SVBT16 p ) { *(USHORT*)p = n; }
- #else
- inline void ShortToSVBT16( USHORT n, SVBT16 p ) { p[0] = (BYTE) n;
- p[1] = (BYTE)(n >> 8); }
- #endif
- #if defined( __LITTLEENDIAN ) && __ALLIGNMENT4 == 1
- inline void LongToSVBT32 ( ULONG n, SVBT32 p ) { *(ULONG*)p = n; }
- #else
- inline void LongToSVBT32 ( ULONG n, SVBT32 p ) { p[0] = (BYTE) n;
- p[1] = (BYTE)(n >> 8);
- p[2] = (BYTE)(n >> 16);
- p[3] = (BYTE)(n >> 24); }
- #endif
- #endif
-
- #endif
-