140865Sbostic /*- 2*62091Sbostic * Copyright (c) 1979, 1993 3*62091Sbostic * The Regents of the University of California. All rights reserved. 440865Sbostic * 540865Sbostic * %sccs.include.redist.c% 640865Sbostic * 7*62091Sbostic * @(#)h00vars.h 8.1 (Berkeley) 06/06/93 840865Sbostic */ 91719Smckusick 101719Smckusick #include <stdio.h> 113041Smckusic #include "whoami.h" 121719Smckusick 131719Smckusick #define PXPFILE "pmon.out" 141719Smckusick #define BITSPERBYTE 8 151719Smckusick #define BITSPERLONG (BITSPERBYTE * sizeof(long)) 163041Smckusic #define LG2BITSBYTE 03 173041Smckusic #define MSKBITSBYTE 07 183041Smckusic #define LG2BITSLONG 05 193041Smckusic #define MSKBITSLONG 037 201719Smckusick #define HZ 60 211719Smckusick #define MAXLVL 20 222177Smckusic #define MAXERRS 75 231719Smckusick #define NAMSIZ 76 241719Smckusick #define MAXFILES 32 251719Smckusick #define PREDEF 2 2610234Smckusick #ifdef ADDR32 2730856Smckusick #ifndef tahoe 281719Smckusick #define STDLVL ((struct iorec *)(0x7ffffff1)) 291719Smckusick #define GLVL ((struct iorec *)(0x7ffffff0)) 3030856Smckusick #else tahoe 3130856Smckusick #define STDLVL ((struct iorec *)(0xbffffff1)) 3230856Smckusick #define GLVL ((struct iorec *)(0xbffffff0)) 3330856Smckusick #endif tahoe 3410234Smckusick #endif ADDR32 3510234Smckusick #ifdef ADDR16 363041Smckusic #define STDLVL ((struct iorec *)(0xfff1)) 373041Smckusic #define GLVL ((struct iorec *)(0xfff0)) 3810234Smckusick #endif ADDR16 391719Smckusick #define FILNIL ((struct iorec *)(0)) 401719Smckusick #define INPUT ((struct iorec *)(&input)) 411719Smckusick #define OUTPUT ((struct iorec *)(&output)) 421719Smckusick #define ERR ((struct iorec *)(&_err)) 433041Smckusic typedef enum {FALSE, TRUE} bool; 441719Smckusick 451719Smckusick /* 461719Smckusick * runtime display structure 471719Smckusick */ 481719Smckusick struct display { 491719Smckusick char *ap; 501719Smckusick char *fp; 511719Smckusick }; 521719Smckusick 531719Smckusick /* 541719Smckusick * formal routine structure 551719Smckusick */ 561719Smckusick struct formalrtn { 573433Smckusic long (*fentryaddr)(); /* formal entry point */ 583433Smckusic long fbn; /* block number of function */ 593433Smckusic struct display fdisp[ MAXLVL ]; /* saved at first passing */ 601719Smckusick }; 611719Smckusick 621719Smckusick /* 631719Smckusick * program variables 641719Smckusick */ 651719Smckusick extern struct display _disply[MAXLVL];/* runtime display */ 661719Smckusick extern int _argc; /* number of passed args */ 671719Smckusick extern char **_argv; /* values of passed args */ 681719Smckusick extern long _stlim; /* statement limit */ 691719Smckusick extern long _stcnt; /* statement count */ 702178Smckusic extern long _seed; /* random number seed */ 711719Smckusick extern char *_maxptr; /* maximum valid pointer */ 721719Smckusick extern char *_minptr; /* minimum valid pointer */ 731719Smckusick extern long _pcpcount[]; /* pxp buffer */ 741719Smckusick 751719Smckusick /* 761719Smckusick * file structures 771719Smckusick */ 781719Smckusick struct iorechd { 791719Smckusick char *fileptr; /* ptr to file window */ 801719Smckusick long lcount; /* number of lines printed */ 811719Smckusick long llimit; /* maximum number of text lines */ 821719Smckusick FILE *fbuf; /* FILE ptr */ 831719Smckusick struct iorec *fchain; /* chain to next file */ 841719Smckusick struct iorec *flev; /* ptr to associated file variable */ 851719Smckusick char *pfname; /* ptr to name of file */ 861719Smckusick short funit; /* file status flags */ 873887Smckusic unsigned short fblk; /* index into active file table */ 881719Smckusick long fsize; /* size of elements in the file */ 891719Smckusick char fname[NAMSIZ]; /* name of associated UNIX file */ 901719Smckusick }; 911719Smckusick 921719Smckusick struct iorec { 931719Smckusick char *fileptr; /* ptr to file window */ 941719Smckusick long lcount; /* number of lines printed */ 951719Smckusick long llimit; /* maximum number of text lines */ 961719Smckusick FILE *fbuf; /* FILE ptr */ 971719Smckusick struct iorec *fchain; /* chain to next file */ 981719Smckusick struct iorec *flev; /* ptr to associated file variable */ 991719Smckusick char *pfname; /* ptr to name of file */ 1001719Smckusick short funit; /* file status flags */ 1013887Smckusic unsigned short fblk; /* index into active file table */ 1021719Smckusick long fsize; /* size of elements in the file */ 1031719Smckusick char fname[NAMSIZ]; /* name of associated UNIX file */ 1041719Smckusick char buf[BUFSIZ]; /* I/O buffer */ 1051719Smckusick char window[1]; /* file window element */ 1061719Smckusick }; 1071719Smckusick 1081719Smckusick /* 1091719Smckusick * unit flags 1101719Smckusick */ 1112225Smckusic #define SPEOLN 0x100 /* 1 => pseudo EOLN char read at EOF */ 1122225Smckusic #define FDEF 0x080 /* 1 => reserved file name */ 1132225Smckusic #define FTEXT 0x040 /* 1 => text file, process EOLN */ 1142225Smckusic #define FWRITE 0x020 /* 1 => open for writing */ 1152225Smckusic #define FREAD 0x010 /* 1 => open for reading */ 1162225Smckusic #define TEMP 0x008 /* 1 => temporary file */ 1172225Smckusic #define SYNC 0x004 /* 1 => window is out of sync */ 1182225Smckusic #define EOLN 0x002 /* 1 => at end of line */ 1192225Smckusic #define EOFF 0x001 /* 1 => at end of file */ 1201719Smckusick 1211719Smckusick /* 1221719Smckusick * file routines 1231719Smckusick */ 1241719Smckusick extern struct iorec *GETNAME(); 1251719Smckusick extern char *MKTEMP(); 1261719Smckusick extern char *PALLOC(); 1271719Smckusick 1281719Smckusick /* 1291719Smckusick * file record variables 1301719Smckusick */ 1311719Smckusick extern struct iorechd _fchain; /* head of active file chain */ 1321719Smckusick extern struct iorec *_actfile[]; /* table of active files */ 1331719Smckusick extern long _filefre; /* last used entry in _actfile */ 1341719Smckusick 1351719Smckusick /* 1361719Smckusick * standard files 1371719Smckusick */ 1381719Smckusick extern struct iorechd input; 1391719Smckusick extern struct iorechd output; 1401719Smckusick extern struct iorechd _err; 1413902Smckusic 1423902Smckusic /* 1433902Smckusic * seek pointer struct for TELL, SEEK extensions 1443902Smckusic */ 1453902Smckusic struct seekptr { 1463902Smckusic long cnt; 1473902Smckusic }; 148