Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

common.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 COMMON_H
00016 #define COMMON_H
00017 
00018 // this file should be included, directly or indirectly by every other.
00019 
00020 #if HAVE_CONFIG_H
00021 #   include "config.h"
00022 
00023     // don't use poll() on mac
00024 #   if defined(__APPLE__)
00025 #       undef HAVE_POLL
00026 #   endif
00027 #else
00028     // we may not have run configure on win32
00029 #   if defined(_WIN32)
00030 #       define SYSAPI_WIN32 1
00031 #       define WINAPI_MSWINDOWS 1
00032 #   endif
00033 
00034     // we may not have run configure on OS X
00035 #   if defined(__APPLE__)
00036 #       define SYSAPI_UNIX 1
00037 #       define WINAPI_CARBON 1
00038 
00039 #       define HAVE_CXX_BOOL 1
00040 #       define HAVE_CXX_CASTS 1
00041 #       define HAVE_CXX_EXCEPTIONS 1
00042 #       define HAVE_CXX_MUTABLE 1
00043 #       define HAVE_CXX_STDLIB 1
00044 #       define HAVE_GETPWUID_R 1
00045 #       define HAVE_GMTIME_R 1
00046 #       define HAVE_INET_ATON 1
00047 #       define HAVE_INTTYPES_H 1
00048 #       define HAVE_ISTREAM 1
00049 #       define HAVE_MEMORY_H 1
00050 #       define HAVE_NANOSLEEP 1
00051 #       define HAVE_OSTREAM 1
00052 #       define HAVE_POSIX_SIGWAIT 1
00053 #       define HAVE_PTHREAD 1
00054 #       define HAVE_PTHREAD_SIGNAL 1
00055 #       include <sys/types.h>
00056 #       include <sys/socket.h>
00057 #       if defined(_SOCKLEN_T)
00058 #           define HAVE_SOCKLEN_T 1
00059 #       endif
00060 #       define HAVE_SSTREAM 1
00061 #       define HAVE_STDINT_H 1
00062 #       define HAVE_STDLIB_H 1
00063 #       define HAVE_STRINGS_H 1
00064 #       define HAVE_STRING_H 1
00065 #       define HAVE_SYS_SELECT_H 1
00066 #       define HAVE_SYS_SOCKET_H 1
00067 #       define HAVE_SYS_STAT_H 1
00068 #       define HAVE_SYS_TIME_H 1
00069 #       define HAVE_SYS_TYPES_H 1
00070 #       define HAVE_SYS_UTSNAME_H 1
00071 #       define HAVE_UNISTD_H 1
00072 #       define HAVE_VSNPRINTF 1
00073 /* disable this so we can build with the 10.2.8 SDK */
00074 /*#     define HAVE_WCHAR_H 1*/
00075 
00076 #       define SELECT_TYPE_ARG1 int
00077 #       define SELECT_TYPE_ARG234 (fd_set *)
00078 #       define SELECT_TYPE_ARG5 (struct timeval *)
00079 #       define SIZEOF_CHAR 1
00080 #       define SIZEOF_INT 4
00081 #       define SIZEOF_LONG 4
00082 #       define SIZEOF_SHORT 2
00083 #       define STDC_HEADERS 1
00084 #       define TIME_WITH_SYS_TIME 1
00085 #       define X_DISPLAY_MISSING 1
00086 #   endif
00087 #endif
00088 
00089 // VC++ specific
00090 #if (_MSC_VER >= 1200)
00091     // work around for statement scoping bug
00092 #   define for if (false) { } else for
00093 
00094     // turn off bonehead warnings
00095 #   pragma warning(disable: 4786) // identifier truncated in debug info
00096 #   pragma warning(disable: 4514) // unreferenced inline function removed
00097 
00098     // this one's a little too aggressive
00099 #   pragma warning(disable: 4127) // conditional expression is constant
00100 
00101     // emitted incorrectly under release build in some circumstances
00102 #   if defined(NDEBUG)
00103 #       pragma warning(disable: 4702) // unreachable code
00104 #       pragma warning(disable: 4701) // variable maybe used uninitialized
00105 #   endif
00106 #endif // (_MSC_VER >= 1200)
00107 
00108 // VC++ has built-in sized types
00109 #if defined(_MSC_VER)
00110 #   include <wchar.h>
00111 #   define TYPE_OF_SIZE_1 __int8
00112 #   define TYPE_OF_SIZE_2 __int16
00113 #   define TYPE_OF_SIZE_4 __int32
00114 #else
00115 #   define SIZE_OF_CHAR     1
00116 #   define SIZE_OF_SHORT    2
00117 #   define SIZE_OF_INT      4
00118 #   define SIZE_OF_LONG     4
00119 #endif
00120 
00121 // FIXME -- including fp.h from Carbon.h causes a undefined symbol error
00122 // on my build system.  the symbol is scalb.  since we don't need any
00123 // math functions we define __FP__, the include guard macro for fp.h, to
00124 // prevent fp.h from being included.
00125 #if defined(__APPLE__)
00126 #define __FP__
00127 #endif
00128 
00129 // define NULL
00130 #include <stddef.h>
00131 
00132 // make assert available since we use it a lot
00133 #include <assert.h>
00134 #include <stdlib.h>
00135 #include <string.h>
00136 
00137 #endif

Generated on Fri Nov 6 00:21:14 2009 for synergy-plus by  doxygen 1.3.9.1