/* $Id$ */ /******************************************************************** * Copyright (c) 1995 - 2004, EMBL, Peter Keller * * CCIF: a library to access and output data conforming to the * CIF (Crystallographic Information File) and mmCIF (Macromolecular * CIF) specifications, and other related specifications. * * This library is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 3, modified in accordance with the provisions of the * license to address the requirements of UK law. * * You should have received a copy of the modified GNU Lesser General * Public License along with this library. If not, copies may be * downloaded from http://www.ccp4.ac.uk/ccp4license.php * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * ********************************************************************/ /* This was a literate program. library.nw is the original source, from which library.c was generated by `notangle' and from which printable LaTeX can be produced by `noweave' if you have those tools. The noweb system is available in anonymous@bellcore.com:pub/norman at the time of writing. */ /* Heavily modified by me (Peter Keller) to cope with all the system * dependencies which I have been coming across during the CCIF * project */ #if defined (_AIX) || defined (___AIX) /* Some versions of gcc define ___AIX but not _AIX, * in the standard configuration */ # define KNOWN_MACHINE # define CALL_LIKE_HPUX 1 # ifndef _AIX # define _AIX # endif #endif #if defined (__APPLE__) # define KNOWN_MACHINE # define CALL_LIKE_SUN 1 #endif /* First attemt at porting to nt wsing the visual fortran and MVC++ */ /* MVS stands for Microsoft Visual Studio - better than VMS */ #if defined(_MSC_VER) # define NOUNISTD # if (_MSC_VER) >= 800 # define CALL_LIKE_MVS 2 # else # define CALL_LIKE_MVS 1 # endif # define KNOWN_MACHINE #endif #if defined (alliant) # define KNOWN_MACHINE # define CALL_LIKE_SUN 1 #endif #if defined (ardent) || defined (titan) # ifndef stardent # define stardent # endif #endif #if defined (stardent) # define KNOWN_MACHINE # define CALL_LIKE_STARDENT 1 #endif #if defined (__convex__) || defined (__convexc__) # define KNOWN_MACHINE # define CALL_LIKE_SUN 1 #endif #if defined (ESV) # define KNOWN_MACHINE # define CALL_LIKE_SUN 1 #endif #if defined (__hpux) # define KNOWN_MACHINE # define CALL_LIKE_HPUX 1 #endif #ifdef __sgi /* in ANSI mode */ # ifndef sgi # define sgi # endif #endif #if defined (sgi) # define KNOWN_MACHINE # define CALL_LIKE_SUN 1 #endif #if defined (solbourne) # ifndef sun # define sun /* don't know whether it's defined or not */ # endif #endif #if defined (sun) || defined (__sun) # define KNOWN_MACHINE # define CALL_LIKE_SUN 1 #endif #if defined (ultrix) || defined(__OSF1__) || defined(__osf__) # define KNOWN_MACHINE # define CALL_LIKE_SUN 1 #endif #ifndef VMS # if defined (vms) || defined (__vms) || defined (__VMS) # define VMS # endif #endif #if defined (VMS) # define KNOWN_MACHINE #endif #if defined (linux) || defined (__linux) || defined (__linux__) || defined (__CYGWIN32__) || defined (__CYGWIN__) || defined (__MINGW32__) || defined (__FreeBSD__) # define KNOWN_MACHINE # define CALL_LIKE_SUN 1 #endif #if defined __CALL_SYSV && ! defined __APPLE__ # define KNOWN_MACHINE # define CALL_LIKE_SUN 1 #endif #if defined __linux__ && defined __PPC # define KNOWN_MACHINE # define CALL_LIKE_SUN 1 #endif #if defined(F2C) || defined(G77) # undef CALL_LIKE_SUN # define CALL_LIKE_SUN 1 # define KNOWN_MACHINE #endif #if ! defined (KNOWN_MACHINE) #error System type is not known -- see the Installation Guide #else #ifdef HAVE_STANDARDS_H # include /* This makes sure that all the _*_SOURCE stuff under AIX is consistent.... */ # endif #ifndef _POSIX_SOURCE /* ... but code is always fixed up to be POSIX anyway. */ #define _POSIX_SOURCE /* In particular, need this to invoke most native POSIX */ #endif /* regular expression packages */ #include #if defined (VMS) # include /* non-POSIX */ # define NOUNISTD #else # include #ifndef _WIN32 # include #endif # include #endif #ifdef stardent /* who knows if this works anyhow... */ # include # include /* non-POSIX */ #else # include #endif #include /* See configure.in */ #ifdef NEED_STRERROR extern char *sys_errlist[]; /* Not declared in errno.h */ extern int sys_nerr; # define strerror(i) (i < sys_nerr? sys_errlist[i] : "Unknown system error") #endif #ifndef NOUNISTD # include #else # ifndef VMS # ifndef _MSC_VER # include /* ESV, old Concentrix */ /* non-POSIX */ # include # include # endif # endif #endif #include #include #include #ifdef HAVE_TIME_H # include #endif /* this has been altered for g2c.h as f2c.h is not always distributed */ #if defined (F2C) # define Skip_f2c_Undefs # include "f2c.h" #endif #if defined (G77) # define Skip_f2c_Undefs /* g2c.h infelicity... */ # if defined (HAVE_G2C_H) # include "g2c.h" # endif #endif #define MAXFLEN 500 /* the maximum length of a filename in CCP4 */ #define MAXFILES 10 /* maximum number of files open symultaneously */ #define DEFMODE 2 /* default mode access for random access files */ #define IRRELEVANT_OP 0 #define READ_OP 1 #define WRITE_OP 2 #ifndef SEEK_SET # define SEEK_SET 0 # define SEEK_CUR 1 # define SEEK_END 2 #endif /* ! SEEK_SET */ #if defined (ardent) || defined (titan) || defined (stardent) struct Str_Desc { char *Str_pointer; int Str_length; int id; }; #endif #endif /* ! defined (KNOWN_MACHINE) */