]> icculus.org git repositories - taylor/freespace2.git/blob - include/unix.h
finished cfilesystem.
[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
53 typedef struct FILETIME_s {
54             DWORD dwLowDateTime;
55             DWORD dwHighDateTime;
56 } FILETIME, *PFILETIME;
57
58 #define WAVE_FORMAT_PCM         1
59 #define WAVE_FORMAT_ADPCM       2
60
61 typedef struct {
62         WORD wFormatTag;
63         WORD nChannels;
64         DWORD nSamplesPerSec;
65         DWORD nAvgBytesPerSec;
66         WORD nBlockAlign;
67 } WAVEFORMAT;
68                     
69 typedef struct {
70         WAVEFORMAT wf;
71         WORD wBitsPerSample;
72 } PCMWAVEFORMAT;
73
74 typedef struct {
75         WORD  wFormatTag;
76         WORD  nChannels;
77         DWORD nSamplesPerSec;
78         DWORD nAvgBytesPerSec;
79         WORD  nBlockAlign;
80         WORD  wBitsPerSample;
81         WORD  cbSize;
82 } WAVEFORMATEX;
83
84 extern void strlwr (char *str);
85 extern int filelength (int fd);
86 extern int MulDiv (int, int, int);
87 #define CRITICAL_SECTION SDL_mutex*
88
89 #ifndef NDEBUG
90 #define STUB_FUNCTION fprintf(stderr,"STUB: %s at " __FILE__ ", line %d, thread %d\n",__FUNCTION__,__LINE__,getpid())
91 #else
92 #define STUB_FUNCTION
93 #endif
94
95 #define closesocket(A) close(A)
96 #define CopyMemory(A,B,C) memcpy(A,B,C)
97 #define UINT unsigned int
98 #define SOCKET int
99 #define SOCKADDR_IN struct sockaddr_in
100 #define SOCKADDR struct sockaddr
101 #define LPSOCKADDR struct sockaddr*
102 #define LPHOSTENT struct hostent*
103 #define HOSTENT struct hostent
104 #define LPINADDR struct in_addr*
105 #define LPIN_ADDR struct in_addr*
106 #define SOCKET_ERROR -1
107 #define INVALID_SOCKET -1
108 #define TIMEVAL struct timeval
109 #define SERVENT struct servent
110 #define BOOL int
111
112 #define WSAEALREADY EALREADY
113 #define WSAEINVAL EINVAL
114 #define WSAEWOULDBLOCK EAGAIN
115 #define WSAEISCONN EISCONN
116 #define WSAECONNRESET ECONNRESET
117 #define WSAECONNABORTED ECONNABORTED
118 #define WSAESHUTDOWN ESHUTDOWN
119
120 typedef struct channel
121
122         int   sig;                      // uniquely
123         int   snd_id;           // identifies which
124         int   pdsb;                     // pointer to the secondary buffer t
125         int   pds3db;           // 3D interface, only used if sound buffer created w
126         int   looping;          // flag to i
127         int   vol;                      // in Direct
128         int   priority; // implementation de
129         bool  is_voice_msg;
130         int                     last_position;
131 } channel;           
132
133 #endif