Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line | 
|---|---|---|---|
| 26 | pmbaty | 1 | /* ucl_conf.h -- main internal configuration file for the the UCL library | 
| 2 | |||
| 3 |    This file is part of the UCL data compression library. | ||
| 4 | |||
| 5 |    Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer | ||
| 6 |    All Rights Reserved. | ||
| 7 | |||
| 8 |    The UCL library is free software; you can redistribute it and/or | ||
| 9 |    modify it under the terms of the GNU General Public License as | ||
| 10 |    published by the Free Software Foundation; either version 2 of | ||
| 11 |    the License, or (at your option) any later version. | ||
| 12 | |||
| 13 |    The UCL library is distributed in the hope that it will be useful, | ||
| 14 |    but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 |    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||
| 16 |    GNU General Public License for more details. | ||
| 17 | |||
| 18 |    You should have received a copy of the GNU General Public License | ||
| 19 |    along with the UCL library; see the file COPYING. | ||
| 20 |    If not, write to the Free Software Foundation, Inc., | ||
| 21 |    59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
| 22 | |||
| 23 |    Markus F.X.J. Oberhumer | ||
| 24 |    <markus@oberhumer.com> | ||
| 25 |    http://www.oberhumer.com/opensource/ucl/ | ||
| 26 |  */ | ||
| 27 | |||
| 28 | |||
| 29 | /* WARNING: this file should *not* be used by applications. It is | ||
| 30 |    part of the implementation of the library and is subject | ||
| 31 |    to change. | ||
| 32 |  */ | ||
| 33 | |||
| 34 | |||
| 35 | #ifndef __UCL_CONF_H | ||
| 36 | #define __UCL_CONF_H | ||
| 37 | |||
| 38 | |||
| 39 | /*********************************************************************** | ||
| 40 | // | ||
| 41 | ************************************************************************/ | ||
| 42 | |||
| 43 | #if defined(__UCLCONF_H_INCLUDED) | ||
| 44 | #  error "include this file first" | ||
| 45 | #endif | ||
| 46 | #include <ucl/uclconf.h> | ||
| 47 | |||
| 48 | #if defined(UCL_HAVE_CONFIG_H) | ||
| 49 | #  define ACC_CONFIG_NO_HEADER 1 | ||
| 50 | #endif | ||
| 51 | #define __ACCLIB_FUNCNAME(f)        error_do_not_use_acclib | ||
| 52 | #include "acc/acc.h" | ||
| 53 | |||
| 54 | #if (ACC_CC_MSC && (_MSC_VER >= 1300)) | ||
| 55 |    /* avoid `-Wall' warnings in system header files */ | ||
| 56 | #  pragma warning(disable: 4820) | ||
| 57 |    /* avoid warnings about inlining */ | ||
| 58 | #  pragma warning(disable: 4710 4711) | ||
| 59 | #endif | ||
| 60 | |||
| 61 | #if defined(__UCL_MMODEL_HUGE) && (!ACC_HAVE_MM_HUGE_PTR) | ||
| 62 | #  error "this should not happen - check defines for __huge" | ||
| 63 | #endif | ||
| 64 | #if !defined(__UCL_MMODEL_HUGE) && defined(HAVE_MEMCMP) | ||
| 65 | #  define ucl_memcmp(a,b,c)     memcmp(a,b,c) | ||
| 66 | #endif | ||
| 67 | #if !defined(__UCL_MMODEL_HUGE) && defined(HAVE_MEMCPY) | ||
| 68 | #  define ucl_memcpy(a,b,c)     memcpy(a,b,c) | ||
| 69 | #endif | ||
| 70 | #if !defined(__UCL_MMODEL_HUGE) && defined(HAVE_MEMMOVE) | ||
| 71 | #  define ucl_memmove(a,b,c)    memmove(a,b,c) | ||
| 72 | #endif | ||
| 73 | #if !defined(__UCL_MMODEL_HUGE) && defined(HAVE_MEMSET) | ||
| 74 | #  define ucl_memset(a,b,c)     memset(a,b,c) | ||
| 75 | #endif | ||
| 76 | |||
| 77 | #if (ACC_OS_DOS16 + 0 != UCL_OS_DOS16 + 0) | ||
| 78 | #  error "DOS16" | ||
| 79 | #endif | ||
| 80 | #if (ACC_OS_OS216 + 0 != UCL_OS_OS216 + 0) | ||
| 81 | #  error "OS216" | ||
| 82 | #endif | ||
| 83 | #if (ACC_OS_WIN16 + 0 != UCL_OS_WIN16 + 0) | ||
| 84 | #  error "WIN16" | ||
| 85 | #endif | ||
| 86 | #if (ACC_OS_DOS32 + 0 != UCL_OS_DOS32 + 0) | ||
| 87 | #  error "DOS32" | ||
| 88 | #endif | ||
| 89 | #if (ACC_OS_OS2 + 0 != UCL_OS_OS2 + 0) | ||
| 90 | #  error "DOS32" | ||
| 91 | #endif | ||
| 92 | #if (ACC_OS_WIN32 + 0 != UCL_OS_WIN32 + 0) | ||
| 93 | #  error "WIN32" | ||
| 94 | #endif | ||
| 95 | #if (ACC_OS_WIN64 + 0 != UCL_OS_WIN64 + 0) | ||
| 96 | #  error "WIN64" | ||
| 97 | #endif | ||
| 98 | |||
| 99 | |||
| 100 | #include "acc/acc_incd.h" | ||
| 101 | #if (ACC_OS_DOS16 || ACC_OS_OS216 || ACC_OS_WIN16) | ||
| 102 | #  include "acc/acc_ince.h" | ||
| 103 | #  include "acc/acc_inci.h" | ||
| 104 | #endif | ||
| 105 | |||
| 106 | #undef NDEBUG | ||
| 107 | #if !defined(UCL_DEBUG) | ||
| 108 | #  define NDEBUG 1 | ||
| 109 | #endif | ||
| 110 | #include <assert.h> | ||
| 111 | |||
| 112 | |||
| 113 | #if (ACC_OS_DOS16 || ACC_OS_OS216 || ACC_OS_WIN16) && (ACC_CC_BORLANDC) | ||
| 114 | #  if (__BORLANDC__ >= 0x0450)  /* v4.00 */ | ||
| 115 | #    pragma option -h           /* enable fast huge pointers */ | ||
| 116 | #  else | ||
| 117 | #    pragma option -h-          /* disable fast huge pointers - compiler bug */ | ||
| 118 | #  endif | ||
| 119 | #endif | ||
| 120 | |||
| 121 | |||
| 122 | /*********************************************************************** | ||
| 123 | // | ||
| 124 | ************************************************************************/ | ||
| 125 | |||
| 126 | #if 1 | ||
| 127 | #  define UCL_BYTE(x)       ((unsigned char) (x)) | ||
| 128 | #else | ||
| 129 | #  define UCL_BYTE(x)       ((unsigned char) ((x) & 0xff)) | ||
| 130 | #endif | ||
| 131 | #if 0 | ||
| 132 | #  define UCL_USHORT(x)     ((unsigned short) (x)) | ||
| 133 | #else | ||
| 134 | #  define UCL_USHORT(x)     ((unsigned short) ((x) & 0xffff)) | ||
| 135 | #endif | ||
| 136 | |||
| 137 | #define UCL_MAX(a,b)        ((a) >= (b) ? (a) : (b)) | ||
| 138 | #define UCL_MIN(a,b)        ((a) <= (b) ? (a) : (b)) | ||
| 139 | #define UCL_MAX3(a,b,c)     ((a) >= (b) ? UCL_MAX(a,c) : UCL_MAX(b,c)) | ||
| 140 | #define UCL_MIN3(a,b,c)     ((a) <= (b) ? UCL_MIN(a,c) : UCL_MIN(b,c)) | ||
| 141 | |||
| 142 | #define ucl_sizeof(type)    ((ucl_uint) (sizeof(type))) | ||
| 143 | |||
| 144 | #define UCL_HIGH(array)     ((ucl_uint) (sizeof(array)/sizeof(*(array)))) | ||
| 145 | |||
| 146 | /* this always fits into 16 bits */ | ||
| 147 | #define UCL_SIZE(bits)      (1u << (bits)) | ||
| 148 | #define UCL_MASK(bits)      (UCL_SIZE(bits) - 1) | ||
| 149 | |||
| 150 | #define UCL_LSIZE(bits)     (1ul << (bits)) | ||
| 151 | #define UCL_LMASK(bits)     (UCL_LSIZE(bits) - 1) | ||
| 152 | |||
| 153 | #define UCL_USIZE(bits)     ((ucl_uint) 1 << (bits)) | ||
| 154 | #define UCL_UMASK(bits)     (UCL_USIZE(bits) - 1) | ||
| 155 | |||
| 156 | /* Maximum value of a signed/unsigned type. | ||
| 157 |    Do not use casts, avoid overflows ! */ | ||
| 158 | #define UCL_STYPE_MAX(b)    (((1l  << (8*(b)-2)) - 1l)  + (1l  << (8*(b)-2))) | ||
| 159 | #define UCL_UTYPE_MAX(b)    (((1ul << (8*(b)-1)) - 1ul) + (1ul << (8*(b)-1))) | ||
| 160 | |||
| 161 | |||
| 162 | /*********************************************************************** | ||
| 163 | // compiler and architecture specific stuff | ||
| 164 | ************************************************************************/ | ||
| 165 | |||
| 166 | /* Some defines that indicate if memory can be accessed at unaligned | ||
| 167 |  * memory addresses. You should also test that this is actually faster | ||
| 168 |  * even if it is allowed by your system. | ||
| 169 |  */ | ||
| 170 | |||
| 171 | #undef UA_GET2 | ||
| 172 | #undef UA_SET2 | ||
| 173 | #undef UA_GET4 | ||
| 174 | #undef UA_SET4 | ||
| 175 | #if 1 && (ACC_ARCH_AMD64 || ACC_ARCH_IA32) | ||
| 176 | #  define UA_GET2(p)    (* (const ucl_ushortp) (p)) | ||
| 177 | #  define UA_SET2(p)    (* (ucl_ushortp) (p)) | ||
| 178 | #  define UA_GET4(p)    (* (const acc_uint32e_t *) (p)) | ||
| 179 | #  define UA_SET4(p)    (* (acc_uint32e_t *) (p)) | ||
| 180 | #elif 0 && (ACC_ARCH_M68K) && (ACC_CC_GNUC >= 0x020900ul) | ||
| 181 | typedef struct { unsigned short v; } __ucl_ua2_t __attribute__((__aligned__(1))); | ||
| 182 | typedef struct { unsigned long v; } __ucl_ua4_t __attribute__((__aligned__(1))); | ||
| 183 | #  define UA_GET2(p)    (((const __ucl_ua2_t *)(p))->v) | ||
| 184 | #  define UA_SET2(p)    (((__ucl_ua2_t *)(p))->v) | ||
| 185 | #  define UA_GET4(p)    (((const __ucl_ua4_t *)(p))->v) | ||
| 186 | #  define UA_SET4(p)    (((__ucl_ua4_t *)(p))->v) | ||
| 187 | #endif | ||
| 188 | |||
| 189 | |||
| 190 | /*********************************************************************** | ||
| 191 | // some globals | ||
| 192 | ************************************************************************/ | ||
| 193 | |||
| 194 | __UCL_EXTERN_C int __ucl_init_done; | ||
| 195 | UCL_EXTERN(const ucl_bytep) ucl_copyright(void); | ||
| 196 | |||
| 197 | |||
| 198 | /*********************************************************************** | ||
| 199 | // ANSI C preprocessor macros | ||
| 200 | ************************************************************************/ | ||
| 201 | |||
| 202 | #define _UCL_STRINGIZE(x)           #x | ||
| 203 | #define _UCL_MEXPAND(x)             _UCL_STRINGIZE(x) | ||
| 204 | |||
| 205 | |||
| 206 | /*********************************************************************** | ||
| 207 | // | ||
| 208 | ************************************************************************/ | ||
| 209 | |||
| 210 | #include "ucl_ptr.h" | ||
| 211 | |||
| 212 | |||
| 213 | #endif /* already included */ | ||
| 214 | |||
| 215 | /* | ||
| 216 | vi:ts=4:et | ||
| 217 | */ | ||
| 218 |