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