11719Smckusick /* Copyright (c) 1979 Regents of the University of California */
21719Smckusick 
3*3887Smckusic /* sccsid[] = "@(#)h00vars.h 1.8 06/14/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 {
463433Smckusic 	long		(*fentryaddr)();	/* formal entry point */
473433Smckusic 	long		fbn;			/* block number of function */
483433Smckusic 	struct display	fdisp[ MAXLVL ];	/* saved at first passing */
491719Smckusick };
501719Smckusick 
511719Smckusick /*
521719Smckusick  * program variables
531719Smckusick  */
541719Smckusick extern struct display	_disply[MAXLVL];/* runtime display */
551719Smckusick extern int		_argc;		/* number of passed args */
561719Smckusick extern char		**_argv;	/* values of passed args */
571719Smckusick extern long		_stlim;		/* statement limit */
581719Smckusick extern long		_stcnt;		/* statement count */
592178Smckusic extern long		_seed;		/* random number seed */
601719Smckusick extern char		*_maxptr;	/* maximum valid pointer */
611719Smckusick extern char		*_minptr;	/* minimum valid pointer */
621719Smckusick extern long		_pcpcount[];	/* pxp buffer */
631719Smckusick 
641719Smckusick /*
651719Smckusick  * file structures
661719Smckusick  */
671719Smckusick struct iorechd {
681719Smckusick 	char		*fileptr;	/* ptr to file window */
691719Smckusick 	long		lcount;		/* number of lines printed */
701719Smckusick 	long		llimit;		/* maximum number of text lines */
711719Smckusick 	FILE		*fbuf;		/* FILE ptr */
721719Smckusick 	struct iorec	*fchain;	/* chain to next file */
731719Smckusick 	struct iorec	*flev;		/* ptr to associated file variable */
741719Smckusick 	char		*pfname;	/* ptr to name of file */
751719Smckusick 	short		funit;		/* file status flags */
76*3887Smckusic 	unsigned short	fblk;		/* index into active file table */
771719Smckusick 	long		fsize;		/* size of elements in the file */
781719Smckusick 	char		fname[NAMSIZ];	/* name of associated UNIX file */
791719Smckusick };
801719Smckusick 
811719Smckusick struct iorec {
821719Smckusick 	char		*fileptr;	/* ptr to file window */
831719Smckusick 	long		lcount;		/* number of lines printed */
841719Smckusick 	long		llimit;		/* maximum number of text lines */
851719Smckusick 	FILE		*fbuf;		/* FILE ptr */
861719Smckusick 	struct iorec	*fchain;	/* chain to next file */
871719Smckusick 	struct iorec	*flev;		/* ptr to associated file variable */
881719Smckusick 	char		*pfname;	/* ptr to name of file */
891719Smckusick 	short		funit;		/* file status flags */
90*3887Smckusic 	unsigned short	fblk;		/* index into active file table */
911719Smckusick 	long		fsize;		/* size of elements in the file */
921719Smckusick 	char		fname[NAMSIZ];	/* name of associated UNIX file */
931719Smckusick 	char		buf[BUFSIZ];	/* I/O buffer */
941719Smckusick 	char		window[1];	/* file window element */
951719Smckusick };
961719Smckusick 
971719Smckusick /*
981719Smckusick  * unit flags
991719Smckusick  */
1002225Smckusic #define SPEOLN	0x100	/* 1 => pseudo EOLN char read at EOF */
1012225Smckusic #define	FDEF	0x080	/* 1 => reserved file name */
1022225Smckusic #define	FTEXT	0x040	/* 1 => text file, process EOLN */
1032225Smckusic #define	FWRITE	0x020	/* 1 => open for writing */
1042225Smckusic #define	FREAD	0x010	/* 1 => open for reading */
1052225Smckusic #define	TEMP	0x008	/* 1 => temporary file */
1062225Smckusic #define	SYNC	0x004	/* 1 => window is out of sync */
1072225Smckusic #define	EOLN	0x002	/* 1 => at end of line */
1082225Smckusic #define	EOFF	0x001	/* 1 => at end of file */
1091719Smckusick 
1101719Smckusick /*
1111719Smckusick  * file routines
1121719Smckusick  */
1131719Smckusick extern struct iorec	*GETNAME();
1141719Smckusick extern char		*MKTEMP();
1151719Smckusick extern char		*PALLOC();
1161719Smckusick 
1171719Smckusick /*
1181719Smckusick  * file record variables
1191719Smckusick  */
1201719Smckusick extern struct iorechd	_fchain;	/* head of active file chain */
1211719Smckusick extern struct iorec	*_actfile[];	/* table of active files */
1221719Smckusick extern long		_filefre;	/* last used entry in _actfile */
1231719Smckusick 
1241719Smckusick /*
1251719Smckusick  * standard files
1261719Smckusick  */
1271719Smckusick extern struct iorechd	input;
1281719Smckusick extern struct iorechd	output;
1291719Smckusick extern struct iorechd	_err;
130