include/libtu/types.h

Sat, 22 Apr 2000 17:34:20 +0200

author
tuomov
date
Sat, 22 Apr 2000 17:34:20 +0200
changeset 8
c1994196683f
parent 5
f878a9ffa3e0
child 9
55e7f2ff6021
permissions
-rw-r--r--

trunk: changeset 11
Portability fixes

5
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
1 /*
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
2 * libtu/types.h
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
3 *
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
4 * Copyright (c) Tuomo Valkonen 1999-2000.
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
5 *
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
6 * This file is distributed under the terms of the "Artistic License".
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
7 * See the included file LICENSE for details.
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
8 */
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
9
8
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
10 #ifndef LIBTU_TYPES_H
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
11 #define LIBTU_TYPES_H
5
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
12
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
13 #include <sys/types.h>
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
14
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
15 #ifndef TRUE
8
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
16 #define TRUE 1
5
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
17 #endif
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
18
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
19 #ifndef FALSE
8
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
20 #define FALSE 0
5
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
21 #endif
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
22
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
23 #ifndef NULL
8
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
24 #define NULL ((void*)0)
5
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
25 #endif
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
26
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
27 #ifndef LIBTU_TYPEDEF_UXXX
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
28
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
29 /* All systems seem to define these whichever way they want to
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
30 * despite -D_*_SOURCE etc. so there is no easy way to know whether
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
31 * they can be typedef'd or not. Unless you want to go through using
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
32 * autoconf or similar methods. ==> Just stick to #define. :-(
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
33 */
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
34
8
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
35 #ifndef uchar
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
36 #define uchar unsigned char
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
37 #endif
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
38
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
39 #ifndef ushort
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
40 #define ushort unsigned short
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
41 #endif
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
42
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
43 #ifndef uint
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
44 #define uint unsigned int
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
45 #endif
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
46
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
47 #ifndef ulong
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
48 #define ulong unsigned long
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
49 #endif
5
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
50
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
51 #else /* LIBTU_TYPEDEF_UXXX */
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
52
8
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
53 #ifndef uchar
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
54 typedef unsigned char uchar;
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
55 #endif
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
56
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
57 #ifndef ushort
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
58 typedef unsigned short ushort;
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
59 #endif
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
60
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
61 #ifndef uint
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
62 typedef unsigned int uint;
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
63 #endif
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
64
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
65 #ifndef ulong
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
66 typedef unsigned long ulong;
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
67 #endif
5
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
68
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
69 #endif /* LIBTU_TYPEDEF_UXXX */
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
70
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
71
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
72 #ifndef LIBTU_TYPEDEF_BOOL
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
73
8
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
74 #ifndef bool
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
75 #define bool int
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
76 #endif
5
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
77
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
78 #else /* LIBTU_TYPEDEF_BOOL */
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
79
8
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
80 #ifndef bool
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
81 typedef int bool;
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
82 #endif
5
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
83
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
84 #endif /* LIBTU_TYPEDEF_BOOL */
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
85
8
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
86 #endif /* LIBTU_TYPES_H */

mercurial