====== old index for f2c, now "readme from 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, and to install it where you can access it by specifying -lf2c . The definition of link_msg in sysdep.c assumes this arrangement. 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 about 640 kilobytes long; for convenience (and checksums), it includes copies of f2c.h, f2c.1, and f2c.1t. 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 Alternatively, if all the mailers in your return path allow long messages, you can supply an appropriate mailsize line in your netlib request, e.g. mailsize 200k 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 205b188 57336 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 Subdirectory msdos contains two PC versions of f2c, f2c.exe.Z and f2cx.exe.Z; the latter uses extended memory. The README in that directory provides more details. ----------------- Recent change log (partial) ----------------- Wed Feb 3 02:05:16 EST 1993: Recognize types INTEGER*1, LOGICAL*1, LOGICAL*2, INTEGER*8. INTEGER*8 is not well tested and will only work reasonably on systems where int = 4 bytes, long = 8 bytes; on such systems, you'll have to modify f2c.h appropriately, changing integer from long to int and adding typedef long longint. You'll also have to compile libI77 with Allow_TYQUAD #defined and adjust libF77/makefile to compile pow_qq.c. In the f2c source, changes for INTEGER*8 are delimited by #ifdef TYQUAD ... #endif. You can omit the INTEGER*8 changes by compiling with NO_TYQUAD #defined. Otherwise, the new command-line option -!i8 disables recognition of INTEGER*8. libf77: add pow_qq.c libi77: add #ifdef Allow_TYQUAD stuff. Changes for INTEGER*1, LOGICAL*1, and LOGICAL*2 came last 23 July 1992. Fix bug in backspace (that only bit when the last character of the second or subsequent buffer read was the previous newline). Guard against L_tmpnam being too small in endfile.c. For MSDOS, close and reopen files when copying to truncate. Lengthen LINTW (buffer size in lwrite.c). Add \ to the end of #define lines that get broken. Fix bug in handling NAMELIST of items in EQUIVALENCE. Under -h (or -hd), convert Hollerith to integer in general expressions (e.g., assignments), not just when they're passed as arguments, and blank-pad rather than 0-pad the Hollerith to a multiple of sizeof(integer) or sizeof(doublereal). Add command-line option -s, which instructs f2c preserve multi- dimensional subscripts (by emitting and using appropriate #defines). Fix glitch (with default type inferences) in examples like call foo('abc') end subroutine foo(goo) end This gave two warning messages: Warning on line 4 of y.f: inconsistent calling sequences for foo: here 1, previously 2 args and string lengths. Warning on line 4 of y.f: inconsistent calling sequences for foo: here 2, previously 1 args and string lengths. Now the second Warning is suppressed. Complain about all inconsistent arguments, not just the first. Separate -P from -A: write old-style .c, ANSI .P files when -P is given without -A or -C++. Switch to automatic creation of "all from f2c/src". For folks getting f2c source via ftp, this means f2c/src/all.Z is now an empty file rather than a bundle. Thu Feb 4 00:32:20 EST 1993: Fix some glitches (introduced yesterday) with -h . Fri Feb 5 01:40:38 EST 1993: Fix bug in types conveyed for namelists (introduced 3 Feb. 1993). Fri Feb 5 21:26:43 EST 1993: libi77: tweaks to NAMELIST and open (after comments by Harold Youngren): 1. Reading a ? instead of &name (the start of a namelist) causes the namelist being sought to be written to stdout (unit 6); to omit this feature, compile rsne.c with -DNo_Namelist_Questions. 2. Reading the wrong namelist name now leads to an error message and an attempt to skip input until the right namelist name is found; to omit this feature, compile rsne.c with -DNo_Bad_Namelist_Skip. 3. Namelist writes now insert newlines before each variable; to omit this feature, compile xwsne.c with -DNo_Extra_Namelist_Newlines. 4. For OPEN of sequential files, ACCESS='APPEND' (or access='anything else starting with "A" or "a"') causes the file to be positioned at end-of-file, so a write will append to the file. (This is nonstandard, but does not require modifying data structures.) Mon Feb 8 14:40:37 EST 1993: Increase number of continuation lines allowed from 19 to 99, and allow changing this limit with -NC (e.g. -NC200 for 200 lines). Treat control-Z (at the beginning of a line) as end-of-file: see the new penultimate paragraph of README. Fix a rarely seen glitch that could make an error messages to say "line 0". Tue Feb 9 02:05:40 EST 1993 libi77: change some #ifdef MSDOS lines to #ifdef NON_UNIX_STDIO, and, in err.c under NON_UNIX_STDIO, avoid close(creat(name,0666)) when the unit has another file descriptor for name. Tue Feb 9 17:12:49 EST 1993 libi77: more tweaks for NON_UNIX_STDIO: use stdio routines rather than open, close, creat, seek, fdopen (except for f__isdev). Fri Feb 12 15:49:33 EST 1993 Update src/gram.c (which was forgotten in the recent updates). Most folks regenerate it anyway (wity yacc or bison). Thu Mar 4 17:07:38 EST 1993 Increase default max labels in computed gotos and alternate returns to 257, and allow -Nl1234 to specify this number. Tweak put.c to check p->tag == TADDR in realpart() and imagpart(). Adjust fc script to allow .r (RATFOR) files and -C (check subscripts). Avoid declaring strchr in niceprintf.c under -DANSI_Libraries . gram.c updated again. libi77: err.c, open.c: take declaration of fdopen from rawio.h. Sat Mar 6 07:09:11 EST 1993 libi77: uio.c: adjust off-end-of-record test for sequential unformatted reads to respond to err= rather than end= . Sat Mar 6 16:12:47 EST 1993 Treat scalar arguments of the form (v) and v+0, where v is a variable, as expressions: assign to a temporary variable, and pass the latter. gram.c updated. Mon Mar 8 09:35:38 EST 1993 "f2c.h from f2c" updated to add types logical1 and integer1 for LOGICAL*1 and INTEGER*1. ("f2c.h from f2c" is supposed to be the same as "f2c.h from f2c/src", which was updated 3 Feb. 1993.) Mon Mar 8 17:57:55 EST 1993 Fix rarely seen bug that could cause strange casts in function invocations (revealed by an example with msdos/f2c.exe). msdos/f2cx.exe.Z and msdos/f2c.exe.Z updated (ftp access only). Fri Mar 12 12:37:01 EST 1993 Fix bug with -s in handling subscripts involving min, max, and complicated expressions requiring temporaries. Fix bug in handling COMMONs that need padding by a char array. msdos/f2cx.exe.Z and msdos/f2c.exe.Z updated (ftp access only). Fri Mar 12 17:16:16 EST 1993 libf77, libi77: updated for compiling under C++. Mon Mar 15 16:21:37 EST 1993 libi77: more minor tweaks (for -DKR_headers); Version.c not changed. Thu Mar 18 12:37:30 EST 1993 Flag -r (for discarding carriage-returns on systems that end lines with carriage-return/newline pairs, e.g. PCs) added to xsum, and xsum.c converted to ANSI/ISO syntax (with K&R syntax available with -DKR_headers). [When time permits, the f2c source will undergo a similar conversion.] libi77: tweaks to #includes in endfile.c, err.c, open.c, rawio.h; Version.c not changed. f2c.ps updated (to pick up revision of 2 Feb. 1993 to f2c.1). Fri Mar 19 09:19:26 EST 1993 libi77: add (char *) casts to malloc and realloc invocations in err.c, open.c; Version.c not changed. Tue Mar 30 07:17:15 EST 1993 Fix bug introduced 6 March 1993: possible memory corruption when loops in data statements involve constant subscripts, as in DATA (GUNIT(1,I),I=0,14)/15*-1/ Tue Mar 30 16:17:42 EST 1993 Fix bug with -s: (floating-point array item)*(complex item) generates an _subscr() reference for the floating-point array, but a #define for the _subscr() was omitted. Tue Apr 6 12:11:22 EDT 1993 libi77: adjust error returns for formatted inputs to flush the current input line when err= is specified. To restore the old behavior (input left mid-line), either adjust the #definition of errfl in fio.h or omit the invocation of f__doend in err__fl (in err.c). Tue Apr 6 13:30:04 EDT 1993 Fix bug revealed in subroutine foo(i) call goo(int(i)) end which now passes a copy of i, rather than i itself. Sat Apr 17 11:41:02 EDT 1993 Adjust appending of underscores to conform with f2c.ps ("A Fortran to C Converter"): names that conflict with C keywords or f2c type names now have just one underscore appended (rather than two); add "integer1", "logical1", "longint" to the keyword list. Append underscores to names that appear in EQUIVALENCE and are component names in a structure declared in f2c.h, thus avoiding a problem caused by the #defines emitted for equivalences. Example: complex a equivalence (i,j) a = 1 ! a.i went awry because of #define i j = 2 write(*,*) a, i end Adjust line-breaking logic to avoid splitting very long constants (and names). Example: ! The next line starts with tab and thus is a free-format line. a=.012345689012345689012345689012345689012345689012345689012345689012345689 end Omit extraneous "return 0;" from entry stubs emitted for multiple entry points of type character, complex, or double complex. Sat Apr 17 14:35:05 EDT 1993 Fix bug (introduced 4 Feb.) in separating -P from -A that kept f2c from re-reading a .P file written without -A or -C++ describing a routine with an external argument. [See the just-added note about separating -P from -A in the changes above for 4 Feb. 1993.] Fix bug (type UNKNOWN for v in the example below) revealed by subroutine a() external c call b(c) end subroutine b(v) end Sun Apr 18 19:55:26 EDT 1993 Fix wrong calling sequence for mem() in yesterday's addition to equiv.c . Wed Apr 21 17:39:46 EDT 1993 Fix bug revealed in ASSIGN 10 TO L1 GO TO 20 10 ASSIGN 30 TO L2 STOP 10 20 ASSIGN 10 TO L2 ! Bug here because 10 had been assigned ! to another label, then defined. GO TO L2 30 END Fri Apr 23 18:38:50 EDT 1993 Fix bug with -h revealed in CHARACTER*9 FOO WRITE(FOO,'(I6)') 1 WRITE(FOO,'(I6)') 2 ! struct icilist io___3 botched END Tue Apr 27 16:08:28 EDT 1993 Tweak to makefile: remove "size f2c". Tue May 4 23:48:20 EDT 1993 libf77: tweak signal_ line of f2ch.add . Tue Jun 1 13:47:13 EDT 1993 Fix bug introduced 3 Feb. 1993 in handling multiple entry points with differing return types -- the postfix array in proc.c needed a new entry for integer*8 (which resulted in wrong Multitype suffixes for non-integral types). For (default) K&R C, generate VOID rather than int functions for functions of Fortran type character, complex, and double complex. msdos/f2cx.exe.Z and msdos/f2c.exe.Z updated (ftp access only). Tue Jun 1 23:11:15 EDT 1993 f2c.h: add Multitype component g and commented type longint. proc.c: omit "return 0;" from stubs for complex and double complex entries (when entries have multiple types); add test to avoid memory fault with illegal combinations of entry types. Mon Jun 7 12:00:47 EDT 1993 Fix memory fault in common /c/ m integer m(1) data m(1)/1/, m(2)/2/ ! one too many initializers end msdos/f2cx.exe.Z and msdos/f2c.exe.Z updated (ftp access only). Fri Jun 18 13:55:51 EDT 1993 libi77: change type of signal_ in f2ch.add; change type of il in union Uint from long to integer (for machines like the DEC Alpha, where integer should be the same as int). Version.c not changed. Tweak gram.dcl and gram.head: add semicolons after some rules that lacked them, and remove an extraneous semicolon. These changes are completely transparent to our local yacc programs, but apparently matter on some VMS systems. Wed Jun 23 01:02:56 EDT 1993 Update "fc" shell script, and bring f2c.1 and f2c.1t up to date: they're meant to be linked with (i.e., the same as) src/f2c.1 and src/f2c.1t . [In the last update of f2c.1* (2 Feb. 1993), only src/f2c.1 and src/f2c.1t got changed -- a mistake.] Wed Jun 23 09:04:31 EDT 1993 libi77: fix bug in format reversions for internal writes. Example: character*60 lines(2) write(lines,"('n =',i3,2(' more text',i3))") 3, 4, 5, 6 write(*,*) 'lines(1) = ', lines(1) write(*,*) 'lines(2) = ', lines(2) end gave an error message that began "iio: off end of record", rather than giving the correct output: lines(1) = n = 3 more text 4 more text 5 lines(2) = more text 6 more text 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/18/1993 13:53:11 xsum0.out 6/18/1993 1:15:20 gram.dcl 6/18/1993 1:15:16 gram.head 6/04/1993 1:44:09 version.c 6/04/1993 1:43:59 formatdata.c 6/01/1993 23:10:00 f2c.h 6/01/1993 23:00:00 proc.c 6/01/1993 12:19:32 names.c 4/27/1993 16:06:59 makefile 4/23/1993 18:34:30 put.c 4/21/1993 16:53:08 exec.c 4/18/1993 19:53:34 equiv.c 4/17/1993 14:33:24 format.c 4/17/1993 14:12:45 putpcc.c 4/17/1993 9:47:04 misc.c 4/17/1993 9:14:52 niceprintf.c 4/17/1993 8:17:51 defs.h 4/06/1993 13:27:22 intr.c 3/30/1993 7:16:05 expr.c 3/18/1993 12:30:34 xsum.c 3/18/1993 12:29:39 README 3/08/1993 16:48:44 output.c 3/06/1993 14:13:58 gram.expr 3/04/1993 14:59:25 gram.exec 3/04/1993 14:00:19 main.c 3/04/1993 13:57:37 init.c 2/08/1993 15:03:27 lex.c 2/08/1993 14:52:58 error.c 2/05/1993 1:37:14 io.c 2/02/1993 12:20:34 f2c.1 2/01/1993 19:24:07 Notice 2/01/1993 8:37:12 sysdep.c 1/29/1993 12:29:27 f2c.1t 1/28/1993 9:03:16 ftypes.h 1/27/1993 10:22:56 mem.c 1/25/1993 11:26:33 defines.h 1/25/1993 10:36:05 data.c 1/20/1993 0:03:18 pread.c 1/19/1993 9:24:08 p1output.c 6/27/1992 14:50:07 vax.c 10/15/1991 1:26:39 sysdep.h 2/08/1991 11:29:18 malloc.c 7/26/1990 10:54:47 parse_args.c 7/26/1990 10:44:26 parse.h 4/18/1990 12:25:18 cds.c 4/06/1990 0:00:57 gram.io 3/27/1990 16:39:18 names.h 3/27/1990 10:05:15 p1defs.h 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/07/1990 1:20:01 usignal.h 11/27/1989 8:27:37 machdefs.h 7/01/1989 11:59:44 pccdefs.h