xref: /csrg-svn/usr.bin/pascal/libpc/h00vars.h (revision 30856)
1 /* Copyright (c) 1979 Regents of the University of California */
2 
3 /* sccsid[] = "@(#)h00vars.h 1.11 04/07/87"; */
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 ADDR32
22 #ifndef tahoe
23 #define STDLVL		((struct iorec *)(0x7ffffff1))
24 #define GLVL		((struct iorec *)(0x7ffffff0))
25 #else tahoe
26 #define STDLVL		((struct iorec *)(0xbffffff1))
27 #define GLVL		((struct iorec *)(0xbffffff0))
28 #endif tahoe
29 #endif ADDR32
30 #ifdef ADDR16
31 #define STDLVL		((struct iorec *)(0xfff1))
32 #define GLVL		((struct iorec *)(0xfff0))
33 #endif ADDR16
34 #define FILNIL		((struct iorec *)(0))
35 #define INPUT		((struct iorec *)(&input))
36 #define OUTPUT		((struct iorec *)(&output))
37 #define ERR		((struct iorec *)(&_err))
38 typedef enum {FALSE, TRUE} bool;
39 
40 /*
41  * runtime display structure
42  */
43 struct display {
44 	char	*ap;
45 	char	*fp;
46 };
47 
48 /*
49  * formal routine structure
50  */
51 struct formalrtn {
52 	long		(*fentryaddr)();	/* formal entry point */
53 	long		fbn;			/* block number of function */
54 	struct display	fdisp[ MAXLVL ];	/* saved at first passing */
55 };
56 
57 /*
58  * program variables
59  */
60 extern struct display	_disply[MAXLVL];/* runtime display */
61 extern int		_argc;		/* number of passed args */
62 extern char		**_argv;	/* values of passed args */
63 extern long		_stlim;		/* statement limit */
64 extern long		_stcnt;		/* statement count */
65 extern long		_seed;		/* random number seed */
66 extern char		*_maxptr;	/* maximum valid pointer */
67 extern char		*_minptr;	/* minimum valid pointer */
68 extern long		_pcpcount[];	/* pxp buffer */
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 	unsigned 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 	unsigned 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 
137 /*
138  * seek pointer struct for TELL, SEEK extensions
139  */
140 struct seekptr {
141 	long	cnt;
142 };
143