1 /* ncbistd.h 2 * =========================================================================== 3 * 4 * PUBLIC DOMAIN NOTICE 5 * National Center for Biotechnology Information 6 * 7 * This software/database is a "United States Government Work" under the 8 * terms of the United States Copyright Act. It was written as part of 9 * the author's official duties as a United States Government employee and 10 * thus cannot be copyrighted. This software/database is freely available 11 * to the public for use. The National Library of Medicine and the U.S. 12 * Government have not placed any restriction on its use or reproduction. 13 * 14 * Although all reasonable efforts have been taken to ensure the accuracy 15 * and reliability of the software and data, the NLM and the U.S. 16 * Government do not and cannot warrant the performance or results that 17 * may be obtained by using this software or data. The NLM and the U.S. 18 * Government disclaim all warranties, express or implied, including 19 * warranties of performance, merchantability or fitness for any particular 20 * purpose. 21 * 22 * Please cite the author in any work or product based on this material. 23 * 24 * =========================================================================== 25 * 26 * File Name: ncbistd.h 27 * 28 * Author: Gish, Kans, Ostell, Schuler 29 * 30 * Version Creation Date: 1/1/91 31 * 32 * $Revision: 6.15 $ 33 * 34 * File Description: 35 * This system-independent header supposedly works "as is" 36 * with the system-dependent header files available for these 37 * system/compiler combinations: 38 * 39 * SunOS 40 * BSD UNIX 41 * SGI IRIX 42 * IBM AIX 43 * Cray UNICOS 44 * MS-DOS and Microsoft C compiler 45 * Macintosh with Apple MPW C and Symantec THINK C 46 * 47 * Modifications: 48 * -------------------------------------------------------------------------- 49 * Date Name Description of modification 50 * ------- ---------- ----------------------------------------------------- 51 * 52 * ========================================================================== 53 */ 54 #ifndef _NCBISTD_ 55 #define _NCBISTD_ 56 57 #if !defined(NDEBUG) && !defined(_DEBUG) 58 # define NDEBUG 59 #endif 60 61 #include <ncbilcl.h> 62 #ifndef _WIN32 63 # include <stdint.h> 64 #endif 65 #include <ncbiopt.h> 66 67 #ifndef LITTLE_ENDIAN 68 #define LITTLE_ENDIAN 1234 69 #define BIG_ENDIAN 4321 70 #define OTHER_ENDIAN 0 71 #endif 72 73 #ifndef BYTE_ORDER 74 #ifdef IS_LITTLE_ENDIAN 75 #define BYTE_ORDER LITTLE_ENDIAN 76 #else 77 #ifdef IS_BIG_ENDIAN 78 #define BYTE_ORDER BIG_ENDIAN 79 #else 80 #define BYTE_ORDER OTHER_ENDIAN 81 #endif 82 #endif 83 #endif 84 85 #ifndef INLINE 86 #ifdef __cplusplus 87 #define INLINE inline 88 #else 89 #define INLINE 90 #endif 91 #endif 92 93 /*----------------------------------------------------------------------*/ 94 /* Aliased Logicals, Datatypes */ 95 /*----------------------------------------------------------------------*/ 96 #ifndef PNTR 97 #define PNTR * 98 #endif 99 #ifndef HNDL 100 #define HNDL * 101 #endif 102 103 #ifndef FnPtr 104 typedef int (*Nlm_FnPtr)(void); 105 #define FnPtr Nlm_FnPtr 106 #endif 107 108 #ifndef VoidPtr 109 typedef void PNTR Nlm_VoidPtr; 110 #define VoidPtr Nlm_VoidPtr 111 #endif 112 #ifndef Pointer 113 #define Pointer Nlm_VoidPtr 114 #endif 115 116 #ifndef Handle 117 typedef void HNDL Nlm_Handle; 118 #define Handle Nlm_Handle 119 #endif 120 121 #ifndef Char 122 typedef char Nlm_Char, PNTR Nlm_CharPtr; 123 #define Char Nlm_Char 124 #define CharPtr Nlm_CharPtr 125 #endif 126 127 #ifndef Uchar 128 typedef unsigned char Nlm_Uchar, PNTR Nlm_UcharPtr; 129 #define Uchar Nlm_Uchar 130 #define UcharPtr Nlm_UcharPtr 131 #endif 132 133 #ifndef Boolean 134 typedef unsigned char Nlm_Boolean, PNTR Nlm_BoolPtr; 135 #define Boolean Nlm_Boolean 136 #define BoolPtr Nlm_BoolPtr 137 #endif 138 139 #ifndef Byte 140 typedef unsigned char Nlm_Byte, PNTR Nlm_BytePtr; 141 #define Byte Nlm_Byte 142 #define BytePtr Nlm_BytePtr 143 #define BYTE_MAX UCHAR_MAX 144 #endif 145 146 #ifndef Int1 147 typedef signed char Nlm_Int1, PNTR Nlm_Int1Ptr; 148 #define Int1 Nlm_Int1 149 #define Int1Ptr Nlm_Int1Ptr 150 #define INT1_MIN SCHAR_MIN 151 #define INT1_MAX SCHAR_MAX 152 #endif 153 154 #ifndef Uint1 155 typedef unsigned char Nlm_Uint1, PNTR Nlm_Uint1Ptr; 156 #define Uint1 Nlm_Uint1 157 #define Uint1Ptr Nlm_Uint1Ptr 158 #define UINT1_MAX UCHAR_MAX 159 #endif 160 161 #ifndef Int2 162 typedef short Nlm_Int2, PNTR Nlm_Int2Ptr; 163 #define Int2 Nlm_Int2 164 #define Int2Ptr Nlm_Int2Ptr 165 #define INT2_MIN SHRT_MIN 166 #define INT2_MAX SHRT_MAX 167 #endif 168 169 #ifndef Uint2 170 typedef unsigned short Nlm_Uint2, PNTR Nlm_Uint2Ptr; 171 #define Uint2 Nlm_Uint2 172 #define Uint2Ptr Nlm_Uint2Ptr 173 #define UINT2_MAX USHRT_MAX 174 #endif 175 176 #ifndef Int4 177 typedef signed int Nlm_Int4, PNTR Nlm_Int4Ptr; 178 #define Int4 Nlm_Int4 179 #define Int4Ptr Nlm_Int4Ptr 180 #define INT4_MIN (-2147483647-1) 181 #define INT4_MAX 2147483647 182 #endif 183 184 #ifndef Uint4 185 typedef unsigned int Nlm_Uint4, PNTR Nlm_Uint4Ptr; 186 #define Uint4 Nlm_Uint4 187 #define Uint4Ptr Nlm_Uint4Ptr 188 #define UINT4_MAX 4294967295U 189 #endif 190 191 #ifndef TIME_MAX 192 #define TIME_MAX ULONG_MAX 193 #endif 194 195 #ifndef FloatLo 196 typedef float Nlm_FloatLo, PNTR Nlm_FloatLoPtr; 197 #define FloatLo Nlm_FloatLo 198 #define FloatLoPtr Nlm_FloatLoPtr 199 #endif 200 201 #ifndef FloatHi 202 typedef double Nlm_FloatHi, PNTR Nlm_FloatHiPtr; 203 #define FloatHi Nlm_FloatHi 204 #define FloatHiPtr Nlm_FloatHiPtr 205 #endif 206 207 #ifndef BigScalar 208 #define BigScalar long 209 #endif 210 211 #ifndef USE_BIGINT_IDS 212 #define USE_BIGINT_IDS 0 213 #endif 214 215 #if USE_BIGINT_IDS 216 #define BIG_ID Int8 217 #define BIG_ID_PNTR Int8Ptr 218 #else 219 #define BIG_ID Int4 220 #define BIG_ID_PNTR Int4Ptr 221 #endif 222 223 /*----------------------------------------------------------------------*/ 224 /* Misc Common Macros */ 225 /*----------------------------------------------------------------------*/ 226 #ifndef SIZE_MAX 227 #define SIZE_MAX MAXALLOC 228 #endif 229 230 #ifndef PATH_MAX 231 #define PATH_MAX FILENAME_MAX 232 #endif 233 234 #ifndef NULL 235 #define NULL ((void *)0) 236 #endif 237 238 #ifndef NULLB 239 #define NULLB '\0' 240 #endif 241 242 #ifndef TRUE 243 #define TRUE ((Nlm_Boolean)1) 244 #endif 245 246 #ifndef FALSE 247 #define FALSE ((Nlm_Boolean)0) 248 #endif 249 250 #ifndef MIN 251 #define MIN(a,b) ((a)>(b)?(b):(a)) 252 #endif 253 254 #ifndef MAX 255 #define MAX(a,b) ((a)>=(b)?(a):(b)) 256 #endif 257 258 #ifndef ABS 259 #define ABS(a) ((a)>=0?(a):-(a)) 260 #endif 261 262 #ifndef SIGN 263 #define SIGN(a) ((a)>0?1:((a)<0?-1:0)) 264 #endif 265 266 #ifndef ROUNDUP /* Round A up to the nearest multiple of B */ 267 #define ROUNDUP(A,B) (((A)%(B)) != 0 ? (A)+(B)-((A)%(B)) : (A)) 268 #endif 269 270 #ifndef DIM 271 #define DIM(A) (sizeof(A)/sizeof((A)[0])) 272 #endif 273 274 #ifndef LN2 275 #define LN2 (0.693147180559945) 276 #endif 277 #ifndef LN10 278 #define LN10 (2.302585092994046) 279 #endif 280 281 /*----------------------------------------------------------------------*/ 282 /* Misc. MS-DOS-isms */ 283 /*----------------------------------------------------------------------*/ 284 #ifndef NEAR 285 #define NEAR 286 #endif 287 #ifndef FAR 288 #define FAR 289 #endif 290 #ifndef CDECL 291 #define CDECL 292 #endif 293 #ifndef PASCAL 294 #define PASCAL 295 #endif 296 #ifndef EXPORT 297 #define EXPORT 298 #endif 299 300 #ifndef LIBCALL 301 #ifdef _WINDLL 302 #define LIBCALL FAR PASCAL EXPORT 303 #else 304 #define LIBCALL FAR PASCAL 305 #endif 306 #endif 307 308 #ifndef LIBCALLBACK 309 #define LIBCALLBACK FAR PASCAL 310 #endif 311 312 #include <ncbi_skew_guard.h> 313 314 #endif 315