mark PurpleImageClass as private
[pidgin-git.git] / libpurple / win32 / libc_interface.h
blobf1fe8edabdf4f68509ea23f12bf0ce3577114d81
1 /*
2 * purple
4 * File: libc_interface.h
6 * Copyright (C) 2002-2003, Herman Bloggs <hermanator12002@yahoo.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
23 #ifndef PURPLE_WIN32_LIBC_INTERFACE_H
24 #define PURPLE_WIN32_LIBC_INTERFACE_H
26 #include <config.h>
28 #include <winsock2.h>
29 #include <ws2tcpip.h>
30 #include <io.h>
31 #include <errno.h>
32 #include "libc_internal.h"
33 #include <glib.h>
34 #include "glibcompat.h"
36 G_BEGIN_DECLS
38 #ifdef _MSC_VER
39 #define S_IRUSR S_IREAD
40 #define S_IWUSR S_IWRITE
41 #define S_IXUSR S_IEXEC
43 #define S_ISDIR(m) (((m)&S_IFDIR)==S_IFDIR)
45 #define F_OK 0
46 #endif
48 /* sys/socket.h */
49 #define socket( domain, style, protocol ) \
50 wpurple_socket( domain, style, protocol )
52 #define connect( socket, addr, length ) \
53 wpurple_connect( socket, addr, length )
55 #define getsockopt( socket, level, optname, optval, optlenptr ) \
56 wpurple_getsockopt( socket, level, optname, optval, optlenptr )
58 #define setsockopt( socket, level, optname, optval, optlen ) \
59 wpurple_setsockopt( socket, level, optname, optval, optlen )
61 #define getsockname( socket, addr, lenptr ) \
62 wpurple_getsockname( socket, addr, lenptr )
64 #define bind( socket, addr, length ) \
65 wpurple_bind( socket, addr, length )
67 #define listen( socket, n ) \
68 wpurple_listen( socket, n )
70 #define sendto(socket, buf, len, flags, to, tolen) \
71 wpurple_sendto(socket, buf, len, flags, to, tolen)
73 #define recv(fd, buf, len, flags) \
74 wpurple_recv(fd, buf, len, flags)
76 #define send(socket, buf, buflen, flags) \
77 wpurple_send(socket, buf, buflen, flags)
79 /* sys/ioctl.h */
80 #define ioctl( fd, command, val ) \
81 wpurple_ioctl( fd, command, val )
83 /* fcntl.h */
84 #define fcntl( fd, command, ... ) \
85 wpurple_fcntl( fd, command, ##__VA_ARGS__ )
87 /* arpa/inet.h */
88 #define inet_aton( name, addr ) \
89 wpurple_inet_aton( name, addr )
91 #define inet_ntop( af, src, dst, cnt ) \
92 wpurple_inet_ntop( af, src, dst, cnt )
94 #define inet_pton( af, src, dst ) \
95 wpurple_inet_pton( af, src, dst )
97 /* netdb.h */
98 #define gethostbyname( name ) \
99 wpurple_gethostbyname( name )
101 /* netinet/in.h */
102 #define ntohl( netlong ) \
103 (unsigned int)ntohl( netlong )
105 /* string.h */
106 #define hstrerror( herror ) \
107 wpurple_strerror( errno )
108 #define strerror( errornum ) \
109 wpurple_strerror( errornum )
110 #define g_strerror( errornum ) \
111 wpurple_strerror( errornum )
113 /* unistd.h */
114 #define read( fd, buf, buflen ) \
115 wpurple_read( fd, buf, buflen )
117 #define write( socket, buf, buflen ) \
118 wpurple_write( socket, buf, buflen )
120 #define close( fd ) \
121 wpurple_close( fd )
123 #ifndef sleep
124 #define sleep(x) Sleep((x)*1000)
125 #endif
127 #define gethostname( name, size ) \
128 wpurple_gethostname( name, size )
130 #define fsync(fd) _commit(fd)
132 /* sys/time.h */
133 #define gettimeofday( timeval, timezone ) \
134 wpurple_gettimeofday( timeval, timezone )
136 /* stdio.h */
137 #if !defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 3 || \
138 !defined(IS_WIN32_CROSS_COMPILED)
139 # undef snprintf
140 # define snprintf _snprintf
141 # undef vsnprintf
142 # define vsnprintf _vsnprintf
143 #endif
145 #define rename( oldname, newname ) \
146 g_rename( oldname, newname )
148 /* sys/stat.h */
149 #define fchmod(a,b)
151 /* time.h */
152 /* XXX: it may be also defined by pthread.h */
153 #undef localtime_r
154 #define localtime_r( time, resultp ) \
155 wpurple_localtime_r( time, resultp )
157 G_END_DECLS
159 #endif /* PURPLE_WIN32_LIBC_INTERFACE_H */