switched to inline heaps
[swftools.git] / lib / bladeenc / system.h
1 /*
2                         (c) Copyright 1998-2000 - Tord Jansson
3                         ======================================
4
5                 This file is part of the BladeEnc MP3 Encoder, based on
6                 ISO's reference code for MPEG Layer 3 compression.
7
8                 This file doesn't contain any of the ISO reference code and
9                 is copyright Tord Jansson (tord.jansson@swipnet.se).
10
11         BladeEnc is free software; you can redistribute this file
12         and/or modify it under the terms of the GNU Lesser General Public
13         License as published by the Free Software Foundation; either
14         version 2.1 of the License, or (at your option) any later version.
15
16         Use TABSIZE 4!!!
17
18
19
20         ------------    Changes    ------------
21
22         2000-12-11  Andre Piotrowski
23
24         -       added autodetection for Mac OS
25
26         2001-01-19      Tord Jansson
27
28         -       Added Andrea Vallinotto's Amiga WarpOS changes.
29         -       Added some more defines and cleaned up.
30
31 */
32
33 #ifndef         __SYSTEM__
34 #define         __SYSTEM__
35
36
37
38 /*==== THE SYSTEMS WE KNOW OF AND CAN AUTODETECT ==========================*/
39
40 #define         UNIX_AUTOCONF                   1   /* All well behaving UNIX systems where you run configure/make */
41                                                                             /* Includes Linux, *BSD, Solaris, IRIX, UnixWare, SCO Open Server, AIX, HPUX */
42
43 #define         WIN32_INTEL                             2   /* Windows 95/98/NT/2k etc on i386 compatible machines */
44
45 #define         BEOS                                    3   /* BeOS, version 4.5+ on i386 and PPC */
46
47 #define         MSDOS_DJGPP                             4   /* MS-DOS protected mode using DJGPP */
48
49 #define         MAC_OS                                  5   /* To compile the Mac version you also need Petteri Kamppuri's wrapper */
50
51
52
53 /*==== SYSTEMS WE SUPPORT BUT DON'T KNOW HOW TO AUTODETECT YET ==============*/
54 /*====       THESE NEEDS TO BE SET EXPLICITLY BELOW!!!         ==============*/
55
56
57 #define         WIN32_ALPHA                             6   /* Windows NT on DEC/Compaq Alpha architectures */
58             
59 #define         IBM_OS2                                 7
60
61 #define         ATARI_TOS                               8
62
63 #define         AMIGA_WOS                               9       /* Amiga WarpOS */
64
65
66 /*= UNCOMMENT LINE AND SET SYSTEM HERE IF YOUR SYSTEM CAN'T BE AUTODETECTED! */
67 /*===========================================================================*/
68 /*#define               SYSTEM          MAC_OS*/
69
70 /*==== SYSTEM AUTODETECTION PROCEDURE ========================*/
71
72 #ifndef SYSTEM
73 #       ifdef   WIN32
74 #               define          SYSTEM          WIN32_INTEL             
75 #       endif
76
77 #       ifdef  __BEOS__
78 #               define          SYSTEM          BEOS
79 #       endif
80
81 #       ifdef __DJGPP__
82 #       define          SYSTEM      MSDOS_DJGPP
83 #       endif
84
85 #       if      defined(__dest_os) && (__dest_os == __mac_os)   /* defined in "ansi_prefix.mac.h" */
86 #               define          SYSTEM          MAC_OS
87 #       endif
88
89 #       ifndef  SYSTEM
90 #               define          SYSTEM          UNIX_AUTOCONF   /* Take UNIX for granted... */
91 #       endif
92
93 #endif
94
95
96
97 /*==== Low level defines ======================================================*/
98  
99 /*
100   LIST OF DEFINES
101   ===============
102
103   BYTEORDER     [byteorder]     Should either be set to BIG_ENDIAN or LITTLE_ENDIAN
104                                                          depending on the processor.
105
106   DRAG_DROP                 Set if Drag-n-Drop operations are supported. If
107                                                          defined, the hint for drag and drop is displayed
108                                                          in the help text.
109
110   PRIO                      Set if priority can be set with the -PRIO switch
111                                                          (UNIX_SYSTEM enables this automatically).
112
113   MSWIN                     Set this for MSWin systems. Includes "windows.h" etc.
114
115   WILDCARDS                 Set this if the program has to expand wildcards
116                                                          itself on your system.
117
118   DIRECTORY_SEPARATOR           Should either be '\\' or '/'.
119                                                          (UNIX_SYSTEM automatically gives you '/').
120
121   WAIT_KEY                                      Set this on systems where we as default want to
122                                                          wait for a keypress before quiting.
123
124   UNIX_SYSTEM                           Set this for UNIX-systems that are posix and
125                                                          (at least to some extent) bsd compliant to enable
126                                                          stuff like config-file support, priority settings etc.
127
128   PAUSE_25_LINES                        Wait for keypress after 25 lines of output when
129                                                          listing important information.
130 */
131
132
133 /*  Most systems allready have these two defines, but some doesn't 
134     so we have to put them here, before they are used. */
135
136 #ifndef BIG_ENDIAN
137 #       define                  BIG_ENDIAN                              4321
138 #endif
139
140 #ifndef LITTLE_ENDIAN
141 #       define                  LITTLE_ENDIAN                   1234
142 #endif
143
144
145 /*____ UNIX with Autoconf support _____________________________________________*/
146
147 #if             SYSTEM == UNIX_AUTOCONF
148 #       ifdef BYTE_ORDER
149 #               define                  BYTEORDER                               BYTE_ORDER
150 #       else
151 #               include "../../config.h"
152 #               if WORDS_BIGENDIAN
153 #                       define          BYTEORDER                               BIG_ENDIAN
154 #               else
155 #                       define          BYTEORDER                               LITTLE_ENDIAN
156 #               endif
157 #       endif
158 #       define                  UNIX_SYSTEM
159 #endif
160
161 /*_____ Windows 95/98/NT Intel defines ________________________________________*/
162
163 #if     SYSTEM == WIN32_INTEL
164
165 #               define                  BYTEORDER                               LITTLE_ENDIAN
166 #               define                  DRAG_DROP
167 #               define                  PRIO
168 #               define                  MSWIN
169 #               define                  WILDCARDS
170 #               define                  DIRECTORY_SEPARATOR             '\\'
171 #               define                  WAIT_KEY
172 #               define                  PAUSE_25_LINES
173 #endif
174
175 /*_____ Windows NT DEC Alpha defines __________________________________________*/
176
177 #if SYSTEM == WIN32_ALPHA
178
179 #               define                  BYTEORDER                               LITTLE_ENDIAN
180 #               define                  DRAG_DROP
181 #               define                  PRIO
182 #               define                  MSWIN
183 #               define                  WILDCARDS
184 #               define                  DIRECTORY_SEPARATOR             '\\'
185 #               define                  WAIT_KEY
186 #               define                  PAUSE_25_LINES
187 #endif
188
189
190 /*____ OS/2 _________________________________________________________________*/
191
192 #if SYSTEM == IBM_OS2
193
194 #               define                  BYTEORDER                               LITTLE_ENDIAN
195 #               define                  PRIO
196 #               define                  WILDCARDS
197 #               define                  DIRECTORY_SEPARATOR             '\\'
198 #               define                  OS2
199 #               define                  WAIT_KEY
200 #               define                  PAUSE_25_LINES
201 #endif
202
203
204 /*____ Atari TOS ____________________________________________________________*/
205
206 #if SYSTEM == ATARI_TOS
207
208 #               define                  BYTEORDER                               BIG_ENDIAN
209 #               define                  DIRECTORY_SEPARATOR             '\\'
210 #               define                  TOS
211 #               define                  PAUSE_25_LINES
212 #endif
213
214 /*____ MSDOS_DJGPP __________________________________________________________*/
215
216 #if SYSTEM == MSDOS_DJGPP
217
218 #               define          BYTEORDER                               LITTLE_ENDIAN
219 #               define                  DIRECTORY_SEPARATOR             '\\'
220 #endif
221
222 /*____ MAC_OS ________________________________________________________________*/
223
224 #if SYSTEM == MAC_OS
225
226 #               define                  BYTEORDER                               BIG_ENDIAN
227 #               define                  DIRECTORY_SEPARATOR             ':'
228 #endif
229
230 /*____ BeOS PowerPC & x86 ___________________________________________________*/
231
232 #if SYSTEM == BEOS
233
234 #       ifdef __i386__
235 #               define                  BYTEORDER                               LITTLE_ENDIAN
236 #       else
237 #               define                  BYTEORDER                               BIG_ENDIAN
238 #       endif
239 #               define                  DIRECTORY_SEPARATOR             '/'
240 #endif
241
242 /*____ Amiga PowerPC WarpOS / VBCC or Storm-GCC_______________________________*/
243
244 #if SYSTEM == AMIGA_WOS
245 #       define                          BYTEORDER              BIG_ENDIAN
246 #       define                          DIRECTORY_SEPARATOR     '/'
247 #       define                          SECOND_DIRECTORY_SEPARATOR     ':'      /* Special case for volumes */
248 #       define                          PRIO                                                            /* Yes, it can be done */
249 #       define                          WILDCARDS                                                       /* Uses dos/ParsePatternNoCase() and friends.*/
250 #       define                          PROTO_ARGS                                                      /* Undocumented, it's useful for GCC-Storm */
251 #       ifdef __VBCC__
252 #               pragma amiga-align
253 #       endif
254 #       include <dos/dos.h>
255 #       ifdef __VBCC__
256 #               pragma default-align
257 #       endif
258
259 #endif
260
261
262
263 /*____ Some defines automatically gives other...*/
264
265 #ifdef UNIX_SYSTEM
266 #       define                  PRIO
267 #       define                  DIRECTORY_SEPARATOR             '/'
268 #endif
269
270
271 /*==== COMPILER SPECIFIC DEFINES ============================================ */
272 /*
273         Unfortunately the inline command differs slightly between compilers (for
274         example GCC calls it 'inline' while VC++ calls it '_inline'), so we have
275         to use our own define for it to keep everything compiler independent.
276
277         Inline just speeds things up, so if we don't recognice the architecture we
278         just define an empty INLINE and take a minor performance hit.
279
280 */
281
282 #ifdef  __GNUC__                                                                                        /* GNU C and family */
283 #               define                  INLINE                                  inline
284 #endif
285
286 #ifdef  __TURBOC__                                                                                      /* Borland Turbo C, Turbo C++, and Borland C++ */
287 #               define                  INLINE                                  __inline
288 #endif
289
290 #ifdef  _MSC                                                                                            /* Visual C++ */
291 #               define                  INLINE                                  _inline         
292 #endif
293
294 #ifdef __STORM
295 #               define                  INLINE                                  __inline        /* Storm C4 */
296 #endif
297
298 #ifdef __VBCC__
299 #               define                  INLINE                                                  /* VBCC */
300 #endif
301
302 #ifndef INLINE
303 #               define                  INLINE                                                          /* Empty construct default, minor performance hit. */
304 #endif
305
306
307 /*____ To make sure that certain necessary defines are set... */
308
309 #ifndef FALSE
310 #       define         FALSE           0
311 #endif
312
313 #ifndef TRUE
314 #       define         TRUE            1
315 #endif
316
317 /*==== Other Global Definitions, placed here for convenience ==================*/
318
319 /*#define                       PRECISE_TIMER*/         /* Gives more accurate speed calculations, */
320                                                                                 /* just for debug purposes. Disable in release version! */
321
322 typedef         unsigned        char    uchar;
323
324 #if (defined(UNIX_SYSTEM) && !defined(SYS_TYPES_H) && !defined(_SYS_TYPES_H)) || (!defined UNIX_SYSTEM  && !defined(__GNUC__))
325                 typedef         unsigned short  ushort;
326                 typedef         unsigned int    uint;
327 #endif
328
329
330 #endif          /* __SYSTEM__ */