]> icculus.org git repositories - taylor/freespace2.git/blob - include/unix.h
recursively create directories (hurt more on OSX) and update all _mkdir() calls accor...
[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 _hypot hypot
33 #define _access access
34 #define byte unsigned char
35 #define __try try
36 #define __except catch
37 #define LPSTR char *
38 #define PASCAL
39 #define CALLBACK
40
41 #if ( defined(__x86_64__) || defined(_WIN64) )
42 typedef unsigned int DWORD;
43 #else
44 typedef unsigned long DWORD;
45 #endif
46 typedef unsigned short WORD;
47
48 extern void strlwr (char *str);
49 extern void strupr (char *str);
50 extern int filelength (int fd);
51 extern int MulDiv (int, int, int);
52
53 extern void Sleep (int miliseconds);
54 extern unsigned long _beginthread (void (*pfuncStart)(void *), unsigned unStackSize, void* pArgList);
55 extern void OutputDebugString (const char *);
56 extern int WSAGetLastError ();
57 extern int _mkdir(const char *path);
58 extern void _splitpath (const char *path, char *drive, char *dir, char *fname, char *ext);
59
60 typedef struct FILETIME_s {
61             DWORD dwLowDateTime;
62             DWORD dwHighDateTime;
63 } FILETIME, *PFILETIME;
64
65 #define WAVE_FORMAT_PCM         1
66 #define WAVE_FORMAT_ADPCM       2
67
68 // these structures are packed on WIN32 so do it here too
69 #pragma pack(push, 1)
70 typedef struct {
71         WORD wFormatTag;
72         WORD nChannels;
73         DWORD nSamplesPerSec;
74         DWORD nAvgBytesPerSec;
75         WORD nBlockAlign;
76 } WAVEFORMAT;
77                     
78 typedef struct {
79         WAVEFORMAT wf;
80         WORD wBitsPerSample;
81 } PCMWAVEFORMAT;
82
83 typedef struct {
84         WORD  wFormatTag;
85         WORD  nChannels;
86         DWORD nSamplesPerSec;
87         DWORD nAvgBytesPerSec;
88         WORD  nBlockAlign;
89         WORD  wBitsPerSample;
90         WORD  cbSize;
91 } WAVEFORMATEX;
92 #pragma pack(pop)
93
94 #define CRITICAL_SECTION SDL_mutex*
95
96 #define closesocket(A) close(A)
97 #define CopyMemory(A,B,C) memcpy(A,B,C)
98 #define UINT unsigned int
99 #define SOCKET int
100 #define SOCKADDR_IN struct sockaddr_in
101 #define SOCKADDR struct sockaddr
102 #define LPSOCKADDR struct sockaddr*
103 #define LPHOSTENT struct hostent*
104 #define HOSTENT struct hostent
105 #define LPINADDR struct in_addr*
106 #define LPIN_ADDR struct in_addr*
107 #define SOCKET_ERROR -1
108 #define INVALID_SOCKET -1
109 #define TIMEVAL struct timeval
110 #define SERVENT struct servent
111 #define BOOL int
112
113 #define WSAEALREADY EALREADY
114 #define WSAEINVAL EINVAL
115 #define WSAEWOULDBLOCK EAGAIN
116 #define WSAEISCONN EISCONN
117 #define WSAECONNRESET ECONNRESET
118 #define WSAECONNABORTED ECONNABORTED
119 #define WSAESHUTDOWN ESHUTDOWN
120 #define WSAENOTSOCK ENOTSOCK
121
122 #endif