BasicTypes.h

00001 /*
00002  * synergy -- mouse and keyboard sharing utility
00003  * Copyright (C) 2002 Chris Schoeneman
00004  * 
00005  * This package is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * found in the file COPYING that should have accompanied this file.
00008  * 
00009  * This package is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  */
00014 
00015 #ifndef BASICTYPES_H
00016 #define BASICTYPES_H
00017 
00018 #include "common.h"
00019 
00020 //
00021 // pick types of particular sizes
00022 //
00023 
00024 #if !defined(TYPE_OF_SIZE_1)
00025 #   if SIZEOF_CHAR == 1
00026 #       define TYPE_OF_SIZE_1 char
00027 #   endif
00028 #endif
00029 
00030 #if !defined(TYPE_OF_SIZE_2)
00031 #   if SIZEOF_INT == 2
00032 #       define TYPE_OF_SIZE_2 int
00033 #   else
00034 #       define TYPE_OF_SIZE_2 short
00035 #   endif
00036 #endif
00037 
00038 #if !defined(TYPE_OF_SIZE_4)
00039     // Carbon defines SInt32 and UInt32 in terms of long
00040 #   if SIZEOF_INT == 4 && !defined(__APPLE__)
00041 #       define TYPE_OF_SIZE_4 int
00042 #   else
00043 #       define TYPE_OF_SIZE_4 long
00044 #   endif
00045 #endif
00046 
00047     //
00048 // verify existence of required types
00049 //
00050 
00051 #if !defined(TYPE_OF_SIZE_1)
00052 #   error No 1 byte integer type
00053 #endif
00054 #if !defined(TYPE_OF_SIZE_2)
00055 #   error No 2 byte integer type
00056 #endif
00057 #if !defined(TYPE_OF_SIZE_4)
00058 #   error No 4 byte integer type
00059 #endif
00060 
00061 
00062 //
00063 // make typedefs
00064 //
00065 // except for SInt8 and UInt8 these types are only guaranteed to be
00066 // at least as big as indicated (in bits).  that is, they may be
00067 // larger than indicated.
00068 //
00069 
00070 // Added this because it doesn't compile on OS X 10.6 because they are already defined in Carbon
00071 #if !defined(__MACTYPES__)
00072 typedef signed TYPE_OF_SIZE_1   SInt8;
00073 typedef signed TYPE_OF_SIZE_2   SInt16;
00074 typedef signed TYPE_OF_SIZE_4   SInt32;
00075 typedef unsigned TYPE_OF_SIZE_1 UInt8;
00076 typedef unsigned TYPE_OF_SIZE_2 UInt16;
00077 typedef unsigned TYPE_OF_SIZE_4 UInt32;
00078 #endif
00079 //
00080 // clean up
00081 //
00082 
00083 #undef TYPE_OF_SIZE_1
00084 #undef TYPE_OF_SIZE_2
00085 #undef TYPE_OF_SIZE_4
00086 
00087 #endif

Generated on Fri Nov 6 00:18:44 2009 for synergy-plus by  doxygen 1.4.7