xref: /original-bsd/usr.bin/pascal/libpc/h00vars.h (revision 1f3a482a)
1 /* Copyright (c) 1979 Regents of the University of California */
2 
3 /* sccsid[] = "@(#)h00vars.h 1.9 06/17/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 /*
52  * program variables
53  */
54 extern struct display	_disply[MAXLVL];/* runtime display */
55 extern int		_argc;		/* number of passed args */
56 extern char		**_argv;	/* values of passed args */
57 extern long		_stlim;		/* statement limit */
58 extern long		_stcnt;		/* statement count */
59 extern long		_seed;		/* random number seed */
60 extern char		*_maxptr;	/* maximum valid pointer */
61 extern char		*_minptr;	/* minimum valid pointer */
62 extern long		_pcpcount[];	/* pxp buffer */
63 
64 /*
65  * file structures
66  */
67 struct iorechd {
68 	char		*fileptr;	/* ptr to file window */
69 	long		lcount;		/* number of lines printed */
70 	long		llimit;		/* maximum number of text lines */
71 	FILE		*fbuf;		/* FILE ptr */
72 	struct iorec	*fchain;	/* chain to next file */
73 	struct iorec	*flev;		/* ptr to associated file variable */
74 	char		*pfname;	/* ptr to name of file */
75 	short		funit;		/* file status flags */
76 	unsigned short	fblk;		/* index into active file table */
77 	long		fsize;		/* size of elements in the file */
78 	char		fname[NAMSIZ];	/* name of associated UNIX file */
79 };
80 
81 struct iorec {
82 	char		*fileptr;	/* ptr to file window */
83 	long		lcount;		/* number of lines printed */
84 	long		llimit;		/* maximum number of text lines */
85 	FILE		*fbuf;		/* FILE ptr */
86 	struct iorec	*fchain;	/* chain to next file */
87 	struct iorec	*flev;		/* ptr to associated file variable */
88 	char		*pfname;	/* ptr to name of file */
89 	short		funit;		/* file status flags */
90 	unsigned short	fblk;		/* index into active file table */
91 	long		fsize;		/* size of elements in the file */
92 	char		fname[NAMSIZ];	/* name of associated UNIX file */
93 	char		buf[BUFSIZ];	/* I/O buffer */
94 	char		window[1];	/* file window element */
95 };
96 
97 /*
98  * unit flags
99  */
100 #define SPEOLN	0x100	/* 1 => pseudo EOLN char read at EOF */
101 #define	FDEF	0x080	/* 1 => reserved file name */
102 #define	FTEXT	0x040	/* 1 => text file, process EOLN */
103 #define	FWRITE	0x020	/* 1 => open for writing */
104 #define	FREAD	0x010	/* 1 => open for reading */
105 #define	TEMP	0x008	/* 1 => temporary file */
106 #define	SYNC	0x004	/* 1 => window is out of sync */
107 #define	EOLN	0x002	/* 1 => at end of line */
108 #define	EOFF	0x001	/* 1 => at end of file */
109 
110 /*
111  * file routines
112  */
113 extern struct iorec	*GETNAME();
114 extern char		*MKTEMP();
115 extern char		*PALLOC();
116 
117 /*
118  * file record variables
119  */
120 extern struct iorechd	_fchain;	/* head of active file chain */
121 extern struct iorec	*_actfile[];	/* table of active files */
122 extern long		_filefre;	/* last used entry in _actfile */
123 
124 /*
125  * standard files
126  */
127 extern struct iorechd	input;
128 extern struct iorechd	output;
129 extern struct iorechd	_err;
130 
131 /*
132  * seek pointer struct for TELL, SEEK extensions
133  */
134 struct seekptr {
135 	long	cnt;
136 };
137