From 11854f4dfea1efe7fdf33afe80292a75963a8e3d Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 17 Jun 2018 22:30:27 +0200 Subject: [PATCH] Ansify and warning fix. --- lang/pc/libpc/LIST | 73 ------------------- lang/pc/libpc/abi.c | 3 +- lang/pc/libpc/abl.c | 3 +- lang/pc/libpc/abr.c | 3 +- lang/pc/libpc/arg.c | 23 +----- lang/pc/libpc/ass.c | 7 +- lang/pc/libpc/asz.c | 11 +-- lang/pc/libpc/atn.c | 7 +- lang/pc/libpc/bcp.c | 4 +- lang/pc/libpc/buff.c | 6 +- lang/pc/libpc/catch.c | 14 +--- lang/pc/libpc/clock.c | 49 ------------- lang/pc/libpc/cls.c | 12 +-- lang/pc/libpc/cvt.c | 17 ++--- lang/pc/libpc/diag.c | 5 +- lang/pc/libpc/efl.c | 9 +-- lang/pc/libpc/eln.c | 8 +- lang/pc/libpc/exp.c | 12 +-- lang/pc/libpc/get.c | 8 +- lang/pc/libpc/hlt.c | 10 +-- lang/pc/libpc/incpt.c | 8 +- lang/pc/libpc/ini.c | 21 +++--- lang/pc/libpc/log.c | 7 +- lang/pc/libpc/mdi.c | 12 ++- lang/pc/libpc/mdl.c | 6 +- lang/pc/libpc/new.c | 4 +- lang/pc/libpc/nfa.c | 6 +- lang/pc/libpc/nobuff.c | 6 +- lang/pc/libpc/notext.c | 4 +- lang/pc/libpc/opn.c | 29 ++------ lang/pc/libpc/outcpt.c | 9 +-- lang/pc/libpc/pac.c | 15 +--- lang/pc/libpc/pc.h | 141 ++++++++++++++++++++++-------------- lang/pc/libpc/pclose.c | 6 +- lang/pc/libpc/pcreat.c | 9 +-- lang/pc/libpc/pentry.c | 9 +-- lang/pc/libpc/perrno.c | 3 +- lang/pc/libpc/pexit.c | 9 +-- lang/pc/libpc/popen.c | 14 +--- lang/pc/libpc/put.c | 7 +- lang/pc/libpc/rcka.c | 12 +-- lang/pc/libpc/rdc.c | 7 +- lang/pc/libpc/rdi.c | 19 ++--- lang/pc/libpc/rdl.c | 10 +-- lang/pc/libpc/rdr.c | 14 +--- lang/pc/libpc/rf.c | 9 +-- lang/pc/libpc/rln.c | 7 +- lang/pc/libpc/rnd.c | 4 +- lang/pc/libpc/sin.c | 15 +--- lang/pc/libpc/sqt.c | 12 +-- lang/pc/libpc/string.c | 12 +-- lang/pc/libpc/unp.c | 16 +--- lang/pc/libpc/uread.c | 4 +- lang/pc/libpc/uwrite.c | 4 +- lang/pc/libpc/wdw.c | 8 +- lang/pc/libpc/wf.c | 8 +- lang/pc/libpc/wrc.c | 12 +-- lang/pc/libpc/wrf.c | 10 +-- lang/pc/libpc/wri.c | 12 +-- lang/pc/libpc/wrl.c | 17 ++--- lang/pc/libpc/wrr.c | 13 +--- plat/cpm/include/unistd.h | 1 + plat/pc86/include/unistd.h | 1 + plat/pdpv7/include/unistd.h | 1 + plat/rpi/include/unistd.h | 1 + 65 files changed, 255 insertions(+), 583 deletions(-) delete mode 100644 lang/pc/libpc/LIST delete mode 100644 lang/pc/libpc/clock.c diff --git a/lang/pc/libpc/LIST b/lang/pc/libpc/LIST deleted file mode 100644 index 297fe8bce..000000000 --- a/lang/pc/libpc/LIST +++ /dev/null @@ -1,73 +0,0 @@ -tail_pc.a -abi.c -abl.c -abr.c -arg.c -ass.c -asz.c -atn.c -bcp.c -bts.e -buff.c -clock.c -diag.c -dis.c -efl.c -eln.c -encaps.e -exp.c -get.c -gto.e -hlt.c -ini.c -catch.c -log.c -mdi.c -mdl.c -new.c -nobuff.c -notext.c -opn.c -hol0.e -pac.c -pclose.c -pcreat.c -pentry.c -perrno.c -pexit.c -popen.c -cls.c -put.c -rdc.c -rdl.c -rdr.c -rdi.c -rln.c -rf.c -rnd.c -sav.e -sig.e -sin.c -sqt.c -fef.e -string.c -trap.e -unp.c -uread.c -uwrite.c -wdw.c -incpt.c -wrc.c -wrf.c -wri.c -wrl.c -wrr.c -cvt.c -fif.e -wrz.c -wrs.c -outcpt.c -wf.c -nfa.c -rcka.c -trp.e diff --git a/lang/pc/libpc/abi.c b/lang/pc/libpc/abi.c index ae5bd8271..9971b292f 100644 --- a/lang/pc/libpc/abi.c +++ b/lang/pc/libpc/abi.c @@ -17,8 +17,9 @@ */ /* Author: J.W. Stevenson */ +#include "pc.h" -int _abi(i) int i; +int _abi(int i) { return (i >= 0 ? i : -i); } diff --git a/lang/pc/libpc/abl.c b/lang/pc/libpc/abl.c index 50a5fb285..0e9bc5708 100644 --- a/lang/pc/libpc/abl.c +++ b/lang/pc/libpc/abl.c @@ -17,8 +17,9 @@ */ /* Author: J.W. Stevenson */ +#include "pc.h" -long _abl(i) long i; +long _abl(long i) { return (i >= 0 ? i : -i); } diff --git a/lang/pc/libpc/abr.c b/lang/pc/libpc/abr.c index 3bde9f69c..a95a13948 100644 --- a/lang/pc/libpc/abr.c +++ b/lang/pc/libpc/abr.c @@ -17,8 +17,9 @@ */ /* Author: J.W. Stevenson */ +#include "pc.h" -double _abr(r) double r; +double _abr(double r) { return (r >= 0 ? r : -r); } diff --git a/lang/pc/libpc/arg.c b/lang/pc/libpc/arg.c index e512c534a..43c6c15f1 100644 --- a/lang/pc/libpc/arg.c +++ b/lang/pc/libpc/arg.c @@ -17,29 +17,26 @@ */ /* Author: J.W. Stevenson */ +#include "pc.h" /* function argc:integer; extern; */ /* function argv(i:integer):string; extern; */ /* procedure argshift; extern; */ /* function environ(i:integer):string; extern; */ -extern int _pargc; -extern char** _pargv; -extern char** _penvp; - -int argc() +int argc(void) { return (_pargc); } -char* argv(i) +char* argv(int i) { if (i >= _pargc) return (0); return (_pargv[i]); } -argshift() +void argshift(void) { if (_pargc > 1) @@ -48,15 +45,3 @@ argshift() _pargv++; } } - -char* environ(i) -{ - char** p; - char* q; - - if (p = _penvp) - while (q = *p++) - if (i-- < 0) - return (q); - return (0); -} diff --git a/lang/pc/libpc/ass.c b/lang/pc/libpc/ass.c index c702d2642..3f888344a 100644 --- a/lang/pc/libpc/ass.c +++ b/lang/pc/libpc/ass.c @@ -19,12 +19,9 @@ /* Author: J.W. Stevenson */ #include -#include +#include "pc.h" -extern char* _hol0(); -extern _trp(); - -_ass(line, bool) int line, bool; +void _ass(int line, int bool) { if (bool == 0) diff --git a/lang/pc/libpc/asz.c b/lang/pc/libpc/asz.c index 304d13a18..9148e9b8b 100644 --- a/lang/pc/libpc/asz.c +++ b/lang/pc/libpc/asz.c @@ -16,16 +16,11 @@ * */ -/* Author: J.W. Stevenson */ +#include "pc.h" -struct descr -{ - int low; - int diff; - int size; -}; +/* Author: J.W. Stevenson */ -int _asz(dp) struct descr* dp; +int _asz(struct descr* dp) { return (dp->size * (dp->diff + 1)); } diff --git a/lang/pc/libpc/atn.c b/lang/pc/libpc/atn.c index 2d05c7b4a..855dd2f80 100644 --- a/lang/pc/libpc/atn.c +++ b/lang/pc/libpc/atn.c @@ -10,12 +10,9 @@ #define __NO_DEFS #include -#if __STDC__ -#include -#endif +#include "pc.h" -double - _atn(x) double x; +double _atn(double x) { /* Algorithm and coefficients from: "Software manual for the elementary functions" diff --git a/lang/pc/libpc/bcp.c b/lang/pc/libpc/bcp.c index cb8d6a240..96dfc2b54 100644 --- a/lang/pc/libpc/bcp.c +++ b/lang/pc/libpc/bcp.c @@ -17,9 +17,9 @@ */ /* Author: J.W. Stevenson */ +#include "pc.h" -int _bcp(sz, y, x) int sz; -unsigned char *y, *x; +int _bcp(int sz, unsigned char* y, unsigned char* x) { while (--sz >= 0) diff --git a/lang/pc/libpc/buff.c b/lang/pc/libpc/buff.c index fdead046e..606ee088a 100644 --- a/lang/pc/libpc/buff.c +++ b/lang/pc/libpc/buff.c @@ -18,13 +18,11 @@ /* Author: J.W. Stevenson */ -#include - -extern _flush(); +#include "pc.h" /* procedure buff(var f:file of ?); */ -buff(f) struct file* f; +void buff(struct file* f) { int sz; diff --git a/lang/pc/libpc/catch.c b/lang/pc/libpc/catch.c index 127994c40..4221f9891 100644 --- a/lang/pc/libpc/catch.c +++ b/lang/pc/libpc/catch.c @@ -20,11 +20,7 @@ #include #include #include -#include -#include - -/* to make it easier to patch ... */ -extern struct file* _curfil; +#include "pc.h" static struct errm { @@ -83,14 +79,8 @@ static struct errm { -1, 0 } }; -extern int _pargc; -extern char** _pargv; -extern char** _penvp; - -extern char* _hol0(); -extern _trp(); -_catch(erno) unsigned erno; +void _catch(unsigned int erno) { register struct errm* ep = &errors[0]; char *p, *q, *s, **qq; diff --git a/lang/pc/libpc/clock.c b/lang/pc/libpc/clock.c deleted file mode 100644 index bd57240ec..000000000 --- a/lang/pc/libpc/clock.c +++ /dev/null @@ -1,49 +0,0 @@ -/* $Id$ */ -/* - * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands. - * - * This product is part of the Amsterdam Compiler Kit. - * - * Permission to use, sell, duplicate or disclose this software must be - * obtained in writing. Requests for such permissions may be sent to - * - * Dr. Andrew S. Tanenbaum - * Wiskundig Seminarium - * Vrije Universiteit - * Postbox 7161 - * 1007 MC Amsterdam - * The Netherlands - * - */ - -/* Author: J.W. Stevenson */ - -/* function clock:integer; extern; */ - -extern int _times(); - -struct tbuf -{ - long utime; - long stime; - long cutime; - long cstime; -}; - -#ifndef EM_WSIZE -#define EM_WSIZE _EM_WSIZE -#endif - -int clock() -{ - struct tbuf t; - - _times(&t); - return ((int)(t.utime + t.stime) & -#if EM_WSIZE <= 2 - 077777 -#else - 0x7fffffffL -#endif - ); -} diff --git a/lang/pc/libpc/cls.c b/lang/pc/libpc/cls.c index dcf3e381d..2cf88fe83 100644 --- a/lang/pc/libpc/cls.c +++ b/lang/pc/libpc/cls.c @@ -20,15 +20,9 @@ #include #include -#include -#include +#include "pc.h" -extern struct file* _curfil; -extern _trp(); -extern _flush(); -extern _outcpt(); - -_xcls(f) struct file* f; +void _xcls(struct file* f) { if ((f->flags & WRBIT) == 0) @@ -45,7 +39,7 @@ _xcls(f) struct file* f; _flush(f); } -_cls(f) struct file* f; +void _cls(struct file* f) { #ifdef MAYBE char* p; diff --git a/lang/pc/libpc/cvt.c b/lang/pc/libpc/cvt.c index bffe97eb5..2481a0f86 100644 --- a/lang/pc/libpc/cvt.c +++ b/lang/pc/libpc/cvt.c @@ -1,3 +1,5 @@ +#include "pc.h" + /* $Id$ */ #ifndef NOFLOAT @@ -8,19 +10,16 @@ #define DBL_MAX M_MAX_D #endif -static char* cvt(); +static char* cvt(double value, int ndigit, int* decpt, int* sign, int ecvtflag); + #define NDIGITS 128 -char* - _ecvt(value, ndigit, decpt, sign) double value; -int ndigit, *decpt, *sign; +char *_ecvt(double value, int ndigit, int *decpt, int *sign) { return cvt(value, ndigit, decpt, sign, 1); } -char* - _fcvt(value, ndigit, decpt, sign) double value; -int ndigit, *decpt, *sign; +char *_fcvt(double value, int ndigit, int *decpt, int *sign) { return cvt(value, ndigit, decpt, sign, 0); } @@ -40,9 +39,7 @@ static struct powers_of_10 1.0e0, 1.0e0, 0 }; -static char* - cvt(value, ndigit, decpt, sign, ecvtflag) double value; -int ndigit, *decpt, *sign; +static char* cvt(double value, int ndigit, int* decpt, int* sign, int ecvtflag) { static char buf[NDIGITS + 1]; register char* p = buf; diff --git a/lang/pc/libpc/diag.c b/lang/pc/libpc/diag.c index d4cffc0fd..69ca69c65 100644 --- a/lang/pc/libpc/diag.c +++ b/lang/pc/libpc/diag.c @@ -18,13 +18,12 @@ /* Author: J.W. Stevenson */ -#include +#include "pc.h" /* procedure diag(var f:text); */ -diag(f) struct file* f; +void diag(struct file* f) { - f->ptr = f->bufadr; f->flags = WRBIT | EOFBIT | ELNBIT | TXTBIT | MAGIC; f->fname = "DIAG"; diff --git a/lang/pc/libpc/efl.c b/lang/pc/libpc/efl.c index 8f3f7b1d3..280a59e57 100644 --- a/lang/pc/libpc/efl.c +++ b/lang/pc/libpc/efl.c @@ -20,14 +20,9 @@ #include #include -#include -#include +#include "pc.h" -extern struct file* _curfil; -extern _trp(); -extern _incpt(); - -int _efl(f) struct file* f; +int _efl(struct file* f) { _curfil = f; diff --git a/lang/pc/libpc/eln.c b/lang/pc/libpc/eln.c index ec6f53e05..beba1dc69 100644 --- a/lang/pc/libpc/eln.c +++ b/lang/pc/libpc/eln.c @@ -18,13 +18,9 @@ /* Author: J.W. Stevenson */ -#include -#include +#include "pc.h" -extern _trp(); -extern _rf(); - -int _eln(f) struct file* f; +int _eln(struct file* f) { _rf(f); diff --git a/lang/pc/libpc/exp.c b/lang/pc/libpc/exp.c index ab7eeb9a4..66def25e4 100644 --- a/lang/pc/libpc/exp.c +++ b/lang/pc/libpc/exp.c @@ -8,12 +8,10 @@ /* $Id$ */ #define __NO_DEFS #include -#include -extern _trp(); +#include "pc.h" #if __STDC__ #include -#include #define M_MIN_D DBL_MIN #define M_MAX_D DBL_MAX #define M_DMINEXP DBL_MIN_EXP @@ -21,11 +19,8 @@ extern _trp(); #undef HUGE #define HUGE 1e1000 -static double - Ldexp(fl, exp) double fl; -int exp; +static double Ldexp(double fl, int exp) { - extern double _fef(); int sign = 1; int currexp; @@ -57,8 +52,7 @@ int exp; return sign * fl; } -double - _exp(x) double x; +double _exp(double x) { /* Algorithm and coefficients from: "Software manual for the elementary functions" diff --git a/lang/pc/libpc/get.c b/lang/pc/libpc/get.c index 1b6c98f33..6c226f0e1 100644 --- a/lang/pc/libpc/get.c +++ b/lang/pc/libpc/get.c @@ -16,13 +16,9 @@ * */ -#include -#include +#include "pc.h" -extern _rf(); -extern _trp(); - -_get(f) struct file* f; +void _get(struct file* f) { _rf(f); diff --git a/lang/pc/libpc/hlt.c b/lang/pc/libpc/hlt.c index 3e4fa0120..a761d51eb 100644 --- a/lang/pc/libpc/hlt.c +++ b/lang/pc/libpc/hlt.c @@ -18,14 +18,10 @@ /* Author: J.W. Stevenson */ -#include +#include +#include "pc.h" -extern struct file** _extfl; -extern int _extflc; -extern _cls(); -extern _exit(); - -_hlt(ecode) int ecode; +void _hlt(int ecode) { int i; diff --git a/lang/pc/libpc/incpt.c b/lang/pc/libpc/incpt.c index 351ec7500..8e549d202 100644 --- a/lang/pc/libpc/incpt.c +++ b/lang/pc/libpc/incpt.c @@ -21,14 +21,10 @@ #include #include #include -#include -#include +#include "pc.h" -extern _trp(); - -_incpt(f) struct file* f; +void _incpt(struct file* f) { - if (f->flags & EOFBIT) _trp(EEOF); f->flags |= WINDOW; diff --git a/lang/pc/libpc/ini.c b/lang/pc/libpc/ini.c index 6f08daa83..d7e7e4d96 100644 --- a/lang/pc/libpc/ini.c +++ b/lang/pc/libpc/ini.c @@ -18,24 +18,21 @@ /* Author: J.W. Stevenson */ -#include -#include +#include "pc.h" -extern (*_sig())(); -extern _catch(); - -struct file** _extfl; -int _extflc; /* number of external files */ -char* _m_lb; /* LB of _m_a_i_n */ -struct file* _curfil; /* points to file struct in case of errors */ int _pargc; char** _pargv; char** _penvp; + +char* _m_lb; /* LB of _m_a_i_n */ +struct file* _curfil; /* points to file struct in case of errors */ + +int _extflc; +struct file** _extfl; + int _fp_hook = 1; /* This is for Minix, but does not harm others */ -_ini(args, c, p, mainlb) char* args, *mainlb; -int c; -struct file** p; +void _ini(char *args, int c, struct file **p, char *mainlb) { struct file* f; diff --git a/lang/pc/libpc/log.c b/lang/pc/libpc/log.c index de1e8083c..2ee2270a1 100644 --- a/lang/pc/libpc/log.c +++ b/lang/pc/libpc/log.c @@ -9,17 +9,15 @@ #define __NO_DEFS #include -#include +#include "pc.h" #if __STDC__ -#include #include #endif #undef HUGE #define HUGE 1e1000 -double - _log(x) double x; +double _log(double x) { /* Algorithm and coefficients from: "Software manual for the elementary functions" @@ -37,7 +35,6 @@ double 1.0 }; - extern double _fef(); double znum, zden, z, w; int exponent; diff --git a/lang/pc/libpc/mdi.c b/lang/pc/libpc/mdi.c index 9b119da45..be0160b9f 100644 --- a/lang/pc/libpc/mdi.c +++ b/lang/pc/libpc/mdi.c @@ -18,11 +18,9 @@ /* Author: J.W. Stevenson */ -#include +#include "pc.h" -extern _trp(); - -int _mdi(j, i) int j, i; +int _mdi(int j, int i) { if (j <= 0) @@ -33,7 +31,7 @@ int _mdi(j, i) int j, i; return (i); } -long _mdil(j, i) long j, i; +long _mdil(long j, long i) { if (j <= 0) @@ -44,7 +42,7 @@ long _mdil(j, i) long j, i; return (i); } -int _dvi(j, i) unsigned int j, i; +int _dvi(unsigned int j, unsigned int i) { int neg = 0; @@ -64,7 +62,7 @@ int _dvi(j, i) unsigned int j, i; return i; } -long _dvil(j, i) unsigned long j, i; +long _dvil(unsigned long j, unsigned long i) { int neg = 0; diff --git a/lang/pc/libpc/mdl.c b/lang/pc/libpc/mdl.c index c7acd5c3d..1c87577fc 100644 --- a/lang/pc/libpc/mdl.c +++ b/lang/pc/libpc/mdl.c @@ -18,11 +18,9 @@ /* Author: J.W. Stevenson */ -#include +#include "pc.h" -extern _trp(); - -long _mdl(j, i) long j, i; +long _mdl(long j, long i) { if (j <= 0) diff --git a/lang/pc/libpc/new.c b/lang/pc/libpc/new.c index faeb70c62..9ce78d41d 100644 --- a/lang/pc/libpc/new.c +++ b/lang/pc/libpc/new.c @@ -1,8 +1,6 @@ #include #include -#include - -extern void _trp(int); /* called on error */ +#include "pc.h" void _new(int n, void** ptr) { diff --git a/lang/pc/libpc/nfa.c b/lang/pc/libpc/nfa.c index d16f6332d..a876c7ee3 100644 --- a/lang/pc/libpc/nfa.c +++ b/lang/pc/libpc/nfa.c @@ -6,11 +6,9 @@ /* Author: Hans van Eck */ -#include +#include "pc.h" -extern _trp(); - -_nfa(bool) +void _nfa(int bool) { if (!bool) _trp(EFUNASS); diff --git a/lang/pc/libpc/nobuff.c b/lang/pc/libpc/nobuff.c index 934e396c8..1f3967988 100644 --- a/lang/pc/libpc/nobuff.c +++ b/lang/pc/libpc/nobuff.c @@ -18,13 +18,11 @@ /* Author: J.W. Stevenson */ -#include - -extern _flush(); +#include "pc.h" /* procedure nobuff(var f:file of ?); */ -nobuff(f) struct file* f; +void nobuff(struct file* f) { if ((f->flags & (0377 | WRBIT)) != (MAGIC | WRBIT)) diff --git a/lang/pc/libpc/notext.c b/lang/pc/libpc/notext.c index 3a22f98a0..2c0360913 100644 --- a/lang/pc/libpc/notext.c +++ b/lang/pc/libpc/notext.c @@ -16,9 +16,9 @@ * */ -#include +#include "pc.h" -notext(f) struct file* f; +void notext(struct file* f) { f->flags &= ~TXTBIT; } diff --git a/lang/pc/libpc/opn.c b/lang/pc/libpc/opn.c index dd2ea7418..f39189a63 100644 --- a/lang/pc/libpc/opn.c +++ b/lang/pc/libpc/opn.c @@ -19,22 +19,11 @@ /* Author: J.W. Stevenson */ #include +#include #include -#include -#include +#include "pc.h" -extern struct file** _extfl; -extern int _extflc; -extern struct file* _curfil; -extern int _pargc; -extern char** _pargv; -extern char** _penvp; - -extern _cls(); -extern _xcls(); -extern _trp(); - -static int tmpfil() +static int tmpfil(void) { static char namebuf[] = "/tmp/plf.xxxxx"; int i; @@ -55,15 +44,13 @@ static int tmpfil() goto error; if ((i = open(p, 2)) < 0) goto error; - if (remove(p) != 0) + if (unlink(p) != 0) error: _trp(EREWR); return (i); } -static int initfl(descr, sz, f) int descr; -int sz; -struct file* f; +static int initfl(int descr, int sz, struct file* f) { int i; @@ -117,16 +104,14 @@ struct file* f; return (1); } -_opn(sz, f) int sz; -struct file* f; +void _opn(int sz, struct file* f) { if (initfl(MAGIC, sz, f)) f->count = 0; } -_cre(sz, f) int sz; -struct file* f; +void _cre(int sz, struct file* f) { if (initfl(WRBIT | EOFBIT | ELNBIT | MAGIC, sz, f)) diff --git a/lang/pc/libpc/outcpt.c b/lang/pc/libpc/outcpt.c index 1e7693bc0..18993bf0a 100644 --- a/lang/pc/libpc/outcpt.c +++ b/lang/pc/libpc/outcpt.c @@ -21,12 +21,9 @@ #include #include #include -#include -#include +#include "pc.h" -extern _trp(); - -_flush(f) struct file* f; +void _flush(struct file* f) { int i, n; @@ -41,7 +38,7 @@ _flush(f) struct file* f; _trp(EWRITE); } -_outcpt(f) struct file* f; +void _outcpt(struct file* f) { f->flags &= ~ELNBIT; diff --git a/lang/pc/libpc/pac.c b/lang/pc/libpc/pac.c index 22cedbf88..a779c0ffc 100644 --- a/lang/pc/libpc/pac.c +++ b/lang/pc/libpc/pac.c @@ -18,9 +18,7 @@ /* Author: J.W. Stevenson */ -#include - -extern _trp(); +#include "pc.h" #define assert(x) /* nothing */ @@ -28,16 +26,7 @@ extern _trp(); #define EM_WSIZE _EM_WSIZE #endif -struct descr -{ - int low; - int diff; - int size; -}; - -_pac(ad, zd, zp, i, ap) int i; -struct descr *ad, *zd; -char *zp, *ap; +void _pac(struct descr *ad, struct descr *zd, char *zp, int i, char *ap) { if (zd->diff > ad->diff || (i -= ad->low) < 0 || (i + zd->diff) > ad->diff) diff --git a/lang/pc/libpc/pc.h b/lang/pc/libpc/pc.h index b3f533eab..a38c62637 100644 --- a/lang/pc/libpc/pc.h +++ b/lang/pc/libpc/pc.h @@ -5,11 +5,36 @@ #include "pc_file.h" #include "pc_math.h" +struct descr +{ + int low; + int diff; + int size; +}; + +struct array_descr +{ + int lbound; + unsigned n_elts_min_one; + unsigned size; /* doesn't really matter */ +}; + + +extern int _extflc; +extern struct file** _extfl; + +extern struct file* _curfil; +extern int _pargc; +extern char** _pargv; +extern char** _penvp; + +extern char* _m_lb; /* LB of _m_a_i_n */ +extern struct file* _curfil; /* points to file struct in case of errors */ + extern char *_ecvt(double value, int ndigit, int *decpt, int *sign); extern char *_fcvt(double value, int ndigit, int *decpt, int *sign); extern char *_wdw(struct file *f); extern char *argv(int i); -extern char *environ(int i); extern char *strbuf(char *s); extern double _abr(double r); extern double _atn(double x); @@ -18,67 +43,25 @@ extern double _exp(double x); extern double _log(double x); extern double _rdr(struct file *f); extern double _rnd(double r); +extern void _sig(void (*)(unsigned int)); extern double _sin(double x); extern double _sqt(double x); -extern int _abi(int i); -extern int _ass(int line, int bool); -extern int _asz(struct descr *dp); -extern int _bcp(int sz, unsigned char *y, unsigned char *x); -extern int _catch(unsigned erno); -extern int _cls(struct file *f); -extern int _cre(int sz, struct file *f); -extern int _dvi(unsigned int j, unsigned int i); -extern int _efl(struct file *f); -extern int _eln(struct file *f); -extern int _flush(struct file *f); -extern int _fstdig(struct file *f); -extern int _get(struct file *f); -extern int _getint(struct file *f); -extern int _getsig(struct file *f); -extern int _hlt(int ecode); -extern int _incpt(struct file *f); -extern int _ini(char *args, int c, struct file **p, char *mainlb); -extern int _mdi(int j, int i); -extern int _nfa(int bool); -extern int _nxtdig(struct file *f); -extern int _opn(int sz, struct file *f); -extern int _outcpt(struct file *f); -extern int _pac(struct descr *ad, struct descr *zd, char *zp, int i, char *ap); -extern int _pag(struct file *f); -extern int _put(struct file *f); -extern int _rcka(struct array_descr *descr, int index); -extern int _rdc(struct file *f); -extern int _rdi(struct file *f); -extern int _rf(struct file *f); -extern int _rln(struct file *f); -extern int _skipsp(struct file *f); -extern int _unp(struct descr *ad, struct descr *zd, int i, char *ap, char *zp, int noext); -extern int _wf(struct file *f); -extern int _wln(struct file *f); -extern int _wrc(int c, struct file *f); -extern int _wrf(int n, int w, double r, struct file *f); -extern int _wri(int i, struct file *f); -extern int _wrl(long l, struct file *f); -extern int _wrr(double r, struct file *f); -extern int _wsl(int w, long l, struct file *f); -extern int _wsr(int w, double r, struct file *f); -extern int _xcls(struct file *f); +extern void _xcls(struct file *f); extern int argc(void); -extern int argshift(void); -extern int buff(struct file *f); -extern int clock(void); -extern int diag(struct file *f); -extern int nobuff(struct file *f); -extern int notext(struct file *f); -extern int pclose(struct file *f); -extern int pcreat(struct file *f, char *s); +extern void argshift(void); +extern void buff(struct file *f); +extern void diag(struct file *f); +extern void nobuff(struct file *f); +extern void notext(struct file *f); +extern void pclose(struct file *f); +extern void pcreat(struct file *f, char *s); extern int perrno(void); -extern int popen(struct file *f, char *s); -extern int procentry(char *name); -extern int procexit(char *name); +extern void popen(struct file *f, char *s); +extern void procentry(char *name); +extern void procexit(char *name); extern int strfetch(char *s, int i); extern int strlen(char *s); -extern int strstore(char *s, int i, int c); +extern void strstore(char *s, int i, int c); extern int strtobuf(char *s, char *b, int l); extern int uread(int fd, char *b, int n); extern int uwrite(int fd, char *b, int n); @@ -87,16 +70,62 @@ extern long _dvil(unsigned long j, unsigned long i); extern long _mdil(long j, long i); extern long _mdl(long j, long i); extern long _rdl(struct file *f); +extern int _abi(int i); +extern void _ass(int line, int bool); +extern int _asz(struct descr *dp); +extern int _bcp(int sz, unsigned char *y, unsigned char *x); +extern void _catch(unsigned erno); +extern void _cls(struct file *f); +extern void _cre(int sz, struct file *f); extern void _dis(int n, void **ptr); +extern int _dvi(unsigned int j, unsigned int i); +extern int _efl(struct file *f); +extern int _eln(struct file *f); +extern double _fef(double fl, int* res); +extern double _fif(double f1, double f2, double* f3); +extern void _flush(struct file *f); +extern int _fstdig(struct file *f); +extern void _get(struct file *f); +extern int _getint(struct file *f); +extern int _getsig(struct file *f); +extern void _hlt(int ecode); +extern void _incpt(struct file *f); +extern void _ini(char *args, int c, struct file **p, char *mainlb); +extern int _mdi(int j, int i); extern void _new(int n, void **ptr); +extern void _nfa(int bool); +extern int _nxtdig(struct file *f); +extern void _opn(int sz, struct file *f); +extern void _outcpt(struct file *f); +extern void _pac(struct descr *ad, struct descr *zd, char *zp, int i, char *ap); +extern void _pag(struct file *f); +extern void _put(struct file *f); +extern void _rcka(struct array_descr *descr, int index); +extern int _rdc(struct file *f); +extern int _rdi(struct file *f); +extern void _rf(struct file *f); +extern void _rln(struct file *f); +extern void _skipsp(struct file *f); extern void _trp(int trapno); +extern void _unp(struct descr *ad, struct descr *zd, int i, char *ap, char *zp, int noext); +extern void _wf(struct file *f); +extern void _wln(struct file *f); extern void _wrb(int b, struct file *f); +extern void _wrc(int c, struct file *f); +extern void _wrf(int n, int w, double r, struct file *f); +extern void _wri(int i, struct file *f); +extern void _wrl(long l, struct file *f); +extern void _wrr(double r, struct file *f); extern void _wrs(int len, char *s, struct file *f); extern void _wrz(char *s, struct file *f); extern void _wsb(int w, int b, struct file* f); extern void _wsc(int w, char c, struct file* f); +extern void _wsi(int w, int i, struct file* f); +extern void _wsl(int w, long l, struct file *f); +extern void _wsr(int w, double r, struct file *f); extern void _wss(int w, int len, char* s, struct file* f); extern void _wstrin(int width, int len, char* buf, struct file* f); extern void _wsz(int w, char* s, struct file* f); +extern char* _hol0(void); #endif diff --git a/lang/pc/libpc/pclose.c b/lang/pc/libpc/pclose.c index 4f94168d9..270e7e5b0 100644 --- a/lang/pc/libpc/pclose.c +++ b/lang/pc/libpc/pclose.c @@ -16,13 +16,11 @@ * */ -#include - -extern _cls(); +#include "pc.h" /* procedure pclose(var f:file of ??); */ -pclose(f) struct file* f; +void pclose(struct file* f) { _cls(f); } diff --git a/lang/pc/libpc/pcreat.c b/lang/pc/libpc/pcreat.c index 3b522d1ff..39c8caa7c 100644 --- a/lang/pc/libpc/pcreat.c +++ b/lang/pc/libpc/pcreat.c @@ -19,16 +19,11 @@ /* Author: J.W. Stevenson */ #include -#include -#include - -extern _cls(); -extern _trp(); +#include "pc.h" /* procedure pcreat(var f:text; s:string); */ -pcreat(f, s) struct file* f; -char* s; +void pcreat(struct file* f, char* s) { _cls(f); /* initializes _curfil */ diff --git a/lang/pc/libpc/pentry.c b/lang/pc/libpc/pentry.c index 16ce893e6..bb3806d36 100644 --- a/lang/pc/libpc/pentry.c +++ b/lang/pc/libpc/pentry.c @@ -18,14 +18,9 @@ /* Author: J.W. Stevenson */ -#include +#include "pc.h" -extern struct file** _extfl; -extern _wrs(); -extern _wrz(); -extern _wln(); - -procentry(name) char* name; +void procentry(char* name) { struct file* f; diff --git a/lang/pc/libpc/perrno.c b/lang/pc/libpc/perrno.c index 488cbc4fe..e57e8b350 100644 --- a/lang/pc/libpc/perrno.c +++ b/lang/pc/libpc/perrno.c @@ -19,8 +19,9 @@ /* function perrno:integer; extern; */ #include +#include "pc.h" -int perrno() +int perrno(void) { return (errno); } diff --git a/lang/pc/libpc/pexit.c b/lang/pc/libpc/pexit.c index a8d1d438d..b42f71e25 100644 --- a/lang/pc/libpc/pexit.c +++ b/lang/pc/libpc/pexit.c @@ -16,14 +16,9 @@ * */ -#include +#include "pc.h" -extern struct file** _extfl; -extern _wrs(); -extern _wrz(); -extern _wln(); - -procexit(name) char* name; +void procexit(char* name) { struct file* f; diff --git a/lang/pc/libpc/popen.c b/lang/pc/libpc/popen.c index b180f9b67..2355913fa 100644 --- a/lang/pc/libpc/popen.c +++ b/lang/pc/libpc/popen.c @@ -18,19 +18,13 @@ /* Author: J.W. Stevenson */ -#include -#include - -extern _cls(); -extern _trp(); -extern int _open(); +#include "fcntl.h" +#include "pc.h" /* procedure popen(var f:text; s:string); */ -popen(f, s) struct file* f; -char* s; +void popen(struct file* f, char* s) { - _cls(f); /* initializes _curfil */ f->ptr = f->bufadr; f->flags = TXTBIT | MAGIC; @@ -38,6 +32,6 @@ char* s; f->size = 1; f->count = 0; f->buflen = PC_BUFLEN; - if ((f->ufd = _open(s, 0)) < 0) + if ((f->ufd = open(s, 0)) < 0) _trp(ERESET); } diff --git a/lang/pc/libpc/put.c b/lang/pc/libpc/put.c index e127115d5..d2b832f94 100644 --- a/lang/pc/libpc/put.c +++ b/lang/pc/libpc/put.c @@ -16,12 +16,9 @@ * */ -#include +#include "pc.h" -extern _wf(); -extern _outcpt(); - -_put(f) struct file* f; +void _put(struct file* f) { _wf(f); _outcpt(f); diff --git a/lang/pc/libpc/rcka.c b/lang/pc/libpc/rcka.c index 732f4c12a..055b7d1c5 100644 --- a/lang/pc/libpc/rcka.c +++ b/lang/pc/libpc/rcka.c @@ -6,18 +6,10 @@ /* Author: Hans van Eck */ +#include "pc.h" #include -extern _trp(); - -struct array_descr -{ - int lbound; - unsigned n_elts_min_one; - unsigned size; /* doesn't really matter */ -}; - -_rcka(descr, index) struct array_descr* descr; +void _rcka(struct array_descr* descr, int index) { if (index < descr->lbound || index > (int)descr->n_elts_min_one + descr->lbound) _trp(EARRAY); diff --git a/lang/pc/libpc/rdc.c b/lang/pc/libpc/rdc.c index 27df316f1..ef7eb3051 100644 --- a/lang/pc/libpc/rdc.c +++ b/lang/pc/libpc/rdc.c @@ -16,12 +16,9 @@ * */ -#include +#include "pc.h" -extern _rf(); -extern _incpt(); - -int _rdc(f) struct file* f; +int _rdc(struct file* f) { int c; diff --git a/lang/pc/libpc/rdi.c b/lang/pc/libpc/rdi.c index eaf3117cf..33e1de897 100644 --- a/lang/pc/libpc/rdi.c +++ b/lang/pc/libpc/rdi.c @@ -18,20 +18,15 @@ /* Author: J.W. Stevenson */ -#include -#include +#include "pc.h" -extern _trp(); -extern _rf(); -extern _incpt(); - -_skipsp(f) struct file* f; +void _skipsp(struct file* f) { while ((*f->ptr == ' ') || (*f->ptr == '\t')) _incpt(f); } -int _getsig(f) struct file* f; +int _getsig(struct file* f) { int sign; @@ -40,7 +35,7 @@ int _getsig(f) struct file* f; return (sign); } -int _fstdig(f) struct file* f; +int _fstdig(struct file* f) { int ch; @@ -53,7 +48,7 @@ int _fstdig(f) struct file* f; return (ch); } -int _nxtdig(f) struct file* f; +int _nxtdig(struct file* f) { int ch; @@ -64,7 +59,7 @@ int _nxtdig(f) struct file* f; return (ch); } -int _getint(f) struct file* f; +int _getint(struct file* f) { int is_signed, i, ch; @@ -77,7 +72,7 @@ int _getint(f) struct file* f; return (is_signed ? i : -i); } -int _rdi(f) struct file* f; +int _rdi(struct file* f) { _rf(f); _skipsp(f); diff --git a/lang/pc/libpc/rdl.c b/lang/pc/libpc/rdl.c index 3cf731f5b..110d4130d 100644 --- a/lang/pc/libpc/rdl.c +++ b/lang/pc/libpc/rdl.c @@ -18,15 +18,9 @@ /* Author: J.W. Stevenson */ -#include +#include "pc.h" -extern _rf(); -extern _skipsp(); -extern int _getsig(); -extern int _fstdig(); -extern int _nxtdig(); - -long _rdl(f) struct file* f; +long _rdl(struct file* f) { int is_signed, ch; long l; diff --git a/lang/pc/libpc/rdr.c b/lang/pc/libpc/rdr.c index 5c8ccec51..c8112fac8 100644 --- a/lang/pc/libpc/rdr.c +++ b/lang/pc/libpc/rdr.c @@ -18,22 +18,14 @@ /* Author: J.W. Stevenson */ -#include +#include "pc.h" #define BIG 1e17 -extern _rf(); -extern _incpt(); -extern _skipsp(); -extern int _getsig(); -extern int _getint(); -extern int _fstdig(); -extern int _nxtdig(); - static double r; static int pow10; -static dig(ch) int ch; +static void dig(int ch) { if (r > BIG) @@ -42,7 +34,7 @@ static dig(ch) int ch; r = r * 10.0 + ch; } -double _rdr(f) struct file* f; +double _rdr(struct file* f) { int i; double e; diff --git a/lang/pc/libpc/rf.c b/lang/pc/libpc/rf.c index a90a9aeb5..498408836 100644 --- a/lang/pc/libpc/rf.c +++ b/lang/pc/libpc/rf.c @@ -16,14 +16,9 @@ * */ -#include -#include +#include "pc.h" -extern struct file* _curfil; -extern _trp(); -extern _incpt(); - -_rf(f) struct file* f; +void _rf(struct file* f) { _curfil = f; diff --git a/lang/pc/libpc/rln.c b/lang/pc/libpc/rln.c index 2c95f4415..20d61f53f 100644 --- a/lang/pc/libpc/rln.c +++ b/lang/pc/libpc/rln.c @@ -16,12 +16,9 @@ * */ -#include +#include "pc.h" -extern _rf(); -extern _incpt(); - -_rln(f) struct file* f; +void _rln(struct file* f) { _rf(f); diff --git a/lang/pc/libpc/rnd.c b/lang/pc/libpc/rnd.c index 67fe2f379..6709ce1f9 100644 --- a/lang/pc/libpc/rnd.c +++ b/lang/pc/libpc/rnd.c @@ -16,7 +16,9 @@ * */ -double _rnd(r) double r; +#include "pc.h" + +double _rnd(double r) { return (r + (r < 0 ? -0.5 : 0.5)); } diff --git a/lang/pc/libpc/sin.c b/lang/pc/libpc/sin.c index a483bed66..3b5965369 100644 --- a/lang/pc/libpc/sin.c +++ b/lang/pc/libpc/sin.c @@ -9,13 +9,9 @@ #define __NO_DEFS #include +#include "pc.h" -#if __STDC__ -#include -#endif - -static double - sinus(x, cos_flag) double x; +static double sinus(double x, int cos_flag) { /* Algorithm and coefficients from: "Software manual for the elementary functions" @@ -62,7 +58,6 @@ static double #define A2 -8.908910206761537356617e-6 { double x1, x2; - extern double _fif(); _fif(y, 1.0, &y); if (_fif(y, 0.5, &x1)) @@ -90,14 +85,12 @@ static double return neg ? -x : x; } -double - _sin(x) double x; +double _sin(double x) { return sinus(x, 0); } -double - _cos(x) double x; +double _cos(double x) { if (x < 0) x = -x; diff --git a/lang/pc/libpc/sqt.c b/lang/pc/libpc/sqt.c index efaf7053d..122bab100 100644 --- a/lang/pc/libpc/sqt.c +++ b/lang/pc/libpc/sqt.c @@ -8,16 +8,12 @@ /* $Id$ */ #define __NO_DEFS #include -#include -extern _trp(); +#include "pc.h" #define NITER 5 -static double - Ldexp(fl, exp) double fl; -int exp; +static double Ldexp(double fl, int exp) { - extern double _fef(); int sign = 1; int currexp; @@ -49,10 +45,8 @@ int exp; return sign * fl; } -double - _sqt(x) double x; +double _sqt(double x) { - extern double _fef(); int exponent; double val; diff --git a/lang/pc/libpc/string.c b/lang/pc/libpc/string.c index 8cc8a68f5..0da9b4764 100644 --- a/lang/pc/libpc/string.c +++ b/lang/pc/libpc/string.c @@ -16,16 +16,18 @@ * */ +#include "pc.h" + /* function strbuf(var b:charbuf):string; */ -char* strbuf(s) char* s; +char* strbuf(char* s) { return (s); } /* function strtobuf(s:string; var b:charbuf; blen:integer):integer; */ -int strtobuf(s, b, l) char *s, *b; +int strtobuf(char* s, char* b, int l) { int i; @@ -41,7 +43,7 @@ int strtobuf(s, b, l) char *s, *b; /* function strlen(s:string):integer; */ -int strlen(s) char* s; +int strlen(char* s) { int i; @@ -53,14 +55,14 @@ int strlen(s) char* s; /* function strfetch(s:string; i:integer):char; */ -int strfetch(s, i) char* s; +int strfetch(char* s, int i) { return (s[i - 1]); } /* procedure strstore(s:string; i:integer; c:char); */ -strstore(s, i, c) char* s; +void strstore(char* s, int i, int c) { s[i - 1] = c; } diff --git a/lang/pc/libpc/unp.c b/lang/pc/libpc/unp.c index 3479fa70b..b335f78ee 100644 --- a/lang/pc/libpc/unp.c +++ b/lang/pc/libpc/unp.c @@ -18,9 +18,7 @@ /* Author: J.W. Stevenson */ -#include - -extern _trp(); +#include "pc.h" #define assert(x) /* nothing */ @@ -28,17 +26,7 @@ extern _trp(); #define EM_WSIZE _EM_WSIZE #endif -struct descr -{ - int low; - int diff; - int size; -}; - -_unp(ad, zd, i, ap, zp, noext) int i; -struct descr *ad, *zd; -char *ap, *zp; -int noext; +void _unp(struct descr *ad, struct descr *zd, int i, char *ap, char *zp, int noext) { if (zd->diff > ad->diff || (i -= ad->low) < 0 || (i + zd->diff) > ad->diff) diff --git a/lang/pc/libpc/uread.c b/lang/pc/libpc/uread.c index b20c3c0bb..c9de43867 100644 --- a/lang/pc/libpc/uread.c +++ b/lang/pc/libpc/uread.c @@ -20,9 +20,9 @@ #include #include +#include "pc.h" -int uread(fd, b, n) char* b; -int fd, n; +int uread(int fd, char* b, int n) { return (read(fd, b, n)); } diff --git a/lang/pc/libpc/uwrite.c b/lang/pc/libpc/uwrite.c index bf8381cd7..35451b707 100644 --- a/lang/pc/libpc/uwrite.c +++ b/lang/pc/libpc/uwrite.c @@ -20,9 +20,9 @@ #include #include +#include "pc.h" -int uwrite(fd, b, n) char* b; -int fd, n; +int uwrite(int fd, char* b, int n) { return (write(fd, b, n)); } diff --git a/lang/pc/libpc/wdw.c b/lang/pc/libpc/wdw.c index 0c45bf215..c91a6d775 100644 --- a/lang/pc/libpc/wdw.c +++ b/lang/pc/libpc/wdw.c @@ -16,14 +16,10 @@ * */ -#include +#include "pc.h" -extern struct file* _curfil; -extern _incpt(); - -char* _wdw(f) struct file* f; +char* _wdw(struct file* f) { - _curfil = f; if ((f->flags & (WINDOW | WRBIT | 0377)) == MAGIC) _incpt(f); diff --git a/lang/pc/libpc/wf.c b/lang/pc/libpc/wf.c index 945d72533..a554fcfef 100644 --- a/lang/pc/libpc/wf.c +++ b/lang/pc/libpc/wf.c @@ -16,13 +16,9 @@ * */ -#include -#include +#include "pc.h" -extern struct file* _curfil; -extern _trp(); - -_wf(f) struct file* f; +void _wf(struct file* f) { _curfil = f; diff --git a/lang/pc/libpc/wrc.c b/lang/pc/libpc/wrc.c index 437d73a54..9055050da 100644 --- a/lang/pc/libpc/wrc.c +++ b/lang/pc/libpc/wrc.c @@ -16,20 +16,16 @@ * */ -#include +#include "pc.h" -extern _wf(); -extern _outcpt(); - -_wrc(c, f) int c; -struct file* f; +void _wrc(int c, struct file* f) { *f->ptr = c; _wf(f); _outcpt(f); } -_wln(f) struct file* f; +void _wln(struct file* f) { #ifdef CPM _wrc('\r', f); @@ -38,7 +34,7 @@ _wln(f) struct file* f; f->flags |= ELNBIT; } -_pag(f) struct file* f; +void _pag(struct file* f) { _wrc('\014', f); f->flags |= ELNBIT; diff --git a/lang/pc/libpc/wrf.c b/lang/pc/libpc/wrf.c index 5c213c7c6..5662ad89b 100644 --- a/lang/pc/libpc/wrf.c +++ b/lang/pc/libpc/wrf.c @@ -18,11 +18,7 @@ /* Author: J.W. Stevenson */ -#include -#include - -extern _wstrin(); -extern char* _fcvt(); +#include "pc.h" #define assert(x) /* nothing */ @@ -36,9 +32,7 @@ extern char* _fcvt(); #define FILL_CHAR '0' /* char printed if all of _fcvt() used */ #define BUFSIZE HUGE_DIG + PREC_DIG + 3 -_wrf(n, w, r, f) int n, w; -double r; -struct file* f; +void _wrf(int n, int w, double r, struct file* f) { char *p, *b; int s, d; diff --git a/lang/pc/libpc/wri.c b/lang/pc/libpc/wri.c index b027bc6f9..7a30a6ce9 100644 --- a/lang/pc/libpc/wri.c +++ b/lang/pc/libpc/wri.c @@ -16,10 +16,7 @@ * */ -#include -#include - -extern _wstrin(); +#include "pc.h" #ifndef EM_WSIZE #ifdef _EM_WSIZE @@ -47,9 +44,7 @@ extern _wstrin(); Something wrong here ! #endif - _wsi(w, i, f) int w, - i; -struct file* f; +void _wsi(int w, int i, struct file* f) { char* p; int j; @@ -75,8 +70,7 @@ struct file* f; _wstrin(w, (int)(&buf[SZ] - p), p, f); } -_wri(i, f) int i; -struct file* f; +void _wri(int i, struct file* f) { _wsi(SZ, i, f); } diff --git a/lang/pc/libpc/wrl.c b/lang/pc/libpc/wrl.c index c5bfff928..eafb912ab 100644 --- a/lang/pc/libpc/wrl.c +++ b/lang/pc/libpc/wrl.c @@ -18,16 +18,10 @@ /* Author: J.W. Stevenson */ -#include -#include +#include "pc.h" +#include -extern _wstrin(); - -#define MAXNEGLONG -2147483648 - -_wsl(w, l, f) int w; -long l; -struct file* f; +void _wsl(int w, long l, struct file* f) { char *p, c; long j; @@ -38,7 +32,7 @@ struct file* f; p = &buf[11]; if ((j = l) < 0) { - if (l == MAXNEGLONG) + if (l == LONG_MIN) { _wstrin(w, 11, "-2147483648", f); return; @@ -55,8 +49,7 @@ struct file* f; _wstrin(w, (int)(&buf[11] - p), p, f); } -_wrl(l, f) long l; -struct file* f; +void _wrl(long l, struct file* f) { _wsl(11, l, f); } diff --git a/lang/pc/libpc/wrr.c b/lang/pc/libpc/wrr.c index 8f99062ca..c61ec2f5b 100644 --- a/lang/pc/libpc/wrr.c +++ b/lang/pc/libpc/wrr.c @@ -18,17 +18,11 @@ /* Author: J.W. Stevenson */ -#include -#include - -extern _wstrin(); -extern char* _ecvt(); +#include "pc.h" #define PREC_DIG 80 /* maximum digits produced by _ecvt() */ -_wsr(w, r, f) int w; -double r; -struct file* f; +void _wsr(int w, double r, struct file* f) { char *p, *b; int s, d, i; @@ -72,8 +66,7 @@ struct file* f; _wstrin(w, (int)(p - buf), buf, f); } -_wrr(r, f) double r; -struct file* f; +void _wrr(double r, struct file* f) { _wsr(13, r, f); } diff --git a/plat/cpm/include/unistd.h b/plat/cpm/include/unistd.h index ea4f51c0f..99f1fb2d4 100644 --- a/plat/cpm/include/unistd.h +++ b/plat/cpm/include/unistd.h @@ -45,6 +45,7 @@ extern int open(const char* path, int access, ...); extern int creat(const char* path, mode_t mode); extern int read(int fd, void* buffer, size_t count); extern int write(int fd, void* buffer, size_t count); +extern int unlink(const char* path); /* Unimplemented system calls (these are just prototypes to let the library * compile). */ diff --git a/plat/pc86/include/unistd.h b/plat/pc86/include/unistd.h index 174c43ad0..77bdcf10d 100644 --- a/plat/pc86/include/unistd.h +++ b/plat/pc86/include/unistd.h @@ -46,6 +46,7 @@ extern int open(const char* path, int access, ...); extern int creat(const char* path, mode_t mode); extern int read(int fd, void* buffer, size_t count); extern int write(int fd, void* buffer, size_t count); +extern int unlink(const char* path); /* Unimplemented system calls (these are just prototypes to let the library * compile). */ diff --git a/plat/pdpv7/include/unistd.h b/plat/pdpv7/include/unistd.h index 2b48dd6bf..31167015f 100644 --- a/plat/pdpv7/include/unistd.h +++ b/plat/pdpv7/include/unistd.h @@ -67,6 +67,7 @@ extern int open(const char* path, int access, ...); extern int creat(const char* path, mode_t mode); extern int read(int fd, void* buffer, size_t count); extern int write(int fd, void* buffer, size_t count); +extern int unlink(const char* path); /* Unimplemented system calls (these are just prototypes to let the library * compile). */ diff --git a/plat/rpi/include/unistd.h b/plat/rpi/include/unistd.h index 6c220d10f..506d781ee 100644 --- a/plat/rpi/include/unistd.h +++ b/plat/rpi/include/unistd.h @@ -67,6 +67,7 @@ extern int open(const char* path, int access, ...); extern int creat(const char* path, mode_t mode); extern int read(int fd, void* buffer, size_t count); extern int write(int fd, void* buffer, size_t count); +extern int unlink(const char* path); /* Unimplemented system calls (these are just prototypes to let the library * compile). */ -- 2.34.1