]> icculus.org git repositories - taylor/freespace2.git/blob - include/unix.h
outwnd_unix.cpp from fs2_open for logging to file in debug mode
[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 _MAX_FNAME 255
14 #define _MAX_PATH 255
15 #define MAX_PATH 255
16 #define _MAX_DIR 256
17 #define MAX_FILENAME_LENGTH 64
18 #define _cdecl
19 #define __cdecl
20 #define __int64 long long
21 #define LARGE_INTEGER long long
22 #define stricmp strcasecmp
23 #define strnicmp strncasecmp
24 #define _strnicmp strncasecmp
25 #define _isnan isnan
26 #define HANDLE int
27 #define HINSTANCE int
28 #define _getcwd getcwd
29 #define _chdir chdir
30 #define _strlwr strlwr
31 #define _unlink unlink
32 #define _mkdir mkdir
33 #define _hypot hypot
34 #define _access access
35 #define byte unsigned char
36 #define __try try
37 #define __except catch
38 #define LPSTR char *
39 #define PASCAL
40 #define CALLBACK
41
42 typedef unsigned long DWORD;
43 typedef unsigned short WORD;
44
45 extern void strlwr (char *str);
46 extern int filelength (int fd);
47 extern int MulDiv (int, int, int);
48
49 extern void Sleep (int miliseconds);
50 extern unsigned long _beginthread (void (*pfuncStart)(void *), unsigned unStackSize, void* pArgList);
51 extern void OutputDebugString (const char *);
52 extern int WSAGetLastError ();
53 extern void _splitpath (const char *path, char *drive, char *dir, char *fname, char *ext);
54
55 typedef struct FILETIME_s {
56             DWORD dwLowDateTime;
57             DWORD dwHighDateTime;
58 } FILETIME, *PFILETIME;
59
60 #define WAVE_FORMAT_PCM         1
61 #define WAVE_FORMAT_ADPCM       2
62
63 // these structures are packed on WIN32 so do it here too
64 #pragma pack(push, 1)
65 typedef struct {
66         WORD wFormatTag;
67         WORD nChannels;
68         DWORD nSamplesPerSec;
69         DWORD nAvgBytesPerSec;
70         WORD nBlockAlign;
71 } WAVEFORMAT;
72                     
73 typedef struct {
74         WAVEFORMAT wf;
75         WORD wBitsPerSample;
76 } PCMWAVEFORMAT;
77
78 typedef struct {
79         WORD  wFormatTag;
80         WORD  nChannels;
81         DWORD nSamplesPerSec;
82         DWORD nAvgBytesPerSec;
83         WORD  nBlockAlign;
84         WORD  wBitsPerSample;
85         WORD  cbSize;
86 } WAVEFORMATEX;
87 #pragma pack(pop)
88
89 #define CRITICAL_SECTION SDL_mutex*
90
91 #define closesocket(A) close(A)
92 #define CopyMemory(A,B,C) memcpy(A,B,C)
93 #define UINT unsigned int
94 #define SOCKET int
95 #define SOCKADDR_IN struct sockaddr_in
96 #define SOCKADDR struct sockaddr
97 #define LPSOCKADDR struct sockaddr*
98 #define LPHOSTENT struct hostent*
99 #define HOSTENT struct hostent
100 #define LPINADDR struct in_addr*
101 #define LPIN_ADDR struct in_addr*
102 #define SOCKET_ERROR -1
103 #define INVALID_SOCKET -1
104 #define TIMEVAL struct timeval
105 #define SERVENT struct servent
106 #define BOOL int
107
108 #define WSAEALREADY EALREADY
109 #define WSAEINVAL EINVAL
110 #define WSAEWOULDBLOCK EAGAIN
111 #define WSAEISCONN EISCONN
112 #define WSAECONNRESET ECONNRESET
113 #define WSAECONNABORTED ECONNABORTED
114 #define WSAESHUTDOWN ESHUTDOWN
115 #define WSAENOTSOCK ENOTSOCK
116
117 #endif