comparison compat.h @ 174:75bf3051235f

Fixes so you can mix compilers.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 01 Dec 2002 12:59:24 +0000
parents 0fc45e386376
children e3dd5c765775
comparison
equal deleted inserted replaced
173:c2b5d0019ec3 174:75bf3051235f
1 /* $Id$ */ 1 /* $Id$ */
2
3 #ifndef _COMPAT_H
4 #define _COMPAT_H
2 5
3 /* This header includes and defines everything needed for a given OS/compiler */ 6 /* This header includes and defines everything needed for a given OS/compiler */
4 #ifdef __UNIX__ 7 #ifdef __UNIX__
5 #include "config.h" 8 #include "config.h"
6 9
56 #define INCL_NLS 59 #define INCL_NLS
57 #define INCL_DOS 60 #define INCL_DOS
58 #define INCL_DEV 61 #define INCL_DEV
59 #define INCL_DOSERRORS 62 #define INCL_DOSERRORS
60 63
64 #if defined(__IBMC__) && !defined(API)
65 #define API _System
66 #endif
67
61 #define msleep(a) DosSleep(a) 68 #define msleep(a) DosSleep(a)
62 69
63 #ifdef __EMX__ 70 #ifdef __EMX__
64 #include <dirent.h> 71 #include <dirent.h>
65 #include <sys/stat.h> 72 #include <sys/stat.h>
120 #else 127 #else
121 #include <dir.h> 128 #include <dir.h>
122 #include <dirent.h> 129 #include <dirent.h>
123 #endif 130 #endif
124 #include <stdarg.h> 131 #include <stdarg.h>
132
133 #if defined(MSVC) && !defined(API)
134 #define API _stdcall
135 #endif
125 136
126 #if defined(__CYGWIN32__) || defined(__MINGW32__) 137 #if defined(__CYGWIN32__) || defined(__MINGW32__)
127 #include <sys/un.h> 138 #include <sys/un.h>
128 #endif /* __CYGWIN32__ || __MINGW32__ */ 139 #endif /* __CYGWIN32__ || __MINGW32__ */
129 140
190 #endif 201 #endif
191 #define FOPEN_READ_BINARY "rb" 202 #define FOPEN_READ_BINARY "rb"
192 #define FOPEN_WRITE_BINARY "wb" 203 #define FOPEN_WRITE_BINARY "wb"
193 #define FOPEN_APPEND_BINARY "ab" 204 #define FOPEN_APPEND_BINARY "ab"
194 205
206 #ifndef API
207 #define API
208 #endif
209
195 /* Compatibility layer for IBM C/Winsock */ 210 /* Compatibility layer for IBM C/Winsock */
196 int sockread (int a, void *b, int c, int d); 211 int API sockread (int a, void *b, int c, int d);
197 int sockwrite (int a, void *b, int c, int d); 212 int API sockwrite (int a, void *b, int c, int d);
198 int sockclose(int a); 213 int API sockclose(int a);
199 int socksprintf(int fd, char *format, ...); 214 int API socksprintf(int fd, char *format, ...);
200 int sockpipe(int *pipes); 215 int API sockpipe(int *pipes);
201 void sockinit(void); 216 void API sockinit(void);
202 void sockshutdown(void); 217 void API sockshutdown(void);
203 int makedir(char *path); 218 int API makedir(char *path);
204 void nonblock(int fd); 219 void API nonblock(int fd);
205 void block(int fd); 220 void API block(int fd);
206 void setfileinfo(char *filename, char *url, char *logfile); 221 void API setfileinfo(char *filename, char *url, char *logfile);
207 long double drivesize(int drive); 222 long double API drivesize(int drive);
208 long double drivefree(int drive); 223 long double API drivefree(int drive);
209 int isdrive(int drive); 224 int API isdrive(int drive);
210 void getfsname(int drive, char *buf, int len); 225 void API getfsname(int drive, char *buf, int len);
211 FILE *fsopen(char *path, char *modes); 226 FILE * API fsopen(char *path, char *modes);
212 int fsclose(FILE *fp); 227 int API fsclose(FILE *fp);
213 char *fsgets(char *str, int size, FILE *stream); 228 char * API fsgets(char *str, int size, FILE *stream);
214 int fsseek(FILE *stream, long offset, int whence); 229 int API fsseek(FILE *stream, long offset, int whence);
215 int locale_init(char *filename, int my_locale); 230 int API locale_init(char *filename, int my_locale);
216 char *locale_string(char *default_text, int message); 231 char * API locale_string(char *default_text, int message);
217 232 #endif