====== index for f2c ============ f2c.h Include file necessary for compiling output of the converter. See the second NOTE below. f2c.1 Man page for f2c. f2c.1t Source for f2c.1 (to be processed by troff -man or nroff -man). libf77 Library of non I/O support routines the generated C may need. Fortran main programs result in a C function named MAIN__ that is meant to be invoked by the main() in libf77. libi77 Library of Fortran I/O routines the generated C may need. Note that some vendors (e.g., BSD, Sun and MIPS) provide a libF77 and libI77 that are incompatible with f2c -- they provide some differently named routines or routines with the names that f2c expects, but with different calling sequences. On such systems, the recommended procedure is to merge libf77 and libi77 into a single library, say libf2c, and install it where you can access it by specifying -lf2c . f2c/src Source for the converter itself, including a file of checksums and source for a program to compute the checksums (to verify correct transmission of the source), is available: ask netlib to send all from f2c/src If the checksums show damage to just a few source files, or if the change log file (see "fixes" below) reports corrections to some source files, you can request those files individually "from f2c/src". For example, to get defs.h and xsum0.out, you would ask netlib to send defs.h xsum0.out from f2c/src "all from f2c/src" is 646225 bytes long. Tip: if asked to send over 99,000 bytes in one request, netlib breaks the shipment into 1000 line pieces and sends each piece separately (since otherwise some mailers might gag). To avoid the hassle of reassembling the pieces, try to keep each request under 99,000 bytes long. The final number in each line of xsum0.out gives the length of each file in f2c/src. For example, send exec.c expr.c from f2c/src send format.c format_data.c from f2c/src will give you slightly less hassle than send exec.c expr.c format.c format_data.c from f2c/src f2c.ps Postscript for a technical report on f2c. fixes The complete change log, reporting bug fixes and other changes. (Some recent change-log entries are given below). fc A shell script that uses f2c and imitates much of the behavior of commonly found f77 commands. You will almost certainly need to adjust some of the shell-variable assignments to make this script work on your system. NOTE: For now, you may exercise f2c by sending netlib a message whose first line is "execute f2c" and whose remaining lines are the Fortran 77 source that you wish to have converted. Return mail brings you the resulting C, with f2c's error messages between #ifdef uNdEfInEd and #endif at the end. (To understand line numbers in the error messages, regard the "execute f2c" line as line 0. It is stripped away by the netlib software before f2c sees your Fortran input.) Options described in the man page may be transmitted to netlib by having the first line of input begin with "c$f2c ", followed by the desired options, e.g., "c$f2c -R -u". This scheme may change -- ask netlib to send index from f2c if you do not get the behavior you expect. During the initial experimental period, incoming Fortran will be saved in a file. Don't send any secrets! BUGS: Please send bug reports (including the shortest example you can find that illustrates the bug) to research!dmg or dmg@research.att.com . NOTE: f2c.h defines several types, e.g., real, integer, doublereal. The definitions in f2c.h are suitable for most machines, but if your machine has sizeof(double) > 2*sizeof(long), you may need to adjust f2c.h appropriately. f2c assumes sizeof(doublecomplex) = 2*sizeof(doublereal) sizeof(doublereal) = sizeof(complex) sizeof(doublereal) = 2*sizeof(real) sizeof(real) = sizeof(integer) sizeof(real) = sizeof(logical) sizeof(real) = 2*sizeof(shortint) EQUIVALENCEs may not be translated correctly if these assumptions are violated. There exists a C compiler that objects to the lines typedef VOID C_f; /* complex function */ typedef VOID H_f; /* character function */ typedef VOID Z_f; /* double complex function */ in f2c.h . If yours is such a compiler, do two things: 1. Complain to your vendor about this compiler bug. 2. Find the line #define VOID void in f2c.h and change it to #define VOID int (For readability, the f2c.h lines shown above have had two tabs inserted before their first character.) FTP: All the material described above is now available by anonymous ftp from research.att.com -- look in dist/f2c . You must uncompress the .Z files once you have a copy of them, e.g., by uncompress *.Z ----------------- Recent change log (partial) ----------------- 7 Jan. 1990: libi77: routines supporting NAMELIST added. Surrounding quotes made optional when no ambiguity arises in a list or namelist READ of a character-string value. 9 Jan. 1990: f2c/src made available. 16 Jan. 1990: New options -P to produce ANSI C or C++ prototypes for procedures defined. Change to -A and -C++: f2c tries to infer prototypes for invoked procedures unless the new -!P option is given. New warning messages for inconsistent calling sequences among procedures within a single file. Most of f2c/src is affected. f2c.h: typedefs for procedure arguments added; netlib's f2c service will insert appropriate typedefs for use with older versions of f2c.h. 24 Jan. 11:44:00 EST 1990: New feature: -P emits comments showing COMMON block lengths, so one can get warnings of incompatible COMMON block lengths by having f2c read .P (or .p) files. Now by running f2c twice, first with -P -!c (or -P!c), then with *.P among the arguments, you can be warned of inconsistent COMMON usage, and COMMON blocks having inconsistent lengths will be given the maximum length. (The latter always did happen within each input file; now -P lets you extend this behavior across files.) 26 Jan. 16:44:00 EST 1990: Option -P now includes information about references, i.e., called procedures, in the prototype files (in the form of special comments). This allows iterative invocations of f2c to infer more about untyped external names, particularly when multiple Fortran files are involved. 28 Jan. 18:32:00 EST 1990: libf77, libi77: checksum files added; "make check" looks for transmission errors. NAMELIST read modified to allow $ rather than & to precede a namelist name, to allow $ rather than / to terminate input where the name of another variable would otherwise be expected, and to regard all nonprinting ASCII characters <= ' ' as spaces. 29 Jan. 02:11:00 EST 1990: "fc from f2c" added. New option -Ps implies -P and returns exit status 4 if rerunning f2c -P with prototype inputs might change prototypes or declarations. Now you can execute a crude script like cat *.f >zap.F rm -f zap.P while :; do f2c -P -!c zap.[FP] case $? in 4) ;; *) break;; esac done to get a file zap.P of the best prototypes f2c can determine for *.f . Wed Mar 28 01:43:06 EST 1990: libI77: 1. Repair nasty I/O bug: opening two files and closing the first (after possibly reading or writing it), then writing the second caused the last buffer of the second to be lost. 2. Formatted reads of logical values treated all letters other than t or T as f (false). f2c itself: Repair nasty bug in translation of ELSE IF (condition involving complicated abs, min, or max) -- auxiliary statements were emitted at the wrong place. Fri Apr 6 08:29:49 EDT 1990: Calls involving alternate return specifiers omitted processing needed for things like min, max, abs, and // (concatenation). INTEGER*2 PARAMETERs were treated as INTEGER*4. Tue Apr 10 20:07:02 EDT 1990: New option -h for forcing strings to word (or, with -hd, double-word) boundaries where possible. New include file "sysdep.h" has some things from defs.h (and elsewhere) that one may need to modify on some systems. Wed Apr 11 18:27:12 EDT 1990: New options -kr and -krd cause f2c to use temporary variables to enforce Fortran evaluation-order rules with pernicious, old-style C compilers that apply the associative law to floating-point operations. Sat Apr 14 15:50:15 EDT 1990: libi77: libI77 adjusted to allow list-directed and namelist I/O of internal files; bug in namelist I/O of logical and character arrays fixed; list input of complex numbers adjusted to permit d or D to denote the start of the exponent field of a component. f2c itself: fix bug in handling complicated lower-bound expressions for character substrings; e.g., min and max did not work right, nor did function invocations involving character arguments. Switch to octal notation, rather than hexadecimal, for nonprinting characters in character and string constants. Wed Apr 18 17:26:27 EDT 1990: Recognize \v (vertical tab) in Hollerith as well as quoted strings; add recognition of \r (carriage return). New option -!bs turns off recognition of escapes in character strings (\0, \\, \b, \f, \n, \r, \t, \v). Move to sysdep.c initialization of some arrays whose initialization assumed ASCII; #define Table_size in sysdep.h rather than using hard-coded 256 in allocating arrays of size 1 << (bits/byte). Mon Apr 23 22:24:51 EDT 1990: When producing default-style C (no -A or -C++), cast switch expressions to (int). Move "-lF77 -lI77 -lm -lc" to link_msg, defined in sysdep.c . Add #define scrub(x) to sysdep.h, with invocations in format.c and formatdata.c, so that people who have systems like VMS that would otherwise create multiple versions of intermediate files can #define scrub(x) unlink(x) Tue Apr 24 18:28:36 EDT 1990: Pass string lengths once rather than twice to a function of character arguments involved in comparison of character strings of length 1. Mon Apr 30 13:30:10 EDT 1990: Change fillers for DATA with holes from substructures to arrays (in an attempt to make things work right with C compilers that have funny padding rules for substructures, e.g., Sun C compilers). Mon Apr 30 23:13:51 EDT 1990: Fix bug in handling return values of functions having multiple entry points of differing return types. Sat May 5 01:45:18 EDT 1990: Fix type inference bug in subroutine foo(x) call goo(x) end subroutine goo(i) i = 3 end Instead of warning of inconsistent calling sequences for goo, f2c was simply making i a real variable; now i is correctly typed as an integer variable, and f2c issues an error message. Adjust error messages issued at end of declarations so they don't blame the first executable statement. Sun May 6 01:29:07 EDT 1990: Fix bug in -P and -Ps: warn when the definition of a subprogram adds information that would change prototypes or previous declarations. Thu May 10 18:09:15 EDT 1990: Fix further obscure bug with (default) -it: inconsistent calling sequences and I/O statements could interact to cause a memory fault. Example: SUBROUTINE FOO CALL GOO(' Something') ! Forgot integer first arg END SUBROUTINE GOO(IUNIT,MSG) CHARACTER*(*)MSG WRITE(IUNIT,'(1X,A)') MSG END Fri May 11 16:49:11 EDT 1990: Under -!c, do not delete any .c files (when there are errors). Avoid dereferencing 0 when a fatal error occurs while reading Fortran on stdin. Wed May 16 18:24:42 EDT 1990: f2c.ps made available. Mon Jun 4 12:53:08 EDT 1990: Diagnose I/O units of invalid type. Add specific error msg about dummy arguments in common. Current timestamps of files in "all from f2c/src", sorted by time, appear below (mm/dd/year hh:mm:ss). To bring your source up to date, obtain source files with a timestamp later than the time shown in your version.c. Note that the time shown in the current version.c is the timestamp of the source module that immediately follows version.c below: 6/04/1990 12:45:49 xsum0.out 6/04/1990 12:17:04 version.c 6/04/1990 12:16:42 proc.c 6/04/1990 11:53:23 io.c 5/11/1990 14:38:39 main.c 5/11/1990 14:17:04 error.c 5/05/1990 23:46:58 putpcc.c 5/05/1990 23:46:57 format.c 5/05/1990 0:39:39 expr.c 4/30/1990 12:04:59 formatdata.c 4/29/1990 9:40:47 exec.c 4/24/1990 15:55:26 mem.c 4/23/1990 17:35:47 sysdep.h 4/23/1990 16:37:50 sysdep.c 4/23/1990 15:13:19 output.c 4/19/1990 0:16:17 lex.c 4/18/1990 23:41:25 misc.c 4/18/1990 16:44:40 f2c.1 4/18/1990 16:24:04 f2c.1t 4/18/1990 12:25:19 init.c 4/18/1990 12:25:19 pread.c 4/18/1990 12:25:18 cds.c 4/18/1990 11:02:55 data.c 4/17/1990 23:24:07 defs.h 4/14/1990 9:32:00 niceprintf.c 4/10/1990 16:52:54 makefile 4/10/1990 16:15:42 README 4/10/1990 0:00:38 put.c 4/09/1990 22:58:17 names.c 4/09/1990 14:05:24 parse_args.c 4/06/1990 0:00:57 gram.io 4/05/1990 23:40:09 gram.exec 4/05/1990 23:40:09 gram.expr 4/01/1990 15:44:01 equiv.c 3/27/1990 16:39:18 names.h 3/27/1990 10:05:15 p1defs.h 3/27/1990 10:05:14 defines.h 3/27/1990 7:54:52 gram.head 2/25/1990 18:29:19 p1output.c 2/25/1990 9:04:30 vax.c 2/16/1990 17:29:40 gram.dcl 2/16/1990 10:37:27 tokens 2/15/1990 16:57:16 intr.c 2/14/1990 2:09:18 xsum.c 2/14/1990 2:00:20 format.h 2/14/1990 1:38:46 output.h 2/14/1990 0:54:06 iob.h 2/09/1990 0:37:33 parse.h 2/03/1990 0:58:26 niceprintf.h 1/29/1990 13:26:52 memset.c 1/20/1990 23:03:00 f2c.h 1/20/1990 22:54:23 safstrncpy.c 1/11/1990 18:02:51 ftypes.h 1/09/1990 16:54:10 malloc.c 1/09/1990 16:50:45 Notice 1/07/1990 1:20:01 usignal.h 11/27/1989 8:27:37 machdefs.h 7/01/1989 11:59:44 pccdefs.h