NCBI C++ ToolKit
ncbiopt.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef _NCBIOPT_
2 #define _NCBIOPT_
3 
4 /* $Id: ncbiopt.hpp 80115 2017-11-08 12:52:45Z ivanov $
5 * ==========================================================================
6 *
7 * PUBLIC DOMAIN NOTICE
8 * National Center for Biotechnology Information
9 *
10 * This software/database is a "United States Government Work" under the
11 * terms of the United States Copyright Act. It was written as part of
12 * the author's official duties as a United States Government employee and
13 * thus cannot be copyrighted. This software/database is freely available
14 * to the public for use. The National Library of Medicine and the U.S.
15 * Government have not placed any restriction on its use or reproduction.
16 *
17 * Although all reasonable efforts have been taken to ensure the accuracy
18 * and reliability of the software and data, the NLM and the U.S.
19 * Government do not and cannot warrant the performance or results that
20 * may be obtained by using this software or data. The NLM and the U.S.
21 * Government disclaim all warranties, express or implied, including
22 * warranties of performance, merchantability or fitness for any particular
23 * purpose.
24 *
25 * Please cite the author in any work or product based on this material.
26 *
27 * ==========================================================================
28 *
29 * Authors: Denis Vakatov, Hugues Sicotte
30 *
31 * File Description:
32 * Miscellaneous platform-dependent types etc. that are probably not
33 * available or not exactly in-sync for different platforms
34 *
35 * ==========================================================================
36 */
37 
38 
39 /** @addtogroup CToolsBridge
40  *
41  * @{
42  */
43 
44 
45 /********************************************************
46  *
47  * Int8, Uint8, INT8_MIN, INT8_MAX, UINT8_MAX
48  *
49  * NOTE: define it as Int4 for the platforms with no 8-byte integers
50  *
51  * TESTED WITH:
52  * SunOS peony 5.6 Generic_105181-04 sun4u sparc SUNW,Ultra-1
53  * cc: WorkShop Compilers 4.2 30 Oct 1996 C 4.2
54  * CC: WorkShop Compilers 4.2 18 Sep 1997 C++ 4.2 patch 104631-04
55  * gcc, g++: gcc version 2.7.2.3
56  *
57  * SunOS oldies 4.1.3_U1 22 sun4m
58  * CC: SC3.0.1 07 Jul 1995
59  * gcc, g++: gcc version 2.7.2.3
60  *
61  * IRIX64 muncher 6.4 02121744 IP27
62  * cc: ???
63  *
64  * IRIX leo 5.3 08031226 IP22 mips
65  * cc: ???
66  *
67  * OSF1 annie V4.0 564 alpha
68  * gcc, g++: gcc version 2.8.0
69  * cc: ???
70  *
71  * 16-bit MS-Windows applications built with:
72  * Visual C++ 1.52 (Int8 is not supported, so gets substituted by Int4)
73  *
74  * 32-bit MS-Windows applications built with:
75  * Visual C++ 4.2
76  * Visual C++ 5.0
77  * Borland C++ 4.5 (Int8 is not supported, so gets substituted by Int4)
78  */
79 
80 /*
81 Avoid errors when stdint.h tries to 'redefine' standard macros that we've corrupted,
82 by including it first.
83 */
84 #if defined(__MWERKS__) || defined(OS_UNIX_DARWIN)
85 #include <stdint.h>
86 #endif
87 
88 #if !defined(Int8) || !defined(Uint8) || !defined(Int8Ptr) || !defined(Uint8Ptr)
89 
90 # if defined(Int8) || defined(Uint8) || defined(Int8Ptr) || defined(Uint8Ptr)
91  /* aut Caesar aut nihil... */
92  ;;;!!!PARTIALLY DEFINED 8-BYTE INTEGER TYPES!!!;;;
93 # endif
94 
95  /* If C++ Toolkit headers have been included, formally stick with their
96  definitions for consistency. */
97 # ifdef CORELIB___NCBITYPE__H
98 # define Int8 Int8
99 # define Uint8 Uint8
100 
101  /* on 64-bit operating systems, the long data type is already 8 bytes */
102 # elif LONG_BIT==64 /* && !defined(OS_UNIX_LINUX) */
103 # define Int8 long
104 # define Uint8 unsigned long
105 
106  /* GNU compiler defines "long long" data type */
107 # elif defined(__GNUC__)
108 # define Int8 long long
109 # define Uint8 unsigned long long
110 
111  /* use the compiler-dependent internal data types */
112 # elif defined(OS_NT) && _INTEGRAL_MAX_BITS >= 64
113 # define Int8 __int64
114 # define Uint8 unsigned __int64
115 
116 # elif defined(OS_UNIX)
117  /* (signed) */
118 # if defined(OS_UNIX_LINUX) || defined(OS_UNIX_SOL) || \
119  defined(OS_UNIX_IRIX) || defined(PROC_HPPA) || defined(OS_UNIX_AIX) || defined(OS_UNIX_DARWIN)
120 # define Int8 long long
121 # elif defined(PROC_ALPHA)
122 # define Int8 long
123 # endif
124 
125  /* (unsigned) */
126 # if defined(Int8)
127 # define Uint8 unsigned Int8
128 # endif
129 
130 # elif defined(OS_MAC)
131 # if defined(PROC_PPC)
132 # define Int8 long long
133 # define Uint8 unsigned long long
134 # elif defined(PROC_I80X86)
135 # define Int8 long long
136 # define Uint8 unsigned long long
137 # elif defined(PROC_MC680X0)
138 # define Int8 long long
139 # define Uint8 unsigned long long
140 # endif
141 
142 # elif defined(PROC_ALPHA)
143 # define Uint8 unsigned long
144 # define Int8 long
145 
146 # endif /* #definitions of Int8,Uint8 for known platforms and compilers */
147 
148 
149 
150 /* Have to undefine Int8 limits if already defined, as on some platforms
151  * INT8_MAX, etc. exist but refer to 8-bit(not 8-byte!) integers
152  RGS no need to worry about partially Defined stuff if we do them individually
153 */
154 # if defined(INT8_MIN)
155 # undef INT8_MIN
156 # endif
157 # if defined(INT8_MAX)
158 # undef INT8_MAX
159 # endif
160 # if defined(UINT8_MAX)
161 # undef UINT8_MAX
162 # endif
163 
164 # if defined(Int8) || defined(Uint8)
165 
166 # if !defined(Int8) || !defined(Uint8)
167  ;;;!!!PARTIALLY DEFINED 8-BYTE INTEGER TYPES!!!;;;
168 # endif
169 
170  typedef Int8 Nlm_Int8;
171  typedef Int8* Nlm_Int8Ptr;
172  typedef Uint8 Nlm_Uint8;
173  typedef Uint8* Nlm_Uint8Ptr;
174 
175 
176 /* RGS
177 # if defined(INT8_MIN) || defined(INT8_MAX) || defined(UINT8_MAX)
178 # if !defined(INT8_MIN) || !defined(INT8_MAX) || !defined(UINT8_MAX)
179  ;;;!!!PARTIALLY DEFINED 8-BYTE INTEGER LIMITS!!!;;;
180 # endif
181 # undef INT8_MIN
182 # undef INT8_MAX
183 # undef UINT8_MAX
184 # endif
185 */
186 
187 # if LONG_BIT==64
188 # define INT8_MIN LONG_MIN
189 # define INT8_MAX LONG_MAX
190 # define UINT8_MAX ULONG_MAX
191 
192 # elif defined(__GNUC__) && defined(LONG_LONG_MIN)
193 # define INT8_MIN LONG_LONG_MIN
194 # define INT8_MAX LONG_LONG_MAX
195 # define UINT8_MAX ULONG_LONG_MAX
196 
197 # elif defined(OS_NT) && ! defined(COMP_METRO)
198 # define INT8_MIN _I64_MIN
199 # define INT8_MAX _I64_MAX
200 # define UINT8_MAX _UI64_MAX
201 # else /* def GNUC, LONG_BIT==64 */
202 # ifdef LLONG_MIN
203 # define INT8_MIN LLONG_MIN
204 # else
205 # define INT8_MIN (-9223372036854775807LL-1LL)
206 # endif
207 
208 # ifdef LLONG_MAX
209 # define INT8_MAX LLONG_MAX
210 # else
211 # define INT8_MAX 9223372036854775807LL
212 # endif
213 
214 # ifdef ULLONG_MAX
215 # define UINT8_MAX ULLONG_MAX
216 # else
217 # define UINT8_MAX 18446744073709551615ULL
218 # endif
219 # endif /* else def GNUC, LONG_BIT==64 */
220 
221  /* will be (re)defined after this #if */
222 # undef Int8
223 # undef Uint8
224 
225 # else
226  /* Until we migrate to C++, and we can overload operations and
227  * specify type conversions, we cannot simply define the Int8 datatype
228  * as a structure...
229  * Type the Int8 as Int4 so we can compile the tools.
230  */
231 # define Nlm_Int8 Nlm_Int4
232 # define Nlm_Int8Ptr Nlm_Int4Ptr
233 # define Nlm_Uint8 Nlm_Uint4
234 # define Nlm_Uint8Ptr Nlm_Uint4Ptr
235 
236 # define INT8_MIN INT4_MIN
237 # define INT8_MAX INT4_MAX
238 # define UINT8_MAX UINT4_MAX
239 
240 # endif /* else def Int8,Uint8 */
241 
242 
243 /* The final type definitions
244  */
245 # define Int8 Nlm_Int8
246 # define Uint8 Nlm_Uint8
247 # define Int8Ptr Nlm_Int8Ptr
248 # define Uint8Ptr Nlm_Uint8Ptr
249 
250 #endif /* ndef Int8, ndef Uint8, ndef Int8Ptr, ndef Uint8Ptr */
251 
252 
253  /* @} */
254 
255 #endif /* _NCBIOPT_ */
unsigned char BYTE
Definition: sybdb.h:334
#define Nlm_Int8Ptr
Definition: ncbiopt.hpp:232
#define Nlm_Uint8Ptr
Definition: ncbiopt.hpp:234
#define Nlm_Int8
Definition: ncbiopt.hpp:231
#define Nlm_Uint8
Definition: ncbiopt.hpp:233
int64_t Int8
8-byte (64-bit) signed integer
Definition: ncbitype.h:104
uint64_t Uint8
8-byte (64-bit) unsigned integer
Definition: ncbitype.h:105
Modified on Fri May 24 14:55:45 2024 by modify_doxy.py rev. 669887