--- cfortran-4.4.orig/cfortran.html +++ cfortran-4.4/cfortran.html @@ -4,9 +4,6 @@ - -
-

cfortran.h: Interfacing C or C++ and FORTRAN

@@ -29,10 +26,10 @@ Unless explicitly noted otherwise, mention of C implicitly includes C++. C++ compilers tested include:

-  SunOS> CC +p +w      # Clean compiles.
-  IRIX>  CC            # Clean compiles.
-  IRIX>  CC -fullwarn  # Still some warnings to be overcome.
-  GNU>   g++ -Wall     # Compiles are clean, other than warnings for unused
+  SunOS> CC +p +w      # Clean compiles.
+  IRIX>  CC            # Clean compiles.
+  IRIX>  CC -fullwarn  # Still some warnings to be overcome.
+  GNU>   g++ -Wall     # Compiles are clean, other than warnings for unused
                        #   cfortran.h static routines.
 
@@ -123,7 +120,7 @@

The complete cfortran.h package consists of 4 files: the documentation in cfortran.doc, the engine cfortran.h, examples in cfortest.c and -cfortex.f/or. [cfortex.for under VMS, +cfortex.f/or. [cfortex.for under VMS, cfortex.f on other machines.]

The cfortran.h package continues to be developed. @@ -142,9 +139,9 @@ link a trivial FORTRAN program using the FORTRAN compilers verbose option, in order to see how the FORTRAN compiler drives the linker. e.g.

-       unix> cat f.f
+       unix> cat f.f
                 END
-       unix> f77 -v f.f
+       unix> f77 -v f.f
        .. lots of info. follows ...
 

@@ -160,125 +157,125 @@ The f77 verbose option, usually -v, may point to a solution.

-RS/6000> # Users are strongly urged to use f77 -qextname and cc -Dextname
-RS/6000> # Use -Dextname=extname if extname is a symbol used in the C code.
-RS/6000> xlf -c -qextname cfortex.f
-RS/6000> cc  -c -Dextname cfortest.c
-RS/6000> xlf -o cfortest cfortest.o cfortex.o && cfortest 
-
-DECFortran> #Only DECstations with DECFortran for Ultrix RISC Systems.
-DECFortran> cc -c -DDECFortran cfortest.c
-DECFortran> f77 -o cfortest cfortest.o cfortex.f  &&  cfortest
+RS/6000> # Users are strongly urged to use f77 -qextname and cc -Dextname
+RS/6000> # Use -Dextname=extname if extname is a symbol used in the C code.
+RS/6000> xlf -c -qextname cfortex.f
+RS/6000> cc  -c -Dextname cfortest.c
+RS/6000> xlf -o cfortest cfortest.o cfortex.o && cfortest 
+
+DECFortran> #Only DECstations with DECFortran for Ultrix RISC Systems.
+DECFortran> cc -c -DDECFortran cfortest.c
+DECFortran> f77 -o cfortest cfortest.o cfortex.f  &&  cfortest
 
 IRIX xxxxxx 5.2 02282015 IP20 mips
-MIPS> # DECstations and Silicon Graphics using the MIPS compilers.
-MIPS> cc -o cfortest cfortest.c cfortex.f -lI77 -lU77 -lF77  &&  cfortest
-MIPS> # Can also let f77 drive linking, e.g.
-MIPS> cc -c cfortest.c
-MIPS> f77 -o cfortest cfortest.o cfortex.f  &&  cfortest
-
-Apollo> # Some 'C compiler 68K Rev6.8' break. [See Section II o) Notes: Apollo]
-Apollo> f77 -c cfortex.f && cc -o cfortest cfortest.c cfortex.o  &&  cfortest
-
-VMS> define lnk$library sys$library:vaxcrtl
-VMS> cc cfortest.c
-VMS> fortran cfortex.for
-VMS> link/exec=cfortest cfortest,cfortex
-VMS> run cfortest
+MIPS> # DECstations and Silicon Graphics using the MIPS compilers.
+MIPS> cc -o cfortest cfortest.c cfortex.f -lI77 -lU77 -lF77  &&  cfortest
+MIPS> # Can also let f77 drive linking, e.g.
+MIPS> cc -c cfortest.c
+MIPS> f77 -o cfortest cfortest.o cfortex.f  &&  cfortest
+
+Apollo> # Some 'C compiler 68K Rev6.8' break. [See Section II o) Notes: Apollo]
+Apollo> f77 -c cfortex.f && cc -o cfortest cfortest.c cfortex.o  &&  cfortest
+
+VMS> define lnk$library sys$library:vaxcrtl
+VMS> cc cfortest.c
+VMS> fortran cfortex.for
+VMS> link/exec=cfortest cfortest,cfortex
+VMS> run cfortest
 
 OSF1 xxxxxx V3.0 347 alpha
-Alpha/OSF> # Probably better to let cc drive linking, e.g.
-Alpha/OSF> f77 -c cfortex.f
-Alpha/OSF> cc  -o cfortest cfortest.c cfortex.o -lUfor -lfor -lFutil -lots -lm
-Alpha/OSF> cfortest
-Alpha/OSF> # Else may need 'cc -Dmain=MAIN__' to let f77 drive linking.
-
-Sun> # Some old cc(1) need a little help. [See Section II o) Notes: Sun]
-Sun> f77 -o cfortest cfortest.c cfortex.f -lc -lm  &&  cfortest
-Sun> # Some older f77 may require 'cc -Dmain=MAIN_'.
-
-CRAY> cft77 cfortex.f
-CRAY> cc -c cfortest.c
-CRAY> segldr -o cfortest.e cfortest.o cfortex.o
-CRAY> ./cfortest.e
+Alpha/OSF> # Probably better to let cc drive linking, e.g.
+Alpha/OSF> f77 -c cfortex.f
+Alpha/OSF> cc  -o cfortest cfortest.c cfortex.o -lUfor -lfor -lFutil -lots -lm
+Alpha/OSF> cfortest
+Alpha/OSF> # Else may need 'cc -Dmain=MAIN__' to let f77 drive linking.
+
+Sun> # Some old cc(1) need a little help. [See Section II o) Notes: Sun]
+Sun> f77 -o cfortest cfortest.c cfortex.f -lc -lm  &&  cfortest
+Sun> # Some older f77 may require 'cc -Dmain=MAIN_'.
+
+CRAY> cft77 cfortex.f
+CRAY> cc -c cfortest.c
+CRAY> segldr -o cfortest.e cfortest.o cfortex.o
+CRAY> ./cfortest.e
 
-NEC> cc -c -Xa cfortest.c
-NEC> f77 -o cfortest cfortest.o cfortex.f  &&  cfortest
+NEC> cc -c -Xa cfortest.c
+NEC> f77 -o cfortest cfortest.o cfortex.f  &&  cfortest
 
-VAX/Ultrix/cc> # For cc on VAX Ultrix only, do the following once to cfortran.h.
-VAX/Ultrix/cc> mv cfortran.h cftmp.h && grep -v "^#pragma" cfortran.h
+VAX/Ultrix/cc> # For cc on VAX Ultrix only, do the following once to cfortran.h.
+VAX/Ultrix/cc> mv cfortran.h cftmp.h && grep -v "^#pragma" <cftmp.h >cfortran.h
                                             
-VAX/Ultrix/f77> # In the following, 'CC' is either 'cc' or 'gcc -ansi'. NOT'vcc'
-VAX/Ultrix/f77> CC -c -Dmain=MAIN_ cfortest.c
-VAX/Ultrix/f77> f77 -o cfortest cfortex.f cfortest.o  &&  cfortest
-
-LynxOS> # In the following, 'CC' is either 'cc' or 'gcc -ansi'.
-LynxOS> # Unfortunately cc is easily overwhelmed by cfortran.h,
-LynxOS> #  and won't compile some of the cfortest.c demos.
-LynxOS> f2c -R cfortex.f
-LynxOS> CC -Dlynx -o cfortest cfortest.c cfortex.c -lf2c  &&  cfortest
-
-HP9000> # Tested with HP-UX 7.05 B 9000/380 and with A.08.07 A 9000/730
-HP9000> # CC may be either 'c89 -Aa' or 'cc -Aa'
-HP9000> #    Depending on the compiler version, you may need to include the
-HP9000> #    option '-tp,/lib/cpp' or worse, you'll have to stick to the K&R C.
-HP9000> #    [See Section II o) Notes: HP9000]
-HP9000> # Users are strongly urged to use f77 +ppu and cc -Dextname
-HP9000> # Use -Dextname=extname if extname is a symbol used in the C code.
-HP9000> CC  -Dextname -c cfortest.c
-HP9000> f77 +ppu         cfortex.f  -o cfortest cfortest.o && cfortest
-HP9000> # Older f77 may need
-HP9000> f77 -c cfortex.f
-HP9000> CC -o cfortest cfortest.c cfortex.o -lI77 -lF77 && cfortest
-
-HP0000> # If old-style f77 +800 compiled objects are required:
-HP9000> # #define hpuxFortran800
-HP9000> cc -c -Aa -DhpuxFortran800 cfortest.c
-HP9000> f77 +800 -o cfortest cfortest.o cfortex.f
-
-f2c> # In the following, 'CC' is any C compiler.
-f2c> f2c -R cfortex.f
-f2c> CC -o cfortest -Df2cFortran cfortest.c cfortex.c -lf2c  &&  cfortest
+VAX/Ultrix/f77> # In the following, 'CC' is either 'cc' or 'gcc -ansi'. NOT'vcc'
+VAX/Ultrix/f77> CC -c -Dmain=MAIN_ cfortest.c
+VAX/Ultrix/f77> f77 -o cfortest cfortex.f cfortest.o  &&  cfortest
+
+LynxOS> # In the following, 'CC' is either 'cc' or 'gcc -ansi'.
+LynxOS> # Unfortunately cc is easily overwhelmed by cfortran.h,
+LynxOS> #  and won't compile some of the cfortest.c demos.
+LynxOS> f2c -R cfortex.f
+LynxOS> CC -Dlynx -o cfortest cfortest.c cfortex.c -lf2c  &&  cfortest
+
+HP9000> # Tested with HP-UX 7.05 B 9000/380 and with A.08.07 A 9000/730
+HP9000> # CC may be either 'c89 -Aa' or 'cc -Aa'
+HP9000> #    Depending on the compiler version, you may need to include the
+HP9000> #    option '-tp,/lib/cpp' or worse, you'll have to stick to the K&R C.
+HP9000> #    [See Section II o) Notes: HP9000]
+HP9000> # Users are strongly urged to use f77 +ppu and cc -Dextname
+HP9000> # Use -Dextname=extname if extname is a symbol used in the C code.
+HP9000> CC  -Dextname -c cfortest.c
+HP9000> f77 +ppu         cfortex.f  -o cfortest cfortest.o && cfortest
+HP9000> # Older f77 may need
+HP9000> f77 -c cfortex.f
+HP9000> CC -o cfortest cfortest.c cfortex.o -lI77 -lF77 && cfortest
+
+HP9000> # If old-style f77 +800 compiled objects are required:
+HP9000> # #define hpuxFortran800
+HP9000> cc -c -Aa -DhpuxFortran800 cfortest.c
+HP9000> f77 +800 -o cfortest cfortest.o cfortex.f
+
+f2c> # In the following, 'CC' is any C compiler.
+f2c> f2c cfortex.f
+f2c> CC -o cfortest -Df2cFortran cfortest.c cfortex.c -lf2c  &&  cfortest
 
 Portland Group $ # Presumably other C compilers also work.
 Portland Group $ pgcc -DpgiFortran -c cfortest.c
-Portland Group $ pgf77 -o cfortest cfortex.f cfortest.o && cfortest
+Portland Group $ pgf77 -o cfortest cfortex.f cfortest.o && cfortest
 
-NAGf90> # cfortex.f is distributed with FORTRAN 77 style comments.
-NAGf90> # To convert to f90 style comments do the following once to cfortex.f: 
-NAGf90> mv cfortex.f cf_temp.f && sed 's/^C/\!/g' cf_temp.f > cfortex.f
-NAGf90> # In the following, 'CC' is any C compiler.
-NAGf90> CC -c -DNAGf90Fortran cfortest.c
-NAGf90> f90 -o cfortest cfortest.o cfortex.f &&  cfortest
-
-PC> # On a PC with PowerStation FORTRAN and Visual_C++
-PC> cl /c cftest.c
-PC> fl32  cftest.obj cftex.for
-
-GNU> # GNU FORTRAN
-GNU> # See Section VI caveat on using 'gcc -traditional'.
-GNU> gcc -ansi -Wall -O -c -Df2cFortran cfortest.c
-GNU> g77 -ff2c -o cfortest cfortest.o cfortex.f &&  cfortest
-
-AbsoftUNIX> # Absoft FORTRAN for all UNIX based operating systems.
-AbsoftUNIX> # e.g. Linux or Next on Intel or Motorola68000.
-AbsoftUNIX> # Absoft f77 -k allows FORTRAN routines to be safely called from C.
-AbsoftUNIX> gcc -ansi -Wall -O -c -DAbsoftUNIXFortran cfortest.c
-AbsoftUNIX> f77 -k -o cfortest cfortest.o cfortex.f && cfortest
-
-AbsoftPro> # Absoft Pro FORTRAN for MacOS
-AbsoftPro> # Use #define AbsoftProFortran
-
-CLIPPER> # INTERGRAPH CLIX using CLIPPER C and FORTRAN compilers.
-CLIPPER> # N.B. - User, not cfortran.h, is responsible for
-CLIPPER> #        f77initio() and f77uninitio() if required.
-CLIPPER> #      - LOGICAL values are not mentioned in CLIPPER doc.s,
-CLIPPER> #        so they may not yet be correct in cfortran.h.
-CLIPPER> #      - K&R mode (-knr or Ac=knr) breaks FLOAT functions
-CLIPPER> #        (see CLIPPER doc.s) and cfortran.h does not fix it up.
-CLIPPER> #        [cfortran.h ok for old sun C which made the same mistake.]
-CLIPPER> acc cfortest.c -c -DCLIPPERFortran
-CLIPPER> af77 cfortex.f cfortest.o -o cfortest
+NAGf90> # cfortex.f is distributed with FORTRAN 77 style comments.
+NAGf90> # To convert to f90 style comments do the following once to cfortex.f: 
+NAGf90> mv cfortex.f cf_temp.f && sed 's/^C/\!/g' cf_temp.f > cfortex.f
+NAGf90> # In the following, 'CC' is any C compiler.
+NAGf90> CC -c -DNAGf90Fortran cfortest.c
+NAGf90> f90 -o cfortest cfortest.o cfortex.f &&  cfortest
+
+PC> # On a PC with PowerStation FORTRAN and Visual_C++
+PC> cl /c cftest.c
+PC> fl32  cftest.obj cftex.for
+
+GNU> # GNU FORTRAN
+GNU> # See Section VI caveat on using 'gcc -traditional'.
+GNU> gcc -ansi -Wall -O -c -Df2cFortran cfortest.c
+GNU> g77 -ff2c -o cfortest cfortest.o cfortex.f &&  cfortest
+
+AbsoftUNIX> # Absoft FORTRAN for all UNIX based operating systems.
+AbsoftUNIX> # e.g. Linux or Next on Intel or Motorola68000.
+AbsoftUNIX> # Absoft f77 -k allows FORTRAN routines to be safely called from C.
+AbsoftUNIX> gcc -ansi -Wall -O -c -DAbsoftUNIXFortran cfortest.c
+AbsoftUNIX> f77 -k -o cfortest cfortest.o cfortex.f && cfortest
+
+AbsoftPro> # Absoft Pro FORTRAN for MacOS
+AbsoftPro> # Use #define AbsoftProFortran
+
+CLIPPER> # INTERGRAPH CLIX using CLIPPER C and FORTRAN compilers.
+CLIPPER> # N.B. - User, not cfortran.h, is responsible for
+CLIPPER> #        f77initio() and f77uninitio() if required.
+CLIPPER> #      - LOGICAL values are not mentioned in CLIPPER doc.s,
+CLIPPER> #        so they may not yet be correct in cfortran.h.
+CLIPPER> #      - K&R mode (-knr or Ac=knr) breaks FLOAT functions
+CLIPPER> #        (see CLIPPER doc.s) and cfortran.h does not fix it up.
+CLIPPER> #        [cfortran.h ok for old sun C which made the same mistake.]
+CLIPPER> acc cfortest.c -c -DCLIPPERFortran
+CLIPPER> af77 cfortex.f cfortest.o -o cfortest
 
By changing the SELECTion ifdef of cfortest.c and recompiling one can try out @@ -359,7 +356,7 @@ are defined and used.
 /* hbook.h */
-#include "cfortran.h"
+#include <cfortran.h>
         :
 PROTOCCALLSFSUB6(HBOOK1,hbook1,INT,STRING,INT,FLOAT,FLOAT,FLOAT)
 #define HBOOK1(ID,CHTITLE,NX,XMI,XMA,VMX)                        \
@@ -404,7 +401,7 @@
 

Example 2

Many VMS System calls are most easily called from FORTRAN, but cfortran.h now gives that ease in C.
-#include "cfortran.h"
+#include <cfortran.h>
 
 PROTOCCALLSFSUB3(LIB$SPAWN,lib$spawn,STRING,STRING,STRING)
 #define LIB$SPAWN(command,input_file,output_file)          \
@@ -434,8 +431,8 @@
       END
 
 /* cstring.c */
-#include              /* string.h prototypes memcpy() */
-#include "cfortran.h"
+#include <string.h>             /* string.h prototypes memcpy() */
+#include <cfortran.h>
 
         :
 FCALLSCSUB3(memcpy,MEMCPY,memcpy,PVOID,PVOID,INT)
@@ -461,12 +458,12 @@
 

  • Specifying the FORTRAN compiler

    - cfortran.h generates interfaces for the default i + cfortran.h generates interfaces for the default FORTRAN compiler. The default can be overridden by defining with - one of the follwoing methods, + one of the following methods,

    • in the code, e.g.: #define NAGf90Fortran -

    • in the compile directive, e.g.: unix> cc -DNAGf90Fortran +

    • in the compile directive, e.g.: unix> cc -DNAGf90Fortran
    one of the following before including cfortran.h:
    @@ -645,11 +642,12 @@
     on all machines, including t3e.
     
-

  • f2c +

  • f2c / g77

    - f2c, by default promotes REAL functions to double. -cfortran.h does not (yet) -support this, so the f2c -R option must be used to turn this promotion off. +f2c and g77 by default promote REAL functions to +double. As of December 9, 2005, the Debian package of cfortran supports this +behavior, so the f2c -R option must NOT be used to turn this +promotion off.

  • f2c

    [Thanks to Dario Autiero for pointing out the following.] @@ -693,11 +691,19 @@ /* Last three lines are a work-around for the strange f2c naming feature. */

  • +

  • gfortran +

    +gfortran behaves similarly to f2c and g77, EXCEPT +that it does NOT by default promote REAL functions to +double. Therefore you should use -DgFortran instead of +-Dg77Fortran or -Df2cFortran to let cfortran.h +know about this difference. +

  • NAG f90

    The FORTRAN 77 subset of FORTRAN 90 is supported. Extending cfortran.h to interface C with all of FORTRAN 90 has not yet been examined. -
    The NAG f90 library hij acks the main() of any program and starts the user's +
    The NAG f90 library hijacks the main() of any program and starts the user's program with a call to: void f90_main(void);
    While this in itself is only a minor hassle, a major problem arises because NAG f90 provides no mechanism to access command line arguments.
    @@ -738,10 +744,10 @@ At least one release of the HP /lib/cpp.ansi preprocessor is broken and will go into an infinite loop when trying to process cfortran.h with the -## catenation operator. The K&R version of cfortran.h must then be used and the -K&R preprocessor must be specified. e.g. +## catenation operator. The K&R version of cfortran.h must then be used and the +K&R preprocessor must be specified. e.g.

    -HP9000> cc -Aa -tp,/lib/cpp -c source.c
    +HP9000> cc -Aa -tp,/lib/cpp -c source.c
     
    The same problem with a similar solution exists on the Apollo. An irrelevant error message '0: extraneous name /usr/include' @@ -757,10 +763,10 @@ /lib/cpp

    On some machines the above error causes compilation to stop; one must then use -K&R C, as with old HP compilers which don't support function prototyping. -cfortran.h has to be informed that K&R C is to being used, e.g. +K&R C, as with old HP compilers which don't support function prototyping. +cfortran.h has to be informed that K&R C is to being used, e.g.

    -HP9000> cc -D__CF__KnR -c source.c
    +HP9000> cc -D__CF__KnR -c source.c
     

  • AbsoftUNIXFortran @@ -785,14 +791,14 @@

    The same problem with a similar solution exists on the HP.

  • Sun -

    Old versions of cc(1), say <~1986, may require help for cfortran.h +

    Old versions of cc(1), say <~1986, may require help for cfortran.h applications:

    • #pragma may not be understood, hence cfortran.h and cfortest.c may require
      -sun> mv cfortran.h cftmp.h && grep -v "^#pragma" cfortran.h
      -sun> mv cfortest.c cftmp.c && grep -v "^#pragma" cfortest.c
      +sun> mv cfortran.h cftmp.h && grep -v "^#pragma" cfortran.h
      +sun> mv cfortest.c cftmp.c && grep -v "^#pragma" cfortest.c
       

    • Old copies of math.h may not include the following from a newer math.h. [For an ancient math.h on a 386 or sparc, get similar from a new math.h.] @@ -800,8 +806,8 @@
          #ifdef mc68000     /* 5 lines Copyright (c) 1988 by Sun Microsystems, Inc. */
          #define FLOATFUNCTIONTYPE	int
      -   #define RETURNFLOAT(x) 		return (*(int *)(&(x)))
      -   #define ASSIGNFLOAT(x,y)	*(int *)(&x) = y
      +   #define RETURNFLOAT(x) 	return (*(int *)(&(x)))
      +   #define ASSIGNFLOAT(x,y)	*(int *)(&x) = y
          #endif
       
      @@ -815,8 +821,8 @@

    • VAX Ultrix

      vcc (1) with f77 is not supported. Although:

      -VAXUltrix> f77 -c cfortex.f
      -VAXUltrix> vcc -o cfortest cfortest.c cfortex.o -lI77 -lU77 -lF77  &&  cfortest
      +VAXUltrix> f77 -c cfortex.f
      +VAXUltrix> vcc -o cfortest cfortest.c cfortex.o -lI77 -lU77 -lF77  &&  cfortest
       
      will link and run. However, the FORTRAN standard I/O is NOT merged with the @@ -849,7 +855,7 @@ At line number 777 in DISK:[DIR]FILE.C;1.
  • where the line given, '777', includes a call across C and FORTRAN via -cfortran.h, usually with >7 arguments and/or very long argument +cfortran.h, usually with >7 arguments and/or very long argument expressions.

    This SPR can be staved off, with the simple modification to cfortran.h, such that the relevant CCALLSFSUBn (or CCALLSFFUNn or @@ -895,7 +901,7 @@

     C FORTRAN                           /* C */
    -      integer function f()          #include 
    +      integer function f()          #include <stdio.h>
           f = 2                         int f_();
           return                        int e_(int (*u)());
           end
    @@ -962,7 +968,7 @@
     
    Where:
    -'n' = 0->14 [SUBROUTINE's ->27] (easily expanded in cfortran.h to > 14 [27]) is 
    +'n' = 0->14 [SUBROUTINE's ->27] (easily expanded in cfortran.h to > 14 [27]) is 
         the number of arguments to the routine.
     Routine_name = C       name of the routine (IN UPPER CASE LETTERS).[see 2.below]
     ROUTINE_NAME = FORTRAN name of the routine (IN UPPER CASE LETTERS).
    @@ -979,7 +985,7 @@
                    STRINGV, ZTRINGV.
                  For vectors of vectors, i.e. 2 dim. arrays use
                  = BYTEVV, DOUBLEVV, FLOATVV, INTVV, LOGICALVV, LONGVV, SHORTVV.
    -             For n-dim. arrays, 1<=n<=7 [7 is the maximum in FORTRAN 77],
    +	     For n-dim. arrays, 1<=n<=7 [7 is the maximum in FORTRAN 77],
                  = BYTEV..nV's..V, DOUBLEV..V, FLOATV..V, INTV..V, LOGICALV..V, 
                    LONGV..V, SHORTV..V.
                     N.B. Array dimensions and types are checked by the C compiler.
    @@ -1042,7 +1048,7 @@
     
     /* Pass the address of a structure, using a type called PSTRUCT */
     #define PSTRUCT_cfN(  T,A)        void *A
    -#define PSTRUCT_cfB(  T,A)       (void *) &(A)
    +#define PSTRUCT_cfB(  T,A)       (void *) &(A)
     
     /* Pass an integer by value, (not standard F77 ), using a type called INTVAL */
     #define INTVAL_cfN(   T,A)      int A
    @@ -1067,7 +1073,7 @@
     unique name, but in practice, the name of the FORTRAN routine in UPPER CASE
     works everywhere and would seem to be an obvious choice.
     
    -

  • [BYTE|DOUBLE|BYTE|DOUBLE|FLOAT|INT|LOGICAL|LONG|SHORT][V|VV|VVV|...] +

  • [BYTE|DOUBLE|FLOAT|INT|LOGICAL|LONG|SHORT][V|VV|VVV|...]

    cfortran.h encourages the exact specification of the type and dimension of array parameters because it allows the C compiler to detect errors in the @@ -1262,7 +1268,7 @@

  • Where: -'n' = 0->27 (easily expanded to > 27) stands for the number of arguments to the +'n' = 0->27 (easily expanded to > 27) stands for the number of arguments to the routine.
     Routine_name = the C       name of the routine. [see 9. below]
    @@ -1343,7 +1349,7 @@
     to C, the same holds true for each element in (P)STRINGV. Space is malloc'd in
     all cases big enough to hold the original string (elements) as well as C's
     terminating '\0'. i.e. The useful size of the string (elements) is the same in
    -both languages. P(N)STRING(V) => the string (elements) will be copied from the
    +both languages. P(N)STRING(V) => the string (elements) will be copied from the
     malloc'd space back into the FORTRAN bytes. If one of the two escape mechanisms
     mentioned below for PNSTRING has been used, the copying back to FORTRAN is
     obviously not relevant.
    @@ -1371,7 +1377,7 @@
     
     
     C FORTRAN                                               /* C */
    -      character*40 str                                  #include "cfortran.h"
    +character*40 str                                        #include <cfortran.h>
     C Set up a NULL as :                                    void cs(char *s) {if (s) printf("%s.\n",s);}
     C    i)  4 NUL characters.                              FCALLSCSUB1(cs,CS,cs,STRING)
     C    ii) NULL pointer.
    @@ -1413,7 +1419,7 @@
     
     
     C FORTRAN                                               /* C */
    -      character*10 s,sn                                 #include "cfortran.h"
    +character*10 s,sn                                       #include <cfortran.h>
                                                             void ps(char *s) {strcpy(s,"hello");}
     C Can   call ps  with undef. s.                         FCALLSCSUB1(ps,PS,ps,PSTRING)
           call ps(s)                                        FCALLSCSUB1(ps,PNS,pns,PNSTRING)
    @@ -1542,9 +1548,9 @@
     
     
            routine_name     is as above.
    -       i [i=1->n.]      specifies the argument number of a STRING VECTOR.
    +       i [i=1->n.]      specifies the argument number of a STRING VECTOR.
            j                would specify a fixed number of elements. 
    -       k [k=1->n. k!=i] would specify an integer argument which specifies the
    +       k [k=1->n. k!=i] would specify an integer argument which specifies the
                             number of elements.
            l [char]         the terminating character at the beginning of an
                             element, indicating to cfortran.h that the preceding
    @@ -1798,7 +1804,7 @@
     of C and FORTRAN, but the following information may help 
     resolve problems.
     

    -From the 2nd or ANSI ed. of K&R C, p.31, last paragraph: +From the 2nd or ANSI ed. of K&R C, p.31, last paragraph:

    i) An external variable must be defined, exactly once, outside of any function; this sets aside storage for it. @@ -1977,7 +1983,7 @@ Therefore, new machinery is required to do:

    -application.h + cfortran.h => final_application.h
    +application.h + cfortran.h => final_application.h
     
    The following example may help clarify the means and ends: @@ -1990,7 +1996,7 @@ preprocessor being used, e.g. cpp -Umips -DCRAY ... ] :
    -#include "cfortran.h"
    +#include <cfortran.h>
     PROTOCCALLSFSUB6(HBOOK1,hbook1,INT,STRING,INT,FLOAT,FLOAT,FLOAT)
     /*#define HBOOK1(ID,CHTITLE,NX,XMI,XMA,VMX)                 \*/
          CCALLSFSUB6(HBOOK1,hbook1,INT,STRING,INT,FLOAT,FLOAT,FLOAT, \
    @@ -2075,23 +2081,23 @@
     Condolences to long suffering ultrix users!
     DEC supplies a working C front end for alpha/OSF, but not for ultrix.
     

    -From K&R ANSI C p. 231: +From K&R ANSI C p. 231:

    -   ultrix> cat cat.c
    +   ultrix> cat cat.c
        #define cat(x, y) x ## y
        #define xcat(x,y) cat(x,y)
        cat(cat(1,2),3)
        xcat(xcat(1,2),3)
    -   ultrix> cc -E cat.c
    -   123                  <---- Should be: cat(1,2)3
    -   123                  <---- Correct.
    -   ultrix> 
    +   ultrix> cc -E cat.c
    +   123                  <---- Should be: cat(1,2)3
    +   123                  <---- Correct.
    +   ultrix> 
     
    The problem for cfortran.h, preventing use of -std and -std1:
    -   ultrix> cat c.c
    +   ultrix> cat c.c
        #define cat(x, y) x ## y
        #define xcat(x,y) cat(x,y)
        #define AB(X) X+X
    @@ -2099,19 +2105,19 @@
        #define X(E,F,G) xcat(E,F)(G)
        C(A,B,2)
        X(A,B,2)
    -   ultrix> cc -std1 -E c.c
    +   ultrix> cc -std1 -E c.c
        2+2  
    -   AB  (2)              <---- ?????????????
    -   ultrix>
    -   ultrix> cc -std0 -E c.c
    +   AB  (2)              <---- ?????????????
    +   ultrix>
    +   ultrix> cc -std0 -E c.c
        2+2  
    -   AB(2)                <---- ?????????????
    -   ultrix>
    +   AB(2)                <---- ?????????????
    +   ultrix>
     
    Due to further ultrix preprocessor problems, for all definitions of definitions with arguments, -cfortran.h >= 3.0 includes the arguments and recommends the same, +cfortran.h >= 3.0 includes the arguments and recommends the same, even though it is not required by ANSI C. e.g. Users are advised to do
    @@ -2145,17 +2151,17 @@
             cc: SC3.0.1 13 Jul 1994
        or equivalently
        ULTRIX 4.4 0 RISC using cc -oldc
    -   are K&R C preprocessors that suffer from infinite loop macros, e.g.
    +   are K&R C preprocessors that suffer from infinite loop macros, e.g.
     
     
    -  zedy03> cat src.c
    -  #include "cfortran.h"
    +  zedy03> cat src.c
    +  #include <cfortran.h>
                                 PROTOCCALLSFFUN1(INT,FREV,frev, INTV)
       #define FREV(A1)               CCALLSFFUN1(    FREV,frev, INTV, A1)
       /* To avoid the problem, deletete these ---^^^^--- spaces.    */
       main() { static int a[] = {1,2}; FREV(a); return EXIT_SUCCESS; }
     
    -  zedy03> cc -c -Xs -v -DMAX_PREPRO_ARGS=31 -D__CF__KnR src.c
    +  zedy03> cc -c -Xs -v -DMAX_PREPRO_ARGS=31 -D__CF__KnR src.c
       "src.c", line 4: FREV: actuals too long
       "src.c", line 4: FREV: actuals too long
       .... 3427 more lines of the same message
    @@ -2190,20 +2196,20 @@
     

    Unlike all other C compilers supported by cfortran.h, 'gcc -traditional' promotes to double all functions returning float -as demonstrated bu the following example. +as demonstrated by the following example.

     /* m.c */
    -#include 
    +#include <stdio.h>
     int main() { FLOAT_FUNCTION d(); float f; f = d(); printf("%f\n",f); return 0; }
     
     /* d.c */
     float d() { return -123.124; }
     
     burow[29] gcc -c -traditional d.c
    -burow[30] gcc -DFLOAT_FUNCTION=float m.c d.o && a.out
    +burow[30] gcc -DFLOAT_FUNCTION=float m.c d.o && a.out
     0.000000
    -burow[31] gcc -DFLOAT_FUNCTION=double m.c d.o && a.out
    +burow[31] gcc -DFLOAT_FUNCTION=double m.c d.o && a.out
     -123.124001
     burow[32]
     
    @@ -2298,7 +2304,7 @@ July '91. 2.0
      -
    • Improved code generation machinery creates K&R or ANSI C. +
    • Improved code generation machinery creates K&R or ANSI C.
    • Supports Sun, CRAY. f2c with vcc on VAX Ultrix.
    • cfortran.h macros now require routine and COMMON block names in both upper and lower case. No changes required to applications though. @@ -2366,7 +2372,7 @@ April'93. 3.0
        -
      • Automagic handling of ANSI ## versus K&R /**/ preprocessor op. +
      • Automagic handling of ANSI ## versus K&R /**/ preprocessor op.
      • Less chance of name space collisions between cfortran.h and other codes.
      • SIMPLE macros, supporting user defined types, have changed names.
      @@ -2494,7 +2500,8 @@
       THIS PACKAGE, I.E. CFORTRAN.H, THIS DOCUMENT, AND THE CFORTRAN.H EXAMPLE
       PROGRAMS ARE PROPERTY OF THE AUTHOR WHO RESERVES ALL RIGHTS. THIS PACKAGE AND
      -THE CODE IT PRODUCES MAY BE FREELY DISTRIBUTED WITHOUT FEES, SUBJECT TO THE
      +THE CODE IT PRODUCES MAY BE FREELY DISTRIBUTED WITHOUT FEES, SUBJECT 
      +(AT YOUR CHOICE) EITHER TO THE GNU LIBRARY GENERAL PUBLIC LICENSE OR TO THE
       FOLLOWING RESTRICTIONS:
       - YOU MUST ACCOMPANY ANY COPIES OR DISTRIBUTION WITH THIS (UNALTERED) NOTICE.
       - YOU MAY NOT RECEIVE MONEY FOR THE DISTRIBUTION OR FOR ITS MEDIA 
      --- cfortran-4.4.orig/cfortran.h
      +++ cfortran-4.4/cfortran.h
      @@ -11,11 +11,108 @@
          MODIFYING, COPYING AND DISTRIBUTING THE CFORTRAN.H PACKAGE.
       */
       
      +/* THIS PACKAGE, I.E. CFORTRAN.H, THIS DOCUMENT, AND THE CFORTRAN.H EXAMPLE
      +PROGRAMS ARE PROPERTY OF THE AUTHOR WHO RESERVES ALL RIGHTS. THIS PACKAGE AND
      +THE CODE IT PRODUCES MAY BE FREELY DISTRIBUTED WITHOUT FEES, SUBJECT
      +(AT YOUR CHOICE) EITHER TO THE GNU LIBRARY GENERAL PUBLIC LICENSE
      +AT http://www.gnu.org/licenses/lgpl.html OR TO THE FOLLOWING RESTRICTIONS:
      +- YOU MUST ACCOMPANY ANY COPIES OR DISTRIBUTION WITH THIS (UNALTERED) NOTICE.
      +- YOU MAY NOT RECEIVE MONEY FOR THE DISTRIBUTION OR FOR ITS MEDIA 
      +  (E.G. TAPE, DISK, COMPUTER, PAPER.)
      +- YOU MAY NOT PREVENT OTHERS FROM COPYING IT FREELY.
      +- YOU MAY NOT DISTRIBUTE MODIFIED VERSIONS WITHOUT CLEARLY DOCUMENTING YOUR
      +  CHANGES AND NOTIFYING THE AUTHOR.
      +- YOU MAY NOT MISREPRESENTED THE ORIGIN OF THIS SOFTWARE, EITHER BY EXPLICIT
      +  CLAIM OR BY OMISSION.
      +
      +THE INTENT OF THE ABOVE TERMS IS TO ENSURE THAT THE CFORTRAN.H PACKAGE NOT BE
      +USED FOR PROFIT MAKING ACTIVITIES UNLESS SOME ROYALTY ARRANGEMENT IS ENTERED
      +INTO WITH ITS AUTHOR.
      +              
      +THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
      +EXPRESSED OR IMPLIED. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
      +SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST
      +OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. THE AUTHOR IS NOT RESPONSIBLE
      +FOR ANY SUPPORT OR SERVICE OF THE CFORTRAN.H PACKAGE.
      +
      +                                              Burkhard Burow 
      +                                              burow@desy.de
      +*/
      +
      +/* The following modifications were made by the authors of CFITSIO or by me. 
      + * They are flagged below with CFITSIO, the author's initials, or KMCCARTY.
      + * PDW = Peter Wilson
      + * DM  = Doug Mink
      + * LEB = Lee E Brotzman
      + * MR  = Martin Reinecke
      + * WDP = William D Pence
      + * BR  = Bastien ROUCARIES
      + * -- Kevin McCarty, for Debian (19 Dec. 2005) */
      +
      +/*******
      +   Modifications:
      +      Oct 1997: Changed symbol name extname to appendus (PDW/HSTX)
      +                (Conflicted with a common variable name in FTOOLS)
      +      Nov 1997: If g77Fortran defined, also define f2cFortran (PDW/HSTX)
      +      Feb 1998: Let VMS see the NUM_ELEMS code. Lets programs treat
      +                single strings as vectors with single elements
      +      Nov 1999: If macintoxh defined, also define f2cfortran (for Mac OS-X)
      +      Apr 2000: If WIN32 defined, also define PowerStationFortran and
      +                VISUAL_CPLUSPLUS (Visual C++)
      +      Jun 2000: If __GNUC__ and linux defined, also define f2cFortran
      +                (linux/gcc environment detection)
      +      Apr 2002: If __CYGWIN__ is defined, also define f2cFortran
      +      Nov 2002: If __APPLE__ defined, also define f2cfortran (for Mac OS-X)
      +
      +      Nov 2003: If __INTEL_COMPILER or INTEL_COMPILER defined, also define
      +                f2cFortran (KMCCARTY)
      +      Dec 2005: If f2cFortran is defined, enforce REAL functions in FORTRAN
      +                returning "double" in C.  This was one of the items on
      +		Burkhard's TODO list. (KMCCARTY)
      +      Dec 2005: Modifications to support 8-byte integers. (MR)
      +		USE AT YOUR OWN RISK!
      +      Feb 2006  Added logic to typedef the symbol 'LONGLONG' to an appropriate
      +                intrinsic 8-byte integer datatype  (WDP)
      +      Apr 2006: Modifications to support gfortran (and g77 with -fno-f2c flag)
      +                since by default it returns "float" for FORTRAN REAL function.
      +                (KMCCARTY)
      +      May 2008: Revert commenting out of "extern" in COMMON_BLOCK_DEF macro.
      +		Add braces around do-nothing ";" in 3 empty while blocks to
      +		get rid of compiler warnings.  Thanks to ROOT developers
      +		Jacek Holeczek and Rene Brun for these suggestions. (KMCCARTY)
      +      Aug 2008: If __GNUC__ is defined and no FORTRAN compiler is specified
      +		via a #define or -D, default to gfortran behavior rather than
      +		g77 behavior. (KMCCARTY)
      +      Oct 2009: Add warning if guessing default fortran. Move g77 above guessing bloc
      + *******/
      +
       /* 
         Avoid symbols already used by compilers and system *.h:
         __ - OSF1 zukal06 V3.0 347 alpha, cc -c -std1 cfortest.c
       
      - */
      +*/
      +
      +/* 
      +   Determine what 8-byte integer data type is available.
      +  'long long' is now supported by most compilers, but older
      +  MS Visual C++ compilers before V7.0 use '__int64' instead. (WDP)
      +*/
      +
      +#ifndef LONGLONG_TYPE   /* this may have been previously defined */
      +#if defined(_MSC_VER)   /* Microsoft Visual C++ */
      +
      +#if (_MSC_VER < 1300)   /* versions earlier than V7.0 do not have 'long long' */
      +    typedef __int64 LONGLONG;
      +#else                   /* newer versions do support 'long long' */
      +    typedef long long LONGLONG; 
      +#endif
      +
      +#else
      +    typedef long long LONGLONG; 
      +#endif
      +
      +#define LONGLONG_TYPE
      +#endif  
       
       
       /* First prepare for the C compiler. */
      @@ -75,7 +172,13 @@
       
       /* Remainder of cfortran.h depends on the Fortran compiler. */
       
      -#if defined(CLIPPERFortran) || defined(pgiFortran)
      +/* 11/29/2003 (KMCCARTY): add *INTEL_COMPILER symbols here */
      +/* 04/05/2006 (KMCCARTY): add gFortran symbol here */
      +#if defined(CLIPPERFortran) || defined(pgiFortran) || defined(__INTEL_COMPILER) || defined(INTEL_COMPILER) || defined(gFortran)
      +#define f2cFortran
      +#endif
      +
      +#if defined(g77Fortran)                        /* 11/03/97 PDW (CFITSIO) */
       #define f2cFortran
       #endif
       
      @@ -84,12 +187,37 @@
       #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)||defined(AbsoftProFortran)||defined(SXFortran))
       /* If no Fortran compiler is given, we choose one for the machines we know.   */
      +#if defined(__GNUC__) || defined(WIN32) /* 10/2009 BR: warm if guess */
      +#warning "Please specify the fortran compiler using -D flags. Try to guess the compiler used"
      +#endif
       #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
      +/* 04/13/00 DM (CFITSIO): Add these lines for NT */
      +/*   with PowerStationFortran and and Visual C++ */
      +#if defined(WIN32) && !defined(__CYGWIN__)
      +#define PowerStationFortran   
      +#define VISUAL_CPLUSPLUS
      +#endif
      +#if        defined(__CYGWIN__)                 /* 04/11/02 LEB (CFITSIO) */
      +#define       f2cFortran 
      +#define	      gFortran /* 8/26/08 (KMCCARTY) */
      +#endif
      +#if        defined(__GNUC__) && defined(linux) /* 06/21/00 PDW (CFITSIO) */
      +#define       f2cFortran 
      +#define	      gFortran /* 8/26/08 (KMCCARTY) */
      +#endif
      +#if defined(macintosh)                         /* 11/1999 (CFITSIO) */
      +#define f2cFortran
      +#define	      gFortran /* 8/26/08 (KMCCARTY) */
      +#endif
      +#if defined(__APPLE__)                         /* 11/2002 (CFITSIO) */
      +#define f2cFortran
      +#define	      gFortran /* 8/26/08 (KMCCARTY) */
      +#endif
       #if defined(__hpux)             /* 921107: Use __hpux instead of __hp9000s300 */
       #define       hpuxFortran       /*         Should also allow hp9000s7/800 use.*/
       #endif
      @@ -131,6 +259,7 @@
       #if !(defined(mipsFortran)||defined(DECFortran)||defined(vmsFortran)||defined(CONVEXFortran)||defined(PowerStationFortran)||defined(AbsoftUNIXFortran)||defined(AbsoftProFortran)||defined(SXFortran))
       /* If your compiler barfs on ' #error', replace # with the trigraph for #     */
        #error "cfortran.h:  Can't find your environment among:\
      +    - GNU gcc (gfortran) on Linux.                                       \
           - 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.                                  \
      @@ -147,11 +276,14 @@
           - 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             \
      +    - f2c/g77:   Use #define    f2cFortran, or cc -Df2cFortran           \
      +    - gfortran:  Use #define    gFortran,   or cc -DgFortran             \
      +                 (also necessary for g77 with -fno-f2c option)           \
           - NAG f90: Use #define NAGf90Fortran, or cc -DNAGf90Fortran          \
           - Absoft UNIX F77: Use #define AbsoftUNIXFortran or cc -DAbsoftUNIXFortran \
           - Absoft Pro Fortran: Use #define AbsoftProFortran \
      -    - Portland Group Fortran: Use #define pgiFortran"
      +    - Portland Group Fortran: Use #define pgiFortran \
      +    - Intel Fortran: Use #define INTEL_COMPILER"
       /* Compiler must throw us out at this point! */
       #endif
       #endif
      @@ -164,7 +296,8 @@
       
       /* 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(SXFortran) || defined(extname)
      +/* "extname" changed to "appendus" below (CFITSIO) */
      +#if defined(f2cFortran) || defined(NAGf90Fortran) || defined(DECFortran) || defined(mipsFortran) || defined(apolloFortran) || defined(sunFortran) || defined(CONVEXFortran) || defined(SXFortran) || defined(appendus)
       #define CFC_(UN,LN)            _(LN,_)      /* Lowercase FORTRAN symbols.     */
       #define orig_fcallsc(UN,LN)    CFC_(UN,LN)
       #else 
      @@ -453,7 +586,7 @@
       {char *e; 
       e = s + strlen(s);
       if (e>s) {                           /* Need this to handle NULL string.*/
      -  while (e>s && *--e==t);            /* Don't follow t's past beginning. */
      +  while (e>s && *--e==t) {;}         /* Don't follow t's past beginning. */
         e[*e==t?0:1] = '\0';               /* Handle s[0]=t correctly.       */
       } return s; }
       
      @@ -469,7 +602,7 @@
       { 
       if (e==s) *e = '\0';                 /* Kill the string makes sense here.*/
       else if (e>s) {                      /* Watch out for neg. length string.*/
      -  while (e>s && *--e==t);            /* Don't follow t's past beginning. */
      +  while (e>s && *--e==t){;}          /* Don't follow t's past beginning. */
         e[*e==t?0:1] = '\0';               /* Handle s[0]=t correctly.       */
       } return s; }
       
      @@ -512,7 +645,7 @@
                           *( (F).dsc$l_m[0]=(F).dsc$bounds[0].dsc$l_u=(ELEMNO)  ),   \
         (F).dsc$a_a0    =  ( (F).dsc$a_pointer=(C) ) - (F).dsc$w_length          ,(F))
       
      -#else
      +#endif      /* PDW: 2/10/98 (CFITSIO) -- Let VMS see NUM_ELEMS definitions */
       #define _NUM_ELEMS      -1
       #define _NUM_ELEM_ARG   -2
       #define NUM_ELEMS(A)    A,_NUM_ELEMS
      @@ -534,13 +667,18 @@
         return term_char;
       if (num_term <=0) num_term = (int)elem_len;
       for (num=0; ; num++) {
      -  for (i=0; i<(unsigned)num_term && *strv==term_char; i++,strv++);
      +  for (i=0; i<(unsigned)num_term && *strv==term_char; i++,strv++){;}
         if (i==(unsigned)num_term) break;
         else strv += elem_len-i;
       }
      +if (0) {  /* to prevent not used warnings in gcc (added by ROOT) */
      +   c2fstrv(0, 0, 0, 0); f2cstrv(0, 0, 0, 0); kill_trailing(0, 0);
      +   vkill_trailing(0, 0, 0, 0); num_elem(0, 0, 0, 0);
      +}
       return (int)num;
       }
      -#endif
      +/* #endif removed 2/10/98 (CFITSIO) */
      +
       /*-------------------------------------------------------------------------*/
       
       /*           UTILITIES FOR C TO USE STRINGS IN FORTRAN COMMON BLOCKS       */
      @@ -1318,6 +1456,7 @@
       #define     INTVVVVVVV_cfTYPE int
       #define LOGICALVVVVVVV_cfTYPE int
       #define    LONGVVVVVVV_cfTYPE long
      +#define LONGLONGVVVVVVV_cfTYPE LONGLONG   /* added by MR December 2005 */
       #define   SHORTVVVVVVV_cfTYPE short
       #define          PBYTE_cfTYPE INTEGER_BYTE
       #define        PDOUBLE_cfTYPE DOUBLE_PRECISION 
      @@ -1325,6 +1464,7 @@
       #define           PINT_cfTYPE int
       #define       PLOGICAL_cfTYPE int
       #define          PLONG_cfTYPE long
      +#define      PLONGLONG_cfTYPE LONGLONG  /* added by MR December 2005 */
       #define         PSHORT_cfTYPE short
       
       #define CFARGS0(A,T,V,W,X,Y,Z) _3(T,_cf,A)
      @@ -1342,6 +1482,7 @@
       #define            INT_cfINT(N,A,B,X,Y,Z)        DOUBLE_cfINT(N,A,B,X,Y,Z)
       #define        LOGICAL_cfINT(N,A,B,X,Y,Z)        DOUBLE_cfINT(N,A,B,X,Y,Z)
       #define           LONG_cfINT(N,A,B,X,Y,Z)        DOUBLE_cfINT(N,A,B,X,Y,Z)
      +#define       LONGLONG_cfINT(N,A,B,X,Y,Z)        DOUBLE_cfINT(N,A,B,X,Y,Z) /* added by MR December 2005 */
       #define          SHORT_cfINT(N,A,B,X,Y,Z)        DOUBLE_cfINT(N,A,B,X,Y,Z)
       #define          PBYTE_cfINT(N,A,B,X,Y,Z)       PDOUBLE_cfINT(N,A,B,X,Y,Z)
       #define        PDOUBLE_cfINT(N,A,B,X,Y,Z) _(CFARGS,N)(A,PINT,B,X,Y,Z,0)
      @@ -1349,6 +1490,7 @@
       #define           PINT_cfINT(N,A,B,X,Y,Z)       PDOUBLE_cfINT(N,A,B,X,Y,Z)
       #define       PLOGICAL_cfINT(N,A,B,X,Y,Z)       PDOUBLE_cfINT(N,A,B,X,Y,Z)
       #define          PLONG_cfINT(N,A,B,X,Y,Z)       PDOUBLE_cfINT(N,A,B,X,Y,Z)
      +#define      PLONGLONG_cfINT(N,A,B,X,Y,Z)       PDOUBLE_cfINT(N,A,B,X,Y,Z) /* added by MR December 2005 */
       #define         PSHORT_cfINT(N,A,B,X,Y,Z)       PDOUBLE_cfINT(N,A,B,X,Y,Z)
       #define          BYTEV_cfINT(N,A,B,X,Y,Z)       DOUBLEV_cfINT(N,A,B,X,Y,Z)
       #define         BYTEVV_cfINT(N,A,B,X,Y,Z)      DOUBLEVV_cfINT(N,A,B,X,Y,Z)
      @@ -1392,6 +1534,13 @@
       #define      LONGVVVVV_cfINT(N,A,B,X,Y,Z)   DOUBLEVVVVV_cfINT(N,A,B,X,Y,Z)
       #define     LONGVVVVVV_cfINT(N,A,B,X,Y,Z)  DOUBLEVVVVVV_cfINT(N,A,B,X,Y,Z)
       #define    LONGVVVVVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVVVVVV_cfINT(N,A,B,X,Y,Z)
      +#define      LONGLONGV_cfINT(N,A,B,X,Y,Z)       DOUBLEV_cfINT(N,A,B,X,Y,Z) /* added by MR December 2005 */
      +#define     LONGLONGVV_cfINT(N,A,B,X,Y,Z)      DOUBLEVV_cfINT(N,A,B,X,Y,Z) /* added by MR December 2005 */
      +#define    LONGLONGVVV_cfINT(N,A,B,X,Y,Z)     DOUBLEVVV_cfINT(N,A,B,X,Y,Z) /* added by MR December 2005 */
      +#define   LONGLONGVVVV_cfINT(N,A,B,X,Y,Z)    DOUBLEVVVV_cfINT(N,A,B,X,Y,Z) /* added by MR December 2005 */
      +#define  LONGLONGVVVVV_cfINT(N,A,B,X,Y,Z)   DOUBLEVVVVV_cfINT(N,A,B,X,Y,Z) /* added by MR December 2005 */
      +#define LONGLONGVVVVVV_cfINT(N,A,B,X,Y,Z)  DOUBLEVVVVVV_cfINT(N,A,B,X,Y,Z) /* added by MR December 2005 */
      +#define LONGLONGVVVVVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVVVVVV_cfINT(N,A,B,X,Y,Z) /* added by MR December 2005 */
       #define         SHORTV_cfINT(N,A,B,X,Y,Z)       DOUBLEV_cfINT(N,A,B,X,Y,Z)
       #define        SHORTVV_cfINT(N,A,B,X,Y,Z)      DOUBLEVV_cfINT(N,A,B,X,Y,Z)
       #define       SHORTVVV_cfINT(N,A,B,X,Y,Z)     DOUBLEVVV_cfINT(N,A,B,X,Y,Z)
      @@ -1451,7 +1600,12 @@
       #define      BYTE_cfPU(A)   CFextern INTEGER_BYTE      FCALLSC_QUALIFIER A
       #define    DOUBLE_cfPU(A)   CFextern DOUBLE_PRECISION  FCALLSC_QUALIFIER A
       #if ! (defined(FLOATFUNCTIONTYPE)&&defined(ASSIGNFLOAT)&&defined(RETURNFLOAT))
      +#if defined (f2cFortran) && ! defined (gFortran)
      +/* f2c/g77 return double from FORTRAN REAL functions. (KMCCARTY, 2005/12/09) */
      +#define     FLOAT_cfPU(A)   CFextern DOUBLE_PRECISION  FCALLSC_QUALIFIER A
      +#else
       #define     FLOAT_cfPU(A)   CFextern FORTRAN_REAL      FCALLSC_QUALIFIER A
      +#endif
       #else				   	                   
       #define     FLOAT_cfPU(A)   CFextern FLOATFUNCTIONTYPE FCALLSC_QUALIFIER A
       #endif				   	                   
      @@ -1589,6 +1743,7 @@
       #define            INT_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
       #define        LOGICAL_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,LOGICAL,A,B,C,D,E)
       #define           LONG_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
      +#define       LONGLONG_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) /* added by MR December 2005 */
       #define          SHORT_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
       #define          BYTEV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
       #define         BYTEVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
      @@ -1632,6 +1787,13 @@
       #define      LONGVVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
       #define     LONGVVVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
       #define    LONGVVVVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
      +#define      LONGLONGV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) /* added by MR December 2005 */
      +#define     LONGLONGVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) /* added by MR December 2005 */
      +#define    LONGLONGVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) /* added by MR December 2005 */
      +#define   LONGLONGVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) /* added by MR December 2005 */
      +#define  LONGLONGVVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) /* added by MR December 2005 */
      +#define LONGLONGVVVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) /* added by MR December 2005 */
      +#define LONGLONGVVVVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) /* added by MR December 2005 */
       #define         SHORTV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
       #define        SHORTVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
       #define       SHORTVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
      @@ -1645,6 +1807,7 @@
       #define           PINT_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
       #define       PLOGICAL_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,PLOGICAL,A,B,C,D,E)
       #define          PLONG_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
      +#define      PLONGLONG_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) /* added by MR December 2005 */
       #define         PSHORT_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
       #define         STRING_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,STRING,A,B,C,D,E)
       #define        PSTRING_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,PSTRING,A,B,C,D,E)
      @@ -1957,6 +2120,7 @@
       #define            INT_cfT(M,I,A,B,D) *A
       #define        LOGICAL_cfT(M,I,A,B,D)  F2CLOGICAL(*A)
       #define           LONG_cfT(M,I,A,B,D) *A
      +#define       LONGLONG_cfT(M,I,A,B,D) *A /* added by MR December 2005 */
       #define          SHORT_cfT(M,I,A,B,D) *A
       #define          BYTEV_cfT(M,I,A,B,D)  A
       #define        DOUBLEV_cfT(M,I,A,B,D)  A
      @@ -1964,6 +2128,7 @@
       #define           INTV_cfT(M,I,A,B,D)  A
       #define       LOGICALV_cfT(M,I,A,B,D)  A
       #define          LONGV_cfT(M,I,A,B,D)  A
      +#define      LONGLONGV_cfT(M,I,A,B,D)  A /* added by MR December 2005 */
       #define         SHORTV_cfT(M,I,A,B,D)  A
       #define         BYTEVV_cfT(M,I,A,B,D)  (void *)A /* We have to cast to void *,*/
       #define        BYTEVVV_cfT(M,I,A,B,D)  (void *)A /* since we don't know the   */
      @@ -2001,6 +2166,12 @@
       #define      LONGVVVVV_cfT(M,I,A,B,D)  (void *)A
       #define     LONGVVVVVV_cfT(M,I,A,B,D)  (void *)A
       #define    LONGVVVVVVV_cfT(M,I,A,B,D)  (void *)A
      +#define     LONGLONGVV_cfT(M,I,A,B,D)  (void *)A /* added by MR December 2005 */
      +#define    LONGLONGVVV_cfT(M,I,A,B,D)  (void *)A /* added by MR December 2005 */
      +#define   LONGLONGVVVV_cfT(M,I,A,B,D)  (void *)A /* added by MR December 2005 */
      +#define  LONGLONGVVVVV_cfT(M,I,A,B,D)  (void *)A /* added by MR December 2005 */
      +#define LONGLONGVVVVVV_cfT(M,I,A,B,D)  (void *)A /* added by MR December 2005 */
      +#define LONGLONGVVVVVVV_cfT(M,I,A,B,D)  (void *)A /* added by MR December 2005 */
       #define        SHORTVV_cfT(M,I,A,B,D)  (void *)A
       #define       SHORTVVV_cfT(M,I,A,B,D)  (void *)A
       #define      SHORTVVVV_cfT(M,I,A,B,D)  (void *)A
      @@ -2013,6 +2184,7 @@
       #define           PINT_cfT(M,I,A,B,D)  A
       #define       PLOGICAL_cfT(M,I,A,B,D)  ((*A=F2CLOGICAL(*A)),A)
       #define          PLONG_cfT(M,I,A,B,D)  A
      +#define      PLONGLONG_cfT(M,I,A,B,D)  A /* added by MR December 2005 */
       #define         PSHORT_cfT(M,I,A,B,D)  A
       #define          PVOID_cfT(M,I,A,B,D)  A
       #if defined(apolloFortran) || defined(hpuxFortran800) || defined(AbsoftUNIXFortran)
      @@ -2083,12 +2255,18 @@
       #define     INT_cfFZ(UN,LN) int   FCALLSC_QUALIFIER fcallsc(UN,LN)(
       #define LOGICAL_cfFZ(UN,LN) int   FCALLSC_QUALIFIER fcallsc(UN,LN)(
       #define    LONG_cfFZ(UN,LN) long  FCALLSC_QUALIFIER fcallsc(UN,LN)(
      +#define LONGLONG_cfFZ(UN,LN) LONGLONG FCALLSC_QUALIFIER fcallsc(UN,LN)( /* added by MR December 2005 */
       #define   SHORT_cfFZ(UN,LN) short FCALLSC_QUALIFIER fcallsc(UN,LN)(
       #define    VOID_cfFZ(UN,LN) void  FCALLSC_QUALIFIER fcallsc(UN,LN)(
       #ifndef __CF__KnR
       /* The void is req'd by the Apollo, to make this an ANSI function declaration.
          The Apollo promotes K&R float functions to double. */
      -#define   FLOAT_cfFZ(UN,LN) FORTRAN_REAL FCALLSC_QUALIFIER fcallsc(UN,LN)(void
      +#if defined (f2cFortran) && ! defined (gFortran)
      +/* f2c/g77 return double from FORTRAN REAL functions. (KMCCARTY, 2005/12/09) */
      +#define FLOAT_cfFZ(UN,LN) DOUBLE_PRECISION FCALLSC_QUALIFIER fcallsc(UN,LN)(void
      +#else
      +#define FLOAT_cfFZ(UN,LN) FORTRAN_REAL FCALLSC_QUALIFIER fcallsc(UN,LN)(void
      +#endif
       #ifdef vmsFortran
       #define  STRING_cfFZ(UN,LN) void  FCALLSC_QUALIFIER fcallsc(UN,LN)(fstring *AS
       #else
      @@ -2104,7 +2282,12 @@
       #endif
       #else
       #if ! (defined(FLOATFUNCTIONTYPE)&&defined(ASSIGNFLOAT)&&defined(RETURNFLOAT))
      +#if defined (f2cFortran) && ! defined (gFortran)
      +/* f2c/g77 return double from FORTRAN REAL functions. (KMCCARTY, 2005/12/09) */
      +#define   FLOAT_cfFZ(UN,LN) DOUBLE_PRECISION  FCALLSC_QUALIFIER fcallsc(UN,LN)(
      +#else
       #define   FLOAT_cfFZ(UN,LN) FORTRAN_REAL      FCALLSC_QUALIFIER fcallsc(UN,LN)(
      +#endif
       #else
       #define   FLOAT_cfFZ(UN,LN) FLOATFUNCTIONTYPE FCALLSC_QUALIFIER fcallsc(UN,LN)(
       #endif
      @@ -2118,13 +2301,19 @@
       #define    BYTE_cfF(UN,LN)     BYTE_cfFZ(UN,LN)
       #define  DOUBLE_cfF(UN,LN)   DOUBLE_cfFZ(UN,LN)
       #ifndef __CF_KnR
      +#if defined (f2cFortran) && ! defined (gFortran)
      +/* f2c/g77 return double from FORTRAN REAL functions. (KMCCARTY, 2005/12/09) */
      +#define   FLOAT_cfF(UN,LN)  DOUBLE_PRECISION FCALLSC_QUALIFIER fcallsc(UN,LN)(
      +#else
       #define   FLOAT_cfF(UN,LN)  FORTRAN_REAL FCALLSC_QUALIFIER fcallsc(UN,LN)(
      +#endif
       #else
       #define   FLOAT_cfF(UN,LN)    FLOAT_cfFZ(UN,LN)
       #endif
       #define     INT_cfF(UN,LN)      INT_cfFZ(UN,LN)
       #define LOGICAL_cfF(UN,LN)  LOGICAL_cfFZ(UN,LN)
       #define    LONG_cfF(UN,LN)     LONG_cfFZ(UN,LN)
      +#define LONGLONG_cfF(UN,LN) LONGLONG_cfFZ(UN,LN) /* added by MR December 2005 */
       #define   SHORT_cfF(UN,LN)    SHORT_cfFZ(UN,LN)
       #define    VOID_cfF(UN,LN)     VOID_cfFZ(UN,LN)
       #define  STRING_cfF(UN,LN)   STRING_cfFZ(UN,LN),
      @@ -2187,6 +2376,7 @@
       #define LOGICAL_cfI  return C2FLOGICAL(A0);
       #endif
       #define    LONG_cfI  return A0;
      +#define LONGLONG_cfI  return A0; /* added by MR December 2005 */
       #define   SHORT_cfI  return A0;
       #define  STRING_cfI  return   ;
       #define    VOID_cfI  return   ;
      --- cfortran-4.4.orig/index.htm
      +++ cfortran-4.4/index.htm
      @@ -22,7 +22,8 @@
          Burkhard D. Burow. "Mixed Language Programming",
         In Computing in High Energy Physics (CHEP'95), Rio de Janeiro, Brazil,
         Sept. 1995, editors R. Shellard and T.Nguyen, World Scientific, pp. 610-614.
      -Here is the paper and the slides of the presentation.
      +Here is the paper +and the slides of the presentation.
      It introduces cfortran.h and alternative methods for mixed language programming
      and thus can help you decide if cfortran.h can be of use to you.

      @@ -33,21 +34,23 @@ then cfortran.h has a few thousand users. You easily can find users in a www search.


      -The cfortran.h software consists of the single C header file cfortran.h.
      +The cfortran.h software consists of the single C header file cfortran.h.

      The documentation is the single file cfortran.html.
      The documentation also is available at its original location http://wwwinfo.cern.ch/asd/cernlib/cfortran.html.
      -The documentation also is available as the original ASCII file cfortran.doc.
      +The documentation also is available as the gzipped ASCII file cfortran.doc.gz.

      A variety of small independent applications are available to test and demonstrate cfortran.h.
      -All the applications are contained in a compressed tar file cfortran.examples.tar.gz.
      +All the applications are contained in + +the examples directory.
      Though NOT recommended for most purposes,
      -the above applications also are available in a single C file cfortest.c
      -and a single Fortran file cfortex.f.
      +the above applications also are available in a single C file cfortest.c
      +and a single Fortran file cfortex.f.


      If cfortran.h has served you well, you may want to look at the recent instance of graph reduction
      --- cfortran-4.4.orig/cfortran.doc +++ cfortran-4.4/cfortran.doc @@ -195,13 +195,13 @@ HP9000> f77 -c cfortex.f HP9000> CC -o cfortest cfortest.c cfortex.o -lI77 -lF77 && cfortest -HP0000> # If old-style f77 +800 compiled objects are required: +HP9000> # If old-style f77 +800 compiled objects are required: HP9000> # #define hpuxFortran800 HP9000> cc -c -Aa -DhpuxFortran800 cfortest.c HP9000> f77 +800 -o cfortest cfortest.o cfortex.f f2c> # In the following, 'CC' is any C compiler. -f2c> f2c -R cfortex.f +f2c> f2c cfortex.f f2c> CC -o cfortest -Df2cFortran cfortest.c cfortex.c -lf2c && cfortest Portland Group $ # Presumably other C compilers also work. @@ -533,9 +533,10 @@ FORTRAN_REAL thus corresponds to FORTRAN's REAL on all machines, including t3e. -o f2c - f2c, by default promotes REAL functions to double. cfortran.h does not (yet) -support this, so the f2c -R option must be used to turn this promotion off. +o f2c / g77 + f2c and g77 by default promote REAL functions to double. As of December 9, +2005, the Debian package of cfortran supports this behavior, so the f2c -R +option must *NOT* be used to turn this promotion off. o f2c [Thanks to Dario Autiero for pointing out the following.] @@ -573,6 +574,11 @@ #endif /* Last three lines are a work-around for the strange f2c naming feature. */ +o gfortran + gfortran behaves similarly to f2c and g77, EXCEPT that it does NOT by default +promote REAL functions to double. Therefore you should use -DgFortran instead +of -Dg77Fortran or -Df2cFortran to let cfortran.h know about this difference. + o NAG f90 The Fortran 77 subset of Fortran 90 is supported. Extending cfortran.h to interface C with all of Fortran 90 has not yet been examined. @@ -643,7 +649,7 @@ [For an ancient math.h on a 386 or sparc, get similar from a new math.h.] #ifdef mc68000 /* 5 lines Copyright (c) 1988 by Sun Microsystems, Inc. */ #define FLOATFUNCTIONTYPE int - #define RETURNFLOAT(x) return (*(int *)(&(x))) + #define RETURNFLOAT(x) return (*(int *)(&(x))) #define ASSIGNFLOAT(x,y) *(int *)(&x) = y #endif @@ -874,7 +880,7 @@ works everywhere and would seem to be an obvious choice. -3. +3. cfortran.h encourages the exact specification of the type and dimension of array parameters because it allows the C compiler to detect errors in the @@ -1835,7 +1841,7 @@ Unlike all other C compilers supported by cfortran.h, 'gcc -traditional' promotes to double all functions returning float -as demonstrated bu the following example. +as demonstrated by the following example. /* m.c */ #include @@ -2017,8 +2023,9 @@ THIS PACKAGE, I.E. CFORTRAN.H, THIS DOCUMENT, AND THE CFORTRAN.H EXAMPLE PROGRAMS ARE PROPERTY OF THE AUTHOR WHO RESERVES ALL RIGHTS. THIS PACKAGE AND -THE CODE IT PRODUCES MAY BE FREELY DISTRIBUTED WITHOUT FEES, SUBJECT TO THE -FOLLOWING RESTRICTIONS: +THE CODE IT PRODUCES MAY BE FREELY DISTRIBUTED WITHOUT FEES, SUBJECT +(AT YOUR CHOICE) EITHER TO THE GNU LIBRARY GENERAL PUBLIC LICENSE +AT http://www.gnu.org/licenses/lgpl.html OR TO THE FOLLOWING RESTRICTIONS: - YOU MUST ACCOMPANY ANY COPIES OR DISTRIBUTION WITH THIS (UNALTERED) NOTICE. - YOU MAY NOT RECEIVE MONEY FOR THE DISTRIBUTION OR FOR ITS MEDIA (E.G. TAPE, DISK, COMPUTER, PAPER.) --- cfortran-4.4.orig/debian/changelog +++ cfortran-4.4/debian/changelog @@ -0,0 +1,164 @@ +cfortran (4.4-14) unstable; urgency=low + + * Add license text to cfortran.h (Closes: #507429). + * Warm if user does not use -D flags as documented in README.debian + (Closes: #497023). + * New maintainer (Closes: #508500). + * Bump policy version. + + -- Bastien ROUCARIÈS Wed, 14 Oct 2009 14:56:50 +0200 + +cfortran (4.4-13) unstable; urgency=low + + * Bump Standards-Version to 3.8.0 (no changes). + * Make the default behavior on CYGWIN, Linux (with gcc) and OS X be to + assume gfortran (rather than g77/f2c) if the FORTRAN compiler has + otherwise been left unspecified. Thanks Davide Mancusi for the prod. + * Fix a buffer overrun bug found by Jean-Guillaume Piccinali in one of + the example programs (fd/fd.c). (Closes: #489886.) + + -- Kevin B. McCarty Tue, 26 Aug 2008 20:55:16 -0700 + +cfortran (4.4-12) unstable; urgency=low + + * Bump Standards-Version to 3.7.3 (no changes). + * Restore commented-out "extern" in COMMON_BLOCK_DEF() macro, by + request of Jacek Holeczek . + N.B. This will cause "paw" source package to FTBFS due to a + Debian-specific patch to paw, so I will upload a fix for that shortly. + * Add {} around lone ";" in three empty "while" bodies to get rid of + spurious compiler warnings with recent gcc. Thanks to Rene Brun + . + * Change package recommends from g77 to gfortran. + * Add README.Debian to mention that most people using gfortran will want + to use -DgFortran (those using g77 will want to keep using -Dg77Fortran + or -Df2cFortran) and to discuss the differences. + + -- Kevin B. McCarty Wed, 14 May 2008 09:07:09 -0700 + +cfortran (4.4-11) unstable; urgency=low + + * Bump Standards-Version to 3.7.2 (no changes). + * Build-Depends: debhelper (instead of Build-Depends-Indep) to fix + Lintian error. + + -- Kevin B. McCarty Mon, 27 Nov 2006 09:16:31 -0500 + +cfortran (4.4-10) unstable; urgency=low + + * Add modifications so that gfortran (and g77 with -fno-f2c flag) are + supported when the C/C++ compiler is invoked with flag -DgFortran + (or gFortran is otherwise #define'd). Possibly at some later time when + gfortran is the default FORTRAN compiler on Debian, this will be made + the default. Thanks to William Pence + for bringing up the issue. Mentioned in debian/NEWS. + * Add modifications by William Pence to define a LONGLONG type more + carefully. + * Bump debian/compat to 5. + + -- Kevin B. McCarty Wed, 5 Apr 2006 17:01:35 -0400 + +cfortran (4.4-9) unstable; urgency=low + + * Add modifications from Martin Reinecke + for partial INTEGER*8 (long long) support. + * Not updating the documentation yet as the cfitsio team has requested + to leave this feature undocumented for now. + + -- Kevin B. McCarty Fri, 23 Dec 2005 08:21:35 -0500 + +cfortran (4.4-8) unstable; urgency=low + + * cfortran.h: Improved to enforce the fact that f2c and g77 generate code + from FORTRAN REAL functions that returns a C "double". This should fix + runtime code breakage on some platforms such as AMD64. See NEWS.Debian + for more information. + * cfortran.doc and cfortran.html: updated to reflect the change. + + -- Kevin B. McCarty Fri, 9 Dec 2005 17:43:06 -0500 + +cfortran (4.4-7) unstable; urgency=low + + * Update FSF address in debian/copyright. + * Update maintainer email in debian/control and debian/copyright. + * Update debhelper compatibility to version 4. + * Update Standards-Version to 3.6.2 (no changes). + * Clean up debian/rules a bit. + * Unpack cfortran.examples.tar.gz into /usr/share/doc/cfortran/examples + to make it easier to explore (removing unneeded symlinks *.C -> *.c). + + -- Kevin B. McCarty Tue, 22 Nov 2005 13:35:38 +0000 + +cfortran (4.4-6) unstable; urgency=medium + + * Recommend "gcc | c-compiler" and "g77 | fortran-compiler" instead of + just the virtual packages. This avoids the situation of a person + naively installing cfortran with aptitude and ending up with some + random little-known compilers. + + -- Kevin B. McCarty Fri, 10 Dec 2004 08:53:47 -0500 + +cfortran (4.4-5) unstable; urgency=low + + * Install a symlink from /usr/include/cfortran/cfortran.h to + /usr/include/cfortran.h, since some build systems expect to find + cfortran.h (and various other Cernlib include files) in + /usr/include/cfortran. Fixes part of #243860. + + -- Kevin B. McCarty Wed, 28 Apr 2004 13:20:50 -0400 + +cfortran (4.4-4) unstable; urgency=low + + * cfortran.h: Add support for Intel Fortran compiler by #defining f2cFortran + when it's used or INTEL_COMPILER is #defined (closes: #222318). + + -- Kevin B. McCarty Sat, 29 Nov 2003 17:38:03 -0500 + +cfortran (4.4-3) unstable; urgency=low + + * debian/copyright: Add email from upstream licensing cfortran under LGPL. + Correct licensing statement; upstream licensed it specifically under + Library GPL (i.e. version 2), not Lesser GPL (i.e. version 2.1). + * debian/changelog: Remove emacs variable cruft from the bottom. + * debian/control: Standards-Version now 3.6.1 (no changes). + + -- Kevin B. McCarty Fri, 10 Oct 2003 14:54:52 -0400 + +cfortran (4.4-2) unstable; urgency=low + + * No longer conflict with current cfitsio-dev, as it no longer includes + a cfortran.h file. + * Merge small modifications (mainly more "#if defined" tests) from + CFITSIO code. + + -- Kevin B. McCarty Mon, 3 Mar 2003 11:19:26 +0100 + +cfortran (4.4-1) unstable; urgency=low + + * debian/control: use Build-Depends-Indep instead of Build-Depends + * Remove README.debian; edit cfortran.h to auto-detect gcc with __GNUC__. + * Fix a few more typos in documentation. + + -- Kevin B. McCarty Sat, 18 Jan 2003 18:14:37 +0100 + +cfortran (4.4-0.3) unstable; urgency=low + + * Escape "&", "<" and ">" characters in HTML documentation and fix a + couple of typos. + * Include note in cfortran.{html,doc} that it is now also licensed + under LGPL. + + -- Kevin B. McCarty Sat, 18 Jan 2003 13:23:14 +0100 + +cfortran (4.4-0.2) unstable; urgency=low + + * Fix links in HTML documentation. + * Add cfortran.examples.tar.gz package to examples directory. + + -- Kevin B. McCarty Sun, 8 Dec 2002 04:01:11 +0100 + +cfortran (4.4-0.1) unstable; urgency=low + + * Initial release as a Debian package. + + -- Kevin B. McCarty Sat, 9 Nov 2002 23:30:19 +0100 --- cfortran-4.4.orig/debian/copyright +++ cfortran-4.4/debian/copyright @@ -0,0 +1,104 @@ +Name: cfortran +Maintainer: Debian Science Maintainers +source: http://wwwinfo.cern.ch/asd/cernlib/download/2003_source/tar/src_cfortran.tar.gz + +Files: debian/* +Copyright: Copyright 2002-2009, Kevin McCarty + Copyright 2009, Bastien ROUCARIÈS +License: LGPL-2+ + The Debian packaging is licensed under the GPL, version 2 or later, + see below. + +Files: * +Copyright: Copyright 1990-2003, Burkhard D Steinmacher-burow +License: LGPL-2 or other + See below + +This package was debianized by Kevin McCarty on +Sat, 9 Nov 2002 23:30:19 +0100. + +It was downloaded from http://www-zeus.desy.de/~burow/cfortran/ except +for the file cfortran.h, which is a more recent version obtained at +http://wwwinfo.cern.ch/asd/cernlib/download/2003_source/tar/src_cfortran.tar.gz + +Upstream Author: Burkhard Burow + +Copyright (C) 1990-2003 Burkhard Burow. + + cfortran is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + cfortran 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU Library General Public License +can be found in `/usr/share/common-licenses/LGPL-2'. + +The upstream version of cfortran does not state that it is licensed under the +LGPL; however, its author has made the following statement making it so. + +----- + +Date: Tue, 22 Oct 2002 12:48:00 -0400 +From: Burkhard D Steinmacher-burow +To: Kevin B. McCarty +Subject: Re: CFortran licensing question + +Kevin, + +[Just noticed that I didn't send this yesterady.] + +I have no time right now to read through licenses. +IIRC, library GPL is fairly unrestrictive, so I'll choose that. So..... + +You may consider this e-mail as a notice that as an alternative to any +other cfortran licenses, +I hereby relase all versions and all parts of cfortran under the +the Library GPL license. +From among these licenses, the user is free to choose +the license or licenses under which cfortran is used. + +Contact me if you'd like to be able to choose another license. + +Burkhard + +steinmac@us.ibm.com, (914)945-3756, Fax 3684, Tieline 862 + +----- + +cfortran may also be used and distributed under the following license: + +THIS PACKAGE, I.E. CFORTRAN.H, THIS DOCUMENT, AND THE CFORTRAN.H EXAMPLE +PROGRAMS ARE PROPERTY OF THE AUTHOR WHO RESERVES ALL RIGHTS. THIS PACKAGE AND +THE CODE IT PRODUCES MAY BE FREELY DISTRIBUTED WITHOUT FEES, SUBJECT TO THE +FOLLOWING RESTRICTIONS: +- YOU MUST ACCOMPANY ANY COPIES OR DISTRIBUTION WITH THIS (UNALTERED) NOTICE. +- YOU MAY NOT RECEIVE MONEY FOR THE DISTRIBUTION OR FOR ITS MEDIA + (E.G. TAPE, DISK, COMPUTER, PAPER.) +- YOU MAY NOT PREVENT OTHERS FROM COPYING IT FREELY. +- YOU MAY NOT DISTRIBUTE MODIFIED VERSIONS WITHOUT CLEARLY DOCUMENTING YOUR + CHANGES AND NOTIFYING THE AUTHOR. +- YOU MAY NOT MISREPRESENTED THE ORIGIN OF THIS SOFTWARE, EITHER BY EXPLICIT + CLAIM OR BY OMISSION. + +THE INTENT OF THE ABOVE TERMS IS TO ENSURE THAT THE CFORTRAN.H PACKAGE NOT BE +USED FOR PROFIT MAKING ACTIVITIES UNLESS SOME ROYALTY ARRANGEMENT IS ENTERED +INTO WITH ITS AUTHOR. + +THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER +EXPRESSED OR IMPLIED. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST +OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. THE AUTHOR IS NOT RESPONSIBLE +FOR ANY SUPPORT OR SERVICE OF THE CFORTRAN.H PACKAGE. + + Burkhard Burow + burow@desy.de + --- cfortran-4.4.orig/debian/docs +++ cfortran-4.4/debian/docs @@ -0,0 +1,3 @@ +cfortran.doc +index.htm +cfortran.html --- cfortran-4.4.orig/debian/README.Debian +++ cfortran-4.4/debian/README.Debian @@ -0,0 +1,112 @@ +cfortran for Debian +------------------- + +The principal FORTRAN compiler in Debian is now gfortran. Please note that if +you use gfortran to build FORTRAN code, you must "#define gFortran" in your C +code or use -DgFortran on the command line to achieve an equivalent effect +before any "#include " line. If you still use g77 to build FORTRAN +code, or if you use the -ff2c flag to gfortran, you must instead +"#define g77Fortran" or use -Dg77Fortran. (Using g77 with the -fno-f2c flag +requires the gFortran macro be defined to cfortran.h.) + +Note also that the f2cFortran flag behaves equivalently to g77Fortran, as g77 +and f2c have the same calling conventions. The use of this flag is discouraged +since prior to cfortran release 4.4-10, it instead behaved like gFortran (but +at that time the gFortran flag was not supported, and there was no way to +invoke correct behavior for g77). + +For instance, each of the following four sets of compile commands are OK: + +gcc -DgFortran -c ccode.c +gfortran -c fcode.F +gfortran fcode.o ccode.o -o my_executable + +gcc -Dg77Fortran -c ccode.c +gfortran -ff2c -c fcode.F +gfortran -ff2c fcode.o ccode.o -o my_executable + +gcc -Dg77Fortran -c ccode.c +g77 -c fcode.F +g77 fcode.o ccode.o -o my_executable + +gcc -DgFortran -c ccode.c +g77 -fno-f2c -c fcode.F +g77 -fno-f2c fcode.o ccode.o -o my_executable + +Supplying an incorrect flag to C code that uses cfortran.h macros makes it +likely that your program will not work correctly on some architectures. In +particular, the example program below will not work on the AMD64 platform if +your FORTRAN compiler is mismatched to the cfortran flag you use. (Try it and +see.) For more information, see the discussion of the -ff2c flag in gfortran +documentation or the -fno-f2c flag in g77 documentation, and see also +http://gcc.gnu.org/PR15397 . + +Test program for cfortran +------------------------- + +* File "fcode.F" + program test + implicit none +* + real funct1, funct2, retval + + print *, 'All results below should be (approx.) 1.1111' + print *, '' + +* Try calling functions from FORTRAN + retval = funct1 (1.1111) + print *, 'Call FORTRAN from FORTRAN: retval ', retval + print *, '' + retval = funct2 (1.1111) + print *, 'Call C from FORTRAN: retval ', retval + print *, '' + +* Try calling functions from C + call ccode() + + stop + end + + real function funct1 ( inval ) + + implicit none + real inval, retval + + retval = inval + print *, ' In FORTRAN func: return value = ', retval + funct1 = retval + + end +* End of "fcode.F" + +------------------------- + +/* File "ccode.c" */ +#include +#include + +/* Declare C prototype for FORTRAN FUNCT1() */ +PROTOCCALLSFFUN1(FLOAT, FUNCT1, funct1, FLOAT) +#define FUNCT1(in) CCALLSFFUN1(FUNCT1, funct1, FLOAT, in) + +float funct2(float in) { + printf(" In C func: return value = %f\n", in); + return in; +} + +void ccode(void) { + float retval = 1.1111; + retval = FUNCT1(1.1111); + printf(" Call FORTRAN from C: retval %f\n\n", retval); + retval = funct2(1.1111); + printf(" Call C from C: retval %f\n\n", retval); +} + +/* Make funct2() and ccode() accessible from FORTRAN */ +FCALLSCFUN1(FLOAT, funct2, FUNCT2, funct2, FLOAT) +FCALLSCSUB0(ccode, CCODE, ccode) + +/* End of "ccode.c" */ +------------------------- + + -- Kevin B. McCarty Thu, 08 May 2008 --- cfortran-4.4.orig/debian/NEWS +++ cfortran-4.4/debian/NEWS @@ -0,0 +1,25 @@ +cfortran (4.4-10) unstable; urgency=low + + cfortran.h has been enhanced to support the gfortran compiler. Use the + flag -DgFortran to your C/C++ compiler, or #define gFortran somewhere in + your source code above the #include . Doing this is also + likely necessary if you use g77 with the -fno-f2c flag, or f2c with the + -R flag. + + -- Kevin B. McCarty Wed, 5 Apr 2006 12:56:15 -0400 + +cfortran (4.4-8) unstable; urgency=low + + In this version of cfortran, the header file cfortran.h has been improved, + as planned by the original author, to enforce the fact that f2c and g77 + generate code from FORTRAN REAL functions that returns a C "double". + This should fix runtime breakage with cfortran on some platforms (e.g. + AMD64); see for instance http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15397 + + If you create libraries that depend upon cfortran to build, it is possible + that this change could affect the ABI of your library. Be particularly + alert to this possibility if you use the PROTOCCALLSFFUN* and/or + FCALLSCFUN* macros with the first argument to the macro(s) (i.e. the + function return type) being "FLOAT". + + -- Kevin B. McCarty Fri, 9 Dec 2005 17:49:46 -0500 --- cfortran-4.4.orig/debian/compat +++ cfortran-4.4/debian/compat @@ -0,0 +1 @@ +5 --- cfortran-4.4.orig/debian/examples +++ cfortran-4.4/debian/examples @@ -0,0 +1,3 @@ +cfortex.f +cfortest.c +eg/* --- cfortran-4.4.orig/debian/dirs +++ cfortran-4.4/debian/dirs @@ -0,0 +1,2 @@ +usr/include +usr/include/cfortran --- cfortran-4.4.orig/debian/rules +++ cfortran-4.4/debian/rules @@ -0,0 +1,57 @@ +#!/usr/bin/make -f +# Sample debian/rules that uses debhelper. +# GNU copyright 1997 to 1999 by Joey Hess. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +build: build-stamp +build-stamp: + dh_testdir + # unpack examples: + tar xvzf cfortran.examples.tar.gz + # fix buffer overrun in one of the examples (cf. #489886 in BTS) + sed -i 's/happy/happy /g' eg/fd/fd.c + # remove unnecessary (and in some cases broken) symlinks: + find eg -name \*.C -type l -exec rm -f \{\} \; + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + rm -rf eg + + # Add here commands to clean up after the build process. + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/cfortran. + cp -p cfortran.h debian/cfortran/usr/include/ + +# Build architecture-dependent files here. +binary-arch: build install +# We have nothing to do here. + +# Build architecture-independent files here. +binary-indep: build install + dh_testdir + dh_testroot + dh_installdocs + dh_installexamples + dh_installchangelogs + dh_compress -X.c -X.f -X.htm -X.html + dh_link usr/include/cfortran.h usr/include/cfortran/cfortran.h + dh_fixperms + dh_installdeb + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install --- cfortran-4.4.orig/debian/control +++ cfortran-4.4/debian/control @@ -0,0 +1,21 @@ +Source: cfortran +Section: devel +Priority: optional +Maintainer: Debian Science Maintainers +Uploaders: Bastien ROUCARIÈS +Vcs-Git: git://git.debian.org/git/debian-science/packages/cfortran.git +Vcs-Browser: http://git.debian.org/?p=debian-science/packages/cfortran.git +DM-Upload-Allowed: yes +Homepage: http://www-zeus.desy.de/~burow/cfortran/ +Build-Depends: debhelper (>= 5.0.0) +Standards-Version: 3.8.3 + +Package: cfortran +Architecture: all +Recommends: gcc | c-compiler, gfortran | fortran-compiler +Conflicts: libcfitsio-dev (<< 2.440-1) +Description: Header file permitting Fortran routines to be called in C/C++ + cfortran.h is an easy-to-use powerful bridge between C and FORTRAN. + It provides a completely transparent, machine independent interface between + C and FORTRAN routines (= subroutines and/or functions) and global data, + i.e. structures and COMMON blocks.