From 492cc5d3c87c6166648027f284686e48c02d48f9 Mon Sep 17 00:00:00 2001 From: Kirk McKusick Date: Sun, 8 Mar 1981 00:07:16 -0800 Subject: [PATCH] merge in onyx changes SCCS-vsn: usr.bin/pascal/libpc/ADDT.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/ARGV.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/BUFF.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/CARD.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/CHR.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/CLCK.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/CTTOT.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/DEFNAME.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/DISPOSE.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/ERROR.c 1.3 SCCS-vsn: usr.bin/pascal/libpc/EXPO.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/FCALL.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/FRTN.c 1.3 SCCS-vsn: usr.bin/pascal/libpc/FSAV.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/GETNAME.c 1.3 SCCS-vsn: usr.bin/pascal/libpc/IN.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/INCT.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/IOSYNC.c 1.4 SCCS-vsn: usr.bin/pascal/libpc/LLIMIT.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/MAX.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/MULT.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/NAM.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/NEW.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/PACK.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/PCSTART.c 1.4 SCCS-vsn: usr.bin/pascal/libpc/PMFLUSH.c 1.3 SCCS-vsn: usr.bin/pascal/libpc/PRED.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/PUT.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/RANDOM.c 1.3 SCCS-vsn: usr.bin/pascal/libpc/RANG4.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/READ4.c 1.4 SCCS-vsn: usr.bin/pascal/libpc/READE.c 1.4 SCCS-vsn: usr.bin/pascal/libpc/RELEQ.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/RELNE.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/RELSGE.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/RELSGT.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/RELSLE.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/RELSLT.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/RELTGE.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/RELTGT.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/RELTLE.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/RELTLT.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/REMOVE.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/RESET.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/REWRITE.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/ROUND.c 1.3 SCCS-vsn: usr.bin/pascal/libpc/RSNG4.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/SCLCK.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/SEED.c 1.5 SCCS-vsn: usr.bin/pascal/libpc/SUBSC.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/SUBSCZ.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/SUBT.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/SUCC.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/TELL.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/TEOF.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/TEOLN.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/TRUNC.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/UNPACK.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/WRITEC.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/WRITEF.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/WRITES.c 1.2 SCCS-vsn: usr.bin/pascal/libpc/h00vars.h 1.5 SCCS-vsn: usr.bin/pascal/libpc/libpc.h 1.2 SCCS-vsn: usr.bin/pascal/libpc/Makefile 1.6 --- usr/src/usr.bin/pascal/libpc/ADDT.c | 7 +-- usr/src/usr.bin/pascal/libpc/ARGV.c | 9 ++-- usr/src/usr.bin/pascal/libpc/BUFF.c | 4 +- usr/src/usr.bin/pascal/libpc/CARD.c | 8 +-- usr/src/usr.bin/pascal/libpc/CHR.c | 5 +- usr/src/usr.bin/pascal/libpc/CLCK.c | 3 +- usr/src/usr.bin/pascal/libpc/CTTOT.c | 70 +++++++++++++++----------- usr/src/usr.bin/pascal/libpc/DEFNAME.c | 7 ++- usr/src/usr.bin/pascal/libpc/DISPOSE.c | 8 +-- usr/src/usr.bin/pascal/libpc/ERROR.c | 46 +++++++++-------- usr/src/usr.bin/pascal/libpc/EXPO.c | 20 ++++++-- usr/src/usr.bin/pascal/libpc/FCALL.c | 19 +++---- usr/src/usr.bin/pascal/libpc/FRTN.c | 11 ++-- usr/src/usr.bin/pascal/libpc/FSAV.c | 11 ++-- usr/src/usr.bin/pascal/libpc/GETNAME.c | 15 +++--- usr/src/usr.bin/pascal/libpc/IN.c | 13 ++--- usr/src/usr.bin/pascal/libpc/INCT.c | 14 +++--- usr/src/usr.bin/pascal/libpc/IOSYNC.c | 4 +- usr/src/usr.bin/pascal/libpc/LLIMIT.c | 4 +- usr/src/usr.bin/pascal/libpc/MAX.c | 9 ++-- usr/src/usr.bin/pascal/libpc/MULT.c | 7 +-- usr/src/usr.bin/pascal/libpc/Makefile | 14 ++++-- usr/src/usr.bin/pascal/libpc/NAM.c | 9 ++-- usr/src/usr.bin/pascal/libpc/NEW.c | 6 +-- usr/src/usr.bin/pascal/libpc/PACK.c | 12 ++--- usr/src/usr.bin/pascal/libpc/PCSTART.c | 6 ++- usr/src/usr.bin/pascal/libpc/PMFLUSH.c | 6 +-- usr/src/usr.bin/pascal/libpc/PRED.c | 9 ++-- usr/src/usr.bin/pascal/libpc/PUT.c | 4 +- usr/src/usr.bin/pascal/libpc/RANDOM.c | 4 +- usr/src/usr.bin/pascal/libpc/RANG4.c | 9 ++-- usr/src/usr.bin/pascal/libpc/READ4.c | 6 ++- usr/src/usr.bin/pascal/libpc/READE.c | 7 ++- usr/src/usr.bin/pascal/libpc/RELEQ.c | 9 ++-- usr/src/usr.bin/pascal/libpc/RELNE.c | 9 ++-- usr/src/usr.bin/pascal/libpc/RELSGE.c | 9 ++-- usr/src/usr.bin/pascal/libpc/RELSGT.c | 9 ++-- usr/src/usr.bin/pascal/libpc/RELSLE.c | 9 ++-- usr/src/usr.bin/pascal/libpc/RELSLT.c | 9 ++-- usr/src/usr.bin/pascal/libpc/RELTGE.c | 5 +- usr/src/usr.bin/pascal/libpc/RELTGT.c | 5 +- usr/src/usr.bin/pascal/libpc/RELTLE.c | 5 +- usr/src/usr.bin/pascal/libpc/RELTLT.c | 5 +- usr/src/usr.bin/pascal/libpc/REMOVE.c | 7 +-- usr/src/usr.bin/pascal/libpc/RESET.c | 6 +-- usr/src/usr.bin/pascal/libpc/REWRITE.c | 6 +-- usr/src/usr.bin/pascal/libpc/ROUND.c | 3 +- usr/src/usr.bin/pascal/libpc/RSNG4.c | 8 +-- usr/src/usr.bin/pascal/libpc/SCLCK.c | 3 +- usr/src/usr.bin/pascal/libpc/SEED.c | 3 +- usr/src/usr.bin/pascal/libpc/SUBSC.c | 3 +- usr/src/usr.bin/pascal/libpc/SUBSCZ.c | 3 +- usr/src/usr.bin/pascal/libpc/SUBT.c | 7 +-- usr/src/usr.bin/pascal/libpc/SUCC.c | 9 ++-- usr/src/usr.bin/pascal/libpc/TELL.c | 3 +- usr/src/usr.bin/pascal/libpc/TEOF.c | 3 +- usr/src/usr.bin/pascal/libpc/TEOLN.c | 3 +- usr/src/usr.bin/pascal/libpc/TRUNC.c | 3 +- usr/src/usr.bin/pascal/libpc/UNPACK.c | 12 ++--- usr/src/usr.bin/pascal/libpc/WRITEC.c | 7 +-- usr/src/usr.bin/pascal/libpc/WRITEF.c | 40 +++++++++++++-- usr/src/usr.bin/pascal/libpc/WRITES.c | 8 +-- usr/src/usr.bin/pascal/libpc/h00vars.h | 15 ++++-- usr/src/usr.bin/pascal/libpc/libpc.h | 52 +++++++++++++++++-- 64 files changed, 413 insertions(+), 251 deletions(-) diff --git a/usr/src/usr.bin/pascal/libpc/ADDT.c b/usr/src/usr.bin/pascal/libpc/ADDT.c index c01b4519e5..9642285bd0 100644 --- a/usr/src/usr.bin/pascal/libpc/ADDT.c +++ b/usr/src/usr.bin/pascal/libpc/ADDT.c @@ -1,16 +1,17 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)ADDT.c 1.1 %G%"; +static char sccsid[] = "@(#)ADDT.c 1.2 %G%"; long * -ADDT(result0, left, right, size) +ADDT(result0, left, right, siz) long *result0; register long *left; register long *right; - register int size; + long siz; { register long *result = result0; + register int size = siz; do { *result++ = *left++ | *right++; diff --git a/usr/src/usr.bin/pascal/libpc/ARGV.c b/usr/src/usr.bin/pascal/libpc/ARGV.c index 531ded8247..2f0255bb12 100644 --- a/usr/src/usr.bin/pascal/libpc/ARGV.c +++ b/usr/src/usr.bin/pascal/libpc/ARGV.c @@ -1,17 +1,18 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)ARGV.c 1.1 %G%"; +static char sccsid[] = "@(#)ARGV.c 1.2 %G%"; #include "h00vars.h" #include "h01errs.h" -ARGV(subscript, var, size) +ARGV(subscript, var, siz) - int subscript; /* subscript into argv */ + long subscript; /* subscript into argv */ register char *var; /* pointer to pascal char array */ - register int size; /* sizeof(var) */ + long siz; /* sizeof(var) */ { register char *cp; + register int size = siz; if (subscript >= _argc) { ERROR(EARGV, subscript); diff --git a/usr/src/usr.bin/pascal/libpc/BUFF.c b/usr/src/usr.bin/pascal/libpc/BUFF.c index b3fc94a7a2..f70dadb3de 100644 --- a/usr/src/usr.bin/pascal/libpc/BUFF.c +++ b/usr/src/usr.bin/pascal/libpc/BUFF.c @@ -1,6 +1,6 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)BUFF.c 1.1 %G%"; +static char sccsid[] = "@(#)BUFF.c 1.2 %G%"; #include "h00vars.h" @@ -8,7 +8,7 @@ extern char _sobuf[]; BUFF(amount) - int amount; + long amount; { struct iorec *curfile; diff --git a/usr/src/usr.bin/pascal/libpc/CARD.c b/usr/src/usr.bin/pascal/libpc/CARD.c index fe74af3055..b9daa9c0bf 100644 --- a/usr/src/usr.bin/pascal/libpc/CARD.c +++ b/usr/src/usr.bin/pascal/libpc/CARD.c @@ -1,6 +1,6 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)CARD.c 1.1 %G%"; +static char sccsid[] = "@(#)CARD.c 1.2 %G%"; char _cntbl[] = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, @@ -21,12 +21,14 @@ char _cntbl[] = { 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8 }; -CARD(setptr, size) +long +CARD(setptr, siz) register unsigned char *setptr; - register int size; + long siz; { register int cnt; + register int size = siz; cnt = 0; do { diff --git a/usr/src/usr.bin/pascal/libpc/CHR.c b/usr/src/usr.bin/pascal/libpc/CHR.c index 502a44bedb..1320484f1e 100644 --- a/usr/src/usr.bin/pascal/libpc/CHR.c +++ b/usr/src/usr.bin/pascal/libpc/CHR.c @@ -1,9 +1,10 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)CHR.c 1.1 %G%"; +static char sccsid[] = "@(#)CHR.c 1.2 %G%"; #include "h01errs.h" +char CHR(value) long value; @@ -12,5 +13,5 @@ CHR(value) ERROR(ECHR, value); return; } - return value; + return (char)value; } diff --git a/usr/src/usr.bin/pascal/libpc/CLCK.c b/usr/src/usr.bin/pascal/libpc/CLCK.c index 1c82508909..334c0b2a71 100644 --- a/usr/src/usr.bin/pascal/libpc/CLCK.c +++ b/usr/src/usr.bin/pascal/libpc/CLCK.c @@ -1,7 +1,8 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)CLCK.c 1.1 %G%"; +static char sccsid[] = "@(#)CLCK.c 1.2 %G%"; +long CLCK() { long tim[4]; diff --git a/usr/src/usr.bin/pascal/libpc/CTTOT.c b/usr/src/usr.bin/pascal/libpc/CTTOT.c index 9eab559239..d72eb86e75 100644 --- a/usr/src/usr.bin/pascal/libpc/CTTOT.c +++ b/usr/src/usr.bin/pascal/libpc/CTTOT.c @@ -1,11 +1,13 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)CTTOT.c 1.1 %G%"; +static char sccsid[] = "@(#)CTTOT.c 1.2 %G%"; +#include "whoami.h" #include "h00vars.h" #include "h01errs.h" long _mask[] = { +# ifdef DEC11 0xffffffff , 0xfffffffe , 0xfffffffc , 0xfffffff8 , 0xfffffff0 , 0xffffffe0 , 0xffffffc0 , 0xffffff80 , 0xffffff00 , 0xfffffe00 , 0xfffffc00 , 0xfffff800 , @@ -15,37 +17,51 @@ long _mask[] = { 0xff000000 , 0xfe000000 , 0xfc000000 , 0xf8000000 , 0xf0000000 , 0xe0000000 , 0xc0000000 , 0x80000000 , 0x00000000 - }; +# else + 0xffffffff , 0xfeffffff , 0xfcffffff , 0xf8ffffff , + 0xf0ffffff , 0xe0ffffff , 0xc0ffffff , 0x80ffffff , + 0x00ffffff , 0x00feffff , 0x00fcffff , 0x00f8ffff , + 0x00f0ffff , 0x00e0ffff , 0x00c0ffff , 0x0080ffff , + 0x0000ffff , 0x0000feff , 0x0000fcff , 0x0000f8ff , + 0x0000f0ff , 0x0000e0ff , 0x0000c0ff , 0x000080ff , + 0x000000ff , 0x000000fe , 0x000000fc , 0x000000f8 , + 0x000000f0 , 0x000000e0 , 0x000000c0 , 0x00000080 , + 0x00000000 +# endif DEC11 + }; /* * Constant set constructor */ long * -CTTOT(result, lowerbnd, upperbnd, paircnt, singcnt, data) +CTTOT(result0, lwrbnd, uprbnd, paircnt, singcnt, data) - long *result; /* pointer to final set */ - int lowerbnd; /* lower bound of set */ - int upperbnd; /* upper - lower of set */ - int paircnt; /* number of pairs to construct */ - int singcnt; /* number of singles to construct */ - int data; /* paircnt plus singcnt sets of data */ + long *result0; /* pointer to final set */ + long lwrbnd; /* lower bound of set */ + long uprbnd; /* upper - lower of set */ + long paircnt; /* number of pairs to construct */ + long singcnt; /* number of singles to construct */ + long data; /* paircnt plus singcnt sets of data */ { - register int lower; - register int lowerdiv; - register int lowermod; - register int upper; - int upperdiv; - int uppermod; - register int *dataptr; + register long *result = result0; + register long *dataptr = &data; + int lowerbnd = lwrbnd; + int upperbnd = uprbnd; register long *lp; + register char *cp; + register long temp; long *limit; - long temp; - long cnt; + int lower; + int lowerdiv; + int lowermod; + int upper; + int upperdiv; + int uppermod; + int cnt; - limit = &result[(upperbnd + 1 + BITSPERLONG - 1) / BITSPERLONG]; + limit = &result[(upperbnd + 1 + BITSPERLONG - 1) >> LG2BITSLONG]; for (lp = result; lp < limit; ) *lp++ = 0; - dataptr = &data; for (cnt = 0; cnt < paircnt; cnt++) { upper = *dataptr++ - lowerbnd; if (upper < 0 || upper > upperbnd) { @@ -60,10 +76,10 @@ CTTOT(result, lowerbnd, upperbnd, paircnt, singcnt, data) if (lower > upper) { continue; } - lowerdiv = lower / BITSPERLONG; - lowermod = lower % BITSPERLONG; - upperdiv = upper / BITSPERLONG; - uppermod = upper % BITSPERLONG; + lowerdiv = lower >> LG2BITSLONG; + lowermod = lower & MSKBITSLONG; + upperdiv = upper >> LG2BITSLONG; + uppermod = upper & MSKBITSLONG; temp = _mask [lowermod]; if ( lowerdiv == upperdiv ) { temp &= ~_mask[ uppermod + 1 ]; @@ -77,15 +93,13 @@ CTTOT(result, lowerbnd, upperbnd, paircnt, singcnt, data) result[ upperdiv ] |= ~_mask[ uppermod + 1 ]; } } - for (cnt = 0; cnt < singcnt; cnt++) { + for (cnt = 0, cp = (char *)result; cnt < singcnt; cnt++) { lower = *dataptr++ - lowerbnd; if (lower < 0 || lower > upperbnd) { ERROR(ECTSNG, *--dataptr); return; } - lowerdiv = lower / BITSPERLONG; - lowermod = lower % BITSPERLONG; - result[ lowerdiv ] |= ( 1 << lowermod ); + cp[ lower >> LG2BITSBYTE ] |= (1 << (lower & MSKBITSBYTE)); } return(result); } diff --git a/usr/src/usr.bin/pascal/libpc/DEFNAME.c b/usr/src/usr.bin/pascal/libpc/DEFNAME.c index 23b7556bdc..21bc137cf7 100644 --- a/usr/src/usr.bin/pascal/libpc/DEFNAME.c +++ b/usr/src/usr.bin/pascal/libpc/DEFNAME.c @@ -1,7 +1,6 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)DEFNAME.c 1.1 %G%"; - +static char sccsid[] = "@(#)DEFNAME.c 1.2 %G%"; #include "h00vars.h" @@ -9,8 +8,8 @@ DEFNAME(filep, name, maxnamlen, datasize) register struct iorec *filep; char *name; - int maxnamlen; - int datasize; + long maxnamlen; + long datasize; { filep = GETNAME(filep, name, maxnamlen, datasize); filep->funit |= FDEF; diff --git a/usr/src/usr.bin/pascal/libpc/DISPOSE.c b/usr/src/usr.bin/pascal/libpc/DISPOSE.c index 90a9c43dc8..fabedf37c1 100644 --- a/usr/src/usr.bin/pascal/libpc/DISPOSE.c +++ b/usr/src/usr.bin/pascal/libpc/DISPOSE.c @@ -1,14 +1,16 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)DISPOSE.c 1.1 %G%"; +static char sccsid[] = "@(#)DISPOSE.c 1.2 %G%"; #include "h00vars.h" #include "h01errs.h" -DISPOSE(var, size) +DISPOSE(var, siz) register char **var; /* pointer to pointer being deallocated */ - int size; /* sizeof(bletch) */ + long siz; /* sizeof(bletch) */ { + register int size = siz; + if (*var == 0 || *var + size > _maxptr || *var < _minptr) { ERROR(ENILPTR,0); return; diff --git a/usr/src/usr.bin/pascal/libpc/ERROR.c b/usr/src/usr.bin/pascal/libpc/ERROR.c index 4b28dd38c9..2ea1ac4460 100644 --- a/usr/src/usr.bin/pascal/libpc/ERROR.c +++ b/usr/src/usr.bin/pascal/libpc/ERROR.c @@ -1,6 +1,6 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)ERROR.c 1.2 %G%"; +static char sccsid[] = "@(#)ERROR.c 1.3 %G%"; #include #include @@ -13,15 +13,19 @@ static char sccsid[] = "@(#)ERROR.c 1.2 %G%"; * and an error specific piece of error data. The error file is constructed * from errdata by the makefile using the editor script make.ed1. */ -ERROR(errnum, errdata) +long +ERROR(errnum, errordata) - long errnum; + short errnum; + double errordata; +{ union cvt { long longdat; char *strngdat; double dbldat; } errdata; -{ + + errdata.dbldat = errordata; PFLUSH(); if (_entry[errnum].entryaddr != 0) { (*_entry[errnum].entryaddr)(errdata); @@ -31,7 +35,7 @@ ERROR(errnum, errdata) SETRACE(); switch (errnum) { case ECHR: - fprintf(stderr, "Argument to chr of %d is out of range\n" + fprintf(stderr, "Argument to chr of %D is out of range\n" ,errdata.longdat); return(errdata.longdat); case EHALT: @@ -59,7 +63,7 @@ ERROR(errnum, errdata) fprintf(stderr,"%s: Line limit exceeded\n",errdata.strngdat); return(0); case ESQRT: - fprintf(stderr,"Negative argument of %E to sqrt\n" + fprintf(stderr,"Negative argument of %e to sqrt\n" ,errdata.dbldat); return(errdata.dbldat); case EREFINAF: @@ -91,7 +95,7 @@ ERROR(errnum, errdata) fprintf(stderr,"%s: File name too long\n",errdata.strngdat); return(0); case ELN: - fprintf(stderr,"Non-positive argument of %E to ln\n" + fprintf(stderr,"Non-positive argument of %e to ln\n" ,errdata.dbldat); return(errdata.dbldat); case EBADINUM: @@ -109,61 +113,61 @@ ERROR(errnum, errdata) return(0); case ENAMRNG: fprintf(stderr, - "Enumerated type value of %d is out of range on output\n", + "Enumerated type value of %D is out of range on output\n", errdata.longdat); return(errdata.longdat); case EFMTSIZE: - fprintf(stderr,"Negative format width: %d\n",errdata.longdat); + fprintf(stderr,"Negative format width: %D\n",errdata.longdat); return(0); case EGOTO: fputs("Active frame not found in non-local goto\n", stderr); return(0); case ECASE: - fprintf(stderr,"Label of %d not found in case\n" + fprintf(stderr,"Label of %D not found in case\n" ,errdata.longdat); return(errdata.longdat); case EOUTOFMEM: fputs("Ran out of memory\n",stderr); return(0); case ECTLWR: - fprintf(stderr, "Range lower bound of %d out of set bounds\n", + fprintf(stderr, "Range lower bound of %D out of set bounds\n", errdata.longdat); return(0); case ECTUPR: - fprintf(stderr, "Range upper bound of %d out of set bounds\n", + fprintf(stderr, "Range upper bound of %D out of set bounds\n", errdata.longdat); return(0); case ECTSNG: - fprintf(stderr, "Value of %d out of set bounds\n", + fprintf(stderr, "Value of %D out of set bounds\n", errdata.longdat); return(0); case ENARGS: if (errdata.longdat < 0) fprintf(stderr, - "There were %d too few arguments to formal routine\n", + "There were %D too few arguments to formal routine\n", -errdata.longdat); else fprintf(stderr, - "There were %d too many arguments to formal routine\n", + "There were %D too many arguments to formal routine\n", errdata.longdat); return(0); case EARGV: - fprintf(stderr,"Argument to argv of %d is out of range\n" + fprintf(stderr,"Argument to argv of %D is out of range\n" ,errdata.longdat); return(errdata.longdat); case EPACK: - fprintf(stderr,"i = %d: Bad i to pack(a,i,z)\n" + fprintf(stderr,"i = %D: Bad i to pack(a,i,z)\n" ,errdata.longdat); return(errdata.longdat); case EUNPACK: - fprintf(stderr,"i = %d: Bad i to unpack(z,a,i)\n" + fprintf(stderr,"i = %D: Bad i to unpack(z,a,i)\n" ,errdata.longdat); return(errdata.longdat); case ERANGE: - fprintf(stderr,"Value of %d is out of range\n",errdata.longdat); + fprintf(stderr,"Value of %D is out of range\n",errdata.longdat); return(errdata.longdat); case ESUBSC: - fprintf(stderr,"Subscript value of %d is out of range\n" + fprintf(stderr,"Subscript value of %D is out of range\n" ,errdata.longdat); return(errdata.longdat); case EASRT: @@ -171,7 +175,7 @@ ERROR(errnum, errdata) return(0); case ESTLIM: fprintf(stderr, - "Statement count limit exceeded, %d statements executed\n", + "Statement count limit exceeded, %D statements executed\n", errdata.longdat); return(errdata.longdat); default: diff --git a/usr/src/usr.bin/pascal/libpc/EXPO.c b/usr/src/usr.bin/pascal/libpc/EXPO.c index 48c81d7007..46f29885ce 100644 --- a/usr/src/usr.bin/pascal/libpc/EXPO.c +++ b/usr/src/usr.bin/pascal/libpc/EXPO.c @@ -1,12 +1,24 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)EXPO.c 1.1 %G%"; +static char sccsid[] = "@(#)EXPO.c 1.2 %G%"; +long EXPO(value) - long value; + double value; { - if (value == 0) + register int retval; + register char *cp; + char sign, buf[30]; + extern char *index(); + + if (value == 0.0) return 0; - return ((value & ~0xffff8000) >> 7) - 128; + sprintf(buf, "%.1e", value); + cp = index(buf, 'e') + 1; + sign = *cp++; + retval = 0; + while (*cp) + retval = retval * 10 + *cp++ - '0'; + return sign == '-' ? -retval : retval; } diff --git a/usr/src/usr.bin/pascal/libpc/FCALL.c b/usr/src/usr.bin/pascal/libpc/FCALL.c index e9e88b63f1..ab5f0bc40a 100644 --- a/usr/src/usr.bin/pascal/libpc/FCALL.c +++ b/usr/src/usr.bin/pascal/libpc/FCALL.c @@ -1,21 +1,16 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)FCALL.c 1.1 %G%"; +static char sccsid[] = "@(#)FCALL.c 1.2 %G%"; #include "h00vars.h" +long * FCALL(frtn) register struct formalrtn *frtn; { - register struct display *dp; - register struct display *ds; - struct display *limit; - - limit = &frtn->disp[2 * frtn->cbn]; - for (dp = &_disply[1], ds = &frtn->disp[frtn->cbn]; ds < limit; ) - *ds++ = *dp++; - limit = &frtn->disp[frtn->cbn]; - for (ds = &frtn->disp[0], dp = &_disply[1]; ds < limit; ) - *dp++ = *ds++; - return (long)(frtn->entryaddr); + blkcpy(frtn->cbn * sizeof(struct display), + &_disply[1], &frtn->disp[frtn->cbn]); + blkcpy(frtn->cbn * sizeof(struct display), + &frtn->disp[0], &_disply[1]); + return (long *)(frtn->entryaddr); } diff --git a/usr/src/usr.bin/pascal/libpc/FRTN.c b/usr/src/usr.bin/pascal/libpc/FRTN.c index b055437e27..bb1dabe664 100644 --- a/usr/src/usr.bin/pascal/libpc/FRTN.c +++ b/usr/src/usr.bin/pascal/libpc/FRTN.c @@ -1,17 +1,12 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)FRTN.c 1.2 %G%"; +static char sccsid[] = "@(#)FRTN.c 1.3 %G%"; #include "h00vars.h" FRTN(frtn) register struct formalrtn *frtn; { - register struct display *dp; - register struct display *ds; - struct display *limit; - - limit = &frtn->disp[2 * frtn->cbn]; - for (ds = &frtn->disp[frtn->cbn], dp = &_disply[1]; ds < limit; ) - *dp++ = *ds++; + blkcpy(frtn->cbn * sizeof(struct display), + &frtn->disp[frtn->cbn], &_disply[1]); } diff --git a/usr/src/usr.bin/pascal/libpc/FSAV.c b/usr/src/usr.bin/pascal/libpc/FSAV.c index cee7989fa6..3e911b4f1f 100644 --- a/usr/src/usr.bin/pascal/libpc/FSAV.c +++ b/usr/src/usr.bin/pascal/libpc/FSAV.c @@ -1,6 +1,6 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)FSAV.c 1.1 %G%"; +static char sccsid[] = "@(#)FSAV.c 1.2 %G%"; #include "h00vars.h" @@ -10,14 +10,9 @@ FSAV(entryaddr, cbn, frtn) long cbn; register struct formalrtn *frtn; { - register struct display *dp; - register struct display *ds; - struct display *limit; - frtn->entryaddr = entryaddr; frtn->cbn = cbn; - limit = &frtn->disp[frtn->cbn]; - for (dp = &_disply[1], ds = &frtn->disp[0]; ds < limit; ) - *ds++ = *dp++; + blkcpy(frtn->cbn * sizeof(struct display), + &_disply[1], &frtn->disp[0]); return frtn; } diff --git a/usr/src/usr.bin/pascal/libpc/GETNAME.c b/usr/src/usr.bin/pascal/libpc/GETNAME.c index eef3b6450f..082282a3c7 100644 --- a/usr/src/usr.bin/pascal/libpc/GETNAME.c +++ b/usr/src/usr.bin/pascal/libpc/GETNAME.c @@ -1,6 +1,6 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)GETNAME.c 1.2 %G%"; +static char sccsid[] = "@(#)GETNAME.c 1.3 %G%"; #include "h00vars.h" #include "h01errs.h" @@ -17,13 +17,14 @@ static char sccsid[] = "@(#)GETNAME.c 1.2 %G%"; */ struct iorec * -GETNAME(filep, name, maxnamlen, datasize) +GETNAME(filep, name, namlim, datasize) register struct iorec *filep; char *name; - int maxnamlen; - int datasize; + long namlim; + long datasize; { + int maxnamlen = namlim; struct iorec *prev; struct iorec *next; register int cnt; @@ -71,9 +72,7 @@ GETNAME(filep, name, maxnamlen, datasize) filep->fchain = next; prev->fchain = filep; } else { - if (filep->funit & FDEF) { - filep->funit &= (TEMP | FTEXT); - } else { + if ((filep->funit & FDEF) == 0) { /* * have a previous buffer, close associated file */ @@ -95,8 +94,8 @@ GETNAME(filep, name, maxnamlen, datasize) ERROR(EREMOVE, filep->pfname); return; } - filep->funit &= (TEMP | FTEXT); } + filep->funit &= (TEMP | FTEXT); } /* * get the filename associated with the buffer diff --git a/usr/src/usr.bin/pascal/libpc/IN.c b/usr/src/usr.bin/pascal/libpc/IN.c index 9103a21b7e..10dbc9121d 100644 --- a/usr/src/usr.bin/pascal/libpc/IN.c +++ b/usr/src/usr.bin/pascal/libpc/IN.c @@ -1,21 +1,22 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)IN.c 1.1 %G%"; +static char sccsid[] = "@(#)IN.c 1.2 %G%"; #include "h00vars.h" +bool IN(element, lower, upper, setptr) - int element; /* element to check */ - int lower; /* lowest element of set */ - int upper; /* upper - lower of set */ + long element; /* element to check */ + long lower; /* lowest element of set */ + long upper; /* upper - lower of set */ char setptr[]; /* pointer to set */ { - int indx; + register int indx; if ((indx = element - lower) < 0 || indx > upper) return FALSE; - if (setptr[indx / BITSPERBYTE] & (1 << (indx % BITSPERBYTE))) + if (setptr[indx >> LG2BITSBYTE] & (1 << (indx & MSKBITSBYTE))) return TRUE; return FALSE; } diff --git a/usr/src/usr.bin/pascal/libpc/INCT.c b/usr/src/usr.bin/pascal/libpc/INCT.c index ef9f5aa369..f0e2d40d47 100644 --- a/usr/src/usr.bin/pascal/libpc/INCT.c +++ b/usr/src/usr.bin/pascal/libpc/INCT.c @@ -1,20 +1,20 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)INCT.c 1.1 %G%"; +static char sccsid[] = "@(#)INCT.c 1.2 %G%"; #include "h00vars.h" +bool INCT(element, paircnt, singcnt, data) - register int element; /* element to find */ - int paircnt; /* number of pairs to check */ - int singcnt; /* number of singles to check */ - int data; /* paircnt plus singcnt bounds */ + register long element; /* element to find */ + long paircnt; /* number of pairs to check */ + long singcnt; /* number of singles to check */ + long data; /* paircnt plus singcnt bounds */ { - register int *dataptr; + register long *dataptr = &data; register int cnt; - dataptr = &data; for (cnt = 0; cnt < paircnt; cnt++) { if (element > *dataptr++) { dataptr++; diff --git a/usr/src/usr.bin/pascal/libpc/IOSYNC.c b/usr/src/usr.bin/pascal/libpc/IOSYNC.c index 4d64685393..8e5727d54a 100644 --- a/usr/src/usr.bin/pascal/libpc/IOSYNC.c +++ b/usr/src/usr.bin/pascal/libpc/IOSYNC.c @@ -1,6 +1,6 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)IOSYNC.c 1.3 %G%"; +static char sccsid[] = "@(#)IOSYNC.c 1.4 %G%"; #include "h00vars.h" #include "h01errs.h" @@ -31,7 +31,7 @@ IOSYNC(curfile) curfile->funit |= EOFF; return; } - fread(curfile->fileptr, curfile->fsize, 1, curfile->fbuf); + fread(curfile->fileptr, (int)curfile->fsize, 1, curfile->fbuf); if (ferror(curfile->fbuf)) { ERROR(EPASTEOF, curfile->pfname); return; diff --git a/usr/src/usr.bin/pascal/libpc/LLIMIT.c b/usr/src/usr.bin/pascal/libpc/LLIMIT.c index b53e02fb08..19da5e0530 100644 --- a/usr/src/usr.bin/pascal/libpc/LLIMIT.c +++ b/usr/src/usr.bin/pascal/libpc/LLIMIT.c @@ -1,6 +1,6 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)LLIMIT.c 1.1 %G%"; +static char sccsid[] = "@(#)LLIMIT.c 1.2 %G%"; #include "h00vars.h" #include "h01errs.h" @@ -8,7 +8,7 @@ static char sccsid[] = "@(#)LLIMIT.c 1.1 %G%"; LLIMIT(curfile, limit) register struct iorec *curfile; - int limit; + long limit; { if (limit <= 0) limit = 0x7fffffff; diff --git a/usr/src/usr.bin/pascal/libpc/MAX.c b/usr/src/usr.bin/pascal/libpc/MAX.c index 86f15683c2..b1cf512a05 100644 --- a/usr/src/usr.bin/pascal/libpc/MAX.c +++ b/usr/src/usr.bin/pascal/libpc/MAX.c @@ -1,15 +1,16 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)MAX.c 1.1 %G%"; +static char sccsid[] = "@(#)MAX.c 1.2 %G%"; #include "h00vars.h" #include "h01errs.h" +long MAX(width, reduce, min) - register int width; /* requested width */ - int reduce; /* amount of extra space required */ - int min; /* minimum amount of space needed */ + register long width; /* requested width */ + long reduce; /* amount of extra space required */ + long min; /* minimum amount of space needed */ { if (width < 0) { ERROR(EFMTSIZE, width); diff --git a/usr/src/usr.bin/pascal/libpc/MULT.c b/usr/src/usr.bin/pascal/libpc/MULT.c index 952cf8c79e..1f3d95c2a5 100644 --- a/usr/src/usr.bin/pascal/libpc/MULT.c +++ b/usr/src/usr.bin/pascal/libpc/MULT.c @@ -1,16 +1,17 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)MULT.c 1.1 %G%"; +static char sccsid[] = "@(#)MULT.c 1.2 %G%"; long * -MULT(result0, left, right, size) +MULT(result0, left, right, siz) long *result0; register long *left; register long *right; - register int size; + long siz; { register long *result = result0; + register int size = siz; do { *result++ = *left++ & *right++; diff --git a/usr/src/usr.bin/pascal/libpc/Makefile b/usr/src/usr.bin/pascal/libpc/Makefile index e6010d57d1..92450fb28c 100644 --- a/usr/src/usr.bin/pascal/libpc/Makefile +++ b/usr/src/usr.bin/pascal/libpc/Makefile @@ -1,7 +1,8 @@ -SCCSID = "@(#)Makefile 1.5 %G%" +SCCSID = "@(#)Makefile 1.6 %G%" CFLAGS = -O LIB = ${DESTDIR}/usr/lib -SRCDIR = /usr/ucb +SRCDIR = ${DESTDIR}/usr/ucb +PASDIR = ${DESTDIR}/usr/src/cmd/pascal LD= ld RM = /bin/rm -f RANLIB= ranlib @@ -19,11 +20,11 @@ CMDS = ACTFILE.c ADDT.c ARGV.c ASRT.c BUFF.c CARD.c CHR.c CLCK.c \ UNIT.c UNPACK.c WRITEC.c WRITEF.c WRITES.c WRITLN.c SYS = ERROR.c GETNAME.c IOSYNC.c PCEXIT.c PCLOSE.c PCSTART.c PFLUSH.c \ - PMFLUSH.c RAND.s SETRACE.s UNSYNC.c UNWIND.c + PMFLUSH.c RAND.s SETRACE.s UNSYNC.c UNWIND.c blkclr.c blkcpy.c EXTN = APPEND.c CATCHERR.c SEEK.c TELL.c -HDRS = h00vars.h ashdr.s errdata make.ed1 +HDRS = whoami.h h00vars.h ashdr.s errdata make.ed1 OBJS = ACTFILE.o ADDT.o ARGV.o ASRT.o BUFF.o CARD.o CHR.o CLCK.o\ CTTOT.o DATE.o DEFNAME.o DISPOSE.o EXPO.o FCALL.o FLUSH.o FNIL.o\ @@ -37,7 +38,7 @@ OBJS = ACTFILE.o ADDT.o ARGV.o ASRT.o BUFF.o CARD.o CHR.o CLCK.o\ TRUNC.o UNIT.o UNPACK.o WRITEC.o WRITEF.o WRITES.o WRITLN.o SYOBJ = ERROR.o GETNAME.o IOSYNC.o PCEXIT.o PCLOSE.o PCSTART.o PFLUSH.o\ - PMFLUSH.o RAND.o SETRACE.o UNSYNC.o UNWIND.o + PMFLUSH.o RAND.o SETRACE.o UNSYNC.o UNWIND.o blkclr.o blkcpy.o EXOBJ = APPEND.o CATCHERR.o SEEK.o TELL.o @@ -65,6 +66,9 @@ h01errs.h: errdata make.ed1 ashdr.s ed - errdata = *sptr) { - ERROR(ENAMRNG, value); + ERROR(ENAMRNG, val); return; } sptr++; diff --git a/usr/src/usr.bin/pascal/libpc/NEW.c b/usr/src/usr.bin/pascal/libpc/NEW.c index 9d522e81ec..4a894d80a9 100644 --- a/usr/src/usr.bin/pascal/libpc/NEW.c +++ b/usr/src/usr.bin/pascal/libpc/NEW.c @@ -1,18 +1,18 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)NEW.c 1.1 %G%"; +static char sccsid[] = "@(#)NEW.c 1.2 %G%"; #include "h00vars.h" #include "h01errs.h" NEW(var, size) char **var; /* pointer to item being deallocated */ - int size; /* sizeof struct pointed to by var */ + long size; /* sizeof struct pointed to by var */ { extern char *malloc(); char *memblk; - memblk = malloc(size); + memblk = malloc((int)size); if (memblk == 0) { ERROR(EOUTOFMEM,0); return; diff --git a/usr/src/usr.bin/pascal/libpc/PACK.c b/usr/src/usr.bin/pascal/libpc/PACK.c index 649ceee9e6..17c2545bc1 100644 --- a/usr/src/usr.bin/pascal/libpc/PACK.c +++ b/usr/src/usr.bin/pascal/libpc/PACK.c @@ -1,6 +1,6 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)PACK.c 1.1 %G%"; +static char sccsid[] = "@(#)PACK.c 1.2 %G%"; #include "h01errs.h" @@ -24,13 +24,13 @@ static char sccsid[] = "@(#)PACK.c 1.1 %G%"; PACK(i, a, z, size_a, lb_a, ub_a, size_z) - int i; /* subscript into a to begin packing */ + long i; /* subscript into a to begin packing */ char *a; /* pointer to structure a */ char *z; /* pointer to structure z */ - int size_a; /* sizeof(a_type) */ - int lb_a; /* lower bound of structure a */ - int ub_a; /* (upper bound of a) - (lb_a + sizeof(z_type)) */ - int size_z; /* sizeof(z_type) */ + long size_a; /* sizeof(a_type) */ + long lb_a; /* lower bound of structure a */ + long ub_a; /* (upper bound of a) - (lb_a + sizeof(z_type)) */ + long size_z; /* sizeof(z_type) */ { int subscr; register char *cp; diff --git a/usr/src/usr.bin/pascal/libpc/PCSTART.c b/usr/src/usr.bin/pascal/libpc/PCSTART.c index 3147418378..b0aeef14d3 100644 --- a/usr/src/usr.bin/pascal/libpc/PCSTART.c +++ b/usr/src/usr.bin/pascal/libpc/PCSTART.c @@ -1,6 +1,6 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)PCSTART.c 1.3 %G%"; +static char sccsid[] = "@(#)PCSTART.c 1.4 %G%"; #include "h00vars.h" @@ -13,7 +13,11 @@ char **_argv; long _stlim = 500000; long _stcnt = 0; long _seed = 1; +#ifdef VAX char *_minptr = (char *)0x7fffffff; +#else +char *_minptr = (char *)0xffff; +#endif VAX char *_maxptr = (char *)0; struct errentry _entry[MAXERRS]; diff --git a/usr/src/usr.bin/pascal/libpc/PMFLUSH.c b/usr/src/usr.bin/pascal/libpc/PMFLUSH.c index 3837e13b3e..44a6aa2854 100644 --- a/usr/src/usr.bin/pascal/libpc/PMFLUSH.c +++ b/usr/src/usr.bin/pascal/libpc/PMFLUSH.c @@ -1,6 +1,6 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)PMFLUSH.c 1.2 %G%"; +static char sccsid[] = "@(#)PMFLUSH.c 1.3 %G%"; #include "h00vars.h" @@ -13,13 +13,13 @@ PMFLUSH(cntrs, rtns, bufaddr) register FILE *filep; bufaddr[0] = 0426; - bufaddr[1] = time(); + time(&bufaddr[1]); bufaddr[2] = cntrs; bufaddr[3] = rtns; filep = fopen(PXPFILE, "w"); if (filep == NULL) goto ioerr; - fwrite(bufaddr, cntrs + 1, sizeof(long), filep); + fwrite(bufaddr, (int)(cntrs + 1), sizeof(long), filep); if (ferror(filep)) goto ioerr; fclose(filep); diff --git a/usr/src/usr.bin/pascal/libpc/PRED.c b/usr/src/usr.bin/pascal/libpc/PRED.c index 14af0127d0..4853590341 100644 --- a/usr/src/usr.bin/pascal/libpc/PRED.c +++ b/usr/src/usr.bin/pascal/libpc/PRED.c @@ -1,14 +1,15 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)PRED.c 1.1 %G%"; +static char sccsid[] = "@(#)PRED.c 1.2 %G%"; #include "h01errs.h" +long PRED(value, lower, upper) - int value; - int lower; - int upper; + long value; + long lower; + long upper; { value--; if (value < lower || value > upper) { diff --git a/usr/src/usr.bin/pascal/libpc/PUT.c b/usr/src/usr.bin/pascal/libpc/PUT.c index 10ca0f9c27..2ea7e9b6f5 100644 --- a/usr/src/usr.bin/pascal/libpc/PUT.c +++ b/usr/src/usr.bin/pascal/libpc/PUT.c @@ -1,6 +1,6 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)PUT.c 1.1 %G%"; +static char sccsid[] = "@(#)PUT.c 1.2 %G%"; #include "h00vars.h" #include "h01errs.h" @@ -13,7 +13,7 @@ PUT(curfile) ERROR(EWRITEIT, curfile->pfname); return; } - fwrite(curfile->fileptr, curfile->fsize, 1, curfile->fbuf); + fwrite(curfile->fileptr, (int)curfile->fsize, 1, curfile->fbuf); if (ferror(curfile->fbuf)) { ERROR(EWRITE, curfile->pfname); return; diff --git a/usr/src/usr.bin/pascal/libpc/RANDOM.c b/usr/src/usr.bin/pascal/libpc/RANDOM.c index ec971bc98f..495bd47b60 100644 --- a/usr/src/usr.bin/pascal/libpc/RANDOM.c +++ b/usr/src/usr.bin/pascal/libpc/RANDOM.c @@ -1,9 +1,11 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)RANDOM.c 1.2 %G%"; +static char sccsid[] = "@(#)RANDOM.c 1.3 %G%"; #include "h00vars.h" +extern long RAND(); + double RANDOM() { diff --git a/usr/src/usr.bin/pascal/libpc/RANG4.c b/usr/src/usr.bin/pascal/libpc/RANG4.c index a380f8721f..739588aa02 100644 --- a/usr/src/usr.bin/pascal/libpc/RANG4.c +++ b/usr/src/usr.bin/pascal/libpc/RANG4.c @@ -1,14 +1,15 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)RANG4.c 1.1 %G%"; +static char sccsid[] = "@(#)RANG4.c 1.2 %G%"; #include "h01errs.h" +long RANG4(value, lower, upper) - int value; - int lower; - int upper; + long value; + long lower; + long upper; { if (value < lower || value > upper) { ERROR(ERANGE, value); diff --git a/usr/src/usr.bin/pascal/libpc/READ4.c b/usr/src/usr.bin/pascal/libpc/READ4.c index 5cf621f325..b49d92f132 100644 --- a/usr/src/usr.bin/pascal/libpc/READ4.c +++ b/usr/src/usr.bin/pascal/libpc/READ4.c @@ -1,15 +1,17 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)READ4.c 1.3 %G%"; +static char sccsid[] = "@(#)READ4.c 1.4 %G%"; #include "h00vars.h" #include "h01errs.h" +long READ4(curfile) register struct iorec *curfile; { - int data, retval; + long data; + int retval; if (curfile->funit & FWRITE) { ERROR(EREADIT, curfile->pfname); diff --git a/usr/src/usr.bin/pascal/libpc/READE.c b/usr/src/usr.bin/pascal/libpc/READE.c index 85070070ae..0bf2417875 100644 --- a/usr/src/usr.bin/pascal/libpc/READE.c +++ b/usr/src/usr.bin/pascal/libpc/READE.c @@ -1,17 +1,16 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)READE.c 1.3 %G%"; +static char sccsid[] = "@(#)READE.c 1.4 %G%"; #include "h00vars.h" #include "h01errs.h" +long READE(curfile, name) register struct iorec *curfile; char *name; { - long data; - register short *sptr; register int len; register int nextlen; @@ -50,7 +49,7 @@ READE(curfile, name) if (nextlen == len && RELEQ(len, namebuf, cp)) { return *((short *) name) - cnt; } - cp += nextlen; + cp += (int)nextlen; } while (--cnt); ERROR(ENUMNTFD, namebuf); } diff --git a/usr/src/usr.bin/pascal/libpc/RELEQ.c b/usr/src/usr.bin/pascal/libpc/RELEQ.c index 7d77e41b99..4703f27831 100644 --- a/usr/src/usr.bin/pascal/libpc/RELEQ.c +++ b/usr/src/usr.bin/pascal/libpc/RELEQ.c @@ -1,15 +1,18 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)RELEQ.c 1.1 %G%"; +static char sccsid[] = "@(#)RELEQ.c 1.2 %G%"; #include "h00vars.h" -RELEQ(size, str1, str2) +bool +RELEQ(siz, str1, str2) - register int size; + long siz; register char *str1; register char *str2; { + register int size = siz; + while (*str1++ == *str2++ && --size) /* void */; if (size == 0) diff --git a/usr/src/usr.bin/pascal/libpc/RELNE.c b/usr/src/usr.bin/pascal/libpc/RELNE.c index 8436e0006e..721db807e8 100644 --- a/usr/src/usr.bin/pascal/libpc/RELNE.c +++ b/usr/src/usr.bin/pascal/libpc/RELNE.c @@ -1,15 +1,18 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)RELNE.c 1.1 %G%"; +static char sccsid[] = "@(#)RELNE.c 1.2 %G%"; #include "h00vars.h" -RELNE(size, str1, str2) +bool +RELNE(siz, str1, str2) - register int size; + long siz; register char *str1; register char *str2; { + register int size = siz; + while (*str1++ == *str2++ && --size) /* void */; if (size == 0) diff --git a/usr/src/usr.bin/pascal/libpc/RELSGE.c b/usr/src/usr.bin/pascal/libpc/RELSGE.c index 352b32fd04..8c895ac52b 100644 --- a/usr/src/usr.bin/pascal/libpc/RELSGE.c +++ b/usr/src/usr.bin/pascal/libpc/RELSGE.c @@ -1,15 +1,18 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)RELSGE.c 1.1 %G%"; +static char sccsid[] = "@(#)RELSGE.c 1.2 %G%"; #include "h00vars.h" -RELSGE(size, str1, str2) +bool +RELSGE(siz, str1, str2) - register int size; + long siz; register char *str1; register char *str2; { + register int size = siz; + while (*str1++ == *str2++ && --size) /* void */; if ((size == 0) || (*--str1 >= *--str2)) diff --git a/usr/src/usr.bin/pascal/libpc/RELSGT.c b/usr/src/usr.bin/pascal/libpc/RELSGT.c index 78aebaeaee..492ccae99d 100644 --- a/usr/src/usr.bin/pascal/libpc/RELSGT.c +++ b/usr/src/usr.bin/pascal/libpc/RELSGT.c @@ -1,15 +1,18 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)RELSGT.c 1.1 %G%"; +static char sccsid[] = "@(#)RELSGT.c 1.2 %G%"; #include "h00vars.h" -RELSGT(size, str1, str2) +bool +RELSGT(siz, str1, str2) - register int size; + long siz; register char *str1; register char *str2; { + register int size = siz; + while (*str1++ == *str2++ && --size) /* void */; if ((size == 0) || (*--str1 <= *--str2)) diff --git a/usr/src/usr.bin/pascal/libpc/RELSLE.c b/usr/src/usr.bin/pascal/libpc/RELSLE.c index e7c70e4ecd..5864ed9dc0 100644 --- a/usr/src/usr.bin/pascal/libpc/RELSLE.c +++ b/usr/src/usr.bin/pascal/libpc/RELSLE.c @@ -1,15 +1,18 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)RELSLE.c 1.1 %G%"; +static char sccsid[] = "@(#)RELSLE.c 1.2 %G%"; #include "h00vars.h" -RELSLE(size, str1, str2) +bool +RELSLE(siz, str1, str2) - register int size; + long siz; register char *str1; register char *str2; { + register int size = siz; + while (*str1++ == *str2++ && --size) /* void */; if ((size == 0) || (*--str1 <= *--str2)) diff --git a/usr/src/usr.bin/pascal/libpc/RELSLT.c b/usr/src/usr.bin/pascal/libpc/RELSLT.c index 43b115aaf6..15994bd5c4 100644 --- a/usr/src/usr.bin/pascal/libpc/RELSLT.c +++ b/usr/src/usr.bin/pascal/libpc/RELSLT.c @@ -1,15 +1,18 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)RELSLT.c 1.1 %G%"; +static char sccsid[] = "@(#)RELSLT.c 1.2 %G%"; #include "h00vars.h" -RELSLT(size, str1, str2) +bool +RELSLT(siz, str1, str2) - register int size; + long siz; register char *str1; register char *str2; { + register int size = siz; + while (*str1++ == *str2++ && --size) /* void */; if ((size == 0) || (*--str1 >= *--str2)) diff --git a/usr/src/usr.bin/pascal/libpc/RELTGE.c b/usr/src/usr.bin/pascal/libpc/RELTGE.c index ceac2ea9a9..75f7da726e 100644 --- a/usr/src/usr.bin/pascal/libpc/RELTGE.c +++ b/usr/src/usr.bin/pascal/libpc/RELTGE.c @@ -1,12 +1,13 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)RELTGE.c 1.1 %G%"; +static char sccsid[] = "@(#)RELTGE.c 1.2 %G%"; #include "h00vars.h" +bool RELTGE(bytecnt, left, right) - int bytecnt; + long bytecnt; register long *left; register long *right; { diff --git a/usr/src/usr.bin/pascal/libpc/RELTGT.c b/usr/src/usr.bin/pascal/libpc/RELTGT.c index ab6490634f..56b11a9702 100644 --- a/usr/src/usr.bin/pascal/libpc/RELTGT.c +++ b/usr/src/usr.bin/pascal/libpc/RELTGT.c @@ -1,12 +1,13 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)RELTGT.c 1.1 %G%"; +static char sccsid[] = "@(#)RELTGT.c 1.2 %G%"; #include "h00vars.h" +bool RELTGT(bytecnt, left, right) - int bytecnt; + long bytecnt; register long *left; register long *right; { diff --git a/usr/src/usr.bin/pascal/libpc/RELTLE.c b/usr/src/usr.bin/pascal/libpc/RELTLE.c index f8be9350f1..1fa74e3044 100644 --- a/usr/src/usr.bin/pascal/libpc/RELTLE.c +++ b/usr/src/usr.bin/pascal/libpc/RELTLE.c @@ -1,12 +1,13 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)RELTLE.c 1.1 %G%"; +static char sccsid[] = "@(#)RELTLE.c 1.2 %G%"; #include "h00vars.h" +bool RELTLE(bytecnt, left, right) - int bytecnt; + long bytecnt; register long *left; register long *right; { diff --git a/usr/src/usr.bin/pascal/libpc/RELTLT.c b/usr/src/usr.bin/pascal/libpc/RELTLT.c index ebfee11894..b888cfc33e 100644 --- a/usr/src/usr.bin/pascal/libpc/RELTLT.c +++ b/usr/src/usr.bin/pascal/libpc/RELTLT.c @@ -1,12 +1,13 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)RELTLT.c 1.1 %G%"; +static char sccsid[] = "@(#)RELTLT.c 1.2 %G%"; #include "h00vars.h" +bool RELTLT(bytecnt, left, right) - int bytecnt; + long bytecnt; register long *left; register long *right; { diff --git a/usr/src/usr.bin/pascal/libpc/REMOVE.c b/usr/src/usr.bin/pascal/libpc/REMOVE.c index c63514b3ee..f24e7ba64d 100644 --- a/usr/src/usr.bin/pascal/libpc/REMOVE.c +++ b/usr/src/usr.bin/pascal/libpc/REMOVE.c @@ -1,16 +1,17 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)REMOVE.c 1.1 %G%"; +static char sccsid[] = "@(#)REMOVE.c 1.2 %G%"; #include "h00vars.h" #include "h01errs.h" -REMOVE(name, maxnamlen) +REMOVE(name, namlim) char *name; - int maxnamlen; + long namlim; { register int cnt; + register int maxnamlen = namlim; char namebuf[NAMSIZ]; /* diff --git a/usr/src/usr.bin/pascal/libpc/RESET.c b/usr/src/usr.bin/pascal/libpc/RESET.c index 3380680e9a..da6d8b2760 100644 --- a/usr/src/usr.bin/pascal/libpc/RESET.c +++ b/usr/src/usr.bin/pascal/libpc/RESET.c @@ -1,6 +1,6 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)RESET.c 1.1 %G%"; +static char sccsid[] = "@(#)RESET.c 1.2 %G%"; #include "h00vars.h" #include "h01errs.h" @@ -9,8 +9,8 @@ RESET(filep, name, maxnamlen, datasize) register struct iorec *filep; char *name; - int maxnamlen; - int datasize; + long maxnamlen; + long datasize; { if (name == NULL && filep == INPUT && filep->fname[0] == '\0') { if (rewind(filep->fbuf)) { diff --git a/usr/src/usr.bin/pascal/libpc/REWRITE.c b/usr/src/usr.bin/pascal/libpc/REWRITE.c index 2db963912d..6fe7618286 100644 --- a/usr/src/usr.bin/pascal/libpc/REWRITE.c +++ b/usr/src/usr.bin/pascal/libpc/REWRITE.c @@ -1,6 +1,6 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)REWRITE.c 1.1 %G%"; +static char sccsid[] = "@(#)REWRITE.c 1.2 %G%"; #include "h00vars.h" #include "h01errs.h" @@ -9,8 +9,8 @@ REWRITE(filep, name, maxnamlen, datasize) register struct iorec *filep; char *name; - int maxnamlen; - int datasize; + long maxnamlen; + long datasize; { filep = GETNAME (filep, name, maxnamlen, datasize); filep->fbuf = fopen(filep->fname, "w"); diff --git a/usr/src/usr.bin/pascal/libpc/ROUND.c b/usr/src/usr.bin/pascal/libpc/ROUND.c index ad1744a285..8b60be0133 100644 --- a/usr/src/usr.bin/pascal/libpc/ROUND.c +++ b/usr/src/usr.bin/pascal/libpc/ROUND.c @@ -1,7 +1,8 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)ROUND.c 1.2 %G%"; +static char sccsid[] = "@(#)ROUND.c 1.3 %G%"; +long ROUND(value) double value; diff --git a/usr/src/usr.bin/pascal/libpc/RSNG4.c b/usr/src/usr.bin/pascal/libpc/RSNG4.c index aa07930a0f..e4157646c5 100644 --- a/usr/src/usr.bin/pascal/libpc/RSNG4.c +++ b/usr/src/usr.bin/pascal/libpc/RSNG4.c @@ -1,14 +1,14 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)RSNG4.c 1.1 %G%"; - +static char sccsid[] = "@(#)RSNG4.c 1.2 %G%"; #include "h01errs.h" +long RSNG4(value, upper) - int value; - int upper; + long value; + long upper; { if (value < 0 || value > upper) { ERROR(ERANGE, value); diff --git a/usr/src/usr.bin/pascal/libpc/SCLCK.c b/usr/src/usr.bin/pascal/libpc/SCLCK.c index 11516c7ff5..5687a9c2ad 100644 --- a/usr/src/usr.bin/pascal/libpc/SCLCK.c +++ b/usr/src/usr.bin/pascal/libpc/SCLCK.c @@ -1,7 +1,8 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)SCLCK.c 1.1 %G%"; +static char sccsid[] = "@(#)SCLCK.c 1.2 %G%"; +long SCLCK() { long tim[4]; diff --git a/usr/src/usr.bin/pascal/libpc/SEED.c b/usr/src/usr.bin/pascal/libpc/SEED.c index d27cd71ff5..60155059f1 100644 --- a/usr/src/usr.bin/pascal/libpc/SEED.c +++ b/usr/src/usr.bin/pascal/libpc/SEED.c @@ -1,9 +1,10 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)SEED.c 1.4 %G%"; +static char sccsid[] = "@(#)SEED.c 1.5 %G%"; #include "h00vars.h" +long SEED(value) long value; { diff --git a/usr/src/usr.bin/pascal/libpc/SUBSC.c b/usr/src/usr.bin/pascal/libpc/SUBSC.c index 13e1f4256b..d1e35aa0dd 100644 --- a/usr/src/usr.bin/pascal/libpc/SUBSC.c +++ b/usr/src/usr.bin/pascal/libpc/SUBSC.c @@ -1,9 +1,10 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)SUBSC.c 1.1 %G%"; +static char sccsid[] = "@(#)SUBSC.c 1.2 %G%"; #include "h01errs.h" +long SUBSC(i, lower, upper) long i, lower, upper; diff --git a/usr/src/usr.bin/pascal/libpc/SUBSCZ.c b/usr/src/usr.bin/pascal/libpc/SUBSCZ.c index e43602d7cf..6e4a641f02 100644 --- a/usr/src/usr.bin/pascal/libpc/SUBSCZ.c +++ b/usr/src/usr.bin/pascal/libpc/SUBSCZ.c @@ -1,9 +1,10 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)SUBSCZ.c 1.1 %G%"; +static char sccsid[] = "@(#)SUBSCZ.c 1.2 %G%"; #include "h01errs.h" +long SUBSCZ(i, upper) long i, upper; diff --git a/usr/src/usr.bin/pascal/libpc/SUBT.c b/usr/src/usr.bin/pascal/libpc/SUBT.c index 057d01f916..dabed541e4 100644 --- a/usr/src/usr.bin/pascal/libpc/SUBT.c +++ b/usr/src/usr.bin/pascal/libpc/SUBT.c @@ -1,16 +1,17 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)SUBT.c 1.1 %G%"; +static char sccsid[] = "@(#)SUBT.c 1.2 %G%"; long * -SUBT(result0, left, right, size) +SUBT(result0, left, right, siz) long *result0; register long *left; register long *right; - register int size; + long siz; { register long *result = result0; + register int size = siz; do { *result++ = *left++ & ~*right++; diff --git a/usr/src/usr.bin/pascal/libpc/SUCC.c b/usr/src/usr.bin/pascal/libpc/SUCC.c index 39eb1dd8e0..4ab5dd2db7 100644 --- a/usr/src/usr.bin/pascal/libpc/SUCC.c +++ b/usr/src/usr.bin/pascal/libpc/SUCC.c @@ -1,14 +1,15 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)SUCC.c 1.1 %G%"; +static char sccsid[] = "@(#)SUCC.c 1.2 %G%"; #include "h01errs.h" +long SUCC(value, lower, upper) - int value; - int lower; - int upper; + long value; + long lower; + long upper; { value++; if (value < lower || value > upper) { diff --git a/usr/src/usr.bin/pascal/libpc/TELL.c b/usr/src/usr.bin/pascal/libpc/TELL.c index b7f9f0a3d8..ec191d2b95 100644 --- a/usr/src/usr.bin/pascal/libpc/TELL.c +++ b/usr/src/usr.bin/pascal/libpc/TELL.c @@ -1,12 +1,13 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)TELL.c 1.1 %G%"; +static char sccsid[] = "@(#)TELL.c 1.2 %G%"; #include "h00vars.h" /* * Find current location */ +long TELL(curfile) register struct iorec *curfile; diff --git a/usr/src/usr.bin/pascal/libpc/TEOF.c b/usr/src/usr.bin/pascal/libpc/TEOF.c index b328cfdd6e..893db41fcc 100644 --- a/usr/src/usr.bin/pascal/libpc/TEOF.c +++ b/usr/src/usr.bin/pascal/libpc/TEOF.c @@ -1,10 +1,11 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)TEOF.c 1.1 %G%"; +static char sccsid[] = "@(#)TEOF.c 1.2 %G%"; #include "h00vars.h" #include "h01errs.h" +bool TEOF(filep) register struct iorec *filep; diff --git a/usr/src/usr.bin/pascal/libpc/TEOLN.c b/usr/src/usr.bin/pascal/libpc/TEOLN.c index 584bef6969..b5703b653a 100644 --- a/usr/src/usr.bin/pascal/libpc/TEOLN.c +++ b/usr/src/usr.bin/pascal/libpc/TEOLN.c @@ -1,10 +1,11 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)TEOLN.c 1.1 %G%"; +static char sccsid[] = "@(#)TEOLN.c 1.2 %G%"; #include "h00vars.h" #include "h01errs.h" +bool TEOLN(filep) register struct iorec *filep; diff --git a/usr/src/usr.bin/pascal/libpc/TRUNC.c b/usr/src/usr.bin/pascal/libpc/TRUNC.c index 5a615a3a9a..67d5b8c927 100644 --- a/usr/src/usr.bin/pascal/libpc/TRUNC.c +++ b/usr/src/usr.bin/pascal/libpc/TRUNC.c @@ -1,7 +1,8 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)TRUNC.c 1.1 %G%"; +static char sccsid[] = "@(#)TRUNC.c 1.2 %G%"; +long TRUNC(value) double value; diff --git a/usr/src/usr.bin/pascal/libpc/UNPACK.c b/usr/src/usr.bin/pascal/libpc/UNPACK.c index 6ba20bdb83..fc1f9d84e1 100644 --- a/usr/src/usr.bin/pascal/libpc/UNPACK.c +++ b/usr/src/usr.bin/pascal/libpc/UNPACK.c @@ -1,6 +1,6 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)UNPACK.c 1.1 %G%"; +static char sccsid[] = "@(#)UNPACK.c 1.2 %G%"; #include "h01errs.h" @@ -15,13 +15,13 @@ static char sccsid[] = "@(#)UNPACK.c 1.1 %G%"; UNPACK(i, a, z, size_a, lb_a, ub_a, size_z) - int i; /* subscript into a to begin packing */ + long i; /* subscript into a to begin packing */ char *a; /* pointer to structure a */ char *z; /* pointer to structure z */ - int size_a; /* sizeof(a_type) */ - int lb_a; /* lower bound of structure a */ - int ub_a; /* (upper bound of a) - (lb_a + sizeof(z_type)) */ - int size_z; /* sizeof(z_type) */ + long size_a; /* sizeof(a_type) */ + long lb_a; /* lower bound of structure a */ + long ub_a; /* (upper bound of a) - (lb_a + sizeof(z_type)) */ + long size_z; /* sizeof(z_type) */ { int subscr; register char *cp; diff --git a/usr/src/usr.bin/pascal/libpc/WRITEC.c b/usr/src/usr.bin/pascal/libpc/WRITEC.c index 34513611c4..c248bb8bef 100644 --- a/usr/src/usr.bin/pascal/libpc/WRITEC.c +++ b/usr/src/usr.bin/pascal/libpc/WRITEC.c @@ -1,6 +1,6 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)WRITEC.c 1.1 %G%"; +static char sccsid[] = "@(#)WRITEC.c 1.2 %G%"; #include "h00vars.h" #include "h01errs.h" @@ -8,13 +8,14 @@ static char sccsid[] = "@(#)WRITEC.c 1.1 %G%"; WRITEC(curfile, d1, d2) register struct iorec *curfile; - int d1, d2; + long d1; + FILE *d2; { if (curfile->funit & FREAD) { ERROR(EWRITEIT, curfile->pfname); return; } - fputc(d1, d2); + fputc((char)d1, d2); if (ferror(curfile->fbuf)) { ERROR(EWRITE, curfile->pfname); return; diff --git a/usr/src/usr.bin/pascal/libpc/WRITEF.c b/usr/src/usr.bin/pascal/libpc/WRITEF.c index bc883c6f00..cbc4e20cfa 100644 --- a/usr/src/usr.bin/pascal/libpc/WRITEF.c +++ b/usr/src/usr.bin/pascal/libpc/WRITEF.c @@ -1,6 +1,6 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)WRITEF.c 1.1 %G%"; +static char sccsid[] = "@(#)WRITEF.c 1.2 %G%"; #include "h00vars.h" #include "h01errs.h" @@ -8,13 +8,47 @@ static char sccsid[] = "@(#)WRITEF.c 1.1 %G%"; WRITEF(curfile, d1, d2, d3, d4, d5, d6) register struct iorec *curfile; - int d1, d2, d3, d4, d5, d6; + FILE *d1; + char *d2; + long d3, d4, d5, d6; { if (curfile->funit & FREAD) { ERROR(EWRITEIT, curfile->pfname); return; } - fprintf(d1, d2, d3, d4, d5, d6); +# ifdef VAX + fprintf(d1, d2, d3, d4, d5, d6); +# else + { + register char *cp; + short scnt; + + scnt = 0; + for (cp = (char *)d2; *cp; ) + switch(*cp++) { + case '*': + case 's': + case 'c': + scnt++; + } + switch(scnt) { + case 0: + fprintf(d1, d2, d3, d4); + break; + case 1: + fprintf(d1, d2, (int)d3, d4, d5); + break; + case 2: + fprintf(d1, d2, (int)d3, (int)d4, d5, d6); + break; + default: + fprintf(stderr, "Panic: bad argcount %d to WRITEF\n", + scnt); + ERROR(EWRITE, curfile->pfname); + return; + } + } +# endif VAX if (ferror(curfile->fbuf)) { ERROR(EWRITE, curfile->pfname); return; diff --git a/usr/src/usr.bin/pascal/libpc/WRITES.c b/usr/src/usr.bin/pascal/libpc/WRITES.c index 93a234aa75..e5c2a37e4d 100644 --- a/usr/src/usr.bin/pascal/libpc/WRITES.c +++ b/usr/src/usr.bin/pascal/libpc/WRITES.c @@ -1,6 +1,6 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)WRITES.c 1.1 %G%"; +static char sccsid[] = "@(#)WRITES.c 1.2 %G%"; #include "h00vars.h" #include "h01errs.h" @@ -8,13 +8,15 @@ static char sccsid[] = "@(#)WRITES.c 1.1 %G%"; WRITES(curfile, d1, d2, d3, d4) register struct iorec *curfile; - int d1, d2, d3, d4; + FILE *d1; + long d2, d3; + char *d4; { if (curfile->funit & FREAD) { ERROR(EWRITEIT, curfile->pfname); return; } - fwrite(d1, d2, d3, d4); + fwrite(d1, (int)d2, (int)d3, d4); if (ferror(curfile->fbuf)) { ERROR(EWRITE, curfile->pfname); return; diff --git a/usr/src/usr.bin/pascal/libpc/h00vars.h b/usr/src/usr.bin/pascal/libpc/h00vars.h index 3401151f03..8228b9c249 100644 --- a/usr/src/usr.bin/pascal/libpc/h00vars.h +++ b/usr/src/usr.bin/pascal/libpc/h00vars.h @@ -1,26 +1,35 @@ /* Copyright (c) 1979 Regents of the University of California */ -/* sccsid[] = "@(#)h00vars.h 1.4 %G%"; */ +/* sccsid[] = "@(#)h00vars.h 1.5 %G%"; */ #include +#include "whoami.h" #define PXPFILE "pmon.out" #define BITSPERBYTE 8 #define BITSPERLONG (BITSPERBYTE * sizeof(long)) +#define LG2BITSBYTE 03 +#define MSKBITSBYTE 07 +#define LG2BITSLONG 05 +#define MSKBITSLONG 037 #define HZ 60 -#define TRUE 1 -#define FALSE 0 #define MAXLVL 20 #define MAXERRS 75 #define NAMSIZ 76 #define MAXFILES 32 #define PREDEF 2 +#ifdef VAX #define STDLVL ((struct iorec *)(0x7ffffff1)) #define GLVL ((struct iorec *)(0x7ffffff0)) +#else +#define STDLVL ((struct iorec *)(0xfff1)) +#define GLVL ((struct iorec *)(0xfff0)) +#endif VAX #define FILNIL ((struct iorec *)(0)) #define INPUT ((struct iorec *)(&input)) #define OUTPUT ((struct iorec *)(&output)) #define ERR ((struct iorec *)(&_err)) +typedef enum {FALSE, TRUE} bool; /* * runtime display structure diff --git a/usr/src/usr.bin/pascal/libpc/libpc.h b/usr/src/usr.bin/pascal/libpc/libpc.h index 27b064c9c7..092b18e65f 100644 --- a/usr/src/usr.bin/pascal/libpc/libpc.h +++ b/usr/src/usr.bin/pascal/libpc/libpc.h @@ -1,11 +1,55 @@ /* Copyright (c) 1979 Regents of the University of California */ -/* static char sccsid[] = "@(#)libpc.h 1.1 %G%"; */ +/* static char sccsid[] = "@(#)libpc.h 1.2 %G%"; */ +extern FILE *ACTFILE(); +extern long *ADDT(); +extern long CARD(); +extern char CHR(); +extern long CLCK(); +extern long *CTTOT(); +extern long ERROR(); +extern long EXPO(); +extern char *FNIL(); +extern long FCALL(); +extern struct formalrtn *FSAV(); +extern long FRET(); +extern struct iorec *GETNAME(); +extern bool IN(); +extern bool INCT(); extern double LN(); -extern double SQRT(); +extern long MAX(); +extern long *MULT(); +extern char *NAM(); +extern char *NIL(); +extern long PRED(); extern double RANDOM(); +extern char READC(); +extern long READ4(); +extern long READE(); extern double READ8(); -extern char *FNIL(); +extern bool RELNE(); +extern bool RELEQ(); +extern bool RELSLT(); +extern bool RELSLE(); +extern bool RELSGT(); +extern bool RELSGE(); +extern bool RELGLT(); +extern bool RELGLE(); +extern bool RELGGT(); +extern bool RELGGE(); +extern long ROUND(); +extern long RANG4(); +extern long RSNG4(); +extern long SCLCK(); +extern long SEED(); +extern double SQRT(); +extern long SUBSC(); +extern long SUBSCZ(); +extern long *SUBT(); +extern long SUCC(); +extern long TELL(); +extern bool TEOF(); +extern bool TEOLN(); +extern long TRUNC(); extern struct iorec *UNIT(); -extern struct formalrtn *FSAV(); -- 2.20.1