Wed, 28 May 2003 23:48:16 +0200
trunk: changeset 57
License changed to Artistic/LGPL dual license.
5 | 1 | /* |
2 | * libtu/types.h | |
3 | * | |
36 | 4 | * Copyright (c) Tuomo Valkonen 1999-2002. |
53 | 5 | * |
6 | * You may distribute and modify this library under the terms of either | |
7 | * the Clarified Artistic License or the GNU LGPL, version 2.1 or later. | |
5 | 8 | */ |
9 | ||
8 | 10 | #ifndef LIBTU_TYPES_H |
11 | #define LIBTU_TYPES_H | |
5 | 12 | |
13 | #include <sys/types.h> | |
14 | ||
15 | #ifndef TRUE | |
8 | 16 | #define TRUE 1 |
5 | 17 | #endif |
18 | ||
19 | #ifndef FALSE | |
8 | 20 | #define FALSE 0 |
5 | 21 | #endif |
22 | ||
23 | #ifndef NULL | |
8 | 24 | #define NULL ((void*)0) |
5 | 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 | ||
8 | 35 | #ifndef uchar |
36 | #define uchar unsigned char | |
37 | #endif | |
38 | ||
39 | #ifndef ushort | |
40 | #define ushort unsigned short | |
41 | #endif | |
42 | ||
43 | #ifndef uint | |
44 | #define uint unsigned int | |
45 | #endif | |
46 | ||
47 | #ifndef ulong | |
48 | #define ulong unsigned long | |
49 | #endif | |
5 | 50 | |
51 | #else /* LIBTU_TYPEDEF_UXXX */ | |
52 | ||
8 | 53 | #ifndef uchar |
54 | typedef unsigned char uchar; | |
55 | #endif | |
56 | ||
57 | #ifndef ushort | |
58 | typedef unsigned short ushort; | |
59 | #endif | |
60 | ||
61 | #ifndef uint | |
62 | typedef unsigned int uint; | |
63 | #endif | |
64 | ||
65 | #ifndef ulong | |
66 | typedef unsigned long ulong; | |
67 | #endif | |
5 | 68 | |
69 | #endif /* LIBTU_TYPEDEF_UXXX */ | |
70 | ||
71 | ||
72 | #ifndef LIBTU_TYPEDEF_BOOL | |
73 | ||
8 | 74 | #ifndef bool |
75 | #define bool int | |
76 | #endif | |
5 | 77 | |
78 | #else /* LIBTU_TYPEDEF_BOOL */ | |
79 | ||
8 | 80 | #ifndef bool |
81 | typedef int bool; | |
82 | #endif | |
5 | 83 | |
84 | #endif /* LIBTU_TYPEDEF_BOOL */ | |
85 | ||
8 | 86 | #endif /* LIBTU_TYPES_H */ |