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