| 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\ |
| 2 | * This is GNU Go, a Go program. Contact gnugo@gnu.org, or see * |
| 3 | * http://www.gnu.org/software/gnugo/ for more information. * |
| 4 | * * |
| 5 | * Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, * |
| 6 | * 2008 and 2009 by the Free Software Foundation. * |
| 7 | * * |
| 8 | * This program is free software; you can redistribute it and/or * |
| 9 | * modify it under the terms of the GNU General Public License as * |
| 10 | * published by the Free Software Foundation - version 3 or * |
| 11 | * (at your option) any later version. * |
| 12 | * * |
| 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 in file COPYING for more details. * |
| 17 | * * |
| 18 | * You should have received a copy of the GNU General Public * |
| 19 | * License along with this program; if not, write to the Free * |
| 20 | * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * |
| 21 | * Boston, MA 02111, USA. * |
| 22 | \* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
| 23 | |
| 24 | |
| 25 | #ifndef GNU_GO_WINSOCKET_H |
| 26 | #define GNU_GO_WINSOCKET_H |
| 27 | |
| 28 | |
| 29 | #ifdef HAVE_CONFIG_H |
| 30 | #include <config.h> |
| 31 | #endif |
| 32 | |
| 33 | |
| 34 | #define USE_WINDOWS_SOCKET_CLUDGE \ |
| 35 | ((defined(_WIN32) || defined(_WIN32_WCE)) \ |
| 36 | && defined(ENABLE_SOCKET_SUPPORT)) |
| 37 | |
| 38 | |
| 39 | #if USE_WINDOWS_SOCKET_CLUDGE |
| 40 | |
| 41 | |
| 42 | #include <stdarg.h> |
| 43 | #include <stdio.h> |
| 44 | |
| 45 | |
| 46 | #ifndef WINSOCKET_H_INTERNAL_INCLUSION |
| 47 | |
| 48 | /* (sic.) Teh cludge. */ |
| 49 | |
| 50 | /* At least in some versions of `stdio.h' on Windows, feof() is a |
| 51 | * macro, not a function. |
| 52 | */ |
| 53 | #ifdef feof |
| 54 | #undef feof |
| 55 | #endif |
| 56 | |
| 57 | #define setbuf winsocket_setbuf |
| 58 | #define fflush winsocket_fflush |
| 59 | #define feof winsocket_feof |
| 60 | #define fclose winsocket_fclose |
| 61 | |
| 62 | #define fread winsocket_fread |
| 63 | #define fgets winsocket_fgets |
| 64 | |
| 65 | #define fwrite winsocket_fwrite |
| 66 | #define fputc winsocket_fputc |
| 67 | #define fputs winsocket_fputs |
| 68 | #define fprintf winsocket_fprintf |
| 69 | #define vfprintf winsocket_vfprintf |
| 70 | |
| 71 | #endif /* WINSOCKET_H_INTERNAL_INCLUSION */ |
| 72 | |
| 73 | |
| 74 | void winsocket_activate(int _socket_handle); |
| 75 | |
| 76 | void winsocket_setbuf(FILE *file, char *buffer); |
| 77 | int winsocket_fflush(FILE *file); |
| 78 | int winsocket_feof(FILE *file); |
| 79 | int winsocket_fclose(FILE *file); |
| 80 | |
| 81 | size_t winsocket_fread(void *buffer, |
| 82 | size_t size, size_t num_items, FILE *file); |
| 83 | char * winsocket_fgets(char *buffer, int size, FILE *file); |
| 84 | |
| 85 | size_t winsocket_fwrite(const void *buffer, |
| 86 | size_t size, size_t num_items, FILE *file); |
| 87 | int winsocket_fputc(int character, FILE *file); |
| 88 | int winsocket_fputs(const char *string, FILE *file); |
| 89 | int winsocket_fprintf(FILE *file, const char *format_string, ...); |
| 90 | int winsocket_vfprintf(FILE *file, const char *format_string, |
| 91 | va_list arguments); |
| 92 | |
| 93 | |
| 94 | #endif /* USE_WINDOWS_SOCKET_CLUDGE */ |
| 95 | |
| 96 | |
| 97 | #endif /* GNU_GO_WINSOCKET_H */ |
| 98 | |
| 99 | |
| 100 | /* |
| 101 | * Local Variables: |
| 102 | * tab-width: 8 |
| 103 | * c-basic-offset: 2 |
| 104 | * End: |
| 105 | */ |