NCBI C Toolkit Cross Reference

C/corelib/ncbilcl.h


  1 /*   ncbilcl.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:  ncbilcl.h
 27 *
 28 * Author:  Gish, Kans, Ostell, Schuler
 29 *
 30 * Version Creation Date:   1/1/91
 31 *
 32 * $Revision: 6.6 $
 33 *
 34 * File Description:
 35 *               system dependent header
 36 *               MS Windows version
 37 *               MCVC++ and Borland C++ compilers
 38 *
 39 * Modifications:
 40 * --------------------------------------------------------------------------
 41 * $Log: ncbilcl.msw,v $
 42 * Revision 6.6  2006/09/08 16:12:45  coulouri
 43 * add x64 support
 44 *
 45 * Revision 6.5  2003/12/24 18:37:55  vakatov
 46 * More consistent #define of FAR and near (as per D.Sinyakov's request).
 47 * Also, get rid of all WIN16-related code (it's just not supported nowdays).
 48 *
 49 * Revision 6.4  2002/11/22 20:05:04  lavr
 50 * Configure HAVE_STRDUP and HAVE_STRCASECMP
 51 *
 52 * Revision 6.3  1999/11/26 21:23:01  vakatov
 53 * Use pragma to get rid of annoying warnings when compiling for DLL
 54 *
 55 * Revision 6.2  1999/03/17 15:37:23  vakatov
 56 * Set the default(<ncbistd.h>) "Nlm_Int4" to "int" rather tnan "long";
 57 * the same for "Nlm_Uint4";  modifyed the concerned "ncbilcl.*" files
 58 * accordingly.
 59 *
 60 * Revision 6.1  1998/07/28 20:28:42  vakatov
 61 * [WIN32,_MT]  #define WIN32_THREADS_AVAIL
 62 *
 63 * Revision 6.0  1997/08/25 18:16:07  madden
 64 * Revision changed to 6.0
 65 *
 66 * Revision 5.4  1997/07/22 19:11:29  vakatov
 67 * Separated Main() from GetArg[svc]() functions;  [WIN_MSWIN] converged
 68 * console and GUI libraries; [for WIN32-DLL] encapsulated global variables
 69 *
 70 * Revision 5.3  1997/06/27 17:05:35  vakatov
 71 * Merged "ncbilcl.bwn" to "ncbilcl.msw";  use only "ncbilcl.msw" now
 72 *
 73 * Revision 5.2  1996/08/19 19:19:10  vakatov
 74 * additional merge of R5.0 & R5.1 (as R5.1 grows immediately from R2.12)
 75 *
 76 * Revision 4.1  1995/12/18  17:37:38  epstein
 77 * add TIME_MAX
 78 * 
 79 * Revision 2.15  1995/07/18  03:34:29  ostell
 80 * added defined(_M_IX86) for MS compiler 2.0
 81 *
 82 * 04-05-93  Schuler     Some changes for WindowsNT and DLLs
 83 * 04-12-93  Schuler     Added some #ifndef's to avoid redefinitions
 84 * 06-11-93  Schuler     Added INLINE macro (defined to __inline)
 85 *
 86 * ==========================================================================
 87 */
 88 #ifndef _NCBILCL_
 89 #define _NCBILCL_
 90 
 91 /*********************** COMPILER DEFINITIONS ******************************/
 92 #if defined(_MSC_VER)
 93 #define COMP_MSC  /* Microsoft Visual C/C++ */
 94 #elif defined(__BORLANDC__)
 95 #define COMP_BOR  /* Borland C/C++ */
 96 #else
 97 #error Unsupported compiler:  must be MSVC++ or Borland C/C++ 
 98 #endif
 99 
100 
101 /*********************** PLATFORM DEFINITIONS ******************************/
102 
103 #if defined(_MAC)  && !defined(COMP_MSC)
104 #error MAC applications can be built with MSVC++ compiler only
105 #endif
106 
107 #if !defined(WIN32) && !defined(_MAC)
108 #  error You must define one of:  WIN32 or _MAC 
109 #endif
110 
111 
112 /*===== Definitions common to all platforms =======*/
113 
114 /* Have to #define both these by historical reasons -- as there was
115  * only GUI in earlier toolkit versions, and therefore all Win-SDK
116  * functions were considered as GUI(#WIN_MSWIN).
117  */
118 #define OS_MSWIN
119 #define WIN_MSWIN
120 
121 
122 /*================[ Win32 ]===============*/
123 #ifdef WIN32
124 
125 #define WIN_DUMB
126 #define OS_NT
127 
128 #ifndef FAR
129 #define FAR
130 #endif
131 
132 #ifndef NEAR
133 #define NEAR
134 #endif
135 
136 #ifndef EXPORT
137 #define EXPORT
138 #endif
139 
140 #if defined(ALPHA) || defined(_ALPHA_)
141 /* DEC Alpha processor */
142 #define PLATFORM_NAME "Win32a"
143 #define PROC_ALPHA
144 #ifndef PASCAL
145 #define PASCAL
146 #define CDECL
147 #endif
148 
149 #elif defined(MIPS) || defined(_MIPS_)
150 /* MIPS processor */
151 #define PLATFORM_NAME "Win32m"
152 #define PROC_MIPS
153 #ifndef PASCAL
154 #define PASCAL
155 #define CDECL
156 #endif
157 
158 #elif defined(i386) || defined(X86) || defined(_X86_) || defined(_M_IX86) || defined(_M_X64)
159 /* INTEL processor */
160 #define PLATFORM_NAME "Win32i"
161 #define PROC_I80X86
162 #define PROC_I80_386
163 #ifndef PASCAL
164 #define PASCAL __stdcall
165 #define CDECL  __cdecl
166 #endif
167 
168 #else
169 #error Unknown processor
170 #endif
171 
172 #ifdef _MT
173 #define WIN32_THREADS_AVAIL
174 #endif
175 
176 #endif /* WIN32 */
177 
178 
179 /*================[ Macintosh ]===============*/
180 #ifdef _MAC
181 
182 #if !(defined(_68K_) || defined(_MPPC_))
183 #error You must define one of: _68K_ or _MPPC_ 
184 #endif
185 
186 #define OS_NT  // Not really, but that makes it work!
187 
188 #ifdef _68K_
189 #define PLATFORM_NAME "Mac68K"
190 #define PROC_M680X0
191 #define mc68000
192 #ifndef PASCAL
193 #define PASCAL  __pascal
194 #define CDECL   __cdecl
195 #endif
196 typedef signed   long  Nlm_Int4,  FAR * Nlm_Int4Ptr;
197 typedef unsigned long  Nlm_Uint4, FAR * Nlm_Uint4Ptr;
198 #define Int4           Nlm_Int4
199 #define Int4Ptr        Nlm_Int4Ptr
200 #define Uint4          Nlm_Uint4
201 #define Uint4Ptr       Nlm_Uint4Ptr
202 #define INT4_MIN       (-2147483647-1)
203 #define INT4_MAX       2147483647
204 #define UINT4_MAX      4294967295U
205 #endif
206 
207 #ifdef _MPPC_
208 #define PLATFORM_NAME "MacPPC"
209 #define PROC_PPC
210 #ifndef PASCAL
211 #define PASCAL  
212 #define CDECL   __cdecl
213 #endif
214 #endif
215 
216 #ifndef FAR
217 #define FAR
218 #endif
219 #ifndef NEAR
220 #define NEAR
221 #endif
222 
223 #endif /* _MAC */
224 
225 
226 /* ...for historical reasons... */
227 #ifdef OS_NT
228 #define OS_WINNT
229 #endif
230 
231 
232 /*----------------------------------------------------------------------*/
233 /*      Desired or available feature list                               */
234 /*----------------------------------------------------------------------*/
235 #ifdef COMP_MSC
236 
237 #if (_MSC_VER >= 700)
238 #define INLINE __inline
239 #endif
240 
241 #define TRACE_TO_AUX  /* TRACE to AUX device */
242 
243 #ifdef _MAC
244 #define NETP_INET_MACTCP 1
245 #else
246 #define NETP_INET_WSOCK  1
247 #endif
248 
249 #ifdef NLM_IMPORT
250 #  pragma warning(disable: 4273)
251 #endif
252 
253 #endif /* COMP_MSC */
254 
255 
256 #ifdef COMP_BOR
257 /*  For importing Microsoft C code */
258 #define __MSC__
259 
260 #define _near   near
261 #define _far    far
262 #define _huge   huge
263 #define _cdecl  cdecl
264 #define _pascal pascal
265 
266 typedef unsigned int   UINT;
267 typedef unsigned long  ULONG;
268 typedef unsigned short USHORT;
269 typedef unsigned char  UCHAR;
270 
271 #endif /* COMP_BOR */
272 
273 #define HAVE_STRDUP 1
274 
275 
276 /*----------------------------------------------------------------------*/
277 /*      #includes                                                       */
278 /*----------------------------------------------------------------------*/
279 #include <stddef.h>
280 #include <sys/types.h>
281 #include <limits.h>
282 #include <sys/stat.h>
283 #include <stdio.h>
284 #include <ctype.h>
285 #include <string.h>
286 #include <stdlib.h>
287 #include <math.h>
288 #include <errno.h>
289 #include <float.h>
290 
291 
292 /*----------------------------------------------------------------------*/
293 /*      Missing ANSI-isms                                               */
294 /*----------------------------------------------------------------------*/
295 #ifndef FILENAME_MAX
296 #define FILENAME_MAX 63
297 #endif
298 
299 
300 /*----------------------------------------------------------------------*/
301 /*      Aliased Logicals, Datatypes                                     */
302 /*----------------------------------------------------------------------*/
303 #define PNTR FAR *
304 #define HNDL NEAR *
305 
306 typedef int (FAR PASCAL *Nlm_FnPtr)();
307 #define FnPtr Nlm_FnPtr
308 
309 
310 /*----------------------------------------------------------------------*/
311 /*      Misc Macros                                                     */
312 /*----------------------------------------------------------------------*/
313 #define PROTO(x)  x   /* Function prototypes are real */
314 #define VPROTO(x) x   /* Prototype for variable argument list */
315 
316 #ifdef _MAC
317 #define IS_BIG_ENDIAN
318 #define DIRDELIMCHR     ':'
319 #define DIRDELIMSTR     ":"
320 #define CWDSTR          ":"
321 #else
322 #define DIRDELIMCHR     '\\'
323 #define DIRDELIMSTR     "\\"
324 #define CWDSTR          "."
325 #endif
326 
327 #ifndef IS_BIG_ENDIAN
328 #define IS_LITTLE_ENDIAN
329 #endif
330 
331 #ifndef PATH_MAX
332 #define PATH_MAX 256
333 #endif
334 
335 #define KBYTE           (1024)
336 #define MBYTE           (1048576L)
337 
338 #define TEMPNAM_AVAIL
339 
340 
341 /*----------------------------------------------------------------------*/
342 /*      Macros for Floating Point                                       */
343 /*----------------------------------------------------------------------*/
344 #define EXP2(x)  exp((x)*LN2)
345 #define LOG2(x)  (log(x)*(1./LN2))
346 #define EXP10(x) exp((x)*LN10)
347 #define LOG10(x) (log10(x))
348 
349 #ifndef TIME_MAX
350 #define TIME_MAX  INT4_MAX
351 #endif
352 
353 
354 /*----------------------------------------------------------------------*/
355 /*      Macros Defining Limits                                          */
356 /*----------------------------------------------------------------------*/
357 #ifdef WIN32
358 #define MAXALLOC        0x7F000000 /* Largest permissible memory request */
359 #else
360 #define MAXALLOC        0x10000    /* Largest permissible memory request */
361 #endif
362 
363 #endif  /* _NCBILCL_ */
364 
365 

source navigation ]   [ diff markup ]   [ identifier search ]   [ freetext search ]   [ file search ]  

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.