⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cfortran.h

📁 A C++ class library for scientific computing
💻 H
📖 第 1 页 / 共 5 页
字号:
/* cfortran.h  3.5 */          /* anonymous ftp@zebra.desy.de *//* Burkhard Burow  burow@desy.de                 1990 - 1996. */#ifndef __CFORTRAN_LOADED#define __CFORTRAN_LOADED/*    THIS FILE IS PROPERTY OF BURKHARD BUROW. IF YOU ARE USING THIS FILE YOU   SHOULD ALSO HAVE ACCESS TO CFORTRAN.DOC WHICH PROVIDES TERMS FOR USING,   MODIFYING, COPYING AND DISTRIBUTING THE CFORTRAN.H PACKAGE.*//*   Avoid symbols already used by compilers and system *.h:  __ - OSF1 zukal06 V3.0 347 alpha, cc -c -std1 cfortest.c *//* First prepare for the C compiler. */#ifndef ANSI_C_preprocessor /* i.e. user can override. */#ifdef __CF__KnR#define ANSI_C_preprocessor 0#else#ifdef __STDC__#define ANSI_C_preprocessor 1#else#define _cfleft             1#define _cfright #define _cfleft_cfright     0#define ANSI_C_preprocessor _cfleft/**/_cfright#endif#endif#endif#if ANSI_C_preprocessor#define _0(A,B)   A##B#define  _(A,B)   _0(A,B)  /* see cat,xcat of K&R ANSI C p. 231 */#define _2(A,B)   A##B     /* K&R ANSI C p.230: .. identifier is not replaced */#define _3(A,B,C) _(A,_(B,C))#else                      /* if it turns up again during rescanning.         */#define  _(A,B)   A/**/B#define _2(A,B)   A/**/B#define _3(A,B,C) A/**/B/**/C#endif#if (defined(vax)&&defined(unix)) || (defined(__vax__)&&defined(__unix__))#define VAXUltrix#endif#include <stdio.h>     /* NULL [in all machines stdio.h]                      */#include <string.h>    /* strlen, memset, memcpy, memchr.                     */#if !( defined(VAXUltrix) || defined(sun) || (defined(apollo)&&!defined(__STDCPP__)) )#include <stdlib.h>    /* malloc,free                                         */#else#include <malloc.h>    /* Had to be removed for DomainOS h105 10.4 sys5.3 425t*/#ifdef apollo#define __CF__APOLLO67 /* __STDCPP__ is in Apollo 6.8 (i.e. ANSI) and onwards */#endif#endif#if !defined(__GNUC__) && !defined(__sun) && (defined(sun)||defined(VAXUltrix)||defined(lynx))#define __CF__KnR     /* Sun, LynxOS and VAX Ultrix cc only supports K&R.     */                      /* Manually define __CF__KnR for HP if desired/required.*/#endif                /*       i.e. We will generate Kernighan and Ritchie C. *//* Note that you may define __CF__KnR before #include cfortran.h, in order togenerate K&R C instead of the default ANSI C. The differences are mainly in thefunction prototypes and declarations. All machines, except the Apollo, workwith either style. The Apollo's argument promotion rules require ANSI or use ofthe obsolete std_$call which we have not implemented here. Hence on the Apollo,only C calling FORTRAN subroutines will work using K&R style.*//* Remainder of cfortran.h depends on the Fortran compiler. */#ifdef CLIPPERFortran#define f2cFortran#endif/* VAX/VMS does not let us \-split long #if lines. */ /* Split #if into 2 because some HP-UX can't handle long #if */#if !(defined(NAGf90Fortran)||defined(f2cFortran)||defined(hpuxFortran)||defined(apolloFortran)||defined(sunFortran)||defined(IBMR2Fortran)||defined(CRAYFortran))#if !(defined(mipsFortran)||defined(DECFortran)||defined(vmsFortran)||defined(CONVEXFortran)||defined(PowerStationFortran)||defined(AbsoftUNIXFortran))/* If no Fortran compiler is given, we choose one for the machines we know.   */#if defined(lynx) || defined(VAXUltrix)#define f2cFortran    /* Lynx:      Only support f2c at the moment.                         VAXUltrix: f77 behaves like f2c.                           Support f2c or f77 with gcc, vcc with f2c.                            f77 with vcc works, missing link magic for f77 I/O.*/#endif#if defined(__hpux)       /* 921107: Use __hpux instead of __hp9000s300 */#define       hpuxFortran /*         Should also allow hp9000s7/800 use.*/#endif#if       defined(apollo)#define           apolloFortran  /* __CF__APOLLO67 defines some behavior. */#endif#if          defined(sun) || defined(__sun) #define              sunFortran#endif#if       defined(_IBMR2)#define            IBMR2Fortran#endif#if        defined(_CRAY)#define             CRAYFortran  /* _CRAY2         defines some behavior. */#endif#if         defined(mips) || defined(__mips)#define             mipsFortran#endif#if          defined(vms) || defined(__vms)#define              vmsFortran#endif#if      defined(__alpha) && defined(__unix__)#define              DECFortran#endif#if   defined(__convex__)#define           CONVEXFortran#endif#if   defined(VISUAL_CPLUSPLUS)#define     PowerStationFortran#endif#endif /* ...Fortran */#endif /* ...Fortran *//* Split #if into 2 because some HP-UX can't handle long #if */#if !(defined(NAGf90Fortran)||defined(f2cFortran)||defined(hpuxFortran)||defined(apolloFortran)||defined(sunFortran)||defined(IBMR2Fortran)||defined(CRAYFortran))#if !(defined(mipsFortran)||defined(DECFortran)||defined(vmsFortran)||defined(CONVEXFortran)||defined(PowerStationFortran)||defined(AbsoftUNIXFortran))/* Apologies for the trigraph, but some compilers barf on #error.             */??=error "cfortran.h:  Can't find your environment among:\    - MIPS cc and f77 2.0. (e.g. Silicon Graphics, DECstations, ...)     \    - IBM AIX XL C and FORTRAN Compiler/6000 Version 01.01.0000.0000     \    - VAX   VMS CC 3.1 and FORTRAN 5.4.                                  \    - Alpha VMS DEC C 1.3 and DEC FORTRAN 6.0.                           \    - Alpha OSF DEC C and DEC Fortran for OSF/1 AXP Version 1.2          \    - Apollo DomainOS 10.2 (sys5.3) with f77 10.7 and cc 6.7.            \    - CRAY                                                               \    - CONVEX                                                             \    - Sun                                                                \    - PowerStation Fortran with Visual C++                               \    - HP9000s300/s700/s800 Latest test with: HP-UX A.08.07 A 9000/730    \    - LynxOS: cc or gcc with f2c.                                        \    - VAXUltrix: vcc,cc or gcc with f2c. gcc or cc with f77.             \    -            f77 with vcc works; but missing link magic for f77 I/O. \    -            NO fort. None of gcc, cc or vcc generate required names.\    - f2c    : Use #define    f2cFortran, or cc -Df2cFortran             \    - NAG f90: Use #define NAGf90Fortran, or cc -DNAGf90Fortran          \    - Absoft UNIX F77: Use #define AbsoftUNIXFortran or cc -DAbsoftUNIXFortran"/* Compiler must throw us out at this point! */#endif#endif#if defined(VAXC) && !defined(__VAXC)#define OLD_VAXC#pragma nostandard                       /* Prevent %CC-I-PARAMNOTUSED.       */#endif/* Throughout cfortran.h we use: UN = Uppercase Name.  LN = Lowercase Name.  */#if defined(f2cFortran) || defined(NAGf90Fortran) || defined(DECFortran) || defined(mipsFortran) || defined(apolloFortran) || defined(sunFortran) || defined(CONVEXFortran) || defined(extname)#define CFC_(UN,LN)            _(LN,_)   /* Lowercase FORTRAN symbols.        */#define orig_fcallsc(UN,LN)    CFC_(UN,LN)#else #if defined(CRAYFortran) || defined(PowerStationFortran)#define CFC_(UN,LN)            UN        /* Uppercase FORTRAN symbols.        */#define orig_fcallsc(UN,LN)    CFC_(UN,LN)  /* CRAY insists on arg.'s here.   */#else  /* For following machines one may wish to change the fcallsc default.  */#define CF_SAME_NAMESPACE#ifdef vmsFortran#define CFC_(UN,LN)            LN        /* Either case FORTRAN symbols.      */     /* BUT we usually use UN for C macro to FORTRAN routines, so use LN here,*/     /* because VAX/VMS doesn't do recursive macros.                          */#define orig_fcallsc(UN,LN)    UN      #else      /* HP-UX without +ppu or IBMR2 without -qextname. NOT reccomended. */#define CFC_(UN,LN)            LN        /* Lowercase FORTRAN symbols.        */#define orig_fcallsc(UN,LN)    CFC_(UN,LN)#endif /*  vmsFortran */#endif /* CRAYFortran */#endif /* ....Fortran */#define fcallsc(UN,LN)               orig_fcallsc(UN,LN)#define preface_fcallsc(P,p,UN,LN)   CFC_(_(P,UN),_(p,LN))#define  append_fcallsc(P,p,UN,LN)   CFC_(_(UN,P),_(LN,p))#define C_FUNCTION(UN,LN)            fcallsc(UN,LN)      #define FORTRAN_FUNCTION(UN,LN)      CFC_(UN,LN)#ifndef COMMON_BLOCK#ifndef CONVEXFortran#ifndef CLIPPERFortran#define COMMON_BLOCK(UN,LN)          CFC_(UN,LN)#else#define COMMON_BLOCK(UN,LN)          _(LN,__)#endif#else#define COMMON_BLOCK(UN,LN)          _3(_,LN,_)#endif#endif#ifdef CRAYFortran#ifdef _CRAY#include <fortran.h>#else#include "fortran.h"  /* i.e. if crosscompiling assume user has file. */#endif#ifndef DOUBLE_PRECISION#define DOUBLE_PRECISION long double#endif#define FLOATVVVVVVV_cfPP (float *)   /* Used for C calls FORTRAN.            *//* CRAY's double==float but CRAY says pointers to doubles and floats are diff.*/#define VOIDP  (void *)  /* When FORTRAN calls C, we don't know if C routine                             arg.'s have been declared float *, or double *.   */#else#ifndef DOUBLE_PRECISION#define DOUBLE_PRECISION double#endif#define FLOATVVVVVVV_cfPP#define VOIDP#endif#ifdef vmsFortran#if    defined(vms) || defined(__vms)#include <descrip.h>#else#include "descrip.h"  /* i.e. if crosscompiling assume user has file. */#endif#endif#ifdef sunFortran#if defined(sun) || defined(__sun)#include <math.h>     /* Sun's FLOATFUNCTIONTYPE, ASSIGNFLOAT, RETURNFLOAT.  */#else#include "math.h"     /* i.e. if crosscompiling assume user has file. */#endif/* At least starting with the default C compiler SC3.0.1 of SunOS 5.3, * FLOATFUNCTIONTYPE, ASSIGNFLOAT, RETURNFLOAT are not required and not in * <math.h>, since sun C no longer promotes C float return values to doubles. * Therefore, only use them if defined. * Even if gcc is being used, assume that it exhibits the Sun C compiler * behavior in order to be able to use *.o from the Sun C compiler. * i.e. If FLOATFUNCTIONTYPE, etc. are in math.h, they required by gcc. */#endif#ifndef apolloFortran#define COMMON_BLOCK_DEF(DEFINITION, NAME) extern DEFINITION NAME#define CF_NULL_PROTO#else                                         /* HP doesn't understand #elif. *//* Without ANSI prototyping, Apollo promotes float functions to double.    *//* Note that VAX/VMS, IBM, Mips choke on 'type function(...);' prototypes. */#define CF_NULL_PROTO ...#ifndef __CF__APOLLO67#define COMMON_BLOCK_DEF(DEFINITION, NAME) \ DEFINITION NAME __attribute((__section(NAME)))#else#define COMMON_BLOCK_DEF(DEFINITION, NAME) \ DEFINITION NAME #attribute[section(NAME)]#endif#endif#ifdef __cplusplus#undef  CF_NULL_PROTO#define CF_NULL_PROTO  ...#endif#ifdef mipsFortran#define CF_DECLARE_GETARG         int f77argc; char **f77argv#define CF_SET_GETARG(ARGC,ARGV)  f77argc = ARGC; f77argv = ARGV

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -