Debian Codegraph @

debian/external_deps/fetk/punc/src/vf2c/README

raw
1 As shipped, "makefile" is a copy of "makefile.u", a Unix makefile.
2 Variants for other systems have names of the form makefile.* and
3 have initial comments saying how to invoke them. You may wish to
4 copy one of the other makefile.* files to makefile.
5
6 If you use a C++ compiler, first say
7
8 make hadd
9
10 to create a suitable f2c.h from f2c.h0 and f2ch.add. Otherwise,
11
12 make f2c.h
13
14 will just copy f2c.h0 to f2c.h .
15
16 If your compiler does not recognize ANSI C headers,
17 compile with KR_headers defined: either add -DKR_headers
18 to the definition of CFLAGS in the makefile, or insert
19
20 #define KR_headers
21
22 at the top of f2c.h .
23
24 If your system lacks onexit() and you are not using an ANSI C
25 compiler, then you should compile main.c with NO_ONEXIT defined.
26 See the comments about onexit in makefile.u.
27
28 If your system has a double drem() function such that drem(a,b)
29 is the IEEE remainder function (with double a, b), then you may
30 wish to compile r_mod.c and d_mod.c with IEEE_drem defined.
31
32 To check for transmission errors, issue the command
33 make check
34 or
35 make -f makefile.u check
36
37 This assumes you have the xsum program whose source, xsum.c,
38 is distributed as part of "all from f2c/src", and that it
39 is installed somewhere in your search path. If you do not
40 have xsum, you can obtain xsum.c by sending the following E-mail
41 message to [email protected]
42 send xsum.c from f2c/src
43
44 For convenience, the f2c.h0 in this directory is a copy of netlib's
45 "f2c.h from f2c". It is best to install f2c.h in a standard place,
46 so "include f2c.h" will work in any directory without further ado.
47 Beware that the makefiles do not cause recompilation when f2c.h is
48 changed.
49
50 On machines, such as those using a DEC Alpha processor, on which
51 sizeof(short) == 2, sizeof(int) == sizeof(float) == 4, and
52 sizeof(long) == sizeof(double) == 8, it suffices to modify f2c.h by
53 removing the first occurrence of "long " on each line containing
54 "long ". On Unix systems, you can do this by issuing the commands
55 mv f2c.h f2c.h0
56 sed 's/long int /int /' f2c.h0 >f2c.h
57 On such machines, one can enable INTEGER*8 by uncommenting the typedefs
58 of longint and ulongint in f2c.h and adjusting them, so they read
59 typedef long longint;
60 typedef unsigned long ulongint;
61 and by compiling libf2c with -DAllow_TYQUAD, as discussed below.
62
63
64 Most of the routines in libf2c are support routines for Fortran
65 intrinsic functions or for operations that f2c chooses not
66 to do "in line". There are a few exceptions, summarized below --
67 functions and subroutines that appear to your program as ordinary
68 external Fortran routines.
69
70 If you use the REAL valued functions listed below (ERF, ERFC,
71 DTIME, and ETIME) with "f2c -R", then you need to compile the
72 corresponding source files with -DREAL=float. To do this, it is
73 perhaps simplest to add "-DREAL=float" to CFLAGS in the makefile.
74
75 1. CALL ABORT prints a message and causes a core dump.
76
77 2. ERF(r) and DERF(d) and the REAL and DOUBLE PRECISION
78 error functions (with x REAL and d DOUBLE PRECISION);
79 DERF must be declared DOUBLE PRECISION in your program.
80 Both ERF and DERF assume your C library provides the
81 underlying erf() function (which not all systems do).
82
83 3. ERFC(r) and DERFC(d) are the complementary error functions:
84 ERFC(r) = 1 - ERF(r) and DERFC(d) = 1.d0 - DERFC(d)
85 (except that their results may be more accurate than
86 explicitly evaluating the above formulae would give).
87 Again, ERFC and r are REAL, and DERFC and d are DOUBLE
88 PRECISION (and must be declared as such in your program),
89 and ERFC and DERFC rely on your system's erfc().
90
91 4. CALL GETARG(n,s), where n is an INTEGER and s is a CHARACTER
92 variable, sets s to the n-th command-line argument (or to
93 all blanks if there are fewer than n command-line arguments);
94 CALL GETARG(0,s) sets s to the name of the program (on systems
95 that support this feature). See IARGC below.
96
97 5. CALL GETENV(name, value), where name and value are of type
98 CHARACTER, sets value to the environment value, $name, of
99 name (or to blanks if $name has not been set).
100
101 6. NARGS = IARGC() sets NARGS to the number of command-line
102 arguments (an INTEGER value).
103
104 7. CALL SIGNAL(n,func), where n is an INTEGER and func is an
105 EXTERNAL procedure, arranges for func to be invoked when n
106 occurs (on systems where this makes sense).
107
108 If your compiler complains about the signal calls in main.c, s_paus.c,
109 and signal_.c, you may need to adjust signal1.h suitably. See the
110 comments in signal1.h.
111
112 8. ETIME(ARR) and DTIME(ARR) are REAL functions that return
113 execution times. ARR is declared REAL ARR(2). The elapsed
114 user and system CPU times are stored in ARR(1) and ARR(2),
115 respectively. ETIME returns the total elapsed CPU time,
116 i.e., ARR(1) + ARR(2). DTIME returns total elapsed CPU
117 time since the previous call on DTIME.
118
119 9. CALL SYSTEM(cmd), where cmd is of type CHARACTER, passes
120 cmd to the system's command processor (on systems where
121 this can be done).
122
123 10. CALL FLUSH flushes all buffers.
124
125 11. FTELL(i) is an INTEGER function that returns the current
126 offset of Fortran unit i (or -1 if unit i is not open).
127
128 12. CALL FSEEK(i, offset, whence, *errlab) attemps to move
129 Fortran unit i to the specified offset: absolute offset
130 if whence = 0; relative to the current offset if whence = 1;
131 relative to the end of the file if whence = 2. It branches
132 to label errlab if unit i is not open or if the call
133 otherwise fails.
134
135 The routines whose objects are makefile.u's $(I77) are for I/O.
136 The following comments apply to them.
137
138 If your system lacks /usr/include/local.h ,
139 then you should create an appropriate local.h in
140 this directory. An appropriate local.h may simply
141 be empty, or it may #define VAX or #define CRAY
142 (or whatever else you must do to make fp.h work right).
143 Alternatively, edit fp.h to suite your machine.
144
145 If your system lacks /usr/include/fcntl.h , then you
146 should simply create an empty fcntl.h in this directory.
147 If your compiler then complains about creat and open not
148 having a prototype, compile with OPEN_DECL defined.
149 On many systems, open and creat are declared in fcntl.h .
150
151 If your system's sprintf does not work the way ANSI C
152 specifies -- specifically, if it does not return the
153 number of characters transmitted -- then insert the line
154
155 #define USE_STRLEN
156
157 at the end of fmt.h . This is necessary with
158 at least some versions of Sun software.
159 In particular, if you get a warning about an improper
160 pointer/integer combination in compiling wref.c, then
161 you need to compile with -DUSE_STRLEN .
162
163 If your system's fopen does not like the ANSI binary
164 reading and writing modes "rb" and "wb", then you should
165 compile open.c with NON_ANSI_RW_MODES #defined.
166
167 If you get error messages about references to cf->_ptr
168 and cf->_base when compiling wrtfmt.c and wsfe.c or to
169 stderr->_flag when compiling err.c, then insert the line
170
171 #define NON_UNIX_STDIO
172
173 at the beginning of fio.h, and recompile everything (or
174 at least those modules that contain NON_UNIX_STDIO).
175
176 Unformatted sequential records consist of a length of record
177 contents, the record contents themselves, and the length of
178 record contents again (for backspace). Prior to 17 Oct. 1991,
179 the length was of type int; now it is of type long, but you
180 can change it back to int by inserting
181
182 #define UIOLEN_int
183
184 at the beginning of fio.h. This affects only sue.c and uio.c .
185
186 If you have a really ancient K&R C compiler that does not understand
187 void, add -Dvoid=int to the definition of CFLAGS in the makefile.
188
189 On VAX, Cray, or Research Tenth-Edition Unix systems, you may
190 need to add -DVAX, -DCRAY, or -DV10 (respectively) to CFLAGS
191 to make fp.h work correctly. Alternatively, you may need to
192 edit fp.h to suit your machine.
193
194 If your compiler complains about the signal calls in main.c, s_paus.c,
195 and signal_.c, you may need to adjust signal1.h suitably. See the
196 comments in signal1.h.
197
198 You may need to supply the following non-ANSI routines:
199
200 fstat(int fileds, struct stat *buf) is similar
201 to stat(char *name, struct stat *buf), except that
202 the first argument, fileds, is the file descriptor
203 returned by open rather than the name of the file.
204 fstat is used in the system-dependent routine
205 canseek (in the libf2c source file err.c), which
206 is supposed to return 1 if it's possible to issue
207 seeks on the file in question, 0 if it's not; you may
208 need to suitably modify err.c . On non-UNIX systems,
209 you can avoid references to fstat and stat by compiling
210 with NON_UNIX_STDIO defined; in that case, you may need
211 to supply access(char *Name,0), which is supposed to
212 return 0 if file Name exists, nonzero otherwise.
213
214 char * mktemp(char *buf) is supposed to replace the
215 6 trailing X's in buf with a unique number and then
216 return buf. The idea is to get a unique name for
217 a temporary file.
218
219 On non-UNIX systems, you may need to change a few other,
220 e.g.: the form of name computed by mktemp() in endfile.c and
221 open.c; the use of the open(), close(), and creat() system
222 calls in endfile.c, err.c, open.c; and the modes in calls on
223 fopen() and fdopen() (and perhaps the use of fdopen() itself
224 -- it's supposed to return a FILE* corresponding to a given
225 an integer file descriptor) in err.c and open.c (component ufmt
226 of struct unit is 1 for formatted I/O -- text mode on some systems
227 -- and 0 for unformatted I/O -- binary mode on some systems).
228 Compiling with -DNON_UNIX_STDIO omits all references to creat()
229 and almost all references to open() and close(), the exception
230 being in the function f__isdev() (in open.c).
231
232 If you wish to use translated Fortran that has funny notions
233 of record length for direct unformatted I/O (i.e., that assumes
234 RECL= values in OPEN statements are not bytes but rather counts
235 of some other units -- e.g., 4-character words for VMS), then you
236 should insert an appropriate #define for url_Adjust at the
237 beginning of open.c . For VMS Fortran, for example,
238 #define url_Adjust(x) x *= 4
239 would suffice.
240
241 By default, Fortran I/O units 5, 6, and 0 are pre-connected to
242 stdin, stdout, and stderr, respectively. You can change this
243 behavior by changing f_init() in err.c to suit your needs.
244 Note that f2c assumes READ(*... means READ(5... and WRITE(*...
245 means WRITE(6... . Moreover, an OPEN(n,... statement that does
246 not specify a file name (and does not specify STATUS='SCRATCH')
247 assumes FILE='fort.n' . You can change this by editing open.c
248 and endfile.c suitably.
249
250 Unless you adjust the "#define MXUNIT" line in fio.h, Fortran units
251 0, 1, ..., 99 are available, i.e., the highest allowed unit number
252 is MXUNIT - 1.
253
254 Lines protected from compilation by #ifdef Allow_TYQUAD
255 are for a possible extension to 64-bit integers in which
256 integer = int = 32 bits and longint = long = 64 bits.
257
258 The makefile does not attempt to compile pow_qq.c, qbitbits.c,
259 and qbitshft.c, which are meant for use with INTEGER*8. To use
260 INTEGER*8, you must modify f2c.h to declare longint and ulongint
261 appropriately; then add $(QINT) to the end of the makefile's
262 dependency list for libf2c.a (if makefile is a copy of makefile.u;
263 for the PC makefiles, add pow_qq.obj qbitbits.obj qbitshft.obj
264 to the library's dependency list and adjust libf2c.lbc or libf2c.sy
265 accordingly). Also add -DAllow_TYQUAD to the makefile's CFLAGS
266 assignment. To make longint and ulongint available, it may suffice
267 to add -DINTEGER_STAR_8 to the CFLAGS assignment.
268
269 Following Fortran 90, s_cat.c and s_copy.c allow the target of a
270 (character string) assignment to be appear on its right-hand, at
271 the cost of some extra overhead for all run-time concatenations.
272 If you prefer the extra efficiency that comes with the Fortran 77
273 requirement that the left-hand side of a character assignment not
274 be involved in the right-hand side, compile s_cat.c and s_copy.c
275 with -DNO_OVERWRITE .
276
277 Extensions (Feb. 1993) to NAMELIST processing:
278 1. Reading a ? instead of &name (the start of a namelist) causes
279 the namelist being sought to be written to stdout (unit 6);
280 to omit this feature, compile rsne.c with -DNo_Namelist_Questions.
281 2. Reading the wrong namelist name now leads to an error message
282 and an attempt to skip input until the right namelist name is found;
283 to omit this feature, compile rsne.c with -DNo_Bad_Namelist_Skip.
284 3. Namelist writes now insert newlines before each variable; to omit
285 this feature, compile xwsne.c with -DNo_Extra_Namelist_Newlines.
286 4. (Sept. 1995) When looking for the &name that starts namelist
287 input, lines whose first non-blank character is something other
288 than &, $, or ? are treated as comment lines and ignored, unless
289 rsne.c is compiled with -DNo_Namelist_Comments.
290
291 Nonstandard extension (Feb. 1993) to open: for sequential files,
292 ACCESS='APPEND' (or access='anything else starting with "A" or "a"')
293 causes the file to be positioned at end-of-file, so a write will
294 append to the file.
295
296 Some buggy Fortran programs use unformatted direct I/O to write
297 an incomplete record and later read more from that record than
298 they have written. For records other than the last, the unwritten
299 portion of the record reads as binary zeros. The last record is
300 a special case: attempting to read more from it than was written
301 gives end-of-file -- which may help one find a bug. Some other
302 Fortran I/O libraries treat the last record no differently than
303 others and thus give no help in finding the bug of reading more
304 than was written. If you wish to have this behavior, compile
305 uio.c with -DPad_UDread .
306
307 If you want to be able to catch write failures (e.g., due to a
308 disk being full) with an ERR= specifier, compile dfe.c, due.c,
309 sfe.c, sue.c, and wsle.c with -DALWAYS_FLUSH. This will lead to
310 slower execution and more I/O, but should make ERR= work as
311 expected, provided fflush returns an error return when its
312 physical write fails.
313
314 Carriage controls are meant to be interpreted by the UNIX col
315 program (or a similar program). Sometimes it's convenient to use
316 only ' ' as the carriage control character (normal single spacing).
317 If you compile lwrite.c and wsfe.c with -DOMIT_BLANK_CC, formatted
318 external output lines will have an initial ' ' quietly omitted,
319 making use of the col program unnecessary with output that only
320 has ' ' for carriage control.
321
322 The Fortran 77 Standard leaves it up to the implementation whether
323 formatted writes of floating-point numbers of absolute value < 1 have
324 a zero before the decimal point. By default, libI77 omits such
325 superfluous zeros, but you can cause them to appear by compiling
326 lwrite.c, wref.c, and wrtfmt.c with -DWANT_LEAD_0 .
327
328 If your (Unix) system lacks a ranlib command, you don't need it.
329 Either comment out the makefile's ranlib invocation, or install
330 a harmless "ranlib" command somewhere in your PATH, such as the
331 one-line shell script
332
333 exit 0
334
335 or (on some systems)
336
337 exec /usr/bin/ar lts $1 >/dev/null
338
339 By default, the routines that implement complex and double complex
340 division, c_div.c and z_div.c, call sig_die to print an error message
341 and exit if they see a divisor of 0, as this is sometimes helpful for
342 debugging. On systems with IEEE arithmetic, compiling c_div.c and
343 z_div.c with -DIEEE_COMPLEX_DIVIDE causes them instead to set both
344 the real and imaginary parts of the result to +INFINITY if the
345 numerator is nonzero, or to NaN if it vanishes.
346
347 Nowadays most Unix and Linux systems have function
348 int ftruncate(int fildes, off_t len);
349 defined in system header file unistd.h that adjusts the length of file
350 descriptor fildes to length len. Unless endfile.c is compiled with
351 -DNO_TRUNCATE, endfile.c #includes "unistd.h" and calls ftruncate() if
352 necessary to shorten files. If your system lacks ftruncate(), compile
353 endfile.c with -DNO_TRUNCATE to make endfile.c use the older and more
354 portable scheme of shortening a file by copying to a temporary file
355 and back again.
356
357 The initializations for "f2c -trapuv" are done by _uninit_f2c(),
358 whose source is uninit.c, introduced June 2001. On IEEE-arithmetic
359 systems, _uninit_f2c should initialize floating-point variables to
360 signaling NaNs and, at its first invocation, should enable the
361 invalid operation exception. Alas, the rules for distinguishing
362 signaling from quiet NaNs were not specified in the IEEE P754 standard,
363 nor were the precise means of enabling and disabling IEEE-arithmetic
364 exceptions, and these details are thus system dependent. There are
365 #ifdef's in uninit.c that specify them for some popular systems. If
366 yours is not one of these systems, it may take some detective work to
367 discover the appropriate details for your system. Sometimes it helps
368 to look in the standard include directories for header files with
369 relevant-sounding names, such as ieeefp.h, nan.h, or trap.h, and
370 it may be simplest to run experiments to see what distinguishes a
371 signaling from a quiet NaN. (If x is initialized to a signaling
372 NaN and the invalid operation exception is masked off, as it should
373 be by default on IEEE-arithmetic systems, then computing, say,
374 y = x + 1 will yield a quiet NaN.)