Mail Archives: djgpp/1996/03/06/14:17:02
I don't speak C very well, and I use DJGPP with the Fortran-to-C
converter F2C. I am having trouble converting a program which
executes under DJGPP v1m4 but encounters a problem under DJGPP v2.0 .
The FORTRAN statement to output a real number in hexidecimal is
Write (6,1000) Num_Coef
1000 format (z8.8)
which works under DJGPP v1m4.
When this statement is executed in C, an error is generated
backspace: end of file
apparent state: unit 6 (unnamed)
last format: (z8.8)
lately writing direct formatted external IO
Abort!
A brief FORTRAN progran to illustrate this problem is contained in
the file A.F, such as:
Program A
REAL*4 Num_Coef
DATA Num_Coef / 1.0 /
Write (6,1000) Num_Coef
1000 format (z8.8)
END
The C code that is generated by F2C, in the file A.C, is
/* a.f -- translated by f2c (version 19950920).
You must link the resulting object file with the libraries:
-lf2c -lm (in that order)
*/
#include "f2c.h"
/* Table of constant values */
static integer c__1 = 1;
/* Main program */ MAIN__()
{
/* Initialized data */
static real num_coef__ = (float)1.;
/* Format strings */
static char fmt_1000[] = "(z8.8)";
/* Builtin functions */
integer s_wsfe(), do_fio(), e_wsfe();
/* Fortran I/O blocks */
static cilist io___2 = { 0, 6, 0, fmt_1000, 0 };
s_wsfe(&io___2);
do_fio(&c__1, (char *)&num_coef__, (ftnlen)sizeof(real));
e_wsfe();
} /* MAIN__ */
/* Main program alias */ int a_ () { MAIN__ (); }
Yes, I have checked that the same code is generated with the two
different set-ups for DJGPP I have on my disk, v1m4 and v2, and have
checked the outputs for both F2C and F2CX.
Can anyone shed some light on my problem? Is this a problem with
DJGPP v2.0 or with the F2C converter?
Thanks
Bill Galbraith
billg AT p3 DOT enzian DOT com
- Raw text -