Ansify and warning fix.
This commit is contained in:
		
							parent
							
								
									5784f5fabe
								
							
						
					
					
						commit
						11854f4dfe
					
				
					 65 changed files with 255 additions and 583 deletions
				
			
		|  | @ -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 | ||||
|  | @ -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); | ||||
| } | ||||
|  |  | |||
|  | @ -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); | ||||
| } | ||||
|  |  | |||
|  | @ -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); | ||||
| } | ||||
|  |  | |||
|  | @ -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); | ||||
| } | ||||
|  |  | |||
|  | @ -19,12 +19,9 @@ | |||
| /* Author: J.W. Stevenson */ | ||||
| 
 | ||||
| #include <em_abs.h> | ||||
| #include <pc_err.h> | ||||
| #include "pc.h" | ||||
| 
 | ||||
| extern char* _hol0(); | ||||
| extern _trp(); | ||||
| 
 | ||||
| _ass(line, bool) int line, bool; | ||||
| void _ass(int line, int bool) | ||||
| { | ||||
| 
 | ||||
| 	if (bool == 0) | ||||
|  |  | |||
|  | @ -16,16 +16,11 @@ | |||
|  * | ||||
|  */ | ||||
| 
 | ||||
| #include "pc.h" | ||||
| 
 | ||||
| /* Author: J.W. Stevenson */ | ||||
| 
 | ||||
| struct descr | ||||
| { | ||||
| 	int low; | ||||
| 	int diff; | ||||
| 	int size; | ||||
| }; | ||||
| 
 | ||||
| int _asz(dp) struct descr* dp; | ||||
| int _asz(struct descr* dp) | ||||
| { | ||||
| 	return (dp->size * (dp->diff + 1)); | ||||
| } | ||||
|  |  | |||
|  | @ -10,12 +10,9 @@ | |||
| #define __NO_DEFS | ||||
| #include <math.h> | ||||
| 
 | ||||
| #if __STDC__ | ||||
| #include <pc_math.h> | ||||
| #endif | ||||
| #include "pc.h" | ||||
| 
 | ||||
| double | ||||
|     _atn(x) double x; | ||||
| double _atn(double x) | ||||
| { | ||||
| 	/*	Algorithm and coefficients from:
 | ||||
| 			"Software manual for the elementary functions" | ||||
|  |  | |||
|  | @ -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) | ||||
|  |  | |||
|  | @ -18,13 +18,11 @@ | |||
| 
 | ||||
| /* Author: J.W. Stevenson */ | ||||
| 
 | ||||
| #include <pc_file.h> | ||||
| 
 | ||||
| extern _flush(); | ||||
| #include "pc.h" | ||||
| 
 | ||||
| /* procedure buff(var f:file of ?); */ | ||||
| 
 | ||||
| buff(f) struct file* f; | ||||
| void buff(struct file* f) | ||||
| { | ||||
| 	int sz; | ||||
| 
 | ||||
|  |  | |||
|  | @ -20,11 +20,7 @@ | |||
| #include <errno.h> | ||||
| #include <unistd.h> | ||||
| #include <em_abs.h> | ||||
| #include <pc_err.h> | ||||
| #include <pc_file.h> | ||||
| 
 | ||||
| /* 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; | ||||
|  |  | |||
|  | @ -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 | ||||
| 	    ); | ||||
| } | ||||
|  | @ -20,15 +20,9 @@ | |||
| 
 | ||||
| #include <stdlib.h> | ||||
| #include <unistd.h> | ||||
| #include <pc_file.h> | ||||
| #include <pc_err.h> | ||||
| #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; | ||||
|  |  | |||
|  | @ -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; | ||||
|  |  | |||
|  | @ -18,13 +18,12 @@ | |||
| 
 | ||||
| /* Author: J.W. Stevenson */ | ||||
| 
 | ||||
| #include <pc_file.h> | ||||
| #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"; | ||||
|  |  | |||
|  | @ -20,14 +20,9 @@ | |||
| 
 | ||||
| #include <stdlib.h> | ||||
| #include <errno.h> | ||||
| #include <pc_file.h> | ||||
| #include <pc_err.h> | ||||
| #include "pc.h" | ||||
| 
 | ||||
| extern struct file* _curfil; | ||||
| extern _trp(); | ||||
| extern _incpt(); | ||||
| 
 | ||||
| int _efl(f) struct file* f; | ||||
| int _efl(struct file* f) | ||||
| { | ||||
| 
 | ||||
| 	_curfil = f; | ||||
|  |  | |||
|  | @ -18,13 +18,9 @@ | |||
| 
 | ||||
| /* Author: J.W. Stevenson */ | ||||
| 
 | ||||
| #include <pc_file.h> | ||||
| #include <pc_err.h> | ||||
| #include "pc.h" | ||||
| 
 | ||||
| extern _trp(); | ||||
| extern _rf(); | ||||
| 
 | ||||
| int _eln(f) struct file* f; | ||||
| int _eln(struct file* f) | ||||
| { | ||||
| 
 | ||||
| 	_rf(f); | ||||
|  |  | |||
|  | @ -8,12 +8,10 @@ | |||
| /* $Id$ */ | ||||
| #define __NO_DEFS | ||||
| #include <math.h> | ||||
| #include <pc_err.h> | ||||
| extern _trp(); | ||||
| #include "pc.h" | ||||
| 
 | ||||
| #if __STDC__ | ||||
| #include <float.h> | ||||
| #include <pc_math.h> | ||||
| #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" | ||||
|  |  | |||
|  | @ -16,13 +16,9 @@ | |||
|  * | ||||
|  */ | ||||
| 
 | ||||
| #include <pc_file.h> | ||||
| #include <pc_err.h> | ||||
| #include "pc.h" | ||||
| 
 | ||||
| extern _rf(); | ||||
| extern _trp(); | ||||
| 
 | ||||
| _get(f) struct file* f; | ||||
| void _get(struct file* f) | ||||
| { | ||||
| 
 | ||||
| 	_rf(f); | ||||
|  |  | |||
|  | @ -18,14 +18,10 @@ | |||
| 
 | ||||
| /* Author: J.W. Stevenson */ | ||||
| 
 | ||||
| #include <pc_file.h> | ||||
| #include <unistd.h> | ||||
| #include "pc.h" | ||||
| 
 | ||||
| extern struct file** _extfl; | ||||
| extern int _extflc; | ||||
| extern _cls(); | ||||
| extern _exit(); | ||||
| 
 | ||||
| _hlt(ecode) int ecode; | ||||
| void _hlt(int ecode) | ||||
| { | ||||
| 	int i; | ||||
| 
 | ||||
|  |  | |||
|  | @ -21,14 +21,10 @@ | |||
| #include <stdlib.h> | ||||
| #include <errno.h> | ||||
| #include <unistd.h> | ||||
| #include <pc_file.h> | ||||
| #include <pc_err.h> | ||||
| #include "pc.h" | ||||
| 
 | ||||
| extern _trp(); | ||||
| 
 | ||||
| _incpt(f) struct file* f; | ||||
| void _incpt(struct file* f) | ||||
| { | ||||
| 
 | ||||
| 	if (f->flags & EOFBIT) | ||||
| 		_trp(EEOF); | ||||
| 	f->flags |= WINDOW; | ||||
|  |  | |||
|  | @ -18,24 +18,21 @@ | |||
| 
 | ||||
| /* Author: J.W. Stevenson */ | ||||
| 
 | ||||
| #include <pc_file.h> | ||||
| #include <pc_err.h> | ||||
| #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; | ||||
| 
 | ||||
|  |  | |||
|  | @ -9,17 +9,15 @@ | |||
| 
 | ||||
| #define __NO_DEFS | ||||
| #include <math.h> | ||||
| #include <pc_err.h> | ||||
| #include "pc.h" | ||||
| 
 | ||||
| #if __STDC__ | ||||
| #include <pc_math.h> | ||||
| #include <float.h> | ||||
| #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; | ||||
| 
 | ||||
|  |  | |||
|  | @ -18,11 +18,9 @@ | |||
| 
 | ||||
| /* Author: J.W. Stevenson */ | ||||
| 
 | ||||
| #include <pc_err.h> | ||||
| #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; | ||||
| 
 | ||||
|  |  | |||
|  | @ -18,11 +18,9 @@ | |||
| 
 | ||||
| /* Author: J.W. Stevenson */ | ||||
| 
 | ||||
| #include <pc_err.h> | ||||
| #include "pc.h" | ||||
| 
 | ||||
| extern _trp(); | ||||
| 
 | ||||
| long _mdl(j, i) long j, i; | ||||
| long _mdl(long j, long i) | ||||
| { | ||||
| 
 | ||||
| 	if (j <= 0) | ||||
|  |  | |||
|  | @ -1,8 +1,6 @@ | |||
| #include <stdlib.h> | ||||
| #include <em_abs.h> | ||||
| #include <pc_err.h> | ||||
| 
 | ||||
| extern void _trp(int); /* called on error */ | ||||
| #include "pc.h" | ||||
| 
 | ||||
| void _new(int n, void** ptr) | ||||
| { | ||||
|  |  | |||
|  | @ -6,11 +6,9 @@ | |||
| 
 | ||||
| /* Author: Hans van Eck */ | ||||
| 
 | ||||
| #include <pc_err.h> | ||||
| #include "pc.h" | ||||
| 
 | ||||
| extern _trp(); | ||||
| 
 | ||||
| _nfa(bool) | ||||
| void _nfa(int bool) | ||||
| { | ||||
| 	if (!bool) | ||||
| 		_trp(EFUNASS); | ||||
|  |  | |||
|  | @ -18,13 +18,11 @@ | |||
| 
 | ||||
| /* Author: J.W. Stevenson */ | ||||
| 
 | ||||
| #include <pc_file.h> | ||||
| 
 | ||||
| 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)) | ||||
|  |  | |||
|  | @ -16,9 +16,9 @@ | |||
|  * | ||||
|  */ | ||||
| 
 | ||||
| #include <pc_file.h> | ||||
| #include "pc.h" | ||||
| 
 | ||||
| notext(f) struct file* f; | ||||
| void notext(struct file* f) | ||||
| { | ||||
| 	f->flags &= ~TXTBIT; | ||||
| } | ||||
|  |  | |||
|  | @ -19,22 +19,11 @@ | |||
| /* Author: J.W. Stevenson */ | ||||
| 
 | ||||
| #include <stdlib.h> | ||||
| #include <fcntl.h> | ||||
| #include <unistd.h> | ||||
| #include <pc_file.h> | ||||
| #include <pc_err.h> | ||||
| #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)) | ||||
|  |  | |||
|  | @ -21,12 +21,9 @@ | |||
| #include <stdlib.h> | ||||
| #include <errno.h> | ||||
| #include <unistd.h> | ||||
| #include <pc_file.h> | ||||
| #include <pc_err.h> | ||||
| #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; | ||||
|  |  | |||
|  | @ -18,9 +18,7 @@ | |||
| 
 | ||||
| /* Author: J.W. Stevenson */ | ||||
| 
 | ||||
| #include <pc_err.h> | ||||
| 
 | ||||
| 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) | ||||
|  |  | |||
|  | @ -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  | ||||
|  |  | |||
|  | @ -16,13 +16,11 @@ | |||
|  * | ||||
|  */ | ||||
| 
 | ||||
| #include <pc_file.h> | ||||
| 
 | ||||
| extern _cls(); | ||||
| #include "pc.h" | ||||
| 
 | ||||
| /* procedure pclose(var f:file of ??); */ | ||||
| 
 | ||||
| pclose(f) struct file* f; | ||||
| void pclose(struct file* f) | ||||
| { | ||||
| 	_cls(f); | ||||
| } | ||||
|  |  | |||
|  | @ -19,16 +19,11 @@ | |||
| /* Author: J.W. Stevenson */ | ||||
| 
 | ||||
| #include <unistd.h> | ||||
| #include <pc_file.h> | ||||
| #include <pc_err.h> | ||||
| 
 | ||||
| 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 */ | ||||
|  |  | |||
|  | @ -18,14 +18,9 @@ | |||
| 
 | ||||
| /* Author: J.W. Stevenson */ | ||||
| 
 | ||||
| #include <pc_file.h> | ||||
| #include "pc.h" | ||||
| 
 | ||||
| extern struct file** _extfl; | ||||
| extern _wrs(); | ||||
| extern _wrz(); | ||||
| extern _wln(); | ||||
| 
 | ||||
| procentry(name) char* name; | ||||
| void procentry(char* name) | ||||
| { | ||||
| 	struct file* f; | ||||
| 
 | ||||
|  |  | |||
|  | @ -19,8 +19,9 @@ | |||
| /* function perrno:integer; extern; */ | ||||
| 
 | ||||
| #include <errno.h> | ||||
| #include "pc.h" | ||||
| 
 | ||||
| int perrno() | ||||
| int perrno(void) | ||||
| { | ||||
| 	return (errno); | ||||
| } | ||||
|  |  | |||
|  | @ -16,14 +16,9 @@ | |||
|  * | ||||
|  */ | ||||
| 
 | ||||
| #include <pc_file.h> | ||||
| #include "pc.h" | ||||
| 
 | ||||
| extern struct file** _extfl; | ||||
| extern _wrs(); | ||||
| extern _wrz(); | ||||
| extern _wln(); | ||||
| 
 | ||||
| procexit(name) char* name; | ||||
| void procexit(char* name) | ||||
| { | ||||
| 	struct file* f; | ||||
| 
 | ||||
|  |  | |||
|  | @ -18,19 +18,13 @@ | |||
| 
 | ||||
| /* Author: J.W. Stevenson */ | ||||
| 
 | ||||
| #include <pc_file.h> | ||||
| #include <pc_err.h> | ||||
| 
 | ||||
| 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); | ||||
| } | ||||
|  |  | |||
|  | @ -16,12 +16,9 @@ | |||
|  * | ||||
|  */ | ||||
| 
 | ||||
| #include <pc_file.h> | ||||
| #include "pc.h" | ||||
| 
 | ||||
| extern _wf(); | ||||
| extern _outcpt(); | ||||
| 
 | ||||
| _put(f) struct file* f; | ||||
| void _put(struct file* f) | ||||
| { | ||||
| 	_wf(f); | ||||
| 	_outcpt(f); | ||||
|  |  | |||
|  | @ -6,18 +6,10 @@ | |||
| 
 | ||||
| /* Author: Hans van Eck */ | ||||
| 
 | ||||
| #include "pc.h" | ||||
| #include <em_abs.h> | ||||
| 
 | ||||
| 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); | ||||
|  |  | |||
|  | @ -16,12 +16,9 @@ | |||
|  * | ||||
|  */ | ||||
| 
 | ||||
| #include <pc_file.h> | ||||
| #include "pc.h" | ||||
| 
 | ||||
| extern _rf(); | ||||
| extern _incpt(); | ||||
| 
 | ||||
| int _rdc(f) struct file* f; | ||||
| int _rdc(struct file* f) | ||||
| { | ||||
| 	int c; | ||||
| 
 | ||||
|  |  | |||
|  | @ -18,20 +18,15 @@ | |||
| 
 | ||||
| /* Author: J.W. Stevenson */ | ||||
| 
 | ||||
| #include <pc_file.h> | ||||
| #include <pc_err.h> | ||||
| #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); | ||||
|  |  | |||
|  | @ -18,15 +18,9 @@ | |||
| 
 | ||||
| /* Author: J.W. Stevenson */ | ||||
| 
 | ||||
| #include <pc_file.h> | ||||
| #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; | ||||
|  |  | |||
|  | @ -18,22 +18,14 @@ | |||
| 
 | ||||
| /* Author: J.W. Stevenson */ | ||||
| 
 | ||||
| #include <pc_file.h> | ||||
| #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; | ||||
|  |  | |||
|  | @ -16,14 +16,9 @@ | |||
|  * | ||||
|  */ | ||||
| 
 | ||||
| #include <pc_file.h> | ||||
| #include <pc_err.h> | ||||
| #include "pc.h" | ||||
| 
 | ||||
| extern struct file* _curfil; | ||||
| extern _trp(); | ||||
| extern _incpt(); | ||||
| 
 | ||||
| _rf(f) struct file* f; | ||||
| void _rf(struct file* f) | ||||
| { | ||||
| 
 | ||||
| 	_curfil = f; | ||||
|  |  | |||
|  | @ -16,12 +16,9 @@ | |||
|  * | ||||
|  */ | ||||
| 
 | ||||
| #include <pc_file.h> | ||||
| #include "pc.h" | ||||
| 
 | ||||
| extern _rf(); | ||||
| extern _incpt(); | ||||
| 
 | ||||
| _rln(f) struct file* f; | ||||
| void _rln(struct file* f) | ||||
| { | ||||
| 
 | ||||
| 	_rf(f); | ||||
|  |  | |||
|  | @ -16,7 +16,9 @@ | |||
|  * | ||||
|  */ | ||||
| 
 | ||||
| double _rnd(r) double r; | ||||
| #include "pc.h" | ||||
| 
 | ||||
| double _rnd(double r) | ||||
| { | ||||
| 	return (r + (r < 0 ? -0.5 : 0.5)); | ||||
| } | ||||
|  |  | |||
|  | @ -9,13 +9,9 @@ | |||
| 
 | ||||
| #define __NO_DEFS | ||||
| #include <math.h> | ||||
| #include "pc.h" | ||||
| 
 | ||||
| #if __STDC__ | ||||
| #include <pc_math.h> | ||||
| #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; | ||||
|  |  | |||
|  | @ -8,16 +8,12 @@ | |||
| /* $Id$ */ | ||||
| #define __NO_DEFS | ||||
| #include <math.h> | ||||
| #include <pc_err.h> | ||||
| 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; | ||||
| 
 | ||||
|  |  | |||
|  | @ -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; | ||||
| } | ||||
|  |  | |||
|  | @ -18,9 +18,7 @@ | |||
| 
 | ||||
| /* Author: J.W. Stevenson */ | ||||
| 
 | ||||
| #include <pc_err.h> | ||||
| 
 | ||||
| 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) | ||||
|  |  | |||
|  | @ -20,9 +20,9 @@ | |||
| 
 | ||||
| #include <stdlib.h> | ||||
| #include <unistd.h> | ||||
| #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)); | ||||
| } | ||||
|  |  | |||
|  | @ -20,9 +20,9 @@ | |||
| 
 | ||||
| #include <stdlib.h> | ||||
| #include <unistd.h> | ||||
| #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)); | ||||
| } | ||||
|  |  | |||
|  | @ -16,14 +16,10 @@ | |||
|  * | ||||
|  */ | ||||
| 
 | ||||
| #include <pc_file.h> | ||||
| #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); | ||||
|  |  | |||
|  | @ -16,13 +16,9 @@ | |||
|  * | ||||
|  */ | ||||
| 
 | ||||
| #include <pc_file.h> | ||||
| #include <pc_err.h> | ||||
| #include "pc.h" | ||||
| 
 | ||||
| extern struct file* _curfil; | ||||
| extern _trp(); | ||||
| 
 | ||||
| _wf(f) struct file* f; | ||||
| void _wf(struct file* f) | ||||
| { | ||||
| 
 | ||||
| 	_curfil = f; | ||||
|  |  | |||
|  | @ -16,20 +16,16 @@ | |||
|  * | ||||
|  */ | ||||
| 
 | ||||
| #include <pc_file.h> | ||||
| #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; | ||||
|  |  | |||
|  | @ -18,11 +18,7 @@ | |||
| 
 | ||||
| /* Author: J.W. Stevenson */ | ||||
| 
 | ||||
| #include <pc_err.h> | ||||
| #include <pc_file.h> | ||||
| 
 | ||||
| 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; | ||||
|  |  | |||
|  | @ -16,10 +16,7 @@ | |||
|  * | ||||
|  */ | ||||
| 
 | ||||
| #include <pc_err.h> | ||||
| #include <pc_file.h> | ||||
| 
 | ||||
| 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); | ||||
| } | ||||
|  |  | |||
|  | @ -18,16 +18,10 @@ | |||
| 
 | ||||
| /* Author: J.W. Stevenson */ | ||||
| 
 | ||||
| #include <pc_err.h> | ||||
| #include <pc_file.h> | ||||
| #include "pc.h" | ||||
| #include <limits.h> | ||||
| 
 | ||||
| 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); | ||||
| } | ||||
|  |  | |||
|  | @ -18,17 +18,11 @@ | |||
| 
 | ||||
| /* Author: J.W. Stevenson */ | ||||
| 
 | ||||
| #include <pc_err.h> | ||||
| #include <pc_file.h> | ||||
| 
 | ||||
| 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); | ||||
| } | ||||
|  |  | |||
|  | @ -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). */ | ||||
|  |  | |||
|  | @ -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). */ | ||||
|  |  | |||
|  | @ -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). */ | ||||
|  |  | |||
|  | @ -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). */ | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue