xref: /original-bsd/usr.bin/pascal/libpc/h00vars.h (revision 6c57d260)
1 /* Copyright (c) 1979 Regents of the University of California */
2 
3 /* sccsid[] = "@(#)h00vars.h 1.6 04/01/81"; */
4 
5 #include <stdio.h>
6 #include "whoami.h"
7 
8 #define PXPFILE		"pmon.out"
9 #define	BITSPERBYTE	8
10 #define	BITSPERLONG	(BITSPERBYTE * sizeof(long))
11 #define LG2BITSBYTE	03
12 #define MSKBITSBYTE	07
13 #define LG2BITSLONG	05
14 #define MSKBITSLONG	037
15 #define HZ		60
16 #define	MAXLVL		20
17 #define MAXERRS		75
18 #define NAMSIZ		76
19 #define MAXFILES	32
20 #define PREDEF		2
21 #ifdef VAX
22 #define STDLVL		((struct iorec *)(0x7ffffff1))
23 #define GLVL		((struct iorec *)(0x7ffffff0))
24 #else
25 #define STDLVL		((struct iorec *)(0xfff1))
26 #define GLVL		((struct iorec *)(0xfff0))
27 #endif VAX
28 #define FILNIL		((struct iorec *)(0))
29 #define INPUT		((struct iorec *)(&input))
30 #define OUTPUT		((struct iorec *)(&output))
31 #define ERR		((struct iorec *)(&_err))
32 typedef enum {FALSE, TRUE} bool;
33 
34 /*
35  * runtime display structure
36  */
37 struct display {
38 	char	*ap;
39 	char	*fp;
40 };
41 
42 /*
43  * formal routine structure
44  */
45 struct formalrtn {
46 	long		(*fentryaddr)();	/* formal entry point */
47 	long		fbn;			/* block number of function */
48 	struct display	fdisp[ MAXLVL ];	/* saved at first passing */
49 };
50 
51 struct errentry {
52 	long (*entryaddr)();
53 };
54 
55 
56 /*
57  * program variables
58  */
59 extern struct display	_disply[MAXLVL];/* runtime display */
60 extern int		_argc;		/* number of passed args */
61 extern char		**_argv;	/* values of passed args */
62 extern long		_stlim;		/* statement limit */
63 extern long		_stcnt;		/* statement count */
64 extern long		_seed;		/* random number seed */
65 extern char		*_maxptr;	/* maximum valid pointer */
66 extern char		*_minptr;	/* minimum valid pointer */
67 extern long		_pcpcount[];	/* pxp buffer */
68 extern struct errentry	_entry[MAXERRS];/* error entry catches */
69 
70 /*
71  * file structures
72  */
73 struct iorechd {
74 	char		*fileptr;	/* ptr to file window */
75 	long		lcount;		/* number of lines printed */
76 	long		llimit;		/* maximum number of text lines */
77 	FILE		*fbuf;		/* FILE ptr */
78 	struct iorec	*fchain;	/* chain to next file */
79 	struct iorec	*flev;		/* ptr to associated file variable */
80 	char		*pfname;	/* ptr to name of file */
81 	short		funit;		/* file status flags */
82 	short		fblk;		/* index into active file table */
83 	long		fsize;		/* size of elements in the file */
84 	char		fname[NAMSIZ];	/* name of associated UNIX file */
85 };
86 
87 struct iorec {
88 	char		*fileptr;	/* ptr to file window */
89 	long		lcount;		/* number of lines printed */
90 	long		llimit;		/* maximum number of text lines */
91 	FILE		*fbuf;		/* FILE ptr */
92 	struct iorec	*fchain;	/* chain to next file */
93 	struct iorec	*flev;		/* ptr to associated file variable */
94 	char		*pfname;	/* ptr to name of file */
95 	short		funit;		/* file status flags */
96 	short		fblk;		/* index into active file table */
97 	long		fsize;		/* size of elements in the file */
98 	char		fname[NAMSIZ];	/* name of associated UNIX file */
99 	char		buf[BUFSIZ];	/* I/O buffer */
100 	char		window[1];	/* file window element */
101 };
102 
103 /*
104  * unit flags
105  */
106 #define SPEOLN	0x100	/* 1 => pseudo EOLN char read at EOF */
107 #define	FDEF	0x080	/* 1 => reserved file name */
108 #define	FTEXT	0x040	/* 1 => text file, process EOLN */
109 #define	FWRITE	0x020	/* 1 => open for writing */
110 #define	FREAD	0x010	/* 1 => open for reading */
111 #define	TEMP	0x008	/* 1 => temporary file */
112 #define	SYNC	0x004	/* 1 => window is out of sync */
113 #define	EOLN	0x002	/* 1 => at end of line */
114 #define	EOFF	0x001	/* 1 => at end of file */
115 
116 /*
117  * file routines
118  */
119 extern struct iorec	*GETNAME();
120 extern char		*MKTEMP();
121 extern char		*PALLOC();
122 
123 /*
124  * file record variables
125  */
126 extern struct iorechd	_fchain;	/* head of active file chain */
127 extern struct iorec	*_actfile[];	/* table of active files */
128 extern long		_filefre;	/* last used entry in _actfile */
129 
130 /*
131  * standard files
132  */
133 extern struct iorechd	input;
134 extern struct iorechd	output;
135 extern struct iorechd	_err;
136