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