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 { DA_FALSE = 0, DA_TRUE = 1 } Bool; 33 #ifndef FALSE 34 # define FALSE DA_FALSE 35 #endif 36 #ifndef TRUE 37 # define TRUE DA_TRUE 38 #endif 39 40 # if UCHAR_MAX == 0xff 41 # ifndef UINT8_TYPEDEF 42 # define UINT8_TYPEDEF 43 typedef unsigned char uint8; 44 # endif /* UINT8_TYPEDEF */ 45 # endif /* UCHAR_MAX */ 46 47 # if SCHAR_MAX == 0x7f 48 # ifndef INT8_TYPEDEF 49 # define INT8_TYPEDEF 50 typedef signed char int8; 51 # endif /* INT8_TYPEDEF */ 52 # endif /* SCHAR_MAX */ 53 54 # if UINT_MAX == 0xffff 55 # ifndef UINT16_TYPEDEF 56 # define UINT16_TYPEDEF 57 typedef unsigned int uint16; 58 # endif /* UINT16_TYPEDEF */ 59 # endif /* UINT_MAX */ 60 61 # if INT_MAX == 0x7fff 62 # ifndef INT16_TYPEDEF 63 # define INT16_TYPEDEF 64 typedef int int16; 65 # endif /* INT16_TYPEDEF */ 66 # endif /* INT_MAX */ 67 68 # if USHRT_MAX == 0xffff 69 # ifndef UINT16_TYPEDEF 70 # define UINT16_TYPEDEF 71 typedef unsigned short uint16; 72 # endif /* UINT16_TYPEDEF */ 73 # endif /* USHRT_MAX */ 74 75 # if SHRT_MAX == 0x7fff 76 # ifndef INT16_TYPEDEF 77 # define INT16_TYPEDEF 78 typedef short int16; 79 # endif /* INT16_TYPEDEF */ 80 # endif /* SHRT_MAX */ 81 82 # if UINT_MAX == 0xffffffff 83 # ifndef UINT32_TYPEDEF 84 # define UINT32_TYPEDEF 85 typedef unsigned int uint32; 86 # endif /* UINT32_TYPEDEF */ 87 # endif /* UINT_MAX */ 88 89 # if INT_MAX == 0x7fffffff 90 # ifndef INT32_TYPEDEF 91 # define INT32_TYPEDEF 92 typedef int int32; 93 # endif /* INT32_TYPEDEF */ 94 # endif /* INT_MAX */ 95 96 # if ULONG_MAX == 0xffffffff 97 # ifndef UINT32_TYPEDEF 98 # define UINT32_TYPEDEF 99 typedef unsigned long uint32; 100 # endif /* UINT32_TYPEDEF */ 101 # endif /* ULONG_MAX */ 102 103 # if LONG_MAX == 0x7fffffff 104 # ifndef INT32_TYPEDEF 105 # define INT32_TYPEDEF 106 typedef long int32; 107 # endif /* INT32_TYPEDEF */ 108 # endif /* LONG_MAX */ 109 110 # ifndef UINT8_TYPEDEF 111 # error "uint8 type is undefined!" 112 # endif 113 # ifndef INT8_TYPEDEF 114 # error "int8 type is undefined!" 115 # endif 116 # ifndef UINT16_TYPEDEF 117 # error "uint16 type is undefined!" 118 # endif 119 # ifndef INT16_TYPEDEF 120 # error "int16 type is undefined!" 121 # endif 122 # ifndef UINT32_TYPEDEF 123 # error "uint32 type is undefined!" 124 # endif 125 # ifndef INT32_TYPEDEF 126 # error "int32 type is undefined!" 127 # endif 128 129 130 #endif /* __TYPEDEFS_H */ 131 132 /* 133 vi:ts=4:ai:expandtab 134 */ 135