10
|
1 #ifndef _MMIO_H_
|
|
2 #define _MMIO_H_
|
|
3
|
|
4 #include <stdio.h>
|
|
5 #include <stdlib.h>
|
|
6 #include "tdefs.h"
|
|
7
|
|
8
|
|
9 #ifdef __cplusplus
|
|
10 extern "C" {
|
|
11 #endif
|
|
12
|
|
13
|
|
14 // LOG.C Prototypes
|
|
15 // ================
|
|
16
|
|
17 #define LOG_SILENT 0
|
|
18 #define LOG_VERBOSE 1
|
|
19
|
|
20 extern int log_init(CHAR *logfile, BOOL val);
|
|
21 extern void log_exit(void);
|
|
22 extern void log_verbose(void);
|
|
23 extern void log_silent(void);
|
|
24 extern void printlog(CHAR *fmt, ... );
|
|
25 extern void printlogv(CHAR *fmt, ... );
|
|
26
|
|
27 #ifdef __WATCOMC__
|
|
28 #pragma aux log_init parm nomemory modify nomemory;
|
|
29 #pragma aux log_exit parm nomemory modify nomemory;
|
|
30 #pragma aux log_verbose parm nomemory modify nomemory;
|
|
31 #pragma aux log_silent parm nomemory modify nomemory;
|
|
32 #pragma aux printlog parm nomemory modify nomemory;
|
|
33 #pragma aux printlogv parm nomemory modify nomemory;
|
|
34 #endif
|
|
35
|
|
36
|
|
37
|
|
38 // MikMod's new error handling routines
|
|
39 // ====================================
|
|
40
|
|
41 // Specific Errors [referenced by _mm_errno]
|
|
42
|
|
43 enum
|
|
44 { MMERR_OPENING_FILE = 1,
|
|
45 MMERR_OUT_OF_MEMORY,
|
|
46 MMERR_END_OF_FILE,
|
|
47 MMERR_DISK_FULL,
|
|
48 MMERR_SAMPLE_TOO_BIG,
|
|
49 MMERR_OUT_OF_HANDLES,
|
|
50 MMERR_ALLOCATING_DMA,
|
|
51 MMERR_UNKNOWN_WAVE_TYPE,
|
|
52 MMERR_NOT_A_STREAM,
|
|
53 MMERR_LOADING_PATTERN,
|
|
54 MMERR_LOADING_TRACK,
|
|
55 MMERR_LOADING_HEADER,
|
|
56 MMERR_LOADING_SAMPLEINFO,
|
|
57 MMERR_NOT_A_MODULE,
|
|
58 MMERR_DETECTING_DEVICE,
|
|
59 MMERR_INVALID_DEVICE,
|
|
60 MMERR_INITIALIZING_MIXER,
|
|
61 #ifdef SUN
|
|
62 #elif defined(SOLARIS)
|
|
63 #elif defined(__alpha)
|
|
64 MMERR_AF_AUDIO_PORT
|
|
65 #elif defined(OSS)
|
|
66 #ifdef ULTRA
|
|
67 #endif
|
|
68 #elif defined(__hpux)
|
|
69 MMERR_OPENING_DEVAUDIO,
|
|
70 MMERR_SETTING_NONBLOCKING,
|
|
71 MMERR_SETTING_SAMPLEFORMAT,
|
|
72 MMERR_SETTING_SAMPLERATE,
|
|
73 MMERR_SETTING_CHANNELS,
|
|
74 MMERR_SELECTING_AUDIO_OUTPUT,
|
|
75 MMERR_GETTING_AUDIO_DESC,
|
|
76 MMERR_GETTING_GAINS,
|
|
77 MMERR_SETTING_GAINS,
|
|
78 MMERR_SETTING_BUFFERSIZE
|
|
79 #elif defined(AIX)
|
|
80 MMERR_OPENING_AIX,
|
|
81 MMERR_AIX_CONFIG_INIT,
|
|
82 MMERR_AIX_CONFIG_CONTROL,
|
|
83 MMERR_AIX_CONFIG_START,
|
|
84 MMERR_AIX_NON_BLOCK
|
|
85 #elif defined(SGI)
|
|
86 #elif defined(__OS2__)
|
|
87 #elif defined(__WIN32__)
|
|
88 #else
|
|
89 MMERR_DETECTING_SOUNDCARD,
|
|
90 MMERR_SETTING_HIDMA
|
|
91 #endif
|
|
92 };
|
|
93
|
|
94 // Memory allocation with error handling - MMALLOC.C
|
|
95 // =================================================
|
|
96
|
|
97 extern void *_mm_malloc(size_t size);
|
|
98 extern void *_mm_calloc(size_t nitems, size_t size);
|
|
99
|
|
100 extern void (*_mm_errorhandler)(void);
|
|
101 extern int _mm_errno;
|
|
102 extern BOOL _mm_critical;
|
|
103 extern CHAR *_mm_errmsg[];
|
|
104
|
|
105 extern void _mm_RegisterErrorHandler(void (*proc)(void));
|
|
106 extern BOOL _mm_FileExists(CHAR *fname);
|
|
107
|
|
108 extern void StringWrite(CHAR *s, FILE *fp);
|
|
109 extern CHAR *StringRead(FILE *fp);
|
|
110
|
|
111
|
|
112 // MikMod/DivEnt style file input / output -
|
|
113 // Solves several portability issues.
|
|
114 // Notibly little vs. big endian machine complications.
|
|
115
|
|
116 #define _mm_write_SBYTE(x,y) fputc((int)x,y)
|
|
117 #define _mm_write_UBYTE(x,y) fputc((int)x,y)
|
|
118
|
|
119 #define _mm_read_SBYTE(x) (SBYTE)fgetc(x)
|
|
120 #define _mm_read_UBYTE(x) (UBYTE)fgetc(x)
|
|
121
|
|
122 #define _mm_write_SBYTES(x,y,z) fwrite((void *)x,1,y,z)
|
|
123 #define _mm_write_UBYTES(x,y,z) fwrite((void *)x,1,y,z)
|
|
124 #define _mm_read_SBYTES(x,y,z) fread((void *)x,1,y,z)
|
|
125 #define _mm_read_UBYTES(x,y,z) fread((void *)x,1,y,z)
|
|
126
|
|
127 #define _mm_rewind(x) _mm_fseek(x,0,SEEK_SET)
|
|
128
|
|
129
|
|
130 extern int _mm_fseek(FILE *stream, long offset, int whence);
|
|
131 extern long _mm_iobase_get(void);
|
|
132 extern void _mm_iobase_set(long iobase);
|
|
133 extern void _mm_iobase_setcur(FILE *fp);
|
|
134 extern void _mm_iobase_revert(void);
|
|
135 extern long _mm_ftell(FILE *stream);
|
|
136 extern long _mm_flength(FILE *stream);
|
|
137 extern FILE *_mm_fopen(CHAR *fname, CHAR *attrib);
|
|
138 extern void _mm_fputs(FILE *fp, CHAR *data);
|
|
139 extern BOOL _mm_copyfile(FILE *fpi, FILE *fpo, ULONG len);
|
|
140 extern void _mm_write_string(CHAR *data, FILE *fp);
|
|
141 extern int _mm_read_string (CHAR *buffer, int number, FILE *fp);
|
|
142
|
|
143
|
|
144 //extern SBYTE _mm_read_SBYTE (FILE *fp);
|
|
145 //extern UBYTE _mm_read_UBYTE (FILE *fp);
|
|
146
|
|
147 extern SWORD _mm_read_M_SWORD (FILE *fp);
|
|
148 extern SWORD _mm_read_I_SWORD (FILE *fp);
|
|
149
|
|
150 extern UWORD _mm_read_M_UWORD (FILE *fp);
|
|
151 extern UWORD _mm_read_I_UWORD (FILE *fp);
|
|
152
|
|
153 extern SLONG _mm_read_M_SLONG (FILE *fp);
|
|
154 extern SLONG _mm_read_I_SLONG (FILE *fp);
|
|
155
|
|
156 extern ULONG _mm_read_M_ULONG (FILE *fp);
|
|
157 extern ULONG _mm_read_I_ULONG (FILE *fp);
|
|
158
|
|
159
|
|
160 //extern int _mm_read_SBYTES (SBYTE *buffer, int number, FILE *fp);
|
|
161 //extern int _mm_read_UBYTES (UBYTE *buffer, int number, FILE *fp);
|
|
162
|
|
163 extern int _mm_read_M_SWORDS (SWORD *buffer, int number, FILE *fp);
|
|
164 extern int _mm_read_I_SWORDS (SWORD *buffer, int number, FILE *fp);
|
|
165
|
|
166 extern int _mm_read_M_UWORDS (UWORD *buffer, int number, FILE *fp);
|
|
167 extern int _mm_read_I_UWORDS (UWORD *buffer, int number, FILE *fp);
|
|
168
|
|
169 extern int _mm_read_M_SLONGS (SLONG *buffer, int number, FILE *fp);
|
|
170 extern int _mm_read_I_SLONGS (SLONG *buffer, int number, FILE *fp);
|
|
171
|
|
172 extern int _mm_read_M_ULONGS (ULONG *buffer, int number, FILE *fp);
|
|
173 extern int _mm_read_I_ULONGS (ULONG *buffer, int number, FILE *fp);
|
|
174
|
|
175
|
|
176 //extern void _mm_write_SBYTE (SBYTE data, FILE *fp);
|
|
177 //extern void _mm_write_UBYTE (UBYTE data, FILE *fp);
|
|
178
|
|
179 extern void _mm_write_M_SWORD (SWORD data, FILE *fp);
|
|
180 extern void _mm_write_I_SWORD (SWORD data, FILE *fp);
|
|
181
|
|
182 extern void _mm_write_M_UWORD (UWORD data, FILE *fp);
|
|
183 extern void _mm_write_I_UWORD (UWORD data, FILE *fp);
|
|
184
|
|
185 extern void _mm_write_M_SLONG (SLONG data, FILE *fp);
|
|
186 extern void _mm_write_I_SLONG (SLONG data, FILE *fp);
|
|
187
|
|
188 extern void _mm_write_M_ULONG (ULONG data, FILE *fp);
|
|
189 extern void _mm_write_I_ULONG (ULONG data, FILE *fp);
|
|
190
|
|
191 //extern void _mm_write_SBYTES (SBYTE *data, int number, FILE *fp);
|
|
192 //extern void _mm_write_UBYTES (UBYTE *data, int number, FILE *fp);
|
|
193
|
|
194 extern void _mm_write_M_SWORDS (SWORD *data, int number, FILE *fp);
|
|
195 extern void _mm_write_I_SWORDS (SWORD *data, int number, FILE *fp);
|
|
196
|
|
197 extern void _mm_write_M_UWORDS (UWORD *data, int number, FILE *fp);
|
|
198 extern void _mm_write_I_UWORDS (UWORD *data, int number, FILE *fp);
|
|
199
|
|
200 extern void _mm_write_M_SLONGS (SLONG *data, int number, FILE *fp);
|
|
201 extern void _mm_write_I_SLONGS (SLONG *data, int number, FILE *fp);
|
|
202
|
|
203 extern void _mm_write_M_ULONGS (ULONG *data, int number, FILE *fp);
|
|
204 extern void _mm_write_I_ULONGS (ULONG *data, int number, FILE *fp);
|
|
205
|
|
206 #ifdef __WATCOMC__
|
|
207 #pragma aux _mm_fseek parm nomemory modify nomemory
|
|
208 #pragma aux _mm_ftell parm nomemory modify nomemory
|
|
209 #pragma aux _mm_flength parm nomemory modify nomemory
|
|
210 #pragma aux _mm_fopen parm nomemory modify nomemory
|
|
211 #pragma aux _mm_fputs parm nomemory modify nomemory
|
|
212 #pragma aux _mm_copyfile parm nomemory modify nomemory
|
|
213 #pragma aux _mm_iobase_get parm nomemory modify nomemory
|
|
214 #pragma aux _mm_iobase_set parm nomemory modify nomemory
|
|
215 #pragma aux _mm_iobase_setcur parm nomemory modify nomemory
|
|
216 #pragma aux _mm_iobase_revert parm nomemory modify nomemory
|
|
217 #pragma aux _mm_write_string parm nomemory modify nomemory
|
|
218 #pragma aux _mm_read_string parm nomemory modify nomemory
|
|
219
|
|
220 #pragma aux _mm_read_M_SWORD parm nomemory modify nomemory;
|
|
221 #pragma aux _mm_read_I_SWORD parm nomemory modify nomemory;
|
|
222 #pragma aux _mm_read_M_UWORD parm nomemory modify nomemory;
|
|
223 #pragma aux _mm_read_I_UWORD parm nomemory modify nomemory;
|
|
224 #pragma aux _mm_read_M_SLONG parm nomemory modify nomemory;
|
|
225 #pragma aux _mm_read_I_SLONG parm nomemory modify nomemory;
|
|
226 #pragma aux _mm_read_M_ULONG parm nomemory modify nomemory;
|
|
227 #pragma aux _mm_read_I_ULONG parm nomemory modify nomemory;
|
|
228
|
|
229 #pragma aux _mm_read_M_SWORDS parm nomemory modify nomemory;
|
|
230 #pragma aux _mm_read_I_SWORDS parm nomemory modify nomemory;
|
|
231 #pragma aux _mm_read_M_UWORDS parm nomemory modify nomemory;
|
|
232 #pragma aux _mm_read_I_UWORDS parm nomemory modify nomemory;
|
|
233 #pragma aux _mm_read_M_SLONGS parm nomemory modify nomemory;
|
|
234 #pragma aux _mm_read_I_SLONGS parm nomemory modify nomemory;
|
|
235 #pragma aux _mm_read_M_ULONGS parm nomemory modify nomemory;
|
|
236 #pragma aux _mm_read_I_ULONGS parm nomemory modify nomemory;
|
|
237
|
|
238 #pragma aux _mm_write_M_SWORD parm nomemory modify nomemory;
|
|
239 #pragma aux _mm_write_I_SWORD parm nomemory modify nomemory;
|
|
240 #pragma aux _mm_write_M_UWORD parm nomemory modify nomemory;
|
|
241 #pragma aux _mm_write_I_UWORD parm nomemory modify nomemory;
|
|
242 #pragma aux _mm_write_M_SLONG parm nomemory modify nomemory;
|
|
243 #pragma aux _mm_write_I_SLONG parm nomemory modify nomemory;
|
|
244 #pragma aux _mm_write_M_ULONG parm nomemory modify nomemory;
|
|
245 #pragma aux _mm_write_I_ULONG parm nomemory modify nomemory;
|
|
246
|
|
247 #pragma aux _mm_write_M_SWORDS parm nomemory modify nomemory;
|
|
248 #pragma aux _mm_write_I_SWORDS parm nomemory modify nomemory;
|
|
249 #pragma aux _mm_write_M_UWORDS parm nomemory modify nomemory;
|
|
250 #pragma aux _mm_write_I_UWORDS parm nomemory modify nomemory;
|
|
251 #pragma aux _mm_write_M_SLONGS parm nomemory modify nomemory;
|
|
252 #pragma aux _mm_write_I_SLONGS parm nomemory modify nomemory;
|
|
253 #pragma aux _mm_write_M_ULONGS parm nomemory modify nomemory;
|
|
254 #pragma aux _mm_write_I_ULONGS parm nomemory modify nomemory;
|
|
255 #endif
|
|
256
|
|
257
|
|
258 #ifndef __WATCOMC__
|
|
259 #ifndef __GNUC__
|
|
260 extern CHAR *strdup(CHAR *str);
|
|
261 #endif
|
|
262 #endif
|
|
263
|
|
264 #ifdef __cplusplus
|
|
265 };
|
|
266 #endif
|
|
267
|
|
268 #endif
|