xref: /csrg-svn/usr.bin/pascal/libpc/h00vars.h (revision 30856)
11719Smckusick /* Copyright (c) 1979 Regents of the University of California */
21719Smckusick 
3*30856Smckusick /* sccsid[] = "@(#)h00vars.h 1.11 04/07/87"; */
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
2110234Smckusick #ifdef ADDR32
22*30856Smckusick #ifndef tahoe
231719Smckusick #define STDLVL		((struct iorec *)(0x7ffffff1))
241719Smckusick #define GLVL		((struct iorec *)(0x7ffffff0))
25*30856Smckusick #else tahoe
26*30856Smckusick #define STDLVL		((struct iorec *)(0xbffffff1))
27*30856Smckusick #define GLVL		((struct iorec *)(0xbffffff0))
28*30856Smckusick #endif tahoe
2910234Smckusick #endif ADDR32
3010234Smckusick #ifdef ADDR16
313041Smckusic #define STDLVL		((struct iorec *)(0xfff1))
323041Smckusic #define GLVL		((struct iorec *)(0xfff0))
3310234Smckusick #endif ADDR16
341719Smckusick #define FILNIL		((struct iorec *)(0))
351719Smckusick #define INPUT		((struct iorec *)(&input))
361719Smckusick #define OUTPUT		((struct iorec *)(&output))
371719Smckusick #define ERR		((struct iorec *)(&_err))
383041Smckusic typedef enum {FALSE, TRUE} bool;
391719Smckusick 
401719Smckusick /*
411719Smckusick  * runtime display structure
421719Smckusick  */
431719Smckusick struct display {
441719Smckusick 	char	*ap;
451719Smckusick 	char	*fp;
461719Smckusick };
471719Smckusick 
481719Smckusick /*
491719Smckusick  * formal routine structure
501719Smckusick  */
511719Smckusick struct formalrtn {
523433Smckusic 	long		(*fentryaddr)();	/* formal entry point */
533433Smckusic 	long		fbn;			/* block number of function */
543433Smckusic 	struct display	fdisp[ MAXLVL ];	/* saved at first passing */
551719Smckusick };
561719Smckusick 
571719Smckusick /*
581719Smckusick  * program variables
591719Smckusick  */
601719Smckusick extern struct display	_disply[MAXLVL];/* runtime display */
611719Smckusick extern int		_argc;		/* number of passed args */
621719Smckusick extern char		**_argv;	/* values of passed args */
631719Smckusick extern long		_stlim;		/* statement limit */
641719Smckusick extern long		_stcnt;		/* statement count */
652178Smckusic extern long		_seed;		/* random number seed */
661719Smckusick extern char		*_maxptr;	/* maximum valid pointer */
671719Smckusick extern char		*_minptr;	/* minimum valid pointer */
681719Smckusick extern long		_pcpcount[];	/* pxp buffer */
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 */
823887Smckusic 	unsigned 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 */
963887Smckusic 	unsigned 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;
1363902Smckusic 
1373902Smckusic /*
1383902Smckusic  * seek pointer struct for TELL, SEEK extensions
1393902Smckusic  */
1403902Smckusic struct seekptr {
1413902Smckusic 	long	cnt;
1423902Smckusic };
143