include/tds_sysdep_private.h

00001 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
00002  * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004  Brian Bruns
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Library General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2 of the License, or (at your option) any later version.
00008  *
00009  * This library 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 GNU
00012  * Library General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Library General Public
00015  * License along with this library; if not, write to the
00016  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017  * Boston, MA 02111-1307, USA.
00018  */
00019 
00020 #ifndef _tds_sysdep_private_h_
00021 #define _tds_sysdep_private_h_
00022 
00023 /* $Id: tds_sysdep_private.h,v 1.23 2007/01/29 11:02:43 freddy77 Exp $ */
00024 
00025 #undef TDS_RCSID
00026 #if defined(__GNUC__) && __GNUC__ >= 3
00027 #define TDS_RCSID(name, id) \
00028         static const char rcsid_##name[] __attribute__ ((unused)) = id
00029 #else
00030 #define TDS_RCSID(name, id) \
00031         static const char rcsid_##name[] = id; \
00032         static const void *const no_unused_##name##_warn[] = { rcsid_##name, no_unused_##name##_warn }
00033 #endif
00034 
00035 #define TDS_ADDITIONAL_SPACE 0
00036 
00037 #ifdef __cplusplus
00038 extern "C"
00039 {
00040 #if 0
00041 }
00042 #endif
00043 #endif
00044 
00045 #ifdef __INCvxWorksh
00046 #include <ioLib.h>              /* for FIONBIO */
00047 #endif                          /* __INCvxWorksh */
00048 
00049 #if defined(DOS32X)
00050 #define READSOCKET(a,b,c)       recv((a), (b), (c), 0L)
00051 #define WRITESOCKET(a,b,c)      send((a), (b), (c), 0L)
00052 #define CLOSESOCKET(a)          closesocket((a))
00053 #define IOCTLSOCKET(a,b,c)      ioctlsocket((a), (b), (char*)(c))
00054 #define select select_s
00055 typedef int pid_t;
00056 #define strcasecmp stricmp
00057 #define strncasecmp strnicmp
00058 #define vsnprintf _vsnprintf
00059 /* TODO this has nothing to do with ip ... */
00060 #define getpid() _gethostid()
00061 #endif  /* defined(DOS32X) */
00062 
00063 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
00064 #include <windows.h>
00065 #define READSOCKET(a,b,c)       recv((a), (b), (c), 0L)
00066 #define WRITESOCKET(a,b,c)      send((a), (b), (c), 0L)
00067 #define CLOSESOCKET(a)          closesocket((a))
00068 #define IOCTLSOCKET(a,b,c)      ioctlsocket((a), (b), (c))
00069 int  _tds_socket_init(void);
00070 #define INITSOCKET()    _tds_socket_init()
00071 void _tds_socket_done(void);
00072 #define DONESOCKET()    _tds_socket_done()
00073 #define NETDB_REENTRANT 1       /* BSD-style netdb interface is reentrant */
00074 
00075 #define TDSSOCK_EINTR WSAEINTR
00076 #define TDSSOCK_EINPROGRESS WSAEWOULDBLOCK
00077 #define sock_errno WSAGetLastError()
00078 #ifndef __MINGW32__
00079 typedef DWORD pid_t;
00080 #endif
00081 #define strcasecmp stricmp
00082 #define strncasecmp strnicmp
00083 #define atoll _atoi64
00084 #define vsnprintf _vsnprintf
00085 
00086 #ifndef WIN32
00087 #define WIN32 1
00088 #endif
00089 
00090 #define TDS_SDIR_SEPARATOR "\\"
00091 
00092 /* use macros to use new style names */
00093 #ifdef __MSVCRT__
00094 #define getpid()           _getpid()
00095 #define strdup(s)          _strdup(s)
00096 #define stricmp(s1,s2)     _stricmp(s1,s2)
00097 #define strnicmp(s1,s2,n)  _strnicmp(s1,s2,n)
00098 #endif
00099 
00100 #endif /* defined(WIN32) || defined(_WIN32) || defined(__WIN32__) */
00101 
00102 #ifndef sock_errno
00103 #define sock_errno errno
00104 #endif
00105 
00106 #ifndef TDSSOCK_EINTR
00107 #define TDSSOCK_EINTR EINTR
00108 #endif
00109 
00110 #ifndef TDSSOCK_EINPROGRESS 
00111 #define TDSSOCK_EINPROGRESS EINPROGRESS
00112 #endif
00113 
00114 #ifndef INITSOCKET
00115 #define INITSOCKET()    0
00116 #endif /* !INITSOCKET */
00117 
00118 #ifndef DONESOCKET
00119 #define DONESOCKET()    do { } while(0)
00120 #endif /* !DONESOCKET */
00121 
00122 #ifndef READSOCKET
00123 #define READSOCKET(a,b,c)       read((a), (b), (c))
00124 #endif /* !READSOCKET */
00125 
00126 #ifndef WRITESOCKET
00127 #define WRITESOCKET(a,b,c)      write((a), (b), (c))
00128 #endif /* !WRITESOCKET */
00129 
00130 #ifndef CLOSESOCKET
00131 #define CLOSESOCKET(a)          close((a))
00132 #endif /* !CLOSESOCKET */
00133 
00134 #ifndef IOCTLSOCKET
00135 #define IOCTLSOCKET(a,b,c)      ioctl((a), (b), (c))
00136 #endif /* !IOCTLSOCKET */
00137 
00138 #ifndef TDS_SDIR_SEPARATOR
00139 #define TDS_SDIR_SEPARATOR "/"
00140 #endif /* !TDS_SDIR_SEPARATOR */
00141 
00142 #ifdef __cplusplus
00143 #if 0
00144 {
00145 #endif
00146 }
00147 #endif
00148 
00149 #endif /* _tds_sysdep_private_h_ */

Generated on Thu Jan 10 16:05:01 2008 for FreeTDS API by  doxygen 1.4.7