]> icculus.org git repositories - taylor/freespace2.git/blob - include/unix.h
cleanup; compile warning fixes
[taylor/freespace2.git] / include / unix.h
1 // unix.h - duplicates some MS defines
2
3 #ifndef _UNIX_H
4 #define _UNIX_H
5
6 #include <stdio.h>
7 #include <sys/types.h>
8 #include <unistd.h>
9 #include "SDL.h"
10
11 #define TRUE 1
12 #define FALSE 0
13 #define DWORD int
14 #define WORD short
15 #define _MAX_FNAME 255
16 #define _MAX_PATH 255
17 #define MAX_PATH 255
18 #define _MAX_DIR 256
19 #define MAX_FILENAME_LENGTH 64
20 #define _cdecl
21 #define __cdecl
22 #define __int64 long long
23 #define LARGE_INTEGER long long
24 #define stricmp strcasecmp
25 #define strnicmp strncasecmp
26 #define _strnicmp strncasecmp
27 #define _isnan isnan
28 #define HANDLE int
29 #define HINSTANCE int
30 #define _getcwd getcwd
31 #define _chdir chdir
32 #define _strlwr strlwr
33 #define _unlink unlink
34 #define _mkdir mkdir
35 #define _hypot hypot
36 #define _access access
37 #define byte unsigned char
38 #define __try try
39 #define __except catch
40 #define LPSTR char *
41 #define PASCAL
42 #define CALLBACK
43
44 extern void strlwr (char *str);
45 extern int filelength (int fd);
46 extern int MulDiv (int, int, int);
47
48 extern void Sleep (int miliseconds);
49 extern unsigned long _beginthread (void (*pfuncStart)(void *), unsigned unStackSize, void* pArgList);
50 extern void OutputDebugString (const char *);
51 extern int WSAGetLastError ();
52 extern void _splitpath (const char *path, char *drive, char *dir, char *fname, char *ext);
53
54 typedef struct FILETIME_s {
55             DWORD dwLowDateTime;
56             DWORD dwHighDateTime;
57 } FILETIME, *PFILETIME;
58
59 #define WAVE_FORMAT_PCM         1
60 #define WAVE_FORMAT_ADPCM       2
61
62 typedef struct {
63         WORD wFormatTag;
64         WORD nChannels;
65         DWORD nSamplesPerSec;
66         DWORD nAvgBytesPerSec;
67         WORD nBlockAlign;
68 } WAVEFORMAT;
69                     
70 typedef struct {
71         WAVEFORMAT wf;
72         WORD wBitsPerSample;
73 } PCMWAVEFORMAT;
74
75 typedef struct {
76         WORD  wFormatTag;
77         WORD  nChannels;
78         DWORD nSamplesPerSec;
79         DWORD nAvgBytesPerSec;
80         WORD  nBlockAlign;
81         WORD  wBitsPerSample;
82         WORD  cbSize;
83 } WAVEFORMATEX;
84
85 #define CRITICAL_SECTION SDL_mutex*
86
87 #ifndef NDEBUG
88 #define STUB_FUNCTION fprintf(stderr,"STUB: %s at " __FILE__ ", line %d, thread %d\n",__FUNCTION__,__LINE__,getpid())
89 #else
90 #define STUB_FUNCTION
91 #endif
92
93 #define closesocket(A) close(A)
94 #define CopyMemory(A,B,C) memcpy(A,B,C)
95 #define UINT unsigned int
96 #define SOCKET int
97 #define SOCKADDR_IN struct sockaddr_in
98 #define SOCKADDR struct sockaddr
99 #define LPSOCKADDR struct sockaddr*
100 #define LPHOSTENT struct hostent*
101 #define HOSTENT struct hostent
102 #define LPINADDR struct in_addr*
103 #define LPIN_ADDR struct in_addr*
104 #define SOCKET_ERROR -1
105 #define INVALID_SOCKET -1
106 #define TIMEVAL struct timeval
107 #define SERVENT struct servent
108 #define BOOL int
109
110 #define WSAEALREADY EALREADY
111 #define WSAEINVAL EINVAL
112 #define WSAEWOULDBLOCK EAGAIN
113 #define WSAEISCONN EISCONN
114 #define WSAECONNRESET ECONNRESET
115 #define WSAECONNABORTED ECONNABORTED
116 #define WSAESHUTDOWN ESHUTDOWN
117 #define WSAENOTSOCK ENOTSOCK
118
119 #endif