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 */ | /* Author: J.W. Stevenson */ | ||||||
|  | #include "pc.h" | ||||||
| 
 | 
 | ||||||
| int _abi(i) int i; | int _abi(int i) | ||||||
| { | { | ||||||
| 	return (i >= 0 ? i : -i); | 	return (i >= 0 ? i : -i); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -17,8 +17,9 @@ | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| /* Author: J.W. Stevenson */ | /* Author: J.W. Stevenson */ | ||||||
|  | #include "pc.h" | ||||||
| 
 | 
 | ||||||
| long _abl(i) long i; | long _abl(long i) | ||||||
| { | { | ||||||
| 	return (i >= 0 ? i : -i); | 	return (i >= 0 ? i : -i); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -17,8 +17,9 @@ | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| /* Author: J.W. Stevenson */ | /* Author: J.W. Stevenson */ | ||||||
|  | #include "pc.h" | ||||||
| 
 | 
 | ||||||
| double _abr(r) double r; | double _abr(double r) | ||||||
| { | { | ||||||
| 	return (r >= 0 ? r : -r); | 	return (r >= 0 ? r : -r); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -17,29 +17,26 @@ | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| /* Author: J.W. Stevenson */ | /* Author: J.W. Stevenson */ | ||||||
|  | #include "pc.h" | ||||||
| 
 | 
 | ||||||
| /* function argc:integer; extern; */ | /* function argc:integer; extern; */ | ||||||
| /* function argv(i:integer):string; extern; */ | /* function argv(i:integer):string; extern; */ | ||||||
| /* procedure argshift; extern; */ | /* procedure argshift; extern; */ | ||||||
| /* function environ(i:integer):string; extern; */ | /* function environ(i:integer):string; extern; */ | ||||||
| 
 | 
 | ||||||
| extern int _pargc; | int argc(void) | ||||||
| extern char** _pargv; |  | ||||||
| extern char** _penvp; |  | ||||||
| 
 |  | ||||||
| int argc() |  | ||||||
| { | { | ||||||
| 	return (_pargc); | 	return (_pargc); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| char* argv(i) | char* argv(int i) | ||||||
| { | { | ||||||
| 	if (i >= _pargc) | 	if (i >= _pargc) | ||||||
| 		return (0); | 		return (0); | ||||||
| 	return (_pargv[i]); | 	return (_pargv[i]); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| argshift() | void argshift(void) | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| 	if (_pargc > 1) | 	if (_pargc > 1) | ||||||
|  | @ -48,15 +45,3 @@ argshift() | ||||||
| 		_pargv++; | 		_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 */ | /* Author: J.W. Stevenson */ | ||||||
| 
 | 
 | ||||||
| #include <em_abs.h> | #include <em_abs.h> | ||||||
| #include <pc_err.h> | #include "pc.h" | ||||||
| 
 | 
 | ||||||
| extern char* _hol0(); | void _ass(int line, int bool) | ||||||
| extern _trp(); |  | ||||||
| 
 |  | ||||||
| _ass(line, bool) int line, bool; |  | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| 	if (bool == 0) | 	if (bool == 0) | ||||||
|  |  | ||||||
|  | @ -16,16 +16,11 @@ | ||||||
|  * |  * | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
|  | #include "pc.h" | ||||||
|  | 
 | ||||||
| /* Author: J.W. Stevenson */ | /* Author: J.W. Stevenson */ | ||||||
| 
 | 
 | ||||||
| struct descr | int _asz(struct descr* dp) | ||||||
| { |  | ||||||
| 	int low; |  | ||||||
| 	int diff; |  | ||||||
| 	int size; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| int _asz(dp) struct descr* dp; |  | ||||||
| { | { | ||||||
| 	return (dp->size * (dp->diff + 1)); | 	return (dp->size * (dp->diff + 1)); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -10,12 +10,9 @@ | ||||||
| #define __NO_DEFS | #define __NO_DEFS | ||||||
| #include <math.h> | #include <math.h> | ||||||
| 
 | 
 | ||||||
| #if __STDC__ | #include "pc.h" | ||||||
| #include <pc_math.h> |  | ||||||
| #endif |  | ||||||
| 
 | 
 | ||||||
| double | double _atn(double x) | ||||||
|     _atn(x) double x; |  | ||||||
| { | { | ||||||
| 	/*	Algorithm and coefficients from:
 | 	/*	Algorithm and coefficients from:
 | ||||||
| 			"Software manual for the elementary functions" | 			"Software manual for the elementary functions" | ||||||
|  |  | ||||||
|  | @ -17,9 +17,9 @@ | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| /* Author: J.W. Stevenson */ | /* Author: J.W. Stevenson */ | ||||||
|  | #include "pc.h" | ||||||
| 
 | 
 | ||||||
| int _bcp(sz, y, x) int sz; | int _bcp(int sz, unsigned char* y, unsigned char* x) | ||||||
| unsigned char *y, *x; |  | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| 	while (--sz >= 0) | 	while (--sz >= 0) | ||||||
|  |  | ||||||
|  | @ -18,13 +18,11 @@ | ||||||
| 
 | 
 | ||||||
| /* Author: J.W. Stevenson */ | /* Author: J.W. Stevenson */ | ||||||
| 
 | 
 | ||||||
| #include <pc_file.h> | #include "pc.h" | ||||||
| 
 |  | ||||||
| extern _flush(); |  | ||||||
| 
 | 
 | ||||||
| /* procedure buff(var f:file of ?); */ | /* procedure buff(var f:file of ?); */ | ||||||
| 
 | 
 | ||||||
| buff(f) struct file* f; | void buff(struct file* f) | ||||||
| { | { | ||||||
| 	int sz; | 	int sz; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -20,11 +20,7 @@ | ||||||
| #include <errno.h> | #include <errno.h> | ||||||
| #include <unistd.h> | #include <unistd.h> | ||||||
| #include <em_abs.h> | #include <em_abs.h> | ||||||
| #include <pc_err.h> | #include "pc.h" | ||||||
| #include <pc_file.h> |  | ||||||
| 
 |  | ||||||
| /* to make it easier to patch ... */ |  | ||||||
| extern struct file* _curfil; |  | ||||||
| 
 | 
 | ||||||
| static struct errm | static struct errm | ||||||
| { | { | ||||||
|  | @ -83,14 +79,8 @@ static struct errm | ||||||
| 	{ -1, 0 } | 	{ -1, 0 } | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| extern int _pargc; |  | ||||||
| extern char** _pargv; |  | ||||||
| extern char** _penvp; |  | ||||||
| 
 | 
 | ||||||
| extern char* _hol0(); | void _catch(unsigned int erno) | ||||||
| extern _trp(); |  | ||||||
| 
 |  | ||||||
| _catch(erno) unsigned erno; |  | ||||||
| { | { | ||||||
| 	register struct errm* ep = &errors[0]; | 	register struct errm* ep = &errors[0]; | ||||||
| 	char *p, *q, *s, **qq; | 	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 <stdlib.h> | ||||||
| #include <unistd.h> | #include <unistd.h> | ||||||
| #include <pc_file.h> | #include "pc.h" | ||||||
| #include <pc_err.h> |  | ||||||
| 
 | 
 | ||||||
| extern struct file* _curfil; | void _xcls(struct file* f) | ||||||
| extern _trp(); |  | ||||||
| extern _flush(); |  | ||||||
| extern _outcpt(); |  | ||||||
| 
 |  | ||||||
| _xcls(f) struct file* f; |  | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| 	if ((f->flags & WRBIT) == 0) | 	if ((f->flags & WRBIT) == 0) | ||||||
|  | @ -45,7 +39,7 @@ _xcls(f) struct file* f; | ||||||
| 	_flush(f); | 	_flush(f); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| _cls(f) struct file* f; | void _cls(struct file* f) | ||||||
| { | { | ||||||
| #ifdef MAYBE | #ifdef MAYBE | ||||||
| 	char* p; | 	char* p; | ||||||
|  |  | ||||||
|  | @ -1,3 +1,5 @@ | ||||||
|  | #include "pc.h" | ||||||
|  | 
 | ||||||
| /* $Id$ */ | /* $Id$ */ | ||||||
| #ifndef NOFLOAT | #ifndef NOFLOAT | ||||||
| 
 | 
 | ||||||
|  | @ -8,19 +10,16 @@ | ||||||
| #define DBL_MAX M_MAX_D | #define DBL_MAX M_MAX_D | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| static char* cvt(); | static char* cvt(double value, int ndigit, int* decpt, int* sign, int ecvtflag); | ||||||
|  | 
 | ||||||
| #define NDIGITS 128 | #define NDIGITS 128 | ||||||
| 
 | 
 | ||||||
| char* | char *_ecvt(double value, int ndigit, int *decpt, int *sign) | ||||||
|     _ecvt(value, ndigit, decpt, sign) double value; |  | ||||||
| int ndigit, *decpt, *sign; |  | ||||||
| { | { | ||||||
| 	return cvt(value, ndigit, decpt, sign, 1); | 	return cvt(value, ndigit, decpt, sign, 1); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| char* | char *_fcvt(double value, int ndigit, int *decpt, int *sign) | ||||||
|     _fcvt(value, ndigit, decpt, sign) double value; |  | ||||||
| int ndigit, *decpt, *sign; |  | ||||||
| { | { | ||||||
| 	return cvt(value, ndigit, decpt, sign, 0); | 	return cvt(value, ndigit, decpt, sign, 0); | ||||||
| } | } | ||||||
|  | @ -40,9 +39,7 @@ static struct powers_of_10 | ||||||
| 	1.0e0, 1.0e0, 0 | 	1.0e0, 1.0e0, 0 | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| static char* | static char* cvt(double value, int ndigit, int* decpt, int* sign, int ecvtflag) | ||||||
|     cvt(value, ndigit, decpt, sign, ecvtflag) double value; |  | ||||||
| int ndigit, *decpt, *sign; |  | ||||||
| { | { | ||||||
| 	static char buf[NDIGITS + 1]; | 	static char buf[NDIGITS + 1]; | ||||||
| 	register char* p = buf; | 	register char* p = buf; | ||||||
|  |  | ||||||
|  | @ -18,13 +18,12 @@ | ||||||
| 
 | 
 | ||||||
| /* Author: J.W. Stevenson */ | /* Author: J.W. Stevenson */ | ||||||
| 
 | 
 | ||||||
| #include <pc_file.h> | #include "pc.h" | ||||||
| 
 | 
 | ||||||
| /* procedure diag(var f:text); */ | /* procedure diag(var f:text); */ | ||||||
| 
 | 
 | ||||||
| diag(f) struct file* f; | void diag(struct file* f) | ||||||
| { | { | ||||||
| 
 |  | ||||||
| 	f->ptr = f->bufadr; | 	f->ptr = f->bufadr; | ||||||
| 	f->flags = WRBIT | EOFBIT | ELNBIT | TXTBIT | MAGIC; | 	f->flags = WRBIT | EOFBIT | ELNBIT | TXTBIT | MAGIC; | ||||||
| 	f->fname = "DIAG"; | 	f->fname = "DIAG"; | ||||||
|  |  | ||||||
|  | @ -20,14 +20,9 @@ | ||||||
| 
 | 
 | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
| #include <errno.h> | #include <errno.h> | ||||||
| #include <pc_file.h> | #include "pc.h" | ||||||
| #include <pc_err.h> |  | ||||||
| 
 | 
 | ||||||
| extern struct file* _curfil; | int _efl(struct file* f) | ||||||
| extern _trp(); |  | ||||||
| extern _incpt(); |  | ||||||
| 
 |  | ||||||
| int _efl(f) struct file* f; |  | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| 	_curfil = f; | 	_curfil = f; | ||||||
|  |  | ||||||
|  | @ -18,13 +18,9 @@ | ||||||
| 
 | 
 | ||||||
| /* Author: J.W. Stevenson */ | /* Author: J.W. Stevenson */ | ||||||
| 
 | 
 | ||||||
| #include <pc_file.h> | #include "pc.h" | ||||||
| #include <pc_err.h> |  | ||||||
| 
 | 
 | ||||||
| extern _trp(); | int _eln(struct file* f) | ||||||
| extern _rf(); |  | ||||||
| 
 |  | ||||||
| int _eln(f) struct file* f; |  | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| 	_rf(f); | 	_rf(f); | ||||||
|  |  | ||||||
|  | @ -8,12 +8,10 @@ | ||||||
| /* $Id$ */ | /* $Id$ */ | ||||||
| #define __NO_DEFS | #define __NO_DEFS | ||||||
| #include <math.h> | #include <math.h> | ||||||
| #include <pc_err.h> | #include "pc.h" | ||||||
| extern _trp(); |  | ||||||
| 
 | 
 | ||||||
| #if __STDC__ | #if __STDC__ | ||||||
| #include <float.h> | #include <float.h> | ||||||
| #include <pc_math.h> |  | ||||||
| #define M_MIN_D DBL_MIN | #define M_MIN_D DBL_MIN | ||||||
| #define M_MAX_D DBL_MAX | #define M_MAX_D DBL_MAX | ||||||
| #define M_DMINEXP DBL_MIN_EXP | #define M_DMINEXP DBL_MIN_EXP | ||||||
|  | @ -21,11 +19,8 @@ extern _trp(); | ||||||
| #undef HUGE | #undef HUGE | ||||||
| #define HUGE 1e1000 | #define HUGE 1e1000 | ||||||
| 
 | 
 | ||||||
| static double | static double Ldexp(double fl, int exp) | ||||||
|     Ldexp(fl, exp) double fl; |  | ||||||
| int exp; |  | ||||||
| { | { | ||||||
| 	extern double _fef(); |  | ||||||
| 	int sign = 1; | 	int sign = 1; | ||||||
| 	int currexp; | 	int currexp; | ||||||
| 
 | 
 | ||||||
|  | @ -57,8 +52,7 @@ int exp; | ||||||
| 	return sign * fl; | 	return sign * fl; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| double | double _exp(double x) | ||||||
|     _exp(x) double x; |  | ||||||
| { | { | ||||||
| 	/*	Algorithm and coefficients from:
 | 	/*	Algorithm and coefficients from:
 | ||||||
| 			"Software manual for the elementary functions" | 			"Software manual for the elementary functions" | ||||||
|  |  | ||||||
|  | @ -16,13 +16,9 @@ | ||||||
|  * |  * | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include <pc_file.h> | #include "pc.h" | ||||||
| #include <pc_err.h> |  | ||||||
| 
 | 
 | ||||||
| extern _rf(); | void _get(struct file* f) | ||||||
| extern _trp(); |  | ||||||
| 
 |  | ||||||
| _get(f) struct file* f; |  | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| 	_rf(f); | 	_rf(f); | ||||||
|  |  | ||||||
|  | @ -18,14 +18,10 @@ | ||||||
| 
 | 
 | ||||||
| /* Author: J.W. Stevenson */ | /* Author: J.W. Stevenson */ | ||||||
| 
 | 
 | ||||||
| #include <pc_file.h> | #include <unistd.h> | ||||||
|  | #include "pc.h" | ||||||
| 
 | 
 | ||||||
| extern struct file** _extfl; | void _hlt(int ecode) | ||||||
| extern int _extflc; |  | ||||||
| extern _cls(); |  | ||||||
| extern _exit(); |  | ||||||
| 
 |  | ||||||
| _hlt(ecode) int ecode; |  | ||||||
| { | { | ||||||
| 	int i; | 	int i; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -21,14 +21,10 @@ | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
| #include <errno.h> | #include <errno.h> | ||||||
| #include <unistd.h> | #include <unistd.h> | ||||||
| #include <pc_file.h> | #include "pc.h" | ||||||
| #include <pc_err.h> |  | ||||||
| 
 | 
 | ||||||
| extern _trp(); | void _incpt(struct file* f) | ||||||
| 
 |  | ||||||
| _incpt(f) struct file* f; |  | ||||||
| { | { | ||||||
| 
 |  | ||||||
| 	if (f->flags & EOFBIT) | 	if (f->flags & EOFBIT) | ||||||
| 		_trp(EEOF); | 		_trp(EEOF); | ||||||
| 	f->flags |= WINDOW; | 	f->flags |= WINDOW; | ||||||
|  |  | ||||||
|  | @ -18,24 +18,21 @@ | ||||||
| 
 | 
 | ||||||
| /* Author: J.W. Stevenson */ | /* Author: J.W. Stevenson */ | ||||||
| 
 | 
 | ||||||
| #include <pc_file.h> | #include "pc.h" | ||||||
| #include <pc_err.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; | int _pargc; | ||||||
| char** _pargv; | char** _pargv; | ||||||
| char** _penvp; | 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 */ | int _fp_hook = 1; /* This is for Minix, but does not harm others */ | ||||||
| 
 | 
 | ||||||
| _ini(args, c, p, mainlb) char* args, *mainlb; | void _ini(char *args, int c, struct file **p, char *mainlb) | ||||||
| int c; |  | ||||||
| struct file** p; |  | ||||||
| { | { | ||||||
| 	struct file* f; | 	struct file* f; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -9,17 +9,15 @@ | ||||||
| 
 | 
 | ||||||
| #define __NO_DEFS | #define __NO_DEFS | ||||||
| #include <math.h> | #include <math.h> | ||||||
| #include <pc_err.h> | #include "pc.h" | ||||||
| 
 | 
 | ||||||
| #if __STDC__ | #if __STDC__ | ||||||
| #include <pc_math.h> |  | ||||||
| #include <float.h> | #include <float.h> | ||||||
| #endif | #endif | ||||||
| #undef HUGE | #undef HUGE | ||||||
| #define HUGE 1e1000 | #define HUGE 1e1000 | ||||||
| 
 | 
 | ||||||
| double | double _log(double x) | ||||||
|     _log(x) double x; |  | ||||||
| { | { | ||||||
| 	/*	Algorithm and coefficients from:
 | 	/*	Algorithm and coefficients from:
 | ||||||
| 			"Software manual for the elementary functions" | 			"Software manual for the elementary functions" | ||||||
|  | @ -37,7 +35,6 @@ double | ||||||
| 		1.0 | 		1.0 | ||||||
| 	}; | 	}; | ||||||
| 
 | 
 | ||||||
| 	extern double _fef(); |  | ||||||
| 	double znum, zden, z, w; | 	double znum, zden, z, w; | ||||||
| 	int exponent; | 	int exponent; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -18,11 +18,9 @@ | ||||||
| 
 | 
 | ||||||
| /* Author: J.W. Stevenson */ | /* Author: J.W. Stevenson */ | ||||||
| 
 | 
 | ||||||
| #include <pc_err.h> | #include "pc.h" | ||||||
| 
 | 
 | ||||||
| extern _trp(); | int _mdi(int j, int i) | ||||||
| 
 |  | ||||||
| int _mdi(j, i) int j, i; |  | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| 	if (j <= 0) | 	if (j <= 0) | ||||||
|  | @ -33,7 +31,7 @@ int _mdi(j, i) int j, i; | ||||||
| 	return (i); | 	return (i); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| long _mdil(j, i) long j, i; | long _mdil(long j, long i) | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| 	if (j <= 0) | 	if (j <= 0) | ||||||
|  | @ -44,7 +42,7 @@ long _mdil(j, i) long j, i; | ||||||
| 	return (i); | 	return (i); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| int _dvi(j, i) unsigned int j, i; | int _dvi(unsigned int j, unsigned int i) | ||||||
| { | { | ||||||
| 	int neg = 0; | 	int neg = 0; | ||||||
| 
 | 
 | ||||||
|  | @ -64,7 +62,7 @@ int _dvi(j, i) unsigned int j, i; | ||||||
| 	return i; | 	return i; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| long _dvil(j, i) unsigned long j, i; | long _dvil(unsigned long j, unsigned long i) | ||||||
| { | { | ||||||
| 	int neg = 0; | 	int neg = 0; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -18,11 +18,9 @@ | ||||||
| 
 | 
 | ||||||
| /* Author: J.W. Stevenson */ | /* Author: J.W. Stevenson */ | ||||||
| 
 | 
 | ||||||
| #include <pc_err.h> | #include "pc.h" | ||||||
| 
 | 
 | ||||||
| extern _trp(); | long _mdl(long j, long i) | ||||||
| 
 |  | ||||||
| long _mdl(j, i) long j, i; |  | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| 	if (j <= 0) | 	if (j <= 0) | ||||||
|  |  | ||||||
|  | @ -1,8 +1,6 @@ | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
| #include <em_abs.h> | #include <em_abs.h> | ||||||
| #include <pc_err.h> | #include "pc.h" | ||||||
| 
 |  | ||||||
| extern void _trp(int); /* called on error */ |  | ||||||
| 
 | 
 | ||||||
| void _new(int n, void** ptr) | void _new(int n, void** ptr) | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -6,11 +6,9 @@ | ||||||
| 
 | 
 | ||||||
| /* Author: Hans van Eck */ | /* Author: Hans van Eck */ | ||||||
| 
 | 
 | ||||||
| #include <pc_err.h> | #include "pc.h" | ||||||
| 
 | 
 | ||||||
| extern _trp(); | void _nfa(int bool) | ||||||
| 
 |  | ||||||
| _nfa(bool) |  | ||||||
| { | { | ||||||
| 	if (!bool) | 	if (!bool) | ||||||
| 		_trp(EFUNASS); | 		_trp(EFUNASS); | ||||||
|  |  | ||||||
|  | @ -18,13 +18,11 @@ | ||||||
| 
 | 
 | ||||||
| /* Author: J.W. Stevenson */ | /* Author: J.W. Stevenson */ | ||||||
| 
 | 
 | ||||||
| #include <pc_file.h> | #include "pc.h" | ||||||
| 
 |  | ||||||
| extern _flush(); |  | ||||||
| 
 | 
 | ||||||
| /* procedure nobuff(var f:file of ?); */ | /* procedure nobuff(var f:file of ?); */ | ||||||
| 
 | 
 | ||||||
| nobuff(f) struct file* f; | void nobuff(struct file* f) | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| 	if ((f->flags & (0377 | WRBIT)) != (MAGIC | WRBIT)) | 	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; | 	f->flags &= ~TXTBIT; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -19,22 +19,11 @@ | ||||||
| /* Author: J.W. Stevenson */ | /* Author: J.W. Stevenson */ | ||||||
| 
 | 
 | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
|  | #include <fcntl.h> | ||||||
| #include <unistd.h> | #include <unistd.h> | ||||||
| #include <pc_file.h> | #include "pc.h" | ||||||
| #include <pc_err.h> |  | ||||||
| 
 | 
 | ||||||
| extern struct file** _extfl; | static int tmpfil(void) | ||||||
| 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 char namebuf[] = "/tmp/plf.xxxxx"; | 	static char namebuf[] = "/tmp/plf.xxxxx"; | ||||||
| 	int i; | 	int i; | ||||||
|  | @ -55,15 +44,13 @@ static int tmpfil() | ||||||
| 		goto error; | 		goto error; | ||||||
| 	if ((i = open(p, 2)) < 0) | 	if ((i = open(p, 2)) < 0) | ||||||
| 		goto error; | 		goto error; | ||||||
| 	if (remove(p) != 0) | 	if (unlink(p) != 0) | ||||||
| 	error: | 	error: | ||||||
| 		_trp(EREWR); | 		_trp(EREWR); | ||||||
| 	return (i); | 	return (i); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static int initfl(descr, sz, f) int descr; | static int initfl(int descr, int sz, struct file* f) | ||||||
| int sz; |  | ||||||
| struct file* f; |  | ||||||
| { | { | ||||||
| 	int i; | 	int i; | ||||||
| 
 | 
 | ||||||
|  | @ -117,16 +104,14 @@ struct file* f; | ||||||
| 	return (1); | 	return (1); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| _opn(sz, f) int sz; | void _opn(int sz, struct file* f) | ||||||
| struct file* f; |  | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| 	if (initfl(MAGIC, sz, f)) | 	if (initfl(MAGIC, sz, f)) | ||||||
| 		f->count = 0; | 		f->count = 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| _cre(sz, f) int sz; | void _cre(int sz, struct file* f) | ||||||
| struct file* f; |  | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| 	if (initfl(WRBIT | EOFBIT | ELNBIT | MAGIC, sz, f)) | 	if (initfl(WRBIT | EOFBIT | ELNBIT | MAGIC, sz, f)) | ||||||
|  |  | ||||||
|  | @ -21,12 +21,9 @@ | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
| #include <errno.h> | #include <errno.h> | ||||||
| #include <unistd.h> | #include <unistd.h> | ||||||
| #include <pc_file.h> | #include "pc.h" | ||||||
| #include <pc_err.h> |  | ||||||
| 
 | 
 | ||||||
| extern _trp(); | void _flush(struct file* f) | ||||||
| 
 |  | ||||||
| _flush(f) struct file* f; |  | ||||||
| { | { | ||||||
| 	int i, n; | 	int i, n; | ||||||
| 
 | 
 | ||||||
|  | @ -41,7 +38,7 @@ _flush(f) struct file* f; | ||||||
| 		_trp(EWRITE); | 		_trp(EWRITE); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| _outcpt(f) struct file* f; | void _outcpt(struct file* f) | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| 	f->flags &= ~ELNBIT; | 	f->flags &= ~ELNBIT; | ||||||
|  |  | ||||||
|  | @ -18,9 +18,7 @@ | ||||||
| 
 | 
 | ||||||
| /* Author: J.W. Stevenson */ | /* Author: J.W. Stevenson */ | ||||||
| 
 | 
 | ||||||
| #include <pc_err.h> | #include "pc.h" | ||||||
| 
 |  | ||||||
| extern _trp(); |  | ||||||
| 
 | 
 | ||||||
| #define assert(x) /* nothing */ | #define assert(x) /* nothing */ | ||||||
| 
 | 
 | ||||||
|  | @ -28,16 +26,7 @@ extern _trp(); | ||||||
| #define EM_WSIZE _EM_WSIZE | #define EM_WSIZE _EM_WSIZE | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| struct descr | void _pac(struct descr *ad, struct descr *zd, char *zp, int i, char *ap) | ||||||
| { |  | ||||||
| 	int low; |  | ||||||
| 	int diff; |  | ||||||
| 	int size; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| _pac(ad, zd, zp, i, ap) int i; |  | ||||||
| struct descr *ad, *zd; |  | ||||||
| char *zp, *ap; |  | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| 	if (zd->diff > ad->diff || (i -= ad->low) < 0 || (i + zd->diff) > ad->diff) | 	if (zd->diff > ad->diff || (i -= ad->low) < 0 || (i + zd->diff) > ad->diff) | ||||||
|  |  | ||||||
|  | @ -5,11 +5,36 @@ | ||||||
| #include "pc_file.h" | #include "pc_file.h" | ||||||
| #include "pc_math.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 *_ecvt(double value, int ndigit, int *decpt, int *sign); | ||||||
| extern char *_fcvt(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 *_wdw(struct file *f); | ||||||
| extern char *argv(int i); | extern char *argv(int i); | ||||||
| extern char *environ(int i); |  | ||||||
| extern char *strbuf(char *s); | extern char *strbuf(char *s); | ||||||
| extern double _abr(double r); | extern double _abr(double r); | ||||||
| extern double _atn(double x); | extern double _atn(double x); | ||||||
|  | @ -18,67 +43,25 @@ extern double _exp(double x); | ||||||
| extern double _log(double x); | extern double _log(double x); | ||||||
| extern double _rdr(struct file *f); | extern double _rdr(struct file *f); | ||||||
| extern double _rnd(double r); | extern double _rnd(double r); | ||||||
|  | extern void _sig(void (*)(unsigned int)); | ||||||
| extern double _sin(double x); | extern double _sin(double x); | ||||||
| extern double _sqt(double x); | extern double _sqt(double x); | ||||||
| extern int _abi(int i); | extern void _xcls(struct file *f); | ||||||
| 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 int argc(void); | extern int argc(void); | ||||||
| extern int argshift(void); | extern void argshift(void); | ||||||
| extern int buff(struct file *f); | extern void buff(struct file *f); | ||||||
| extern int clock(void); | extern void diag(struct file *f); | ||||||
| extern int diag(struct file *f); | extern void nobuff(struct file *f); | ||||||
| extern int nobuff(struct file *f); | extern void notext(struct file *f); | ||||||
| extern int notext(struct file *f); | extern void pclose(struct file *f); | ||||||
| extern int pclose(struct file *f); | extern void pcreat(struct file *f, char *s); | ||||||
| extern int pcreat(struct file *f, char *s); |  | ||||||
| extern int perrno(void); | extern int perrno(void); | ||||||
| extern int popen(struct file *f, char *s); | extern void popen(struct file *f, char *s); | ||||||
| extern int procentry(char *name); | extern void procentry(char *name); | ||||||
| extern int procexit(char *name); | extern void procexit(char *name); | ||||||
| extern int strfetch(char *s, int i); | extern int strfetch(char *s, int i); | ||||||
| extern int strlen(char *s); | 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 strtobuf(char *s, char *b, int l); | ||||||
| extern int uread(int fd, char *b, int n); | extern int uread(int fd, char *b, int n); | ||||||
| extern int uwrite(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 _mdil(long j, long i); | ||||||
| extern long _mdl(long j, long i); | extern long _mdl(long j, long i); | ||||||
| extern long _rdl(struct file *f); | 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 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 _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 _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 _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 _wrs(int len, char *s, struct file *f); | ||||||
| extern void _wrz(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 _wsb(int w, int b, struct file* f); | ||||||
| extern void _wsc(int w, char c, 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 _wss(int w, int len, char* s, struct file* f); | ||||||
| extern void _wstrin(int width, int len, char* buf, 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 void _wsz(int w, char* s, struct file* f); | ||||||
|  | extern char* _hol0(void); | ||||||
| 
 | 
 | ||||||
| #endif  | #endif  | ||||||
|  |  | ||||||
|  | @ -16,13 +16,11 @@ | ||||||
|  * |  * | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include <pc_file.h> | #include "pc.h" | ||||||
| 
 |  | ||||||
| extern _cls(); |  | ||||||
| 
 | 
 | ||||||
| /* procedure pclose(var f:file of ??); */ | /* procedure pclose(var f:file of ??); */ | ||||||
| 
 | 
 | ||||||
| pclose(f) struct file* f; | void pclose(struct file* f) | ||||||
| { | { | ||||||
| 	_cls(f); | 	_cls(f); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -19,16 +19,11 @@ | ||||||
| /* Author: J.W. Stevenson */ | /* Author: J.W. Stevenson */ | ||||||
| 
 | 
 | ||||||
| #include <unistd.h> | #include <unistd.h> | ||||||
| #include <pc_file.h> | #include "pc.h" | ||||||
| #include <pc_err.h> |  | ||||||
| 
 |  | ||||||
| extern _cls(); |  | ||||||
| extern _trp(); |  | ||||||
| 
 | 
 | ||||||
| /* procedure pcreat(var f:text; s:string); */ | /* procedure pcreat(var f:text; s:string); */ | ||||||
| 
 | 
 | ||||||
| pcreat(f, s) struct file* f; | void pcreat(struct file* f, char* s) | ||||||
| char* s; |  | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| 	_cls(f); /* initializes _curfil */ | 	_cls(f); /* initializes _curfil */ | ||||||
|  |  | ||||||
|  | @ -18,14 +18,9 @@ | ||||||
| 
 | 
 | ||||||
| /* Author: J.W. Stevenson */ | /* Author: J.W. Stevenson */ | ||||||
| 
 | 
 | ||||||
| #include <pc_file.h> | #include "pc.h" | ||||||
| 
 | 
 | ||||||
| extern struct file** _extfl; | void procentry(char* name) | ||||||
| extern _wrs(); |  | ||||||
| extern _wrz(); |  | ||||||
| extern _wln(); |  | ||||||
| 
 |  | ||||||
| procentry(name) char* name; |  | ||||||
| { | { | ||||||
| 	struct file* f; | 	struct file* f; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -19,8 +19,9 @@ | ||||||
| /* function perrno:integer; extern; */ | /* function perrno:integer; extern; */ | ||||||
| 
 | 
 | ||||||
| #include <errno.h> | #include <errno.h> | ||||||
|  | #include "pc.h" | ||||||
| 
 | 
 | ||||||
| int perrno() | int perrno(void) | ||||||
| { | { | ||||||
| 	return (errno); | 	return (errno); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -16,14 +16,9 @@ | ||||||
|  * |  * | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include <pc_file.h> | #include "pc.h" | ||||||
| 
 | 
 | ||||||
| extern struct file** _extfl; | void procexit(char* name) | ||||||
| extern _wrs(); |  | ||||||
| extern _wrz(); |  | ||||||
| extern _wln(); |  | ||||||
| 
 |  | ||||||
| procexit(name) char* name; |  | ||||||
| { | { | ||||||
| 	struct file* f; | 	struct file* f; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -18,19 +18,13 @@ | ||||||
| 
 | 
 | ||||||
| /* Author: J.W. Stevenson */ | /* Author: J.W. Stevenson */ | ||||||
| 
 | 
 | ||||||
| #include <pc_file.h> | #include "fcntl.h" | ||||||
| #include <pc_err.h> | #include "pc.h" | ||||||
| 
 |  | ||||||
| extern _cls(); |  | ||||||
| extern _trp(); |  | ||||||
| extern int _open(); |  | ||||||
| 
 | 
 | ||||||
| /* procedure popen(var f:text; s:string); */ | /* procedure popen(var f:text; s:string); */ | ||||||
| 
 | 
 | ||||||
| popen(f, s) struct file* f; | void popen(struct file* f, char* s) | ||||||
| char* s; |  | ||||||
| { | { | ||||||
| 
 |  | ||||||
| 	_cls(f); /* initializes _curfil */ | 	_cls(f); /* initializes _curfil */ | ||||||
| 	f->ptr = f->bufadr; | 	f->ptr = f->bufadr; | ||||||
| 	f->flags = TXTBIT | MAGIC; | 	f->flags = TXTBIT | MAGIC; | ||||||
|  | @ -38,6 +32,6 @@ char* s; | ||||||
| 	f->size = 1; | 	f->size = 1; | ||||||
| 	f->count = 0; | 	f->count = 0; | ||||||
| 	f->buflen = PC_BUFLEN; | 	f->buflen = PC_BUFLEN; | ||||||
| 	if ((f->ufd = _open(s, 0)) < 0) | 	if ((f->ufd = open(s, 0)) < 0) | ||||||
| 		_trp(ERESET); | 		_trp(ERESET); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -16,12 +16,9 @@ | ||||||
|  * |  * | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include <pc_file.h> | #include "pc.h" | ||||||
| 
 | 
 | ||||||
| extern _wf(); | void _put(struct file* f) | ||||||
| extern _outcpt(); |  | ||||||
| 
 |  | ||||||
| _put(f) struct file* f; |  | ||||||
| { | { | ||||||
| 	_wf(f); | 	_wf(f); | ||||||
| 	_outcpt(f); | 	_outcpt(f); | ||||||
|  |  | ||||||
|  | @ -6,18 +6,10 @@ | ||||||
| 
 | 
 | ||||||
| /* Author: Hans van Eck */ | /* Author: Hans van Eck */ | ||||||
| 
 | 
 | ||||||
|  | #include "pc.h" | ||||||
| #include <em_abs.h> | #include <em_abs.h> | ||||||
| 
 | 
 | ||||||
| extern _trp(); | void _rcka(struct array_descr* descr, int index) | ||||||
| 
 |  | ||||||
| struct array_descr |  | ||||||
| { |  | ||||||
| 	int lbound; |  | ||||||
| 	unsigned n_elts_min_one; |  | ||||||
| 	unsigned size; /* doesn't really matter */ |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| _rcka(descr, index) struct array_descr* descr; |  | ||||||
| { | { | ||||||
| 	if (index < descr->lbound || index > (int)descr->n_elts_min_one + descr->lbound) | 	if (index < descr->lbound || index > (int)descr->n_elts_min_one + descr->lbound) | ||||||
| 		_trp(EARRAY); | 		_trp(EARRAY); | ||||||
|  |  | ||||||
|  | @ -16,12 +16,9 @@ | ||||||
|  * |  * | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include <pc_file.h> | #include "pc.h" | ||||||
| 
 | 
 | ||||||
| extern _rf(); | int _rdc(struct file* f) | ||||||
| extern _incpt(); |  | ||||||
| 
 |  | ||||||
| int _rdc(f) struct file* f; |  | ||||||
| { | { | ||||||
| 	int c; | 	int c; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -18,20 +18,15 @@ | ||||||
| 
 | 
 | ||||||
| /* Author: J.W. Stevenson */ | /* Author: J.W. Stevenson */ | ||||||
| 
 | 
 | ||||||
| #include <pc_file.h> | #include "pc.h" | ||||||
| #include <pc_err.h> |  | ||||||
| 
 | 
 | ||||||
| extern _trp(); | void _skipsp(struct file* f) | ||||||
| extern _rf(); |  | ||||||
| extern _incpt(); |  | ||||||
| 
 |  | ||||||
| _skipsp(f) struct file* f; |  | ||||||
| { | { | ||||||
| 	while ((*f->ptr == ' ') || (*f->ptr == '\t')) | 	while ((*f->ptr == ' ') || (*f->ptr == '\t')) | ||||||
| 		_incpt(f); | 		_incpt(f); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| int _getsig(f) struct file* f; | int _getsig(struct file* f) | ||||||
| { | { | ||||||
| 	int sign; | 	int sign; | ||||||
| 
 | 
 | ||||||
|  | @ -40,7 +35,7 @@ int _getsig(f) struct file* f; | ||||||
| 	return (sign); | 	return (sign); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| int _fstdig(f) struct file* f; | int _fstdig(struct file* f) | ||||||
| { | { | ||||||
| 	int ch; | 	int ch; | ||||||
| 
 | 
 | ||||||
|  | @ -53,7 +48,7 @@ int _fstdig(f) struct file* f; | ||||||
| 	return (ch); | 	return (ch); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| int _nxtdig(f) struct file* f; | int _nxtdig(struct file* f) | ||||||
| { | { | ||||||
| 	int ch; | 	int ch; | ||||||
| 
 | 
 | ||||||
|  | @ -64,7 +59,7 @@ int _nxtdig(f) struct file* f; | ||||||
| 	return (ch); | 	return (ch); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| int _getint(f) struct file* f; | int _getint(struct file* f) | ||||||
| { | { | ||||||
| 	int is_signed, i, ch; | 	int is_signed, i, ch; | ||||||
| 
 | 
 | ||||||
|  | @ -77,7 +72,7 @@ int _getint(f) struct file* f; | ||||||
| 	return (is_signed ? i : -i); | 	return (is_signed ? i : -i); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| int _rdi(f) struct file* f; | int _rdi(struct file* f) | ||||||
| { | { | ||||||
| 	_rf(f); | 	_rf(f); | ||||||
| 	_skipsp(f); | 	_skipsp(f); | ||||||
|  |  | ||||||
|  | @ -18,15 +18,9 @@ | ||||||
| 
 | 
 | ||||||
| /* Author: J.W. Stevenson */ | /* Author: J.W. Stevenson */ | ||||||
| 
 | 
 | ||||||
| #include <pc_file.h> | #include "pc.h" | ||||||
| 
 | 
 | ||||||
| extern _rf(); | long _rdl(struct file* f) | ||||||
| extern _skipsp(); |  | ||||||
| extern int _getsig(); |  | ||||||
| extern int _fstdig(); |  | ||||||
| extern int _nxtdig(); |  | ||||||
| 
 |  | ||||||
| long _rdl(f) struct file* f; |  | ||||||
| { | { | ||||||
| 	int is_signed, ch; | 	int is_signed, ch; | ||||||
| 	long l; | 	long l; | ||||||
|  |  | ||||||
|  | @ -18,22 +18,14 @@ | ||||||
| 
 | 
 | ||||||
| /* Author: J.W. Stevenson */ | /* Author: J.W. Stevenson */ | ||||||
| 
 | 
 | ||||||
| #include <pc_file.h> | #include "pc.h" | ||||||
| 
 | 
 | ||||||
| #define BIG 1e17 | #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 double r; | ||||||
| static int pow10; | static int pow10; | ||||||
| 
 | 
 | ||||||
| static dig(ch) int ch; | static void dig(int ch) | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| 	if (r > BIG) | 	if (r > BIG) | ||||||
|  | @ -42,7 +34,7 @@ static dig(ch) int ch; | ||||||
| 		r = r * 10.0 + ch; | 		r = r * 10.0 + ch; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| double _rdr(f) struct file* f; | double _rdr(struct file* f) | ||||||
| { | { | ||||||
| 	int i; | 	int i; | ||||||
| 	double e; | 	double e; | ||||||
|  |  | ||||||
|  | @ -16,14 +16,9 @@ | ||||||
|  * |  * | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include <pc_file.h> | #include "pc.h" | ||||||
| #include <pc_err.h> |  | ||||||
| 
 | 
 | ||||||
| extern struct file* _curfil; | void _rf(struct file* f) | ||||||
| extern _trp(); |  | ||||||
| extern _incpt(); |  | ||||||
| 
 |  | ||||||
| _rf(f) struct file* f; |  | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| 	_curfil = f; | 	_curfil = f; | ||||||
|  |  | ||||||
|  | @ -16,12 +16,9 @@ | ||||||
|  * |  * | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include <pc_file.h> | #include "pc.h" | ||||||
| 
 | 
 | ||||||
| extern _rf(); | void _rln(struct file* f) | ||||||
| extern _incpt(); |  | ||||||
| 
 |  | ||||||
| _rln(f) struct file* f; |  | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| 	_rf(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)); | 	return (r + (r < 0 ? -0.5 : 0.5)); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -9,13 +9,9 @@ | ||||||
| 
 | 
 | ||||||
| #define __NO_DEFS | #define __NO_DEFS | ||||||
| #include <math.h> | #include <math.h> | ||||||
|  | #include "pc.h" | ||||||
| 
 | 
 | ||||||
| #if __STDC__ | static double sinus(double x, int cos_flag) | ||||||
| #include <pc_math.h> |  | ||||||
| #endif |  | ||||||
| 
 |  | ||||||
| static double |  | ||||||
|     sinus(x, cos_flag) double x; |  | ||||||
| { | { | ||||||
| 	/*	Algorithm and coefficients from:
 | 	/*	Algorithm and coefficients from:
 | ||||||
| 			"Software manual for the elementary functions" | 			"Software manual for the elementary functions" | ||||||
|  | @ -62,7 +58,6 @@ static double | ||||||
| #define A2 -8.908910206761537356617e-6 | #define A2 -8.908910206761537356617e-6 | ||||||
| 	{ | 	{ | ||||||
| 		double x1, x2; | 		double x1, x2; | ||||||
| 		extern double _fif(); |  | ||||||
| 
 | 
 | ||||||
| 		_fif(y, 1.0, &y); | 		_fif(y, 1.0, &y); | ||||||
| 		if (_fif(y, 0.5, &x1)) | 		if (_fif(y, 0.5, &x1)) | ||||||
|  | @ -90,14 +85,12 @@ static double | ||||||
| 	return neg ? -x : x; | 	return neg ? -x : x; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| double | double _sin(double x) | ||||||
|     _sin(x) double x; |  | ||||||
| { | { | ||||||
| 	return sinus(x, 0); | 	return sinus(x, 0); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| double | double _cos(double x) | ||||||
|     _cos(x) double x; |  | ||||||
| { | { | ||||||
| 	if (x < 0) | 	if (x < 0) | ||||||
| 		x = -x; | 		x = -x; | ||||||
|  |  | ||||||
|  | @ -8,16 +8,12 @@ | ||||||
| /* $Id$ */ | /* $Id$ */ | ||||||
| #define __NO_DEFS | #define __NO_DEFS | ||||||
| #include <math.h> | #include <math.h> | ||||||
| #include <pc_err.h> | #include "pc.h" | ||||||
| extern _trp(); |  | ||||||
| 
 | 
 | ||||||
| #define NITER 5 | #define NITER 5 | ||||||
| 
 | 
 | ||||||
| static double | static double Ldexp(double fl, int exp) | ||||||
|     Ldexp(fl, exp) double fl; |  | ||||||
| int exp; |  | ||||||
| { | { | ||||||
| 	extern double _fef(); |  | ||||||
| 	int sign = 1; | 	int sign = 1; | ||||||
| 	int currexp; | 	int currexp; | ||||||
| 
 | 
 | ||||||
|  | @ -49,10 +45,8 @@ int exp; | ||||||
| 	return sign * fl; | 	return sign * fl; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| double | double _sqt(double x) | ||||||
|     _sqt(x) double x; |  | ||||||
| { | { | ||||||
| 	extern double _fef(); |  | ||||||
| 	int exponent; | 	int exponent; | ||||||
| 	double val; | 	double val; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -16,16 +16,18 @@ | ||||||
|  * |  * | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
|  | #include "pc.h" | ||||||
|  | 
 | ||||||
| /* function strbuf(var b:charbuf):string; */ | /* function strbuf(var b:charbuf):string; */ | ||||||
| 
 | 
 | ||||||
| char* strbuf(s) char* s; | char* strbuf(char* s) | ||||||
| { | { | ||||||
| 	return (s); | 	return (s); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /* function strtobuf(s:string; var b:charbuf; blen:integer):integer; */ | /* 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; | 	int i; | ||||||
| 
 | 
 | ||||||
|  | @ -41,7 +43,7 @@ int strtobuf(s, b, l) char *s, *b; | ||||||
| 
 | 
 | ||||||
| /* function strlen(s:string):integer; */ | /* function strlen(s:string):integer; */ | ||||||
| 
 | 
 | ||||||
| int strlen(s) char* s; | int strlen(char* s) | ||||||
| { | { | ||||||
| 	int i; | 	int i; | ||||||
| 
 | 
 | ||||||
|  | @ -53,14 +55,14 @@ int strlen(s) char* s; | ||||||
| 
 | 
 | ||||||
| /* function strfetch(s:string; i:integer):char; */ | /* function strfetch(s:string; i:integer):char; */ | ||||||
| 
 | 
 | ||||||
| int strfetch(s, i) char* s; | int strfetch(char* s, int i) | ||||||
| { | { | ||||||
| 	return (s[i - 1]); | 	return (s[i - 1]); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /* procedure strstore(s:string; i:integer; c:char); */ | /* 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; | 	s[i - 1] = c; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -18,9 +18,7 @@ | ||||||
| 
 | 
 | ||||||
| /* Author: J.W. Stevenson */ | /* Author: J.W. Stevenson */ | ||||||
| 
 | 
 | ||||||
| #include <pc_err.h> | #include "pc.h" | ||||||
| 
 |  | ||||||
| extern _trp(); |  | ||||||
| 
 | 
 | ||||||
| #define assert(x) /* nothing */ | #define assert(x) /* nothing */ | ||||||
| 
 | 
 | ||||||
|  | @ -28,17 +26,7 @@ extern _trp(); | ||||||
| #define EM_WSIZE _EM_WSIZE | #define EM_WSIZE _EM_WSIZE | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| struct descr | void _unp(struct descr *ad, struct descr *zd, int i, char *ap, char *zp, int noext) | ||||||
| { |  | ||||||
| 	int low; |  | ||||||
| 	int diff; |  | ||||||
| 	int size; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| _unp(ad, zd, i, ap, zp, noext) int i; |  | ||||||
| struct descr *ad, *zd; |  | ||||||
| char *ap, *zp; |  | ||||||
| int noext; |  | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| 	if (zd->diff > ad->diff || (i -= ad->low) < 0 || (i + zd->diff) > ad->diff) | 	if (zd->diff > ad->diff || (i -= ad->low) < 0 || (i + zd->diff) > ad->diff) | ||||||
|  |  | ||||||
|  | @ -20,9 +20,9 @@ | ||||||
| 
 | 
 | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
| #include <unistd.h> | #include <unistd.h> | ||||||
|  | #include "pc.h" | ||||||
| 
 | 
 | ||||||
| int uread(fd, b, n) char* b; | int uread(int fd, char* b, int n) | ||||||
| int fd, n; |  | ||||||
| { | { | ||||||
| 	return (read(fd, b, n)); | 	return (read(fd, b, n)); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -20,9 +20,9 @@ | ||||||
| 
 | 
 | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
| #include <unistd.h> | #include <unistd.h> | ||||||
|  | #include "pc.h" | ||||||
| 
 | 
 | ||||||
| int uwrite(fd, b, n) char* b; | int uwrite(int fd, char* b, int n) | ||||||
| int fd, n; |  | ||||||
| { | { | ||||||
| 	return (write(fd, b, n)); | 	return (write(fd, b, n)); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -16,14 +16,10 @@ | ||||||
|  * |  * | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include <pc_file.h> | #include "pc.h" | ||||||
| 
 | 
 | ||||||
| extern struct file* _curfil; | char* _wdw(struct file* f) | ||||||
| extern _incpt(); |  | ||||||
| 
 |  | ||||||
| char* _wdw(f) struct file* f; |  | ||||||
| { | { | ||||||
| 
 |  | ||||||
| 	_curfil = f; | 	_curfil = f; | ||||||
| 	if ((f->flags & (WINDOW | WRBIT | 0377)) == MAGIC) | 	if ((f->flags & (WINDOW | WRBIT | 0377)) == MAGIC) | ||||||
| 		_incpt(f); | 		_incpt(f); | ||||||
|  |  | ||||||
|  | @ -16,13 +16,9 @@ | ||||||
|  * |  * | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include <pc_file.h> | #include "pc.h" | ||||||
| #include <pc_err.h> |  | ||||||
| 
 | 
 | ||||||
| extern struct file* _curfil; | void _wf(struct file* f) | ||||||
| extern _trp(); |  | ||||||
| 
 |  | ||||||
| _wf(f) struct file* f; |  | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| 	_curfil = f; | 	_curfil = f; | ||||||
|  |  | ||||||
|  | @ -16,20 +16,16 @@ | ||||||
|  * |  * | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include <pc_file.h> | #include "pc.h" | ||||||
| 
 | 
 | ||||||
| extern _wf(); | void _wrc(int c, struct file* f) | ||||||
| extern _outcpt(); |  | ||||||
| 
 |  | ||||||
| _wrc(c, f) int c; |  | ||||||
| struct file* f; |  | ||||||
| { | { | ||||||
| 	*f->ptr = c; | 	*f->ptr = c; | ||||||
| 	_wf(f); | 	_wf(f); | ||||||
| 	_outcpt(f); | 	_outcpt(f); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| _wln(f) struct file* f; | void _wln(struct file* f) | ||||||
| { | { | ||||||
| #ifdef CPM | #ifdef CPM | ||||||
| 	_wrc('\r', f); | 	_wrc('\r', f); | ||||||
|  | @ -38,7 +34,7 @@ _wln(f) struct file* f; | ||||||
| 	f->flags |= ELNBIT; | 	f->flags |= ELNBIT; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| _pag(f) struct file* f; | void _pag(struct file* f) | ||||||
| { | { | ||||||
| 	_wrc('\014', f); | 	_wrc('\014', f); | ||||||
| 	f->flags |= ELNBIT; | 	f->flags |= ELNBIT; | ||||||
|  |  | ||||||
|  | @ -18,11 +18,7 @@ | ||||||
| 
 | 
 | ||||||
| /* Author: J.W. Stevenson */ | /* Author: J.W. Stevenson */ | ||||||
| 
 | 
 | ||||||
| #include <pc_err.h> | #include "pc.h" | ||||||
| #include <pc_file.h> |  | ||||||
| 
 |  | ||||||
| extern _wstrin(); |  | ||||||
| extern char* _fcvt(); |  | ||||||
| 
 | 
 | ||||||
| #define assert(x) /* nothing */ | #define assert(x) /* nothing */ | ||||||
| 
 | 
 | ||||||
|  | @ -36,9 +32,7 @@ extern char* _fcvt(); | ||||||
| #define FILL_CHAR '0' /* char printed if all of _fcvt() used */ | #define FILL_CHAR '0' /* char printed if all of _fcvt() used */ | ||||||
| #define BUFSIZE HUGE_DIG + PREC_DIG + 3 | #define BUFSIZE HUGE_DIG + PREC_DIG + 3 | ||||||
| 
 | 
 | ||||||
| _wrf(n, w, r, f) int n, w; | void _wrf(int n, int w, double r, struct file* f) | ||||||
| double r; |  | ||||||
| struct file* f; |  | ||||||
| { | { | ||||||
| 	char *p, *b; | 	char *p, *b; | ||||||
| 	int s, d; | 	int s, d; | ||||||
|  |  | ||||||
|  | @ -16,10 +16,7 @@ | ||||||
|  * |  * | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include <pc_err.h> | #include "pc.h" | ||||||
| #include <pc_file.h> |  | ||||||
| 
 |  | ||||||
| extern _wstrin(); |  | ||||||
| 
 | 
 | ||||||
| #ifndef EM_WSIZE | #ifndef EM_WSIZE | ||||||
| #ifdef _EM_WSIZE | #ifdef _EM_WSIZE | ||||||
|  | @ -47,9 +44,7 @@ extern _wstrin(); | ||||||
| Something wrong here ! | Something wrong here ! | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|     _wsi(w, i, f) int w, | void _wsi(int w, int i, struct file* f) | ||||||
|     i; |  | ||||||
| struct file* f; |  | ||||||
| { | { | ||||||
| 	char* p; | 	char* p; | ||||||
| 	int j; | 	int j; | ||||||
|  | @ -75,8 +70,7 @@ struct file* f; | ||||||
| 	_wstrin(w, (int)(&buf[SZ] - p), p, f); | 	_wstrin(w, (int)(&buf[SZ] - p), p, f); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| _wri(i, f) int i; | void _wri(int i, struct file* f) | ||||||
| struct file* f; |  | ||||||
| { | { | ||||||
| 	_wsi(SZ, i, f); | 	_wsi(SZ, i, f); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -18,16 +18,10 @@ | ||||||
| 
 | 
 | ||||||
| /* Author: J.W. Stevenson */ | /* Author: J.W. Stevenson */ | ||||||
| 
 | 
 | ||||||
| #include <pc_err.h> | #include "pc.h" | ||||||
| #include <pc_file.h> | #include <limits.h> | ||||||
| 
 | 
 | ||||||
| extern _wstrin(); | void _wsl(int w, long l, struct file* f) | ||||||
| 
 |  | ||||||
| #define MAXNEGLONG -2147483648 |  | ||||||
| 
 |  | ||||||
| _wsl(w, l, f) int w; |  | ||||||
| long l; |  | ||||||
| struct file* f; |  | ||||||
| { | { | ||||||
| 	char *p, c; | 	char *p, c; | ||||||
| 	long j; | 	long j; | ||||||
|  | @ -38,7 +32,7 @@ struct file* f; | ||||||
| 	p = &buf[11]; | 	p = &buf[11]; | ||||||
| 	if ((j = l) < 0) | 	if ((j = l) < 0) | ||||||
| 	{ | 	{ | ||||||
| 		if (l == MAXNEGLONG) | 		if (l == LONG_MIN) | ||||||
| 		{ | 		{ | ||||||
| 			_wstrin(w, 11, "-2147483648", f); | 			_wstrin(w, 11, "-2147483648", f); | ||||||
| 			return; | 			return; | ||||||
|  | @ -55,8 +49,7 @@ struct file* f; | ||||||
| 	_wstrin(w, (int)(&buf[11] - p), p, f); | 	_wstrin(w, (int)(&buf[11] - p), p, f); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| _wrl(l, f) long l; | void _wrl(long l, struct file* f) | ||||||
| struct file* f; |  | ||||||
| { | { | ||||||
| 	_wsl(11, l, f); | 	_wsl(11, l, f); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -18,17 +18,11 @@ | ||||||
| 
 | 
 | ||||||
| /* Author: J.W. Stevenson */ | /* Author: J.W. Stevenson */ | ||||||
| 
 | 
 | ||||||
| #include <pc_err.h> | #include "pc.h" | ||||||
| #include <pc_file.h> |  | ||||||
| 
 |  | ||||||
| extern _wstrin(); |  | ||||||
| extern char* _ecvt(); |  | ||||||
| 
 | 
 | ||||||
| #define PREC_DIG 80 /* maximum digits produced by _ecvt() */ | #define PREC_DIG 80 /* maximum digits produced by _ecvt() */ | ||||||
| 
 | 
 | ||||||
| _wsr(w, r, f) int w; | void _wsr(int w, double r, struct file* f) | ||||||
| double r; |  | ||||||
| struct file* f; |  | ||||||
| { | { | ||||||
| 	char *p, *b; | 	char *p, *b; | ||||||
| 	int s, d, i; | 	int s, d, i; | ||||||
|  | @ -72,8 +66,7 @@ struct file* f; | ||||||
| 	_wstrin(w, (int)(p - buf), buf, f); | 	_wstrin(w, (int)(p - buf), buf, f); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| _wrr(r, f) double r; | void _wrr(double r, struct file* f) | ||||||
| struct file* f; |  | ||||||
| { | { | ||||||
| 	_wsr(13, r, 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 creat(const char* path, mode_t mode); | ||||||
| extern int read(int fd, void* buffer, size_t count); | extern int read(int fd, void* buffer, size_t count); | ||||||
| extern int write(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
 | /* Unimplemented system calls (these are just prototypes to let the library
 | ||||||
|  * compile). */ |  * compile). */ | ||||||
|  |  | ||||||
|  | @ -46,6 +46,7 @@ extern int open(const char* path, int access, ...); | ||||||
| extern int creat(const char* path, mode_t mode); | extern int creat(const char* path, mode_t mode); | ||||||
| extern int read(int fd, void* buffer, size_t count); | extern int read(int fd, void* buffer, size_t count); | ||||||
| extern int write(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
 | /* Unimplemented system calls (these are just prototypes to let the library
 | ||||||
|  * compile). */ |  * compile). */ | ||||||
|  |  | ||||||
|  | @ -67,6 +67,7 @@ extern int open(const char* path, int access, ...); | ||||||
| extern int creat(const char* path, mode_t mode); | extern int creat(const char* path, mode_t mode); | ||||||
| extern int read(int fd, void* buffer, size_t count); | extern int read(int fd, void* buffer, size_t count); | ||||||
| extern int write(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
 | /* Unimplemented system calls (these are just prototypes to let the library
 | ||||||
|  * compile). */ |  * compile). */ | ||||||
|  |  | ||||||
|  | @ -67,6 +67,7 @@ extern int open(const char* path, int access, ...); | ||||||
| extern int creat(const char* path, mode_t mode); | extern int creat(const char* path, mode_t mode); | ||||||
| extern int read(int fd, void* buffer, size_t count); | extern int read(int fd, void* buffer, size_t count); | ||||||
| extern int write(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
 | /* Unimplemented system calls (these are just prototypes to let the library
 | ||||||
|  * compile). */ |  * compile). */ | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue