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