====== index for f2c ============ FILES: 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, to install it where you can access it by specifying -lf2c , and to adjust the definition of link_msg in sysdep.c appropriately. f2c.ps Postscript for a technical report on f2c. After you strip the mail header, the first line should be "%!PS". 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. SUBDIRECTORY: 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 649642 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 If you have trouble generating gram.c, you can ask netlib to send gram.c from f2c/src Then `xsum gram.c` should report gram.c efa337b3 57282 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 be a comment whose first 6 characters are "c$f2c " and whose remaining characters are 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 . You might first check whether the bug goes away when you turn optimization off. 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 ftp from research.att.com (login: netlib; Password: your E-mail address; cd f2c). You must uncompress the .Z files once you have a copy of them, e.g., by uncompress *.Z ----------------- Recent change log (partial) ----------------- Tue Jan 15 12:00:24 EST 1991: Fix bug when two equivalence groups are merged, the second with nonzero offset, and the result is then merged into a common block. Example: INTEGER W(3), X(3), Y(3), Z(3) COMMON /ZOT/ Z EQUIVALENCE (W(1),X(1)), (X(2),Y(1)), (Z(3),X(1)) ***** W WAS GIVEN THE WRONG OFFSET Recognize Fortran 90's optional NML= in NAMELIST READs and WRITEs. (Currently NML= and FMT= are treated as synonyms -- there's no error message if, e.g., NML= specifies a format.) libi77: minor adjustment to allow internal READs from character string constants in read-only memory. Wed Jan 23 00:38:48 EST 1991: Allow hex, octal, and binary constants to have the qualifying letter (z, x, o, or b) either before or after the quoted string containing the digits. For now this change will not be reflected in f2c.ps . Tue Jan 29 16:23:45 EST 1991: Arrange for character-valued statement functions to give results of the right length (that of the statement function's name). Wed Jan 30 07:05:32 EST 1991: More tweaks for character-valued statement functions: an error check and an adjustment so a right-hand side of nonconstant length (e.g., a substring) is handled right. Thu Jan 31 13:53:44 EST 1991: Add a test after the cleanup call generated for I/O statements with ERR= or END= clauses to catch the unlikely event that the cleanup routine encounters an error. Tue Feb 5 01:39:36 EST 1991: Change Mktemp to mktmp (for the benefit of systems so brain-damaged that they do not distinguish case in external names -- and that for some reason want to load mktemp). Try to get xsum0.out right this time (it somehow didn't get updated on 4 Feb. 1991). Add note to libi77/README about adjusting the interpretation of RECL= specifiers in OPENs for direct unformatted I/O. Thu Feb 7 17:24:42 EST 1991: New option -r casts values of REAL functions, including intrinsics, to REAL. This only matters for unportable code like real r r = asin(1.) if (r .eq. asin(1.)) ... [The behavior of such code varies with the Fortran compiler used -- and sometimes is affected by compiler options.] For now, the man page at the end of f2c.ps is the only part of f2c.ps that reflects this new option. Fri Feb 8 18:12:51 EST 1991: Cast pointer differences passed as arguments to the appropriate type. This matters, e.g., with MSDOS compilers that yield a long pointer difference but have int == short. Disallow nonpositive dimensions. Fri Feb 15 12:24:15 EST 1991: Change %d to %ld in sprintf call in putpower in putpcc.c. Free more memory (e.g. allowing translation of larger Fortran files under MS-DOS). Recognize READ (character expression) as formatted I/O with the format given by the character expression. Update year in Notice. Mon Mar 4 15:19:42 EST 1991: Fix bug in passing the real part of a complex argument to an intrinsic function. Omit unneeded parentheses in nested calls to intrinsics. Example: subroutine foo(x, y) complex y x = exp(sin(real(y))) + exp(imag(y)) end Fri Mar 8 15:05:42 EST 1991: Fix a comment in expr.c; omit safstrncpy.c (which had bugs in cases not used by f2c). Wed Mar 13 02:27:23 EST 1991: Initialize firstmemblock->next in mem_init in mem.c . [On most systems it was fortuituously 0, but with System V, -lmalloc could trip on this missed initialization.] Wed Mar 13 11:47:42 EST 1991: Fix a reference to freed memory. Wed Mar 27 00:42:19 EST 1991: Fix a memory fault caused by such illegal Fortran as function foo x = 3 logical foo ! declaration among executables foo=.false. ! used to suffer memory fault end Fri Apr 5 08:30:31 EST 1991: Fix loss of % in some format expressions, e.g. write(*,'(1h%)') Fix botch introduced 27 March 1991 that caused subroutines with multiple entry points to have extraneous declarations of ret_val. Fri Apr 5 12:44:02 EST 1991 Try again to omit extraneous ret_val declarations -- this morning's fix was sometimes wrong. Mon Apr 8 13:47:06 EDT 1991: Arrange for s_rnge to have the right prototype under -A -C . Wed Apr 17 13:36:03 EDT 1991: New fatal error message for apparent invocation of a recursive statement function. Thu Apr 25 15:13:37 EDT 1991: F2c and libi77 adjusted so NAMELIST works with -i2. (I forgot about -i2 when adding NAMELIST.) This required a change to f2c.h (that only affects NAMELIST I/O under -i2.) Man-page description of -i2 adjusted to reflect that -i2 stores array lengths in short ints. Fri Apr 26 02:54:41 EDT 1991: Libi77: fix some bugs in NAMELIST reading of multi-dimensional arrays (file rsne.c). Tue May 7 09:04:48 EDT 1991: gram.c added to f2c/src (for folks who have trouble generating it. It is not in "all from f2c", nor in the list of current timestamps below.) Thu May 9 02:13:51 EDT 1991: Omit a trailing space in expr.c (could cause a false xsum value if a mailer drops the trailing blank). Thu May 16 13:14:59 EDT 1991: libi77: increase LEFBL in lio.h to overcome a NeXT bug. Tweak for compilers that recognize "nested" comments: inside comments, turn /* into /+ (as well as */ into +/). Sat May 25 11:44:25 EDT 1991: libf77: s_rnge: declare line long int rather than int. Fri May 31 07:51:50 EDT 1991: libf77: system_: officially return status. Mon Jun 17 16:52:53 EDT 1991: Minor tweaks: omit unnecessary declaration of strcmp (that caused trouble on a system where strcmp was a macro) from misc.c; add SHELL = /bin/sh to makefiles. Fix a dereference of null when a CHARACTER*(*) declaration appears (illegally) after DATA. Complain only once per subroutine about declarations appearing after DATA. Mon Jul 1 00:28:13 EDT 1991: Add test and error message for illegal use of subroutine names, e.g. SUBROUTINE ZAP(A) ZAP = A END Mon Jul 8 21:49:20 EDT 1991: Issue a warning about things like integer i i = 'abc' (which is treated as i = ichar('a')). [It might be nice to treat 'abc' as an integer initialized (in a DATA statement) with 'abc', but other matters have higher priority.] Render i = ichar('A') as i = 'A'; rather than i = 65; (which assumes ASCII). Fri Jul 12 07:41:30 EDT 1991: Note added to README about erroneous definitions of __STDC__ . Sat Jul 13 13:38:54 EDT 1991: Fix bugs in double type convesions of complex values, e.g. sngl(real(...)) or dble(real(...)) (where ... is complex). Mon Jul 15 13:21:42 EDT 1991: Fix bug introduced 8 July 1991 that caused erroneous warnings "ichar([first char. of] char. string) assumed for conversion to numeric" when a subroutine had an array of character strings as an argument. Wed Aug 28 01:12:17 EDT 1991: Omit an unused function in format.c, an unused variable in proc.c . Under -r8, promote complex to double complex (as the man page claims). Fri Aug 30 17:19:17 EDT 1991: f2c.ps updated: slightly expand description of intrinsics and,or,xor, not; add mention of intrinsics lshift, rshift; add note about f2c accepting Fortran 90 inline comments (starting with !); update Cobalt Blue address. Tue Sep 17 07:17:33 EDT 1991: libI77: err.c and open.c modified to use modes "rb" and "wb" when (f)opening unformatted files; README updated to point out that it may be necessary to change these modes to "r" and "w" on some non-ANSI systems. 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: 8/28/1991 0:29:01 xsum0.out 8/28/1991 0:23:26 version.c 8/28/1991 0:07:02 main.c 8/28/1991 0:07:01 gram.dcl 8/28/1991 0:07:01 expr.c 8/28/1991 0:07:00 defs.h 8/13/1991 9:06:09 format.c 8/13/1991 9:04:25 proc.c 7/13/1991 12:58:37 putpcc.c 7/12/1991 7:25:33 README 7/05/1991 7:16:57 intr.c 6/17/1991 16:43:01 gram.head 6/06/1991 0:41:56 makefile 6/05/1991 8:34:09 misc.c 5/16/1991 13:06:06 p1output.c 4/25/1991 13:20:26 f2c.1 4/25/1991 12:56:19 f2c.h 4/25/1991 12:51:27 f2c.1t 4/25/1991 12:10:22 io.c 4/05/1991 7:43:45 mem.c 3/13/1991 11:18:09 output.c 3/08/1991 10:14:45 niceprintf.c 2/15/1991 12:08:26 Notice 2/08/1991 11:29:18 gram.exec 2/08/1991 11:29:18 malloc.c 2/05/1991 0:52:39 exec.c 1/22/1991 19:25:10 lex.c 1/15/1991 1:21:00 equiv.c 12/16/1990 16:46:20 xsum.c 12/07/1990 17:37:08 names.c 11/30/1990 9:47:48 data.c 7/26/1990 10:54:47 parse_args.c 7/26/1990 10:44:26 parse.h 6/19/1990 0:18:23 formatdata.c 5/11/1990 14:17:04 error.c 4/23/1990 17:35:47 sysdep.h 4/23/1990 16:37:50 sysdep.c 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/10/1990 0:00:38 put.c 4/06/1990 0:00:57 gram.io 4/05/1990 23:40:09 gram.expr 3/27/1990 16:39:18 names.h 3/27/1990 10:05:15 p1defs.h 3/27/1990 10:05:14 defines.h 2/25/1990 9:04:30 vax.c 2/16/1990 10:37:27 tokens 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/03/1990 0:58:26 niceprintf.h 1/29/1990 13:26:52 memset.c 1/11/1990 18:02:51 ftypes.h 1/07/1990 1:20:01 usignal.h 11/27/1989 8:27:37 machdefs.h 7/01/1989 11:59:44 pccdefs.h