Go to the documentation of this file.00001
00002
00003
00004
00005
00006 #ifndef __STDAFX
00007 #define __STDAFX
00008
00009 #include <stdio.h>
00010 #include <stdlib.h>
00011 #include <stddef.h>
00012 #ifdef WINCE
00013 int errno;
00014 #define strerror(err) "strerror() Not Supported in Windows CE"
00015 #define abort() exit(1)
00016 #define EAGAIN 35
00017 #define EINTR 4
00018 #else
00019 #include <sys/types.h>
00020 #include <errno.h>
00021 #endif
00022
00023 #define USE_PHIDGET21_LOGGING
00024
00025
00026 #ifdef NO_ZEROCONF
00027 #ifdef USE_ZEROCONF
00028 #undef USE_ZEROCONF
00029 #endif
00030 #else
00031 #ifndef USE_ZEROCONF
00032 #define USE_ZEROCONF
00033 #endif
00034 #endif
00035
00036
00037 #if defined(_IPHONE) || defined(_ANDROID)
00038 #define USE_INTERNAL_UNICONV
00039 #endif
00040
00041 #ifndef TRUE
00042 #define TRUE 1
00043 #endif
00044
00045 #ifndef FALSE
00046 #define FALSE 0
00047 #endif
00048
00049 #ifdef _WINDOWS
00050
00051 #ifndef AI_ADDRCONFIG
00052 #define AI_ADDRCONFIG 0x00000400 // Resolution only if global address configured
00053 #endif
00054
00055
00056 #ifndef WINCE
00057 #ifndef COMPILE_PHIDGETS_LABVIEW
00058 #define COMPILE_PHIDGETS_LABVIEW 1
00059 #endif
00060 #endif
00061
00062
00063 #ifndef ZEROCONF_RUNTIME_LINKING
00064 #define ZEROCONF_RUNTIME_LINKING
00065 #endif
00066
00067
00068 #ifndef WINCE
00069 #ifndef ZEROCONF_LOOKUP
00070 #define ZEROCONF_LOOKUP
00071 #endif
00072 #endif
00073
00074
00075
00076 #ifndef WINVER // Allow use of features specific to Windows XP or later.
00077 #define WINVER 0x0500 // Change this to the appropriate value to target other versions of Windows.
00078 #endif
00079
00080 #ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
00081 #define _WIN32_WINNT 0x0500 // Change this to the appropriate value to target other versions of Windows.
00082 #endif
00083
00084 #ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
00085 #define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
00086 #endif
00087
00088 #ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later.
00089 #define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE.
00090 #endif
00091
00092 #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
00093
00094 #ifndef _CYGWIN
00095 #include <Winsock2.h>
00096 #include <ws2tcpip.h>
00097 #endif
00098 #if !defined(WINCE) && defined(_MSC_EXTENSIONS)
00099 #include <Wspiapi.h>
00100 #endif
00101
00102 #include <windows.h>
00103 #include <winbase.h>
00104 #include <stdio.h>
00105 #include <stdlib.h>
00106 #include <time.h>
00107 #include <assert.h>
00108 #include <math.h>
00109
00110 #ifdef USE_INTERNAL_UNICONV
00111 #include "cvtutf.h"
00112 #else
00113 #include <locale.h>
00114 #endif
00115
00116 #ifdef _MSC_EXTENSIONS
00117 #include "snprintf.h"
00118 #endif
00119 #ifndef _CYGWIN
00120 #include "wincompat.h"
00121 #endif
00122
00123 #define strdup _strdup
00124 #define snprintf _snprintf
00125
00126 #define strtoll (__int64)_strtoi64
00127 #define strtoull (__int64)_strtoui64
00128
00129 #define CCONV __stdcall
00130 #define CCONV_CDECL __cdecl
00131 #define SLEEP(dlay) Sleep(dlay);
00132 #define ZEROMEM(var,size) ZeroMemory(var, size);
00133
00134 #ifdef PHIDGET21_EXPORTS
00135 #ifndef PHIDGET21_API
00136 #define PHIDGET21_API
00137 #endif
00138 #else
00139 #ifndef PHIDGET21_API
00140 #define PHIDGET21_API __declspec(dllimport)
00141 #endif
00142 #endif
00143
00144 typedef SYSTEMTIME TIME;
00145 typedef unsigned __int64 __uint64;
00146
00147 typedef int ssize_t;
00148
00149 #define C_IN 1
00150 #define NETDB_INTERNAL -1
00151
00152 #ifndef DEPRECATE_WIN
00153 #define DEPRECATE_WIN(depmsg) __declspec(deprecated( depmsg ))
00154 #endif
00155 #ifndef DEPRECATE_GCC
00156 #define DEPRECATE_GCC
00157 #endif
00158
00159 #ifndef ECANCELED
00160 #define ECANCELED 89
00161 #endif
00162
00163 #else
00164
00165 #include <semaphore.h>
00166 #include <time.h>
00167 #include <stdio.h>
00168 #include <stdarg.h>
00169 #include <stdlib.h>
00170 #include <string.h>
00171 #include <pthread.h>
00172 #include <errno.h>
00173 #include <sys/types.h>
00174 #include <sys/socket.h>
00175 #include <netinet/in.h>
00176 #include <arpa/inet.h>
00177 #include <arpa/nameser.h>
00178 #include <netdb.h>
00179 #include <unistd.h>
00180 #include <sys/time.h>
00181 #include <ctype.h>
00182 #include <math.h>
00183 #ifdef USE_INTERNAL_UNICONV
00184 #include "cvtutf.h"
00185 #else
00186 #include <iconv.h>
00187 #endif
00188
00189 #define CCONV
00190 #define CCONV_CDECL
00191 #define SLEEP(dlay) usleep(dlay*1000);
00192 #define ZEROMEM(var,size) memset(var, 0, size);
00193 #ifndef PHIDGET21_API
00194 #define PHIDGET21_API
00195 #endif
00196 typedef void *HANDLE;
00197 #define INFINITE 0xFFFFFFFF
00198 typedef long *LPDWORD;
00199 #define STILL_ACTIVE 0x00000103L
00200 #define WAIT_TIMEOUT 258L
00201 #define WAIT_ABANDONED 0x00000080
00202 #define WAIT_OBJECT_0 0x00000000L
00203 #define WAIT_FAILED 0xFFFFFFFF
00204 typedef int SOCKET;
00205 #define INVALID_SOCKET -1
00206 #ifndef SOCKET_ERROR
00207 #define SOCKET_ERROR -1
00208 #endif
00209 typedef void *OVERLAPPED;
00210
00211 typedef struct timeval TIME;
00212
00213 #ifndef DEPRECATE_GCC
00214 #define DEPRECATE_GCC __attribute__ ((deprecated))
00215 #endif
00216 #ifndef DEPRECATE_WIN
00217 #define DEPRECATE_WIN(depmsg)
00218 #endif
00219
00220 #ifdef _MACOSX
00221
00222 #include <CoreFoundation/CoreFoundation.h>
00223 #include <mach/mach.h>
00224
00225 #ifndef _IPHONE
00226 #include <IOKit/IOKitLib.h>
00227 #endif
00228
00229
00230 #define C_IN 1
00231 #ifndef ZEROCONF_LOOKUP
00232 #define ZEROCONF_LOOKUP
00233 #endif
00234
00235 #elif _LINUX
00236
00237 #include <assert.h>
00238 #include <dlfcn.h>
00239
00240
00241 #ifndef ZEROCONF_RUNTIME_LINKING
00242 #define ZEROCONF_RUNTIME_LINKING
00243 #endif
00244 #endif
00245 #endif
00246
00247 #ifndef round
00248 #define round(x) ((x)>=0?(int)((x)+0.5):(int)((x)-0.5))
00249 #endif
00250
00251 #ifndef MSG_NOSIGNAL
00252 #define MSG_NOSIGNAL 0
00253 #endif
00254
00255
00256 double round_double(double x, int decimals);
00257 int hexval(unsigned char c);
00258
00259 #include "clog.h"
00260 #include "pdictclient.h"
00261 #include "cphidget.h"
00262
00263 #ifdef DMALLOC
00264 #include "dmalloc.h"
00265 #endif
00266
00267 extern void(CCONV *fptrJavaDetachCurrentThread)(void);
00268
00269 #endif
00270
00271