11719Smckusick /* Copyright (c) 1979 Regents of the University of California */
21719Smckusick 
3*3433Smckusic /* sccsid[] = "@(#)h00vars.h 1.6 04/01/81"; */
41719Smckusick 
51719Smckusick #include <stdio.h>
63041Smckusic #include "whoami.h"
71719Smckusick 
81719Smckusick #define PXPFILE		"pmon.out"
91719Smckusick #define	BITSPERBYTE	8
101719Smckusick #define	BITSPERLONG	(BITSPERBYTE * sizeof(long))
113041Smckusic #define LG2BITSBYTE	03
123041Smckusic #define MSKBITSBYTE	07
133041Smckusic #define LG2BITSLONG	05
143041Smckusic #define MSKBITSLONG	037
151719Smckusick #define HZ		60
161719Smckusick #define	MAXLVL		20
172177Smckusic #define MAXERRS		75
181719Smckusick #define NAMSIZ		76
191719Smckusick #define MAXFILES	32
201719Smckusick #define PREDEF		2
213041Smckusic #ifdef VAX
221719Smckusick #define STDLVL		((struct iorec *)(0x7ffffff1))
231719Smckusick #define GLVL		((struct iorec *)(0x7ffffff0))
243041Smckusic #else
253041Smckusic #define STDLVL		((struct iorec *)(0xfff1))
263041Smckusic #define GLVL		((struct iorec *)(0xfff0))
273041Smckusic #endif VAX
281719Smckusick #define FILNIL		((struct iorec *)(0))
291719Smckusick #define INPUT		((struct iorec *)(&input))
301719Smckusick #define OUTPUT		((struct iorec *)(&output))
311719Smckusick #define ERR		((struct iorec *)(&_err))
323041Smckusic typedef enum {FALSE, TRUE} bool;
331719Smckusick 
341719Smckusick /*
351719Smckusick  * runtime display structure
361719Smckusick  */
371719Smckusick struct display {
381719Smckusick 	char	*ap;
391719Smckusick 	char	*fp;
401719Smckusick };
411719Smckusick 
421719Smckusick /*
431719Smckusick  * formal routine structure
441719Smckusick  */
451719Smckusick struct formalrtn {
46*3433Smckusic 	long		(*fentryaddr)();	/* formal entry point */
47*3433Smckusic 	long		fbn;			/* block number of function */
48*3433Smckusic 	struct display	fdisp[ MAXLVL ];	/* saved at first passing */
491719Smckusick };
501719Smckusick 
512177Smckusic struct errentry {
522177Smckusic 	long (*entryaddr)();
532177Smckusic };
542177Smckusic 
552177Smckusic 
561719Smckusick /*
571719Smckusick  * program variables
581719Smckusick  */
591719Smckusick extern struct display	_disply[MAXLVL];/* runtime display */
601719Smckusick extern int		_argc;		/* number of passed args */
611719Smckusick extern char		**_argv;	/* values of passed args */
621719Smckusick extern long		_stlim;		/* statement limit */
631719Smckusick extern long		_stcnt;		/* statement count */
642178Smckusic extern long		_seed;		/* random number seed */
651719Smckusick extern char		*_maxptr;	/* maximum valid pointer */
661719Smckusick extern char		*_minptr;	/* minimum valid pointer */
671719Smckusick extern long		_pcpcount[];	/* pxp buffer */
682177Smckusic extern struct errentry	_entry[MAXERRS];/* error entry catches */
691719Smckusick 
701719Smckusick /*
711719Smckusick  * file structures
721719Smckusick  */
731719Smckusick struct iorechd {
741719Smckusick 	char		*fileptr;	/* ptr to file window */
751719Smckusick 	long		lcount;		/* number of lines printed */
761719Smckusick 	long		llimit;		/* maximum number of text lines */
771719Smckusick 	FILE		*fbuf;		/* FILE ptr */
781719Smckusick 	struct iorec	*fchain;	/* chain to next file */
791719Smckusick 	struct iorec	*flev;		/* ptr to associated file variable */
801719Smckusick 	char		*pfname;	/* ptr to name of file */
811719Smckusick 	short		funit;		/* file status flags */
821719Smckusick 	short		fblk;		/* index into active file table */
831719Smckusick 	long		fsize;		/* size of elements in the file */
841719Smckusick 	char		fname[NAMSIZ];	/* name of associated UNIX file */
851719Smckusick };
861719Smckusick 
871719Smckusick struct iorec {
881719Smckusick 	char		*fileptr;	/* ptr to file window */
891719Smckusick 	long		lcount;		/* number of lines printed */
901719Smckusick 	long		llimit;		/* maximum number of text lines */
911719Smckusick 	FILE		*fbuf;		/* FILE ptr */
921719Smckusick 	struct iorec	*fchain;	/* chain to next file */
931719Smckusick 	struct iorec	*flev;		/* ptr to associated file variable */
941719Smckusick 	char		*pfname;	/* ptr to name of file */
951719Smckusick 	short		funit;		/* file status flags */
961719Smckusick 	short		fblk;		/* index into active file table */
971719Smckusick 	long		fsize;		/* size of elements in the file */
981719Smckusick 	char		fname[NAMSIZ];	/* name of associated UNIX file */
991719Smckusick 	char		buf[BUFSIZ];	/* I/O buffer */
1001719Smckusick 	char		window[1];	/* file window element */
1011719Smckusick };
1021719Smckusick 
1031719Smckusick /*
1041719Smckusick  * unit flags
1051719Smckusick  */
1062225Smckusic #define SPEOLN	0x100	/* 1 => pseudo EOLN char read at EOF */
1072225Smckusic #define	FDEF	0x080	/* 1 => reserved file name */
1082225Smckusic #define	FTEXT	0x040	/* 1 => text file, process EOLN */
1092225Smckusic #define	FWRITE	0x020	/* 1 => open for writing */
1102225Smckusic #define	FREAD	0x010	/* 1 => open for reading */
1112225Smckusic #define	TEMP	0x008	/* 1 => temporary file */
1122225Smckusic #define	SYNC	0x004	/* 1 => window is out of sync */
1132225Smckusic #define	EOLN	0x002	/* 1 => at end of line */
1142225Smckusic #define	EOFF	0x001	/* 1 => at end of file */
1151719Smckusick 
1161719Smckusick /*
1171719Smckusick  * file routines
1181719Smckusick  */
1191719Smckusick extern struct iorec	*GETNAME();
1201719Smckusick extern char		*MKTEMP();
1211719Smckusick extern char		*PALLOC();
1221719Smckusick 
1231719Smckusick /*
1241719Smckusick  * file record variables
1251719Smckusick  */
1261719Smckusick extern struct iorechd	_fchain;	/* head of active file chain */
1271719Smckusick extern struct iorec	*_actfile[];	/* table of active files */
1281719Smckusick extern long		_filefre;	/* last used entry in _actfile */
1291719Smckusick 
1301719Smckusick /*
1311719Smckusick  * standard files
1321719Smckusick  */
1331719Smckusick extern struct iorechd	input;
1341719Smckusick extern struct iorechd	output;
1351719Smckusick extern struct iorechd	_err;
136