d385b6157179b1aff2e77849c1b70f72c3b22f85
[platform/upstream/libdatrie.git] / datrie / typedefs.h
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * libdatrie - Double-Array Trie Library
4  * Copyright (C) 2006  Theppitak Karoonboonyanan <theppitak@gmail.com>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19  */
20
21 /*
22  * typedefs.h - general types
23  * Created : 11 Aug 2006
24  * Author  : Theppitak Karoonboonyanan <theppitak@gmail.com>
25  */
26
27 #ifndef __TYPEDEFS_H
28 #define __TYPEDEFS_H
29
30 #include <limits.h>
31
32 typedef enum { FALSE = 0, TRUE = 1 } Bool;
33
34 # if UCHAR_MAX == 0xff
35 #   ifndef UINT8_TYPEDEF
36 #     define UINT8_TYPEDEF
37       typedef unsigned char  uint8;
38 #   endif /* UINT8_TYPEDEF */
39 # endif /* UCHAR_MAX */
40
41 # if SCHAR_MAX == 0x7f
42 #   ifndef INT8_TYPEDEF
43 #     define INT8_TYPEDEF
44       typedef signed char    int8;
45 #   endif /* INT8_TYPEDEF */
46 # endif /* SCHAR_MAX */
47
48 # if UINT_MAX == 0xffff
49 #   ifndef UINT16_TYPEDEF
50 #     define UINT16_TYPEDEF
51       typedef unsigned int   uint16;
52 #   endif /* UINT16_TYPEDEF */
53 # endif /* UINT_MAX */
54
55 # if INT_MAX == 0x7fff
56 #   ifndef INT16_TYPEDEF
57 #     define INT16_TYPEDEF
58       typedef int            int16;
59 #   endif /* INT16_TYPEDEF */
60 # endif /* INT_MAX */
61
62 # if USHRT_MAX == 0xffff
63 #   ifndef UINT16_TYPEDEF
64 #     define UINT16_TYPEDEF
65       typedef unsigned short uint16;
66 #   endif /* UINT16_TYPEDEF */
67 # endif /* USHRT_MAX */
68
69 # if SHRT_MAX == 0x7fff
70 #   ifndef INT16_TYPEDEF
71 #     define INT16_TYPEDEF
72       typedef short          int16;
73 #   endif /* INT16_TYPEDEF */
74 # endif /* SHRT_MAX */
75
76 # if UINT_MAX == 0xffffffff
77 #   ifndef UINT32_TYPEDEF
78 #     define UINT32_TYPEDEF
79       typedef unsigned int   uint32;
80 #   endif /* UINT32_TYPEDEF */
81 # endif /* UINT_MAX */
82
83 # if INT_MAX == 0x7fffffff
84 #   ifndef INT32_TYPEDEF
85 #     define INT32_TYPEDEF
86       typedef int            int32;
87 #   endif /* INT32_TYPEDEF */
88 # endif /* INT_MAX */
89
90 # if ULONG_MAX == 0xffffffff
91 #   ifndef UINT32_TYPEDEF
92 #     define UINT32_TYPEDEF
93       typedef unsigned long  uint32;
94 #   endif /* UINT32_TYPEDEF */
95 # endif /* ULONG_MAX */
96
97 # if LONG_MAX == 0x7fffffff
98 #   ifndef INT32_TYPEDEF
99 #     define INT32_TYPEDEF
100       typedef long           int32;
101 #   endif /* INT32_TYPEDEF */
102 # endif /* LONG_MAX */
103
104 # ifndef UINT8_TYPEDEF
105 #   error "uint8 type is undefined!"
106 # endif
107 # ifndef INT8_TYPEDEF
108 #   error "int8 type is undefined!"
109 # endif
110 # ifndef UINT16_TYPEDEF
111 #   error "uint16 type is undefined!"
112 # endif
113 # ifndef INT16_TYPEDEF
114 #   error "int16 type is undefined!"
115 # endif
116 # ifndef UINT32_TYPEDEF
117 #   error "uint32 type is undefined!"
118 # endif
119 # ifndef INT32_TYPEDEF
120 #   error "int32 type is undefined!"
121 # endif
122
123 typedef uint8  byte;
124 typedef uint16 word;
125 typedef uint32 dword;
126
127
128 #endif /* __TYPEDEFS_H */
129
130 /*
131 vi:ts=4:ai:expandtab
132 */