SCCS-vsn: usr.bin/f77/libI77/Makefile 5.4
SCCS-vsn: usr.bin/f77/libI77/err.c 5.2
SCCS-vsn: usr.bin/f77/libI77/f_errlist.c 5.2
SCCS-vsn: usr.bin/f77/libI77/f_errno.h 5.2
SCCS-vsn: usr.bin/f77/libI77/fiodefs.h 5.2
SCCS-vsn: usr.bin/f77/libI77/lio.h 5.2
SCCS-vsn: usr.bin/f77/libI77/dolio.c 5.2
SCCS-vsn: usr.bin/f77/libI77/lread.c 5.2
SCCS-vsn: usr.bin/f77/libI77/lwrite.c 5.2
# All rights reserved. The Berkeley software License Agreement
# specifies the terms and conditions for redistribution.
#
# All rights reserved. The Berkeley software License Agreement
# specifies the terms and conditions for redistribution.
#
-# @(#)Makefile 5.3 (Berkeley) %G%
+# @(#)Makefile 5.4 (Berkeley) %G%
#
# Makefile for f77 I/O lib, libI77.a
#
# Makefile for f77 I/O lib, libI77.a
fio.h \
fiodefs.h \
format.h \
fio.h \
fiodefs.h \
format.h \
rfi.o \
rsfe.o \
rsli.o \
rfi.o \
rsfe.o \
rsli.o \
sue.o \
util.o \
wdfe.o \
wfi.o \
wrtfmt.o \
wsfe.o \
sue.o \
util.o \
wdfe.o \
wfi.o \
wrtfmt.o \
wsfe.o \
OLDDIR = $(DESTDIR)/usr/old/lib
OLDDIR = $(DESTDIR)/usr/old/lib
rfi.c \
rsfe.c \
rsli.c \
rfi.c \
rsfe.c \
rsli.c \
sue.c \
util.c \
wdfe.c \
wfi.c \
wrtfmt.c \
wsfe.c \
sue.c \
util.c \
wdfe.c \
wfi.c \
wrtfmt.c \
wsfe.c \
all: $(LIBRARY) $(LIBRARY_P) libI66.o
all: $(LIBRARY) $(LIBRARY_P) libI66.o
err.o: fio.h f_errno.h fiodefs.h err.c
fmtlib.o: fio.h f_errno.h fiodefs.h fmtlib.c
f77_abort.o: fio.h f_errno.h fiodefs.h f77_abort.c
err.o: fio.h f_errno.h fiodefs.h err.c
fmtlib.o: fio.h f_errno.h fiodefs.h fmtlib.c
f77_abort.o: fio.h f_errno.h fiodefs.h f77_abort.c
+rsnmle.o: fio.h f_errno.h fiodefs.h lio.h nmlio.h rsnmle.c
+wsnmle.o: fio.h f_errno.h fiodefs.h lio.h nmlio.h wsnmle.c
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
- * list directed i/o common routines
+ * list directed and namelist i/o common routines
{ int n;
lfname = NULL;
elist = NO;
{ int n;
lfname = NULL;
elist = NO;
- sequential=external=formatted= LISTDIRECTED;
- fmtbuf = "ext list io";
+ sequential=external=YES;
errflag = a->cierr;
endflag = a->ciend;
lunit = a->ciunit;
errflag = a->cierr;
endflag = a->ciend;
lunit = a->ciunit;
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
flag reading; /*1 if reading, 0 if writing*/
flag external; /*1 if external io, 0 if internal */
flag sequential; /*1 if sequential io, 0 if direct*/
flag reading; /*1 if reading, 0 if writing*/
flag external; /*1 if external io, 0 if internal */
flag sequential; /*1 if sequential io, 0 if direct*/
-flag formatted; /*1 if formatted io, 0 if unformatted, -1 if list*/
+flag formatted; /*1 if formatted io, 0 if unformatted,
+ -1 if list directed, -2 if namelist */
char *fmtbuf, *icptr, *icend, *fmtptr;
int (*doed)(),(*doned)();
int (*doend)(),(*donewrec)(),(*dorevert)(),(*dotab)();
char *fmtbuf, *icptr, *icend, *fmtptr;
int (*doed)(),(*doned)();
int (*doend)(),(*donewrec)(),(*dorevert)(),(*dotab)();
{ fprintf(stderr,"lately: %s %s %s %s I/O\n",
reading?"reading":"writing",
sequential?"sequential":"direct",
{ fprintf(stderr,"lately: %s %s %s %s I/O\n",
reading?"reading":"writing",
sequential?"sequential":"direct",
- formatted>0?"formatted":(formatted<0?"list":"unformatted"),
+ formatted>0?"formatted":(formatted==0?"unformatted":
+ (formatted==LISTDIRECTED?"list":"namelist")),
external?"external":"internal");
if (formatted)
{ if(fmtbuf) prnt_fmt(n);
external?"external":"internal");
if (formatted)
{ if(fmtbuf) prnt_fmt(n);
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
- * @(#)f_errlist.c 5.1 %G%
+ * @(#)f_errlist.c 5.2 %G%
/* 122 */ "negative repeat count",
/* 123 */ "illegal operation for unit",
/* 124 */ "invalid data for d,e,f, or g format term",
/* 122 */ "negative repeat count",
/* 123 */ "illegal operation for unit",
/* 124 */ "invalid data for d,e,f, or g format term",
+/* 125 */ "illegal input for namelist",
};
int f_nerr = (sizeof(f_errlist)/sizeof(char *));
};
int f_nerr = (sizeof(f_errlist)/sizeof(char *));
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
- * @(#)f_errno.h 5.1 (Berkeley) %G%
+ * @(#)f_errno.h 5.2 (Berkeley) %G%
#define F_ERNREP 122 /* negative repeat count */
#define F_ERILLOP 123 /* illegal operation for channel or device */
#define F_ERRFCHR 124 /* invalid data for d,e,f, or g format term */
#define F_ERNREP 122 /* negative repeat count */
#define F_ERILLOP 123 /* illegal operation for channel or device */
#define F_ERRFCHR 124 /* invalid data for d,e,f, or g format term */
+#define F_ERNMLIST 125 /* illegal input for namelist */
#define F_MAXERR (f_nerr + F_ER)
#define F_MAXERR (f_nerr + F_ER)
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
- * @(#)fiodefs.h 5.1 (Berkeley) %G%
+ * @(#)fiodefs.h 5.2 (Berkeley) %G%
#define GLITCH '\2' /* special quote for Stu, generated in f77pass1 */
#define GLITCH '\2' /* special quote for Stu, generated in f77pass1 */
#define LISTDIRECTED -1
#define FORMATTED 1
#define LISTDIRECTED -1
#define FORMATTED 1
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
- * @(#)lio.h 5.1 (Berkeley) %G%
+ * @(#)lio.h 5.2 (Berkeley) %G%
#define width(z) ((z!=0.0 && (abs(z)>=LHIGH || abs(z)<LLOW))?LEW:LFW)
#define dwidth(z) ((z!=0.0 && (abs(z)>=LDHIGH || abs(z)<LLOW))?LDEW:LDFW)
#define ERR(x) if(n=(x)) err(n>0?errflag:endflag,n,"list io")
#define width(z) ((z!=0.0 && (abs(z)>=LHIGH || abs(z)<LLOW))?LEW:LFW)
#define dwidth(z) ((z!=0.0 && (abs(z)>=LDHIGH || abs(z)<LLOW))?LDEW:LDFW)
#define ERR(x) if(n=(x)) err(n>0?errflag:endflag,n,"list io")
+#define ERRCHK(x) if(n=(x)) goto got_err;
+#define chk_len(w) if(recpos+w > line_len) PUT('\n');
typedef union
{ short flshort;
typedef union
{ short flshort;
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
+ formatted = LISTDIRECTED;
+ fmtbuf = "ext list io";
if(n=c_le(a,READ)) return(n);
l_first = YES;
lquit = NO;
if(n=c_le(a,READ)) return(n);
l_first = YES;
lquit = NO;
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
+ formatted = LISTDIRECTED;
+ fmtbuf = "ext list io";
if(n=c_le(a,WRITE)) return(n);
putn = t_putc;
lioproc = l_write;
if(n=c_le(a,WRITE)) return(n);
putn = t_putc;
lioproc = l_write;
double *yy;
for(i=0;i< *number; i++)
{
double *yy;
for(i=0;i< *number; i++)
{
+ if( formatted == NAMELIST && i != 0 ) PUT(',');
switch((int)type)
{
case TYSHORT:
switch((int)type)
{
case TYSHORT:
goto xint;
case TYLONG:
x=ptr->flint;
goto xint;
case TYLONG:
x=ptr->flint;
+ xint: ERRCHK(lwrt_I(x));
- ERR(lwrt_F(ptr->flreal));
+ ERRCHK(lwrt_F(ptr->flreal));
- ERR(lwrt_D(ptr->fldouble));
+ ERRCHK(lwrt_D(ptr->fldouble));
break;
case TYCOMPLEX:
xx= &(ptr->flreal);
y = *xx++;
z = *xx;
break;
case TYCOMPLEX:
xx= &(ptr->flreal);
y = *xx++;
z = *xx;
break;
case TYDCOMPLEX:
yy = &(ptr->fldouble);
yd= *yy++;
zd = *yy;
break;
case TYDCOMPLEX:
yy = &(ptr->fldouble);
yd= *yy++;
zd = *yy;
+ ERRCHK(lwrt_DC(yd,zd));
break;
case TYLOGICAL:
if(len == sizeof(short))
x = ptr->flshort;
else
x = ptr->flint;
break;
case TYLOGICAL:
if(len == sizeof(short))
x = ptr->flshort;
else
x = ptr->flint;
- ERR(lwrt_A((char *)ptr,len));
+ ERRCHK(lwrt_A((char *)ptr,len));
break;
default:
fatal(F_ERSYS,"unknown type in lwrite");
break;
default:
fatal(F_ERSYS,"unknown type in lwrite");
ptr = (flex *)((char *)ptr + len);
}
return(OK);
ptr = (flex *)((char *)ptr + len);
}
return(OK);
+
+got_err:
+ err( n>0?errflag:endflag, n,
+ formatted==LISTDIRECTED?"list io":"name list io");
{ int n;
char buf[16],*p;
sprintf(buf," %ld",(long)in);
{ int n;
char buf[16],*p;
sprintf(buf," %ld",(long)in);
- if(n=chk_len(LINTW)) return(n);
for(p=buf;*p;) PUT(*p++)
return(OK);
}
for(p=buf;*p;) PUT(*p++)
return(OK);
}
LOCAL
lwrt_L(ln) ftnint ln;
{ int n;
LOCAL
lwrt_L(ln) ftnint ln;
{ int n;
- if(n=chk_len(LLOGW)) return(n);
return(wrt_L(&ln,LLOGW));
}
LOCAL
lwrt_A(p,len) char *p; ftnlen len;
{ int i,n;
return(wrt_L(&ln,LLOGW));
}
LOCAL
lwrt_A(p,len) char *p; ftnlen len;
{ int i,n;
- if(n=chk_len(LSTRW)) return(n);
- PUT(' ')
- PUT(' ')
- for(i=0;i<len;i++) PUT(*p++)
+ chk_len(LSTRW);
+ if(formatted == LISTDIRECTED)
+ {
+ PUT(' ')
+ PUT(' ')
+ for(i=0;i<len;i++) PUT(*p++)
+ }
+ else
+ {
+ PUT('\'')
+ for(i=0;i<len;i++) PUT(*p++)
+ PUT('\'')
+ }
if(fn==0.0) return(lwrt_0());
f.pf = fn;
d = width(fn);
if(fn==0.0) return(lwrt_0());
f.pf = fn;
d = width(fn);
- if(n=chk_len(d)) return(n);
if(dn==0.0) return(lwrt_0());
f.pd = dn;
d = dwidth(dn);
if(dn==0.0) return(lwrt_0());
f.pd = dn;
d = dwidth(dn);
- if(n=chk_len(d)) return(n);
LOCAL
lwrt_C(a,b) float a,b;
{ int n;
LOCAL
lwrt_C(a,b) float a,b;
{ int n;
- if(n=chk_len(LCW)) return(n);
PUT(' ')
PUT(' ')
PUT('(')
PUT(' ')
PUT(' ')
PUT('(')
LOCAL
lwrt_DC(a,b) double a,b;
{ int n;
LOCAL
lwrt_DC(a,b) double a,b;
{ int n;
- if(n=chk_len(LDCW)) return(n);
PUT(' ')
PUT(' ')
PUT('(')
PUT(' ')
PUT(' ')
PUT('(')
LOCAL
lwrt_0()
{ int n; char *z = " 0.";
LOCAL
lwrt_0()
{ int n; char *z = " 0.";
- if(n=chk_len(4)) return(n);
while(*z) PUT(*z++)
return(OK);
}
while(*z) PUT(*z++)
return(OK);
}
-
-LOCAL
-chk_len(w)
-{ int n;
- if(recpos+w > line_len) PUT('\n')
- return(OK);
-}