include/types.h

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

mercurial