Dec 112017
 
Source code for F2C.EXE - compile your own exe file - This file and its companion are compliments of AT&T Bellcore Laboratories.
File F2CSRC.ZIP from The Programmer’s Corner in
Category C Source Code
Source code for F2C.EXE – compile your own exe file – This file and its companion are compliments of AT&T Bellcore Laboratories.
File Name File Size Zip Size Zip Type
F2C 0 0 stored
CDS.C 4062 1563 deflated
DATA.C 9714 3399 deflated
DEFINES.H 8468 3264 deflated
DEFS.H 24216 8190 deflated
EQUIV.C 8924 3031 deflated
ERROR.C 3905 1285 deflated
EXEC.C 18858 6334 deflated
EXPR.C 60052 15987 deflated
F2C.1 5981 2563 deflated
F2C.1T 6032 2628 deflated
F2C.H 4347 1386 deflated
FIXES 46345 17109 deflated
FORMAT.C 52786 13378 deflated
FORMAT.H 310 215 deflated
FORMATDA.C 24870 7313 deflated
FTYPES.H 980 480 deflated
GRAM.DCL 8429 2865 deflated
GRAM.EXC 3139 1090 deflated
GRAM.EXP 3222 883 deflated
GRAM.HEA 7815 3091 deflated
GRAM.IO 3467 782 deflated
INDEX 12959 5531 deflated
INIT.C 10793 3948 deflated
INTR.C 20489 5469 deflated
IO.C 30391 8783 deflated
IOB.H 483 206 deflated
LEX.C 30827 10151 deflated
LIBF77 0 0 stored
ABORT_.C 132 104 deflated
CABS.C 330 168 deflated
C_ABS.C 105 86 deflated
C_COS.C 167 122 deflated
C_DIV.C 588 275 deflated
C_EXP.C 177 123 deflated
C_LOG.C 155 124 deflated
C_SIN.C 165 120 deflated
C_SQRT.C 373 202 deflated
DERFC_.C 99 77 deflated
DERF_.C 96 76 deflated
D_ABS.C 101 84 deflated
D_ACOS.C 97 75 deflated
D_ASIN.C 97 75 deflated
D_ATAN.C 97 75 deflated
D_ATN2.C 108 86 deflated
D_CNJG.C 93 83 deflated
D_COS.C 94 74 deflated
D_COSH.C 97 75 deflated
D_DIM.C 98 86 deflated
D_EXP.C 94 74 deflated
D_IMAG.C 78 72 deflated
D_INT.C 124 97 deflated
D_LG10.C 147 118 deflated
D_LOG.C 94 74 deflated
D_MOD.C 441 240 deflated
D_NINT.C 136 110 deflated
D_PROD.C 84 81 deflated
D_SIGN.C 133 105 deflated
D_SIN.C 94 74 deflated
D_SINH.C 97 75 deflated
D_SQRT.C 97 75 deflated
D_TAN.C 94 74 deflated
D_TANH.C 97 75 deflated
EF1ASC_.C 300 205 deflated
EF1CMC_.C 233 158 deflated
ERFC_.C 92 73 deflated
ERF_.C 89 72 deflated
GETARG_.C 442 267 deflated
GETENV_.C 930 468 deflated
HL_GE.C 144 118 deflated
HL_GT.C 143 117 deflated
HL_LE.C 144 117 deflated
HL_LT.C 143 116 deflated
H_ABS.C 128 103 deflated
H_DIM.C 125 105 deflated
H_DNNT.C 165 130 deflated
H_INDX.C 328 214 deflated
H_LEN.C 110 98 deflated
H_MOD.C 108 96 deflated
H_NINT.C 159 130 deflated
H_SIGN.C 162 123 deflated
IARGC_.C 86 78 deflated
I_ABS.C 99 78 deflated
I_DIM.C 96 82 deflated
I_DNNT.C 137 117 deflated
I_INDX.C 305 197 deflated
I_LEN.C 82 80 deflated
I_MOD.C 82 72 deflated
I_NINT.C 131 114 deflated
I_SIGN.C 132 101 deflated
LIBF77.XSU 2538 1230 deflated
LIBFILE 843 364 deflated
L_GE.C 142 114 deflated
L_GT.C 141 113 deflated
L_LE.C 142 113 deflated
L_LT.C 110 96 deflated
MAIN.C 1457 565 deflated
MAKEFILE 3796 1408 deflated
MAKEFILE.UNX 2998 1189 deflated
NOTICE 1206 545 deflated
POW_CI.C 202 151 deflated
POW_DD.C 113 84 deflated
POW_DI.C 361 196 deflated
POW_HH.C 270 167 deflated
POW_II.C 267 165 deflated
POW_RI.C 355 195 deflated
POW_ZI.C 564 289 deflated
POW_ZZ.C 329 193 deflated
README 922 503 deflated
R_ABS.C 95 84 deflated
R_ACOS.C 91 74 deflated
R_ASIN.C 91 74 deflated
R_ATAN.C 91 74 deflated
R_ATN2.C 102 85 deflated
R_CNJG.C 92 83 deflated
R_COS.C 88 73 deflated
R_COSH.C 91 74 deflated
R_DIM.C 92 84 deflated
R_EXP.C 88 73 deflated
R_IMAG.C 72 72 stored
R_INT.C 118 95 deflated
R_LG10.C 141 117 deflated
R_LOG.C 88 73 deflated
R_MOD.C 443 244 deflated
R_NINT.C 130 110 deflated
R_SIGN.C 127 104 deflated
R_SIN.C 88 73 deflated
R_SINH.C 91 74 deflated
R_SQRT.C 91 74 deflated
R_TAN.C 88 73 deflated
R_TANH.C 91 74 deflated
SIGNAL_.C 249 146 deflated
SIG_DIE.C 419 256 deflated
SYSTEM_.C 306 207 deflated
S_CAT.C 317 197 deflated
S_CMP.C 545 248 deflated
S_COPY.C 302 182 deflated
S_PAUS.C 787 406 deflated
S_RNGE.C 534 298 deflated
S_STOP.C 257 183 deflated
VERSION.C 770 473 deflated
Z_ABS.C 111 87 deflated
Z_COS.C 173 122 deflated
Z_DIV.C 580 270 deflated
Z_EXP.C 183 123 deflated
Z_LOG.C 163 125 deflated
Z_SIN.C 171 120 deflated
Z_SQRT.C 354 200 deflated
LIBI77 0 0 stored
BACKSPAC.C 1315 537 deflated
CLOSE.C 962 443 deflated
DFE.C 2599 887 deflated
DOLIO.C 178 129 deflated
DUE.C 1208 465 deflated
ENDFILE.C 1648 773 deflated
ERR.C 5419 2019 deflated
FIO.H 1354 665 deflated
FMT.C 7306 2267 deflated
FMT.H 1017 460 deflated
FMTLIB.C 511 273 deflated
FP.H 639 340 deflated
IIO.C 1943 661 deflated
ILNW.C 861 363 deflated
INQUIRE.C 2406 725 deflated
LIBFILE 219 144 deflated
LIBI77.XSU 848 501 deflated
LIO.H 804 418 deflated
LOCAL.H 3 3 stored
LREAD.C 9580 2788 deflated
LWRITE.C 2540 1025 deflated
MAKEFILE 2488 832 deflated
MAKEFILE.UNX 1894 699 deflated
NOTICE 1206 545 deflated
OPEN.C 3560 1380 deflated
RDFMT.C 6027 1919 deflated
README 3790 1759 deflated
REWIND.C 370 226 deflated
RSFE.C 1245 534 deflated
RSLI.C 1329 542 deflated
RSNE.C 8888 2852 deflated
SFE.C 583 331 deflated
SUE.C 1487 540 deflated
TYPESIZE.C 203 124 deflated
UIO.C 949 319 deflated
UTIL.C 1089 490 deflated
VERSION.C 4000 1927 deflated
WREF.C 3856 1456 deflated
WRTFMT.C 5608 1636 deflated
WSFE.C 1625 727 deflated
WSLE.C 585 315 deflated
WSNE.C 462 268 deflated
XWSNE.C 935 432 deflated
LINKFILE 192 133 deflated
MACHDEFS.H 690 350 deflated
MAIN.C 16830 5553 deflated
MAKEFILE 2904 1096 deflated
MAKEFILE.UNX 2577 980 deflated
MALLOC.C 3564 1375 deflated
MEM.C 4991 1783 deflated
MEMSET.C 2030 901 deflated
MISC.C 18822 6069 deflated
NAMES.C 19833 6491 deflated
NAMES.H 711 299 deflated
NICEPRIN.C 9722 3292 deflated
NICEPRIN.H 428 266 deflated
NOTICE 1206 545 deflated
OUTPUT.C 38475 10671 deflated
OUTPUT.H 2178 888 deflated
P1DEFS.H 5936 2094 deflated
P1OUTPUT.C 12766 3994 deflated
PARSE.H 894 414 deflated
PARSE_AR.C 13514 4143 deflated
PCCDEFS.H 1259 484 deflated
PREAD.C 16677 4803 deflated
PROC.C 35433 11061 deflated
PUT.C 9898 3666 deflated
PUTPCC.C 39905 11259 deflated
README 3039 1377 deflated
README.DOS 1525 707 deflated
SYSDEP.C 11307 3766 deflated
SYSDEP.H 2615 1121 deflated
TOKDEFS.H 1906 611 deflated
TOKENIZE.AWK 31 31 stored
TOKENS 826 360 deflated
UNLINE.AWK 56 43 deflated
USIGNAL.H 131 88 deflated
VAX.C 7974 2902 deflated
VERSION.C 135 106 deflated
XSUM.C 5653 2649 deflated
XSUM0.OUT 1305 727 deflated

Download File F2CSRC.ZIP Here

Contents of the README file


If your system lacks onexit() and you are not using an ANSI C
compiler, then you should compile main.c with NO_ONEXIT defined.
See the comments about onexit in the makefile.

If your system has a double drem() function such that drem(a,b)
is the IEEE remainder function (with double a, b), then you may
wish to compile r_mod.c and d_mod.c with IEEE_drem defined.

To check for transmission errors, issue the command
make check
This assumes you have the xsum program whose source, xsum.c,
is distributed as part of "all from f2c/src". If you do not
have xsum, you can obtain xsum.c by sending the following E-mail
message to [email protected]
send xsum.c from f2c/src

The makefile assumes you have installed f2c.h in a standard
place (and does not cause recompilation when f2c.h is changed);
f2c.h comes with "all from f2c" (the source for f2c) and is
available separately ("f2c.h from f2c").
If your system lacks /usr/include/local.h ,
then you should create an appropriate local.h in
this directory. An appropriate local.h may simply
be empty, or it may #define VAX or #define CRAY
(or whatever else you must do to make fp.h work right).
Alternatively, edit fp.h to suite your machine.

If your system lacks /usr/include/fcntl.h , then you
should simply create an empty fcntl.h in this directory.

If your system's sprintf does not work the way ANSI C
specifies -- specifically, if it does not return the
number of characters transmitted -- then insert the line

#define USE_STRLEN

at the end of fmt.h . This is necessary with
at least some versions of Sun software.

If you get error messages about references to cf->_ptr
and cf->_base when compiling wrtfmt.c and wsfe.c or to
stderr->_flag when compiling err.c, then insert the line

#define NON_UNIX_STDIO

at the beginning of fio.h, and recompile these modules.

You may need to supply the following non-ANSI routines:

fstat(int fileds, struct stat *buf) is similar
to stat(char *name, struct stat *buf), except that
the first argument, fileds, is the file descriptor
returned by open rather than the name of the file.
fstat is used in the system-dependent routine
canseek (in the libI77 source file err.c), which
is supposed to return 1 if it's possible to issue
seeks on the file in question, 0 if it's not; you may
need to suitably modify err.c . On non-UNIX systems,
you can avoid references to fstat and stat by compiling
err.c, inquire.c, open.c, and util.c with MSDOS defined;
in that case, you may need to supply access(char *Name,0),
which is supposed to return 0 if file Name exists,
nonzero otherwise.

char * mktemp(char *buf) is supposed to replace the
6 trailing X's in buf with a unique number and then
return buf. The idea is to get a unique name for
a temporary file.

On non-UNIX systems, you may need to change a few other,
e.g.: the form of name computed by mktemp() in endfile.c and
open.c; the use of the open(), close(), and creat() system
calls in endfile.c, err.c, open.c; and the modes in calls on
fopen() and fdopen() (and perhaps the use of fdopen() itself
-- it's supposed to return a FILE* corresponding to a given
an integer file descriptor) in err.c and open.c (component ufmt
of struct unit is 1 for formatted I/O -- text mode on some systems
-- and 0 for unformatted I/O -- binary mode on some systems).

For Turbo C++, in particular, you need to adjust the mktemp
invocations and should compile all of libI77 with -DMSDOS .
You also need to #undef ungetc in lread.c and rsne.c .
Don't use -mh -- it is horribly broken.

If you want to be able to load against libI77 but not libF77,
then you will need to add sig_die.o (from libF77) to libI77.

If you wish to use translated Fortran that has funny notions
of record length for direct unformatted I/O (i.e., that assumes
RECL= values in OPEN statements are not bytes but rather counts
of some other units -- e.g., 4-character words for VMS), then you
should insert an appropriate #define for url_Adjust at the
beginning of open.c . For VMS Fortran, for example,
#define url_Adjust(x) x *= 4
would suffice.

To check for transmission errors, issue the command
make check
This assumes you have the xsum program whose source, xsum.c,
is distributed as part of "all from f2c/src". If you do not
have xsum, you can obtain xsum.c by sending the following E-mail
message to [email protected]
send xsum.c from f2c/src

The makefile assumes you have installed f2c.h in a standard
place (and does not cause recompilation when f2c.h is changed);
f2c.h comes with "all from f2c" (the source for f2c) and is
available separately ("f2c.h from f2c").
Type "make" to check the validity of the f2c source and compile f2c.

If (in accordance with what follows) you need to modify the makefile
or any of the source files, first issue a "make xsum.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 to send you
the files in question "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 from f2c/src

On some systems, the malloc and free in malloc.c let f2c run faster
than do the standard malloc and free. Other systems cannot tolerate
redefinition of malloc and free. If yours is such a system, you may
either modify the makefile appropriately, 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.

On some BSD systems, you may need to create a file named "string.h"
whose single line is
#include
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 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 "index from f2c". If you do this,
then you should adjust the definition of link_msg in sysdep.c
appropriately (e.g., replacing "-lF77 -lI77" by "-lf2c").

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.

Please send bug reports to [email protected] . The index file
("send index from f2c") will report recent changes in the recent-change
log at its end; all changes will be shown in the "fixes" file
("send fixes from f2c"). To keep current source, you will need to
request xsum0.out and version.c, in addition to the changed source
files.


 December 11, 2017  Add comments

Leave a Reply