1998-02-01 02:37:08 +01:00
|
|
|
#include "f2c.h"
|
|
|
|
#include "fio.h"
|
|
|
|
#include "fmt.h"
|
|
|
|
#include "lio.h"
|
|
|
|
|
|
|
|
ftnint L_len;
|
|
|
|
int f__Aquote;
|
|
|
|
|
g2c.hin, [...]: Kill VOID, Void and Int.
* g2c.hin, libF77/d_cnjg.c, libF77/main.c, libF77/r_cnjg.c,
libF77/s_cat.c, libF77/s_paus.c, libF77/s_rnge.c, libF77/setarg.c,
libF77/setsig.c, libF77/signal1.h0, libI77/dfe.c, libI77/due.c,
libI77/err.c, libI77/fio.h, libI77/fmt.c, libI77/iio.c,
libI77/ilnw.c, libI77/lread.c, libI77/lwrite.c, libI77/rsfe.c,
libI77/rsli.c, libI77/rsne.c, libI77/sfe.c, libI77/sue.c,
libI77/util.c, libI77/wrtfmt.c, libI77/wsfe.c, libI77/wsle.c,
libI77/xwsne.c, libU77/date_.c: Kill VOID, Void and Int.
From-SVN: r54134
2002-06-01 03:58:10 +02:00
|
|
|
static void
|
2002-06-01 14:38:32 +02:00
|
|
|
donewrec (void)
|
1998-02-01 02:37:08 +01:00
|
|
|
{
|
2002-06-01 14:38:32 +02:00
|
|
|
if (f__recpos)
|
|
|
|
(*f__donewrec) ();
|
|
|
|
}
|
1998-02-01 02:37:08 +01:00
|
|
|
|
g2c.hin, [...]: Kill VOID, Void and Int.
* g2c.hin, libF77/d_cnjg.c, libF77/main.c, libF77/r_cnjg.c,
libF77/s_cat.c, libF77/s_paus.c, libF77/s_rnge.c, libF77/setarg.c,
libF77/setsig.c, libF77/signal1.h0, libI77/dfe.c, libI77/due.c,
libI77/err.c, libI77/fio.h, libI77/fmt.c, libI77/iio.c,
libI77/ilnw.c, libI77/lread.c, libI77/lwrite.c, libI77/rsfe.c,
libI77/rsli.c, libI77/rsne.c, libI77/sfe.c, libI77/sue.c,
libI77/util.c, libI77/wrtfmt.c, libI77/wsfe.c, libI77/wsle.c,
libI77/xwsne.c, libU77/date_.c: Kill VOID, Void and Int.
From-SVN: r54134
2002-06-01 03:58:10 +02:00
|
|
|
static void
|
2002-06-01 14:38:32 +02:00
|
|
|
lwrt_I (longint n)
|
1998-02-01 02:37:08 +01:00
|
|
|
{
|
2002-06-01 14:38:32 +02:00
|
|
|
char *p;
|
|
|
|
int ndigit, sign;
|
1998-02-01 02:37:08 +01:00
|
|
|
|
2002-06-01 14:38:32 +02:00
|
|
|
p = f__icvt (n, &ndigit, &sign, 10);
|
|
|
|
if (f__recpos + ndigit >= L_len)
|
|
|
|
donewrec ();
|
|
|
|
PUT (' ');
|
|
|
|
if (sign)
|
|
|
|
PUT ('-');
|
|
|
|
while (*p)
|
|
|
|
PUT (*p++);
|
1998-02-01 02:37:08 +01:00
|
|
|
}
|
g2c.hin, [...]: Kill VOID, Void and Int.
* g2c.hin, libF77/d_cnjg.c, libF77/main.c, libF77/r_cnjg.c,
libF77/s_cat.c, libF77/s_paus.c, libF77/s_rnge.c, libF77/setarg.c,
libF77/setsig.c, libF77/signal1.h0, libI77/dfe.c, libI77/due.c,
libI77/err.c, libI77/fio.h, libI77/fmt.c, libI77/iio.c,
libI77/ilnw.c, libI77/lread.c, libI77/lwrite.c, libI77/rsfe.c,
libI77/rsli.c, libI77/rsne.c, libI77/sfe.c, libI77/sue.c,
libI77/util.c, libI77/wrtfmt.c, libI77/wsfe.c, libI77/wsle.c,
libI77/xwsne.c, libU77/date_.c: Kill VOID, Void and Int.
From-SVN: r54134
2002-06-01 03:58:10 +02:00
|
|
|
static void
|
2002-06-01 14:38:32 +02:00
|
|
|
lwrt_L (ftnint n, ftnlen len)
|
1998-02-01 02:37:08 +01:00
|
|
|
{
|
2002-06-01 14:38:32 +02:00
|
|
|
if (f__recpos + LLOGW >= L_len)
|
|
|
|
donewrec ();
|
|
|
|
wrt_L ((Uint *) & n, LLOGW, len);
|
1998-02-01 02:37:08 +01:00
|
|
|
}
|
g2c.hin, [...]: Kill VOID, Void and Int.
* g2c.hin, libF77/d_cnjg.c, libF77/main.c, libF77/r_cnjg.c,
libF77/s_cat.c, libF77/s_paus.c, libF77/s_rnge.c, libF77/setarg.c,
libF77/setsig.c, libF77/signal1.h0, libI77/dfe.c, libI77/due.c,
libI77/err.c, libI77/fio.h, libI77/fmt.c, libI77/iio.c,
libI77/ilnw.c, libI77/lread.c, libI77/lwrite.c, libI77/rsfe.c,
libI77/rsli.c, libI77/rsne.c, libI77/sfe.c, libI77/sue.c,
libI77/util.c, libI77/wrtfmt.c, libI77/wsfe.c, libI77/wsle.c,
libI77/xwsne.c, libU77/date_.c: Kill VOID, Void and Int.
From-SVN: r54134
2002-06-01 03:58:10 +02:00
|
|
|
static void
|
2002-06-01 14:38:32 +02:00
|
|
|
lwrt_A (char *p, ftnlen len)
|
1998-02-01 02:37:08 +01:00
|
|
|
{
|
2002-06-01 14:38:32 +02:00
|
|
|
int a;
|
|
|
|
char *p1, *pe;
|
1998-02-01 02:37:08 +01:00
|
|
|
|
2002-06-01 14:38:32 +02:00
|
|
|
a = 0;
|
|
|
|
pe = p + len;
|
|
|
|
if (f__Aquote)
|
|
|
|
{
|
|
|
|
a = 3;
|
|
|
|
if (len > 1 && p[len - 1] == ' ')
|
|
|
|
{
|
|
|
|
while (--len > 1 && p[len - 1] == ' ');
|
|
|
|
pe = p + len;
|
|
|
|
}
|
|
|
|
p1 = p;
|
|
|
|
while (p1 < pe)
|
|
|
|
if (*p1++ == '\'')
|
|
|
|
a++;
|
|
|
|
}
|
|
|
|
if (f__recpos + len + a >= L_len)
|
|
|
|
donewrec ();
|
|
|
|
if (a
|
1998-02-01 02:37:08 +01:00
|
|
|
#ifndef OMIT_BLANK_CC
|
2002-06-01 14:38:32 +02:00
|
|
|
|| !f__recpos
|
1998-02-01 02:37:08 +01:00
|
|
|
#endif
|
2002-06-01 14:38:32 +02:00
|
|
|
)
|
|
|
|
PUT (' ');
|
|
|
|
if (a)
|
|
|
|
{
|
|
|
|
PUT ('\'');
|
|
|
|
while (p < pe)
|
|
|
|
{
|
|
|
|
if (*p == '\'')
|
|
|
|
PUT ('\'');
|
|
|
|
PUT (*p++);
|
|
|
|
}
|
|
|
|
PUT ('\'');
|
|
|
|
}
|
|
|
|
else
|
|
|
|
while (p < pe)
|
|
|
|
PUT (*p++);
|
1998-02-01 02:37:08 +01:00
|
|
|
}
|
|
|
|
|
2002-06-01 14:38:32 +02:00
|
|
|
static int
|
|
|
|
l_g (char *buf, double n)
|
1998-02-01 02:37:08 +01:00
|
|
|
{
|
|
|
|
#ifdef Old_list_output
|
2002-06-01 14:38:32 +02:00
|
|
|
doublereal absn;
|
|
|
|
char *fmt;
|
1998-02-01 02:37:08 +01:00
|
|
|
|
2002-06-01 14:38:32 +02:00
|
|
|
absn = n;
|
|
|
|
if (absn < 0)
|
|
|
|
absn = -absn;
|
|
|
|
fmt = LLOW <= absn && absn < LHIGH ? LFFMT : LEFMT;
|
1998-02-01 02:37:08 +01:00
|
|
|
#ifdef USE_STRLEN
|
2002-06-01 14:38:32 +02:00
|
|
|
sprintf (buf, fmt, n);
|
|
|
|
return strlen (buf);
|
1998-02-01 02:37:08 +01:00
|
|
|
#else
|
2002-06-01 14:38:32 +02:00
|
|
|
return sprintf (buf, fmt, n);
|
1998-02-01 02:37:08 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#else
|
2002-06-01 14:38:32 +02:00
|
|
|
register char *b, c, c1;
|
1998-02-01 02:37:08 +01:00
|
|
|
|
2002-06-01 14:38:32 +02:00
|
|
|
b = buf;
|
|
|
|
*b++ = ' ';
|
|
|
|
if (n < 0)
|
|
|
|
{
|
|
|
|
*b++ = '-';
|
|
|
|
n = -n;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
*b++ = ' ';
|
|
|
|
if (n == 0)
|
|
|
|
{
|
|
|
|
*b++ = '0';
|
|
|
|
*b++ = '.';
|
|
|
|
*b = 0;
|
|
|
|
goto f__ret;
|
|
|
|
}
|
|
|
|
sprintf (b, LGFMT, n);
|
|
|
|
switch (*b)
|
|
|
|
{
|
1998-02-01 02:37:08 +01:00
|
|
|
#ifndef WANT_LEAD_0
|
2002-06-01 14:38:32 +02:00
|
|
|
case '0':
|
|
|
|
while (b[0] = b[1])
|
|
|
|
b++;
|
|
|
|
break;
|
1998-02-01 02:37:08 +01:00
|
|
|
#endif
|
2002-06-01 14:38:32 +02:00
|
|
|
case 'i':
|
|
|
|
case 'I':
|
|
|
|
/* Infinity */
|
|
|
|
case 'n':
|
|
|
|
case 'N':
|
|
|
|
/* NaN */
|
|
|
|
while (*++b);
|
|
|
|
break;
|
1998-02-01 02:37:08 +01:00
|
|
|
|
2002-06-01 14:38:32 +02:00
|
|
|
default:
|
|
|
|
/* Fortran 77 insists on having a decimal point... */
|
|
|
|
for (;; b++)
|
|
|
|
switch (*b)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
*b++ = '.';
|
|
|
|
*b = 0;
|
|
|
|
goto f__ret;
|
|
|
|
case '.':
|
|
|
|
while (*++b);
|
|
|
|
goto f__ret;
|
|
|
|
case 'E':
|
dfe.c (s_rdfe, s_wdfe): Wrap parentheses around assignment used as truth value.
* libI77/dfe.c (s_rdfe, s_wdfe): Wrap parentheses around
assignment used as truth value.
* libI77/due.c (s_rdue, s_wdue): Likewise.
* libI77/endfile.c (f_end): Likewise.
* libI77/iio.c (s_rsfi, s_wsfi): Likewise.
* libI77/lread.c (ERR, l_C, nmL_getc, s_rsle): Likewise.
* libI77/lwrite.c (l_g, l_put): Likewise.
* libI77/open.c (f_open): Likewise.
* libI77/rdfmt.c (rd_Z): Likewise.
* libI77/rsfe.c (s_rsfe): Likewise.
* libI77/rsne.c (hash, mk_hashtab, nl_init, getname, getdimen,
x_rsne, s_rsne): Likewise.
* libI77/sue.c (s_rsue, s_wsue): Likewise.
* libI77/wref.c (wrt_E, wrt_F): Likewise.
* libI77/wsfe.c (s_wsfe): Likewise.
* libI77/wsle.c (s_wsle): Likewise.
* libI77/wsne.c (s_wsne): Likewise.
From-SVN: r54172
2002-06-02 16:34:31 +02:00
|
|
|
for (c1 = '.', c = 'E'; (*b = c1); c1 = c, c = *++b);
|
2002-06-01 14:38:32 +02:00
|
|
|
goto f__ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
f__ret:
|
|
|
|
return b - buf;
|
1998-02-01 02:37:08 +01:00
|
|
|
#endif
|
2002-06-01 14:38:32 +02:00
|
|
|
}
|
1998-02-01 02:37:08 +01:00
|
|
|
|
g2c.hin, [...]: Kill VOID, Void and Int.
* g2c.hin, libF77/d_cnjg.c, libF77/main.c, libF77/r_cnjg.c,
libF77/s_cat.c, libF77/s_paus.c, libF77/s_rnge.c, libF77/setarg.c,
libF77/setsig.c, libF77/signal1.h0, libI77/dfe.c, libI77/due.c,
libI77/err.c, libI77/fio.h, libI77/fmt.c, libI77/iio.c,
libI77/ilnw.c, libI77/lread.c, libI77/lwrite.c, libI77/rsfe.c,
libI77/rsli.c, libI77/rsne.c, libI77/sfe.c, libI77/sue.c,
libI77/util.c, libI77/wrtfmt.c, libI77/wsfe.c, libI77/wsle.c,
libI77/xwsne.c, libU77/date_.c: Kill VOID, Void and Int.
From-SVN: r54134
2002-06-01 03:58:10 +02:00
|
|
|
static void
|
2002-06-01 14:38:32 +02:00
|
|
|
l_put (register char *s)
|
1998-02-01 02:37:08 +01:00
|
|
|
{
|
2002-06-01 14:38:32 +02:00
|
|
|
register void (*pn) (int) = f__putn;
|
|
|
|
register int c;
|
1998-05-19 12:52:03 +02:00
|
|
|
|
dfe.c (s_rdfe, s_wdfe): Wrap parentheses around assignment used as truth value.
* libI77/dfe.c (s_rdfe, s_wdfe): Wrap parentheses around
assignment used as truth value.
* libI77/due.c (s_rdue, s_wdue): Likewise.
* libI77/endfile.c (f_end): Likewise.
* libI77/iio.c (s_rsfi, s_wsfi): Likewise.
* libI77/lread.c (ERR, l_C, nmL_getc, s_rsle): Likewise.
* libI77/lwrite.c (l_g, l_put): Likewise.
* libI77/open.c (f_open): Likewise.
* libI77/rdfmt.c (rd_Z): Likewise.
* libI77/rsfe.c (s_rsfe): Likewise.
* libI77/rsne.c (hash, mk_hashtab, nl_init, getname, getdimen,
x_rsne, s_rsne): Likewise.
* libI77/sue.c (s_rsue, s_wsue): Likewise.
* libI77/wref.c (wrt_E, wrt_F): Likewise.
* libI77/wsfe.c (s_wsfe): Likewise.
* libI77/wsle.c (s_wsle): Likewise.
* libI77/wsne.c (s_wsne): Likewise.
From-SVN: r54172
2002-06-02 16:34:31 +02:00
|
|
|
while ((c = *s++))
|
2002-06-01 14:38:32 +02:00
|
|
|
(*pn) (c);
|
|
|
|
}
|
1998-02-01 02:37:08 +01:00
|
|
|
|
g2c.hin, [...]: Kill VOID, Void and Int.
* g2c.hin, libF77/d_cnjg.c, libF77/main.c, libF77/r_cnjg.c,
libF77/s_cat.c, libF77/s_paus.c, libF77/s_rnge.c, libF77/setarg.c,
libF77/setsig.c, libF77/signal1.h0, libI77/dfe.c, libI77/due.c,
libI77/err.c, libI77/fio.h, libI77/fmt.c, libI77/iio.c,
libI77/ilnw.c, libI77/lread.c, libI77/lwrite.c, libI77/rsfe.c,
libI77/rsli.c, libI77/rsne.c, libI77/sfe.c, libI77/sue.c,
libI77/util.c, libI77/wrtfmt.c, libI77/wsfe.c, libI77/wsle.c,
libI77/xwsne.c, libU77/date_.c: Kill VOID, Void and Int.
From-SVN: r54134
2002-06-01 03:58:10 +02:00
|
|
|
static void
|
2002-06-01 14:38:32 +02:00
|
|
|
lwrt_F (double n)
|
1998-02-01 02:37:08 +01:00
|
|
|
{
|
2002-06-01 14:38:32 +02:00
|
|
|
char buf[LEFBL];
|
1998-02-01 02:37:08 +01:00
|
|
|
|
2002-06-01 14:38:32 +02:00
|
|
|
if (f__recpos + l_g (buf, n) >= L_len)
|
|
|
|
donewrec ();
|
|
|
|
l_put (buf);
|
1998-02-01 02:37:08 +01:00
|
|
|
}
|
g2c.hin, [...]: Kill VOID, Void and Int.
* g2c.hin, libF77/d_cnjg.c, libF77/main.c, libF77/r_cnjg.c,
libF77/s_cat.c, libF77/s_paus.c, libF77/s_rnge.c, libF77/setarg.c,
libF77/setsig.c, libF77/signal1.h0, libI77/dfe.c, libI77/due.c,
libI77/err.c, libI77/fio.h, libI77/fmt.c, libI77/iio.c,
libI77/ilnw.c, libI77/lread.c, libI77/lwrite.c, libI77/rsfe.c,
libI77/rsli.c, libI77/rsne.c, libI77/sfe.c, libI77/sue.c,
libI77/util.c, libI77/wrtfmt.c, libI77/wsfe.c, libI77/wsle.c,
libI77/xwsne.c, libU77/date_.c: Kill VOID, Void and Int.
From-SVN: r54134
2002-06-01 03:58:10 +02:00
|
|
|
static void
|
2002-06-01 14:38:32 +02:00
|
|
|
lwrt_C (double a, double b)
|
1998-02-01 02:37:08 +01:00
|
|
|
{
|
2002-06-01 14:38:32 +02:00
|
|
|
char *ba, *bb, bufa[LEFBL], bufb[LEFBL];
|
|
|
|
int al, bl;
|
1998-02-01 02:37:08 +01:00
|
|
|
|
2002-06-01 14:38:32 +02:00
|
|
|
al = l_g (bufa, a);
|
|
|
|
for (ba = bufa; *ba == ' '; ba++)
|
|
|
|
--al;
|
|
|
|
bl = l_g (bufb, b) + 1; /* intentionally high by 1 */
|
|
|
|
for (bb = bufb; *bb == ' '; bb++)
|
|
|
|
--bl;
|
|
|
|
if (f__recpos + al + bl + 3 >= L_len)
|
|
|
|
donewrec ();
|
1998-02-01 02:37:08 +01:00
|
|
|
#ifdef OMIT_BLANK_CC
|
2002-06-01 14:38:32 +02:00
|
|
|
else
|
1998-02-01 02:37:08 +01:00
|
|
|
#endif
|
2002-06-01 14:38:32 +02:00
|
|
|
PUT (' ');
|
|
|
|
PUT ('(');
|
|
|
|
l_put (ba);
|
|
|
|
PUT (',');
|
|
|
|
if (f__recpos + bl >= L_len)
|
|
|
|
{
|
|
|
|
(*f__donewrec) ();
|
1998-02-01 02:37:08 +01:00
|
|
|
#ifndef OMIT_BLANK_CC
|
2002-06-01 14:38:32 +02:00
|
|
|
PUT (' ');
|
1998-02-01 02:37:08 +01:00
|
|
|
#endif
|
2002-06-01 14:38:32 +02:00
|
|
|
}
|
|
|
|
l_put (bb);
|
|
|
|
PUT (')');
|
1998-02-01 02:37:08 +01:00
|
|
|
}
|
main.c (main): Avoid implicit int.
* libF77/main.c (main): Avoid implicit int.
* libI77/dfe.c (y_rsk, y_getc, c_dfe): Likewise.
* libI77/due.c (c_due): Likewise.
* libI77/err.c (f__canseek, f__nowreading, f__nowwriting):
Likewise.
* libI77/fmt.c (op_gen, ne_d, e_d, pars_f, type_f, en_fio):
Likewise.
* libI77/iio.c (z_getc, z_rnew, c_si, z_wnew): Likewise.
* libI77/lread.c (t_getc, c_le, l_read): Likewise.
* libI77/lwrite.c (l_write): Likewise.
* libI77/open.c (fk_open): Likewise.
* libI77/rdfmt.c (rd_ed, rd_ned): Likewise.
* libI77/rsfe.c (xrd_SL, x_getc, x_endp, x_rev): Likewise.
* libI77/rsne.c (t_getc, x_rsne): Likewise.
* libI77/sfe.c (c_sfe): Likewise.
* libI77/sue.c (c_sue): Likewise.
* libI77/uio.c (do_us): Likewise.
* libI77/wref.c (wrt_E, wrt_F): Likewise.
* libI77/wrtfmt.c (wrt_L, w_ed, w_ned): Likewise.
From-SVN: r54169
2002-06-02 15:01:12 +02:00
|
|
|
|
|
|
|
int
|
2002-06-01 14:38:32 +02:00
|
|
|
l_write (ftnint * number, char *ptr, ftnlen len, ftnint type)
|
1998-02-01 02:37:08 +01:00
|
|
|
{
|
|
|
|
#define Ptr ((flex *)ptr)
|
2002-06-01 14:38:32 +02:00
|
|
|
int i;
|
|
|
|
longint x;
|
|
|
|
double y, z;
|
|
|
|
real *xx;
|
|
|
|
doublereal *yy;
|
|
|
|
for (i = 0; i < *number; i++)
|
|
|
|
{
|
|
|
|
switch ((int) type)
|
1998-02-01 02:37:08 +01:00
|
|
|
{
|
2002-06-01 14:38:32 +02:00
|
|
|
default:
|
|
|
|
f__fatal (204, "unknown type in lio");
|
|
|
|
case TYINT1:
|
|
|
|
x = Ptr->flchar;
|
|
|
|
goto xint;
|
|
|
|
case TYSHORT:
|
|
|
|
x = Ptr->flshort;
|
|
|
|
goto xint;
|
1998-02-01 02:37:08 +01:00
|
|
|
#ifdef Allow_TYQUAD
|
2002-06-01 14:38:32 +02:00
|
|
|
case TYQUAD:
|
|
|
|
x = Ptr->fllongint;
|
|
|
|
goto xint;
|
1998-02-01 02:37:08 +01:00
|
|
|
#endif
|
2002-06-01 14:38:32 +02:00
|
|
|
case TYLONG:
|
|
|
|
x = Ptr->flint;
|
|
|
|
xint:lwrt_I (x);
|
|
|
|
break;
|
|
|
|
case TYREAL:
|
|
|
|
y = Ptr->flreal;
|
|
|
|
goto xfloat;
|
|
|
|
case TYDREAL:
|
|
|
|
y = Ptr->fldouble;
|
|
|
|
xfloat:lwrt_F (y);
|
|
|
|
break;
|
|
|
|
case TYCOMPLEX:
|
|
|
|
xx = &Ptr->flreal;
|
|
|
|
y = *xx++;
|
|
|
|
z = *xx;
|
|
|
|
goto xcomplex;
|
|
|
|
case TYDCOMPLEX:
|
|
|
|
yy = &Ptr->fldouble;
|
|
|
|
y = *yy++;
|
|
|
|
z = *yy;
|
|
|
|
xcomplex:
|
|
|
|
lwrt_C (y, z);
|
|
|
|
break;
|
|
|
|
case TYLOGICAL1:
|
|
|
|
x = Ptr->flchar;
|
|
|
|
goto xlog;
|
|
|
|
case TYLOGICAL2:
|
|
|
|
x = Ptr->flshort;
|
|
|
|
goto xlog;
|
|
|
|
case TYLOGICAL:
|
|
|
|
x = Ptr->flint;
|
|
|
|
xlog:lwrt_L (Ptr->flint, len);
|
|
|
|
break;
|
|
|
|
case TYCHAR:
|
|
|
|
lwrt_A (ptr, len);
|
|
|
|
break;
|
1998-02-01 02:37:08 +01:00
|
|
|
}
|
2002-06-01 14:38:32 +02:00
|
|
|
ptr += len;
|
|
|
|
}
|
|
|
|
return (0);
|
1998-02-01 02:37:08 +01:00
|
|
|
}
|