xref: /plan9/sys/src/cmd/bzip2/lib/os.h (revision 59cc4ca53493a3c6d2349fe2b7f7c40f7dce7294)
1 /*
2  * THIS FILE IS NOT IDENTICAL TO THE ORIGINAL
3  * FROM THE BZIP2 DISTRIBUTION.
4  *
5  * It has been modified, mainly to break the library
6  * into smaller pieces.
7  *
8  * Russ Cox
9  * rsc@plan9.bell-labs.com
10  * July 2000
11  */
12 
13 /*---------------------------------------------*/
14 /*--
15   Place a 1 beside your platform, and 0 elsewhere.
16   Attempts to autosniff this even if you don't.
17 --*/
18 
19 
20 /*--
21   Generic 32-bit Unix.
22   Also works on 64-bit Unix boxes.
23 --*/
24 #define BZ_UNIX      1
25 
26 /*--
27   Win32, as seen by Jacob Navia's excellent
28   port of (Chris Fraser & David Hanson)'s excellent
29   lcc compiler.
30 --*/
31 #define BZ_LCCWIN32  0
32 
33 #if defined(_WIN32) && !defined(__CYGWIN__)
34 #undef  BZ_LCCWIN32
35 #define BZ_LCCWIN32 1
36 #undef  BZ_UNIX
37 #define BZ_UNIX 0
38 #endif
39 
40 /*--
41   Plan 9 from Bell Labs
42 --*/
43 #define BZ_PLAN9     0
44 
45 #if defined(PLAN9)
46 #undef  BZ_UNIX
47 #define BZ_UNIX 0
48 #undef  BZ_PLAN9
49 #define BZ_PLAN9 1
50 #endif
51 
52 #if BZ_UNIX
53 # include "unix.h"
54 #elif BZ_LCCWIN32
55 # include "lccwin32.h"
56 #elif BZ_PLAN9
57 # include "plan9.h"
58 #endif
59 
60 #ifdef __GNUC__
61 #   define NORETURN __attribute__ ((noreturn))
62 #else
63 #   define NORETURN /**/
64 #endif
65 
66 /*--
67   Some more stuff for all platforms :-)
68   This might have to get moved into the platform-specific
69   header files if we encounter a machine with different sizes.
70 --*/
71 
72 typedef char            Char;
73 typedef unsigned char   Bool;
74 typedef unsigned char   UChar;
75 typedef int             Int32;
76 typedef unsigned int    UInt32;
77 typedef short           Int16;
78 typedef unsigned short  UInt16;
79 
80 #define True  ((Bool)1)
81 #define False ((Bool)0)
82 
83 /*--
84   IntNative is your platform's `native' int size.
85   Only here to avoid probs with 64-bit platforms.
86 --*/
87 typedef int IntNative;
88 
89