freebsd-nq/usr.bin/f2c
Doug Rabson f4dd1f4feb From the submitter:
I found the reason why f77 so offen dies on alpha. Here is a fix.
"Const" is a union of int and double.
If nelt->constblock.Const.ci > 0 then it trys to evaluate it as double
and floating point exception occurs.

Submitted by: Hidetoshi Shimokawa <simokawa@sat.t.u-tokyo.ac.jp>
Obtained from: NetBSD
1999-01-10 17:22:49 +00:00
..
cds.c Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
data.c Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
defines.h Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
defs.h Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
equiv.c Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
error.c Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
exec.c Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
expr.c Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
f2c.1 During compilation of a Fortran program f2c/f77 will spew the 1998-07-24 07:13:57 +00:00
f2c.h Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
format.c Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
format.h
formatdata.c Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
ftypes.h
gram.dcl Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
gram.exec Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
gram.expr
gram.head Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
gram.io
init.c Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
intr.c Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
io.c Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
iob.h
lex.c Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
machdefs.h
main.c During compilation of a Fortran program f2c/f77 will spew the 1998-07-24 07:13:57 +00:00
Makefile Fixed `make -jN' for large N. Just put all generated headers in SRCS. 1998-03-06 13:51:18 +00:00
malloc.c Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
mem.c Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
memset.c Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
misc.c Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
names.c Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
names.h
niceprintf.c Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
niceprintf.h
Notice Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
output.c Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
output.h
p1defs.h
p1output.c Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
parse_args.c Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
parse.h
pccdefs.h
pread.c Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
proc.c From the submitter: 1999-01-10 17:22:49 +00:00
put.c Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
putpcc.c Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
README Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
sysdep.c Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
sysdep.h Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
tokens
usignal.h
vax.c Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00
version.c Upgrade to the 1997/02/19 version. 1997-04-13 01:13:52 +00:00

Type "make" to check the validity of the f2c source and compile f2c.

On a PC, you may need to compile xsum.c with -DMSDOS (i.e., with
MSDOS #defined).

If your compiler does not understand ANSI/ISO C syntax (i.e., if
you have a K&R C compiler), compile with -DKR_headers .

On non-Unix systems where files have separate binary and text modes,
you may need to "make xsumr.out" rather than "make xsum.out".

If (in accordance with what follows) you need to any of the source
files (excluding the makefile), first issue a "make xsum.out" (or, if
appropriate, "make xsumr.out") to check the validity of the f2c source,
then make your changes, then type "make f2c".

The file usignal.h is for the benefit of strictly ANSI include files
on a UNIX system -- the ANSI signal.h does not define SIGHUP or SIGQUIT.
You may need to modify usignal.h if you are not running f2c on a UNIX
system.

Should you get the message "xsum0.out xsum1.out differ", see what lines
are different (`diff xsum0.out xsum1.out`) and ask netlib
(e.g., netlib@netlib.bell-labs.com) to send you the files in question,
plus the current xsum0.out (which may have changed) "from f2c/src".
For example, if exec.c and expr.c have incorrect check sums, you would
send netlib the message
	send exec.c expr.c xsum0.out from f2c/src
You can also ftp these files from netlib.bell-labs.com; for more
details, ask netlib@netlib.bell-labs.com to "send readme from f2c".

On some systems, the malloc and free in malloc.c let f2c run faster
than do the standard malloc and free.  Other systems may not tolerate
redefinition of malloc and free (though changes of 8 Nov. 1994 may
render this less of a problem than hitherto).  If yours is such a
system, you may either modify the makefile appropriately (remove
"malloc.o" from the "OBJECTS =" assignment), or simply execute
	cc -c -DCRAY malloc.c
before typing "make".  Still other systems have a -lmalloc that
provides performance competitive with that from malloc.c; you may
wish to compare the two on your system.  In general, if f2c faults
when you first try to run it, try compiling malloc.c with -DCRAY;
this is necessary with at least one version of Linux (but not with
others).

On some BSD systems, you may need to create a file named "string.h"
whose single line is
#include <strings.h>
you may need to add " -Dstrchr=index" to the "CFLAGS =" assignment
in the makefile, and you may need to add " memset.o" to the "OBJECTS ="
assignment in the makefile -- see the comments in memset.c .

For non-UNIX systems, you may need to change some things in sysdep.c,
such as the choice of intermediate file names.

On some systems, you may need to modify parts of sysdep.h (which is
included by defs.h).  In particular, for Sun 4.1 systems and perhaps
some others, you need to comment out the typedef of size_t.  For some
systems (e.g., IRIX 4.0.1 and AIX) it is better to add
#define ANSI_Libraries
to the beginning of sysdep.h (or to supply -DANSI_Libraries in the
makefile).

Alas, some systems #define __STDC__ but do not provide a true standard
(ANSI or ISO) C environment, e.g. do not provide stdlib.h .  If yours
is such a system, then (a) you should complain loudly to your vendor
about __STDC__ being erroneously defined, and (b) you should insert
#undef __STDC__
at the beginning of sysdep.h .  You may need to make other adjustments.

For some non-ANSI versions of stdio, you must change the values given
to binread and binwrite in sysdep.c from "rb" and "wb" to "r" and "w".
You may need to make this change if you run f2c and get an error
message of the form
	Compiler error ... cannot open intermediate file ...

On many systems, it is best to combine libF77 and libI77 into a single
library, say libf2c, as suggested in "readme from f2c".  If you do not
do this, then you should adjust the definition of link_msg in sysdep.c
appropriately (e.g., replacing "-lf2c" by "-lF77 -lI77").  On Unix
systems, the easiest way to create libf2c.a is to make libF77/libF77.a
and libI77/libI77.a (after reading and heeding libF77/README and
libI77/README), and then to say

	cp libF77/libF77.a libf2c.a
	ar ruv libf2c.a libI77/*.o
	ranlib libf2c.a

The last step, ranlib, may not be necessary on your system.  On
other systems, just compile all the .c files in libF77 and libI77,
and put the resulting objects (except one or both of the Version
objects) into a library, called perhaps f2c.lib .

In general, under Linux it is necessary to compile libI77 with
-DNON_UNIX_STDIO .  Under at least one variant of Linux, you can make
and install a shared-library version of libf2c by compiling libI77
with -DNON_UNIX_STDIO, creating libf2c.a as above, and then executing

	mkdir t
	ln lib?77/*.o t
	cd t; cc -shared -o ../libf2c.so -Wl,-soname,libf2c.so.1 *.o
	cd ..
	rm -r t
	rm /usr/lib/libf2c*
	mv libf2c.a libf2c.so /usr/lib
	cd /usr/lib
	ln libf2c.so libf2c.so.1
	ln libf2c.so libf2c.so.1.0.0

On some other systems, /usr/local/lib is the appropriate installation
directory.


Some older C compilers object to
	typedef void (*foo)();
or to
	typedef void zap;
	zap (*foo)();
If yours is such a compiler, change the definition of VOID in
f2c.h from void to int.

For convenience with systems that use control-Z to denote end-of-file,
f2c treats control-Z characters (ASCII 26, '\x1a') that appear at the
beginning of a line as an end-of-file indicator.  You can disable this
test by compiling lex.c with NO_EOF_CHAR_CHECK #defined, or can
change control-Z to some other character by #defining EOF_CHAR to
be the desired value.


If your machine has IEEE, VAX, or IBM-mainframe arithmetic, but your
printf is inaccurate (e.g., with Symantec C++ version 6.0,
printf("%.17g",12.) prints 12.000000000000001), you can make f2c print
correctly rounded numbers by compiling with -DUSE_DTOA and adding
dtoa.o g_fmt.o to the makefile's OBJECTS = line, so it becomes

	OBJECTS = $(OBJECTSd) malloc.o dtoa.o g_fmt.o

Also add the rule

	dtoa.o: dtoa.c
		$(CC) -c $(CFLAGS) -DMALLOC=ckalloc -DIEEE... dtoa.c

(without the initial tab) to the makefile, where IEEE... is one of
IEEE_MC68k, IEEE_8087, VAX, or IBM, depending on your machine's
arithmetic.  See the comments near the start of dtoa.c.

The relevant source files, dtoa.c and g_fmt.c, are available
separately from netlib's fp directory.  For example, you could
send the E-mail message

	send dtoa.c g_fmt.c from fp

to netlib@netlib.bell-labs.com (or use anonymous ftp from
netlib.bell-labs.com and look in directory /netlib/fp).

The makefile has a rule for creating tokdefs.h.  If you cannot use the
makefile, an alternative is to extract tokdefs.h from the beginning of
gram.c: it's the first 100 lines.


Please send bug reports to dmg@bell-labs.com .  The old index file
(now called "readme" due to unfortunate changes in netlib conventions:
"send readme from f2c") will report recent changes in the recent-change
log at its end; all changes will be shown in the "changes" file
("send changes from f2c").  To keep current source, you will need to
request xsum0.out and version.c, in addition to the changed source
files.  Changes first appear on netlib@netlib.bell-labs.com, and in due
time propagate to the other netlib sites that are kept current.