xref: /original-bsd/usr.bin/pascal/libpc/PCSTART.c (revision 7e7b101a)
1 /* Copyright (c) 1979 Regents of the University of California */
2 
3 static char sccsid[] = "@(#)PCSTART.c 1.8 01/10/83";
4 
5 #include <signal.h>
6 #include "h00vars.h"
7 #include "libpc.h"
8 
9 /*
10  * program variables
11  */
12 struct display	_disply[MAXLVL];
13 int		_argc;
14 char		**_argv;
15 long		_stlim = 500000;
16 long		_stcnt = 0;
17 long		_seed = 1;
18 #ifdef ADDR32
19 char		*_minptr = (char *)0x7fffffff;
20 #endif ADDR32
21 #ifdef ADDR16
22 char		*_minptr = (char *)0xffff;
23 #endif ADDR16
24 char		*_maxptr = (char *)0;
25 
26 /*
27  * file record variables
28  */
29 long		_filefre = PREDEF;
30 struct iorechd	_fchain = {
31 	0, 0, 0, 0,		/* only use fchain field */
32 	INPUT			/* fchain  */
33 };
34 struct iorec	*_actfile[MAXFILES] = {
35 	INPUT,
36 	OUTPUT,
37 	ERR
38 };
39 
40 /*
41  * standard files
42  */
43 char		_inwin, _outwin, _errwin;
44 struct iorechd	input = {
45 	&_inwin,		/* fileptr */
46 	0,			/* lcount  */
47 	0x7fffffff,		/* llimit  */
48 	&_iob[0],		/* fbuf    */
49 	OUTPUT,			/* fchain  */
50 	STDLVL,			/* flev    */
51 	"standard input",	/* pfname  */
52 	FTEXT|FREAD|SYNC|EOLN,	/* funit   */
53 	0,			/* fblk    */
54 	1			/* fsize   */
55 };
56 struct iorechd	output = {
57 	&_outwin,		/* fileptr */
58 	0,			/* lcount  */
59 	0x7fffffff,		/* llimit  */
60 	&_iob[1],		/* fbuf    */
61 	ERR,			/* fchain  */
62 	STDLVL,			/* flev    */
63 	"standard output",	/* pfname  */
64 	FTEXT | FWRITE | EOFF,	/* funit   */
65 	1,			/* fblk    */
66 	1			/* fsize   */
67 };
68 struct iorechd	_err = {
69 	&_errwin,		/* fileptr */
70 	0,			/* lcount  */
71 	0x7fffffff,		/* llimit  */
72 	&_iob[2],		/* fbuf    */
73 	FILNIL,			/* fchain  */
74 	STDLVL,			/* flev    */
75 	"Message file",		/* pfname  */
76 	FTEXT | FWRITE | EOFF,	/* funit   */
77 	2,			/* fblk    */
78 	1			/* fsize   */
79 };
80 
81 PCSTART(mode)
82 	int mode;
83 {
84 	/*
85 	 * necessary only on systems which do not initialize
86 	 * memory to zero
87 	 */
88 
89 	struct iorec	**ip;
90 
91 	/*
92 	 * if running with runtime tests enabled, give more
93 	 * coherent error messages for FPEs
94 	 */
95 	if (mode) {
96 		signal(SIGFPE, EXCEPT);
97 	}
98 	for (ip = &_actfile[3]; ip < &_actfile[MAXFILES]; *ip++ = FILNIL);
99 }
100