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