2001-05-16 20:59:29 +02:00
|
|
|
#include "config.h"
|
1998-02-01 02:37:08 +01:00
|
|
|
#include "f2c.h"
|
|
|
|
#include "fio.h"
|
|
|
|
#include "lio.h"
|
|
|
|
|
2002-06-01 14:38:32 +02:00
|
|
|
#define MAX_NL_CACHE 3 /* maximum number of namelist hash tables to cache */
|
|
|
|
#define MAXDIM 20 /* maximum number of subscripts */
|
1998-02-01 02:37:08 +01:00
|
|
|
|
2002-06-01 14:38:32 +02:00
|
|
|
struct dimen
|
|
|
|
{
|
|
|
|
ftnlen extent;
|
|
|
|
ftnlen curval;
|
|
|
|
ftnlen delta;
|
|
|
|
ftnlen stride;
|
|
|
|
};
|
|
|
|
typedef struct dimen dimen;
|
1998-02-01 02:37:08 +01:00
|
|
|
|
2002-06-01 14:38:32 +02:00
|
|
|
struct hashentry
|
|
|
|
{
|
|
|
|
struct hashentry *next;
|
|
|
|
char *name;
|
|
|
|
Vardesc *vd;
|
|
|
|
};
|
|
|
|
typedef struct hashentry hashentry;
|
1998-02-01 02:37:08 +01:00
|
|
|
|
2002-06-01 14:38:32 +02:00
|
|
|
struct hashtab
|
|
|
|
{
|
|
|
|
struct hashtab *next;
|
|
|
|
Namelist *nl;
|
|
|
|
int htsize;
|
|
|
|
hashentry *tab[1];
|
|
|
|
};
|
|
|
|
typedef struct hashtab hashtab;
|
1998-02-01 02:37:08 +01:00
|
|
|
|
2002-06-01 14:38:32 +02:00
|
|
|
static hashtab *nl_cache;
|
|
|
|
static int n_nlcache;
|
|
|
|
static hashentry **zot;
|
|
|
|
static int colonseen;
|
|
|
|
extern ftnlen f__typesize[];
|
1998-02-01 02:37:08 +01:00
|
|
|
|
2002-06-01 14:38:32 +02:00
|
|
|
extern flag f__lquit;
|
|
|
|
extern int f__lcount, nml_read;
|
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
|
|
|
extern int t_getc (void);
|
1998-02-01 02:37:08 +01:00
|
|
|
|
|
|
|
#undef abs
|
|
|
|
#undef min
|
|
|
|
#undef max
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#ifdef ungetc
|
2002-06-01 14:38:32 +02:00
|
|
|
static int
|
|
|
|
un_getc (int x, FILE * f__cf)
|
|
|
|
{
|
|
|
|
return ungetc (x, f__cf);
|
|
|
|
}
|
1998-02-01 02:37:08 +01:00
|
|
|
#else
|
|
|
|
#define un_getc ungetc
|
2002-06-01 14:38:32 +02:00
|
|
|
extern int ungetc (int, FILE *); /* for systems with a buggy stdio.h */
|
1998-02-01 02:37:08 +01:00
|
|
|
#endif
|
|
|
|
|
2002-06-01 14:38:32 +02:00
|
|
|
static Vardesc *
|
|
|
|
hash (hashtab * ht, register char *s)
|
1998-02-01 02:37:08 +01:00
|
|
|
{
|
2002-06-01 14:38:32 +02:00
|
|
|
register int c, x;
|
|
|
|
register hashentry *h;
|
|
|
|
char *s0 = s;
|
1998-02-01 02:37:08 +01: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
|
|
|
for (x = 0; (c = *s++); x = x & 0x4000 ? ((x << 1) & 0x7fff) + 1 : x << 1)
|
2002-06-01 14:38:32 +02:00
|
|
|
x += c;
|
|
|
|
for (h = *(zot = ht->tab + x % ht->htsize); h; h = h->next)
|
|
|
|
if (!strcmp (s0, h->name))
|
|
|
|
return h->vd;
|
|
|
|
return 0;
|
|
|
|
}
|
1998-02-01 02:37:08 +01:00
|
|
|
|
2002-06-01 14:38:32 +02:00
|
|
|
hashtab *
|
|
|
|
mk_hashtab (Namelist * nl)
|
1998-02-01 02:37:08 +01:00
|
|
|
{
|
2002-06-01 14:38:32 +02:00
|
|
|
int nht, nv;
|
|
|
|
hashtab *ht;
|
|
|
|
Vardesc *v, **vd, **vde;
|
|
|
|
hashentry *he;
|
1998-02-01 02:37:08 +01:00
|
|
|
|
2002-06-01 14:38:32 +02:00
|
|
|
hashtab **x, **x0, *y;
|
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 (x = &nl_cache; (y = *x); x0 = x, x = &y->next)
|
2002-06-01 14:38:32 +02:00
|
|
|
if (nl == y->nl)
|
|
|
|
return y;
|
|
|
|
if (n_nlcache >= MAX_NL_CACHE)
|
|
|
|
{
|
|
|
|
/* discard least recently used namelist hash table */
|
|
|
|
y = *x0;
|
|
|
|
free ((char *) y->next);
|
|
|
|
y->next = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
n_nlcache++;
|
|
|
|
nv = nl->nvars;
|
|
|
|
if (nv >= 0x4000)
|
|
|
|
nht = 0x7fff;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (nht = 1; nht < nv; nht <<= 1);
|
|
|
|
nht += nht - 1;
|
|
|
|
}
|
|
|
|
ht = (hashtab *) malloc (sizeof (hashtab) + (nht - 1) * sizeof (hashentry *)
|
|
|
|
+ nv * sizeof (hashentry));
|
|
|
|
if (!ht)
|
|
|
|
return 0;
|
|
|
|
he = (hashentry *) & ht->tab[nht];
|
|
|
|
ht->nl = nl;
|
|
|
|
ht->htsize = nht;
|
|
|
|
ht->next = nl_cache;
|
|
|
|
nl_cache = ht;
|
|
|
|
memset ((char *) ht->tab, 0, nht * sizeof (hashentry *));
|
|
|
|
vd = nl->vars;
|
|
|
|
vde = vd + nv;
|
|
|
|
while (vd < vde)
|
|
|
|
{
|
|
|
|
v = *vd++;
|
|
|
|
if (!hash (ht, v->name))
|
|
|
|
{
|
|
|
|
he->next = *zot;
|
|
|
|
*zot = he;
|
|
|
|
he->name = v->name;
|
|
|
|
he->vd = v;
|
|
|
|
he++;
|
1998-02-01 02:37:08 +01:00
|
|
|
}
|
2002-06-01 14:38:32 +02:00
|
|
|
}
|
|
|
|
return ht;
|
|
|
|
}
|
1998-02-01 02:37:08 +01:00
|
|
|
|
|
|
|
static char Alpha[256], Alphanum[256];
|
|
|
|
|
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
|
|
|
nl_init (void)
|
|
|
|
{
|
|
|
|
register char *s;
|
|
|
|
register int c;
|
1998-02-01 02:37:08 +01: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
|
|
|
for (s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; (c = *s++);)
|
2002-06-01 14:38:32 +02:00
|
|
|
Alpha[c]
|
|
|
|
= Alphanum[c] = Alpha[c + 'a' - 'A'] = Alphanum[c + 'a' - 'A'] = c;
|
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 (s = "0123456789_"; (c = *s++);)
|
2002-06-01 14:38:32 +02:00
|
|
|
Alphanum[c] = c;
|
|
|
|
}
|
1998-02-01 02:37:08 +01:00
|
|
|
|
|
|
|
#define GETC(x) (x=(*l_getc)())
|
|
|
|
#define Ungetc(x,y) (*l_ungetc)(x,y)
|
|
|
|
|
2002-06-01 14:38:32 +02:00
|
|
|
static int
|
|
|
|
getname (register char *s, int slen)
|
1998-02-01 02:37:08 +01:00
|
|
|
{
|
2002-06-01 14:38:32 +02:00
|
|
|
register char *se = s + slen - 1;
|
|
|
|
register int ch;
|
1998-02-01 02:37:08 +01:00
|
|
|
|
2002-06-01 14:38:32 +02:00
|
|
|
GETC (ch);
|
|
|
|
if (!(*s++ = Alpha[ch & 0xff]))
|
|
|
|
{
|
|
|
|
if (ch != EOF)
|
|
|
|
ch = 115;
|
|
|
|
errfl (f__elist->cierr, ch, "namelist read");
|
|
|
|
}
|
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 ((*s = Alphanum[GETC (ch) & 0xff]))
|
2002-06-01 14:38:32 +02:00
|
|
|
if (s < se)
|
|
|
|
s++;
|
|
|
|
if (ch == EOF)
|
|
|
|
err (f__elist->cierr, EOF, "namelist read");
|
|
|
|
if (ch > ' ')
|
|
|
|
Ungetc (ch, f__cf);
|
|
|
|
return *s = 0;
|
|
|
|
}
|
1998-02-01 02:37:08 +01:00
|
|
|
|
2002-06-01 14:38:32 +02:00
|
|
|
static int
|
|
|
|
getnum (int *chp, ftnlen * val)
|
1998-02-01 02:37:08 +01:00
|
|
|
{
|
2002-06-01 14:38:32 +02:00
|
|
|
register int ch, sign;
|
|
|
|
register ftnlen x;
|
1998-02-01 02:37:08 +01:00
|
|
|
|
2002-06-01 14:38:32 +02:00
|
|
|
while (GETC (ch) <= ' ' && ch >= 0);
|
|
|
|
if (ch == '-')
|
|
|
|
{
|
|
|
|
sign = 1;
|
|
|
|
GETC (ch);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sign = 0;
|
|
|
|
if (ch == '+')
|
|
|
|
GETC (ch);
|
|
|
|
}
|
|
|
|
x = ch - '0';
|
|
|
|
if (x < 0 || x > 9)
|
|
|
|
return 115;
|
|
|
|
while (GETC (ch) >= '0' && ch <= '9')
|
|
|
|
x = 10 * x + ch - '0';
|
|
|
|
while (ch <= ' ' && ch >= 0)
|
|
|
|
GETC (ch);
|
|
|
|
if (ch == EOF)
|
|
|
|
return EOF;
|
|
|
|
*val = sign ? -x : x;
|
|
|
|
*chp = ch;
|
|
|
|
return 0;
|
|
|
|
}
|
1998-02-01 02:37:08 +01:00
|
|
|
|
2002-06-01 14:38:32 +02:00
|
|
|
static int
|
|
|
|
getdimen (int *chp, dimen * d, ftnlen delta, ftnlen extent, ftnlen * x1)
|
1998-02-01 02:37:08 +01:00
|
|
|
{
|
2002-06-01 14:38:32 +02:00
|
|
|
register int k;
|
|
|
|
ftnlen x2, x3;
|
1998-02-01 02:37:08 +01: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
|
|
|
if ((k = getnum (chp, x1)))
|
2002-06-01 14:38:32 +02:00
|
|
|
return k;
|
|
|
|
x3 = 1;
|
|
|
|
if (*chp == ':')
|
|
|
|
{
|
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
|
|
|
if ((k = getnum (chp, &x2)))
|
2002-06-01 14:38:32 +02:00
|
|
|
return k;
|
|
|
|
x2 -= *x1;
|
|
|
|
if (*chp == ':')
|
|
|
|
{
|
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
|
|
|
if ((k = getnum (chp, &x3)))
|
2002-06-01 14:38:32 +02:00
|
|
|
return k;
|
|
|
|
if (!x3)
|
|
|
|
return 123;
|
|
|
|
x2 /= x3;
|
|
|
|
colonseen = 1;
|
1998-02-01 02:37:08 +01:00
|
|
|
}
|
2002-06-01 14:38:32 +02:00
|
|
|
if (x2 < 0 || x2 >= extent)
|
|
|
|
return 123;
|
|
|
|
d->extent = x2 + 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
d->extent = 1;
|
|
|
|
d->curval = 0;
|
|
|
|
d->delta = delta;
|
|
|
|
d->stride = x3;
|
|
|
|
return 0;
|
|
|
|
}
|
1998-02-01 02:37:08 +01:00
|
|
|
|
|
|
|
#ifndef No_Namelist_Questions
|
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
|
|
|
print_ne (cilist * a)
|
1998-02-01 02:37:08 +01:00
|
|
|
{
|
2002-06-01 14:38:32 +02:00
|
|
|
flag intext = f__external;
|
|
|
|
int rpsave = f__recpos;
|
|
|
|
FILE *cfsave = f__cf;
|
|
|
|
unit *usave = f__curunit;
|
|
|
|
cilist t;
|
|
|
|
t = *a;
|
|
|
|
t.ciunit = 6;
|
|
|
|
s_wsne (&t);
|
|
|
|
fflush (f__cf);
|
|
|
|
f__external = intext;
|
|
|
|
f__reading = 1;
|
|
|
|
f__recpos = rpsave;
|
|
|
|
f__cf = cfsave;
|
|
|
|
f__curunit = usave;
|
|
|
|
f__elist = a;
|
|
|
|
}
|
1998-02-01 02:37:08 +01:00
|
|
|
#endif
|
|
|
|
|
2002-06-01 14:38:32 +02:00
|
|
|
static char where0[] = "namelist read start ";
|
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
|
|
|
x_rsne (cilist * a)
|
1998-02-01 02:37:08 +01:00
|
|
|
{
|
2002-06-01 14:38:32 +02:00
|
|
|
int ch, got1, k, n, nd, quote, readall;
|
|
|
|
Namelist *nl;
|
|
|
|
static char where[] = "namelist read";
|
|
|
|
char buf[64];
|
|
|
|
hashtab *ht;
|
|
|
|
Vardesc *v;
|
|
|
|
dimen *dn, *dn0, *dn1;
|
|
|
|
ftnlen *dims, *dims1;
|
|
|
|
ftnlen b, b0, b1, ex, no, nomax, size, span;
|
|
|
|
ftnint no1, type;
|
|
|
|
char *vaddr;
|
|
|
|
long iva, ivae;
|
|
|
|
dimen dimens[MAXDIM], substr;
|
1998-02-01 02:37:08 +01:00
|
|
|
|
2002-06-01 14:38:32 +02:00
|
|
|
if (!Alpha['a'])
|
|
|
|
nl_init ();
|
|
|
|
f__reading = 1;
|
|
|
|
f__formatted = 1;
|
|
|
|
got1 = 0;
|
|
|
|
top:
|
|
|
|
for (;;)
|
|
|
|
switch (GETC (ch))
|
|
|
|
{
|
|
|
|
case EOF:
|
|
|
|
eof:
|
|
|
|
err (a->ciend, (EOF), where0);
|
|
|
|
case '&':
|
|
|
|
case '$':
|
|
|
|
goto have_amp;
|
1998-02-01 02:37:08 +01:00
|
|
|
#ifndef No_Namelist_Questions
|
2002-06-01 14:38:32 +02:00
|
|
|
case '?':
|
|
|
|
print_ne (a);
|
|
|
|
continue;
|
1998-02-01 02:37:08 +01:00
|
|
|
#endif
|
2002-06-01 14:38:32 +02:00
|
|
|
default:
|
|
|
|
if (ch <= ' ' && ch >= 0)
|
|
|
|
continue;
|
1998-02-01 02:37:08 +01:00
|
|
|
#ifndef No_Namelist_Comments
|
2002-06-01 14:38:32 +02:00
|
|
|
while (GETC (ch) != '\n')
|
|
|
|
if (ch == EOF)
|
|
|
|
goto eof;
|
1998-02-01 02:37:08 +01:00
|
|
|
#else
|
2002-06-01 14:38:32 +02:00
|
|
|
errfl (a->cierr, 115, where0);
|
1998-02-01 02:37:08 +01:00
|
|
|
#endif
|
2002-06-01 14:38:32 +02:00
|
|
|
}
|
|
|
|
have_amp:
|
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
|
|
|
if ((ch = getname (buf, sizeof (buf))))
|
2002-06-01 14:38:32 +02:00
|
|
|
return ch;
|
|
|
|
nl = (Namelist *) a->cifmt;
|
|
|
|
if (strcmp (buf, nl->name))
|
1998-02-01 02:37:08 +01:00
|
|
|
#ifdef No_Bad_Namelist_Skip
|
2002-06-01 14:38:32 +02:00
|
|
|
errfl (a->cierr, 118, where0);
|
1998-02-01 02:37:08 +01:00
|
|
|
#else
|
2002-06-01 14:38:32 +02:00
|
|
|
{
|
|
|
|
fprintf (stderr,
|
|
|
|
"Skipping namelist \"%s\": seeking namelist \"%s\".\n",
|
|
|
|
buf, nl->name);
|
|
|
|
fflush (stderr);
|
|
|
|
for (;;)
|
|
|
|
switch (GETC (ch))
|
|
|
|
{
|
|
|
|
case EOF:
|
|
|
|
err (a->ciend, EOF, where0);
|
|
|
|
case '/':
|
|
|
|
case '&':
|
|
|
|
case '$':
|
|
|
|
if (f__external)
|
|
|
|
e_rsle ();
|
|
|
|
else
|
|
|
|
z_rnew ();
|
|
|
|
goto top;
|
|
|
|
case '"':
|
|
|
|
case '\'':
|
|
|
|
quote = ch;
|
|
|
|
more_quoted:
|
|
|
|
while (GETC (ch) != quote)
|
|
|
|
if (ch == EOF)
|
|
|
|
err (a->ciend, EOF, where0);
|
|
|
|
if (GETC (ch) == quote)
|
|
|
|
goto more_quoted;
|
|
|
|
Ungetc (ch, f__cf);
|
|
|
|
default:
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
ht = mk_hashtab (nl);
|
|
|
|
if (!ht)
|
|
|
|
errfl (f__elist->cierr, 113, where0);
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
for (;;)
|
|
|
|
switch (GETC (ch))
|
|
|
|
{
|
|
|
|
case EOF:
|
|
|
|
if (got1)
|
|
|
|
return 0;
|
|
|
|
err (a->ciend, EOF, where0);
|
|
|
|
case '/':
|
|
|
|
case '$':
|
|
|
|
case '&':
|
|
|
|
return 0;
|
|
|
|
default:
|
2002-06-04 04:24:26 +02:00
|
|
|
if ((ch <= ' ' && ch >= 0) || ch == ',')
|
2002-06-01 14:38:32 +02:00
|
|
|
continue;
|
|
|
|
Ungetc (ch, f__cf);
|
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
|
|
|
if ((ch = getname (buf, sizeof (buf))))
|
2002-06-01 14:38:32 +02:00
|
|
|
return ch;
|
|
|
|
goto havename;
|
|
|
|
}
|
|
|
|
havename:
|
|
|
|
v = hash (ht, buf);
|
|
|
|
if (!v)
|
|
|
|
errfl (a->cierr, 119, where);
|
|
|
|
while (GETC (ch) <= ' ' && ch >= 0);
|
|
|
|
vaddr = v->addr;
|
|
|
|
type = v->type;
|
|
|
|
if (type < 0)
|
|
|
|
{
|
|
|
|
size = -type;
|
|
|
|
type = TYCHAR;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
size = f__typesize[type];
|
|
|
|
ivae = size;
|
|
|
|
iva = readall = 0;
|
|
|
|
if (ch == '(' /*) */ )
|
1998-02-01 02:37:08 +01:00
|
|
|
{
|
2002-06-01 14:38:32 +02:00
|
|
|
dn = dimens;
|
|
|
|
if (!(dims = v->dims))
|
|
|
|
{
|
|
|
|
if (type != TYCHAR)
|
|
|
|
errfl (a->cierr, 122, where);
|
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
|
|
|
if ((k = getdimen (&ch, dn, (ftnlen) size, (ftnlen) size, &b)))
|
2002-06-01 14:38:32 +02:00
|
|
|
errfl (a->cierr, k, where);
|
|
|
|
if (ch != ')')
|
|
|
|
errfl (a->cierr, 115, where);
|
|
|
|
b1 = dn->extent;
|
|
|
|
if (--b < 0 || b + b1 > size)
|
|
|
|
return 124;
|
|
|
|
iva += b;
|
|
|
|
size = b1;
|
|
|
|
while (GETC (ch) <= ' ' && ch >= 0);
|
|
|
|
goto scalar;
|
|
|
|
}
|
|
|
|
nd = (int) dims[0];
|
|
|
|
nomax = span = dims[1];
|
|
|
|
ivae = iva + size * nomax;
|
|
|
|
colonseen = 0;
|
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
|
|
|
if ((k = getdimen (&ch, dn, size, nomax, &b)))
|
2002-06-01 14:38:32 +02:00
|
|
|
errfl (a->cierr, k, where);
|
|
|
|
no = dn->extent;
|
|
|
|
b0 = dims[2];
|
|
|
|
dims1 = dims += 3;
|
|
|
|
ex = 1;
|
|
|
|
for (n = 1; n++ < nd; dims++)
|
|
|
|
{
|
|
|
|
if (ch != ',')
|
|
|
|
errfl (a->cierr, 115, where);
|
|
|
|
dn1 = dn + 1;
|
|
|
|
span /= *dims;
|
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
|
|
|
if ((k = getdimen (&ch, dn1, dn->delta ** dims, span, &b1)))
|
2002-06-01 14:38:32 +02:00
|
|
|
errfl (a->cierr, k, where);
|
|
|
|
ex *= *dims;
|
|
|
|
b += b1 * ex;
|
|
|
|
no *= dn1->extent;
|
|
|
|
dn = dn1;
|
|
|
|
}
|
|
|
|
if (ch != ')')
|
|
|
|
errfl (a->cierr, 115, where);
|
|
|
|
readall = 1 - colonseen;
|
|
|
|
b -= b0;
|
|
|
|
if (b < 0 || b >= nomax)
|
|
|
|
errfl (a->cierr, 125, where);
|
|
|
|
iva += size * b;
|
|
|
|
dims = dims1;
|
|
|
|
while (GETC (ch) <= ' ' && ch >= 0);
|
|
|
|
no1 = 1;
|
|
|
|
dn0 = dimens;
|
|
|
|
if (type == TYCHAR && ch == '(' /*) */ )
|
|
|
|
{
|
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
|
|
|
if ((k = getdimen (&ch, &substr, size, size, &b)))
|
2002-06-01 14:38:32 +02:00
|
|
|
errfl (a->cierr, k, where);
|
|
|
|
if (ch != ')')
|
|
|
|
errfl (a->cierr, 115, where);
|
|
|
|
b1 = substr.extent;
|
|
|
|
if (--b < 0 || b + b1 > size)
|
|
|
|
return 124;
|
|
|
|
iva += b;
|
|
|
|
b0 = size;
|
|
|
|
size = b1;
|
|
|
|
while (GETC (ch) <= ' ' && ch >= 0);
|
|
|
|
if (b1 < b0)
|
|
|
|
goto delta_adj;
|
|
|
|
}
|
|
|
|
if (readall)
|
|
|
|
goto delta_adj;
|
|
|
|
for (; dn0 < dn; dn0++)
|
|
|
|
{
|
|
|
|
if (dn0->extent != *dims++ || dn0->stride != 1)
|
|
|
|
break;
|
|
|
|
no1 *= dn0->extent;
|
|
|
|
}
|
|
|
|
if (dn0 == dimens && dimens[0].stride == 1)
|
|
|
|
{
|
|
|
|
no1 = dimens[0].extent;
|
|
|
|
dn0++;
|
|
|
|
}
|
|
|
|
delta_adj:
|
|
|
|
ex = 0;
|
|
|
|
for (dn1 = dn0; dn1 <= dn; dn1++)
|
|
|
|
ex += (dn1->extent - 1) * (dn1->delta *= dn1->stride);
|
|
|
|
for (dn1 = dn; dn1 > dn0; dn1--)
|
|
|
|
{
|
|
|
|
ex -= (dn1->extent - 1) * dn1->delta;
|
|
|
|
dn1->delta -= ex;
|
|
|
|
}
|
|
|
|
}
|
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
|
|
|
else if ((dims = v->dims))
|
2002-06-01 14:38:32 +02:00
|
|
|
{
|
|
|
|
no = no1 = dims[1];
|
|
|
|
ivae = iva + no * size;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
scalar:
|
|
|
|
no = no1 = 1;
|
|
|
|
if (ch != '=')
|
|
|
|
errfl (a->cierr, 115, where);
|
|
|
|
got1 = nml_read = 1;
|
|
|
|
f__lcount = 0;
|
|
|
|
readloop:
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
if (iva >= ivae || iva < 0)
|
|
|
|
{
|
|
|
|
f__lquit = 1;
|
|
|
|
goto mustend;
|
|
|
|
}
|
|
|
|
else if (iva + no1 * size > ivae)
|
|
|
|
no1 = (ivae - iva) / size;
|
|
|
|
f__lquit = 0;
|
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
|
|
|
if ((k = l_read (&no1, vaddr + iva, size, type)))
|
2002-06-01 14:38:32 +02:00
|
|
|
return k;
|
|
|
|
if (f__lquit == 1)
|
|
|
|
return 0;
|
|
|
|
if (readall)
|
|
|
|
{
|
|
|
|
iva += dn0->delta;
|
|
|
|
if (f__lcount > 0)
|
|
|
|
{
|
2002-08-31 16:38:57 +02:00
|
|
|
ftnint no2 = (ivae - iva) / size;
|
|
|
|
if (no2 > f__lcount)
|
|
|
|
no2 = f__lcount;
|
|
|
|
if ((k = l_read (&no2, vaddr + iva, size, type)))
|
2002-06-01 14:38:32 +02:00
|
|
|
return k;
|
2002-08-31 16:38:57 +02:00
|
|
|
iva += no2 * dn0->delta;
|
1998-02-01 02:37:08 +01:00
|
|
|
}
|
2002-06-01 14:38:32 +02:00
|
|
|
}
|
|
|
|
mustend:
|
|
|
|
GETC (ch);
|
|
|
|
if (readall)
|
2002-06-02 14:57:28 +02:00
|
|
|
{
|
|
|
|
if (iva >= ivae)
|
|
|
|
readall = 0;
|
|
|
|
else
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
switch (ch)
|
|
|
|
{
|
|
|
|
case ' ':
|
|
|
|
case '\t':
|
|
|
|
case '\n':
|
|
|
|
GETC (ch);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2002-06-01 14:38:32 +02:00
|
|
|
if (ch == '/' || ch == '$' || ch == '&')
|
|
|
|
{
|
|
|
|
f__lquit = 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else if (f__lquit)
|
|
|
|
{
|
|
|
|
while (ch <= ' ' && ch >= 0)
|
|
|
|
GETC (ch);
|
|
|
|
Ungetc (ch, f__cf);
|
|
|
|
if (!Alpha[ch & 0xff] && ch >= 0)
|
|
|
|
errfl (a->cierr, 125, where);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
Ungetc (ch, f__cf);
|
|
|
|
if (readall && !Alpha[ch & 0xff])
|
|
|
|
goto readloop;
|
|
|
|
if ((no -= no1) <= 0)
|
|
|
|
break;
|
|
|
|
for (dn1 = dn0; dn1 <= dn; dn1++)
|
|
|
|
{
|
|
|
|
if (++dn1->curval < dn1->extent)
|
|
|
|
{
|
|
|
|
iva += dn1->delta;
|
|
|
|
goto readloop;
|
1998-02-01 02:37:08 +01:00
|
|
|
}
|
2002-06-01 14:38:32 +02:00
|
|
|
dn1->curval = 0;
|
|
|
|
}
|
|
|
|
break;
|
1998-02-01 02:37:08 +01:00
|
|
|
}
|
2002-06-01 14:38:32 +02:00
|
|
|
}
|
|
|
|
}
|
1998-02-01 02:37:08 +01:00
|
|
|
|
2002-06-01 14:38:32 +02:00
|
|
|
integer
|
|
|
|
s_rsne (cilist * a)
|
1998-02-01 02:37:08 +01:00
|
|
|
{
|
2002-06-01 14:38:32 +02:00
|
|
|
extern int l_eof;
|
|
|
|
int n;
|
1998-02-01 02:37:08 +01:00
|
|
|
|
2002-06-01 14:38:32 +02:00
|
|
|
f__external = 1;
|
|
|
|
l_eof = 0;
|
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
|
|
|
if ((n = c_le (a)))
|
2002-06-01 14:38:32 +02:00
|
|
|
return n;
|
|
|
|
if (f__curunit->uwrt && f__nowreading (f__curunit))
|
|
|
|
err (a->cierr, errno, where0);
|
|
|
|
l_getc = t_getc;
|
|
|
|
l_ungetc = un_getc;
|
|
|
|
f__doend = xrd_SL;
|
|
|
|
n = x_rsne (a);
|
|
|
|
nml_read = 0;
|
|
|
|
if (n)
|
|
|
|
return n;
|
|
|
|
return e_rsle ();
|
|
|
|
}
|