date and time created 83/02/11 15:45:08 by rrh
[unix-history] / usr / src / usr.bin / pascal / libpc / h00vars.h
CommitLineData
e9664031
KM
1/* Copyright (c) 1979 Regents of the University of California */
2
a7012926 3/* sccsid[] = "@(#)h00vars.h 1.10 %G%"; */
e9664031
KM
4
5#include <stdio.h>
492cc5d3 6#include "whoami.h"
e9664031
KM
7
8#define PXPFILE "pmon.out"
9#define BITSPERBYTE 8
10#define BITSPERLONG (BITSPERBYTE * sizeof(long))
492cc5d3
KM
11#define LG2BITSBYTE 03
12#define MSKBITSBYTE 07
13#define LG2BITSLONG 05
14#define MSKBITSLONG 037
e9664031 15#define HZ 60
e9664031 16#define MAXLVL 20
93ac5838 17#define MAXERRS 75
e9664031
KM
18#define NAMSIZ 76
19#define MAXFILES 32
20#define PREDEF 2
a7012926 21#ifdef ADDR32
e9664031
KM
22#define STDLVL ((struct iorec *)(0x7ffffff1))
23#define GLVL ((struct iorec *)(0x7ffffff0))
a7012926
KM
24#endif ADDR32
25#ifdef ADDR16
492cc5d3
KM
26#define STDLVL ((struct iorec *)(0xfff1))
27#define GLVL ((struct iorec *)(0xfff0))
a7012926 28#endif ADDR16
e9664031
KM
29#define FILNIL ((struct iorec *)(0))
30#define INPUT ((struct iorec *)(&input))
31#define OUTPUT ((struct iorec *)(&output))
32#define ERR ((struct iorec *)(&_err))
492cc5d3 33typedef enum {FALSE, TRUE} bool;
e9664031
KM
34
35/*
36 * runtime display structure
37 */
38struct display {
39 char *ap;
40 char *fp;
41};
42
43/*
44 * formal routine structure
45 */
46struct formalrtn {
f630942b
KM
47 long (*fentryaddr)(); /* formal entry point */
48 long fbn; /* block number of function */
49 struct display fdisp[ MAXLVL ]; /* saved at first passing */
e9664031
KM
50};
51
52/*
53 * program variables
54 */
55extern struct display _disply[MAXLVL];/* runtime display */
56extern int _argc; /* number of passed args */
57extern char **_argv; /* values of passed args */
58extern long _stlim; /* statement limit */
59extern long _stcnt; /* statement count */
b91a3590 60extern long _seed; /* random number seed */
e9664031
KM
61extern char *_maxptr; /* maximum valid pointer */
62extern char *_minptr; /* minimum valid pointer */
63extern long _pcpcount[]; /* pxp buffer */
64
65/*
66 * file structures
67 */
68struct 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 */
9ebeac9b 77 unsigned short fblk; /* index into active file table */
e9664031
KM
78 long fsize; /* size of elements in the file */
79 char fname[NAMSIZ]; /* name of associated UNIX file */
80};
81
82struct 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 */
9ebeac9b 91 unsigned short fblk; /* index into active file table */
e9664031
KM
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 */
1d9ef80b
KM
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 */
e9664031
KM
110
111/*
112 * file routines
113 */
114extern struct iorec *GETNAME();
115extern char *MKTEMP();
116extern char *PALLOC();
117
118/*
119 * file record variables
120 */
121extern struct iorechd _fchain; /* head of active file chain */
122extern struct iorec *_actfile[]; /* table of active files */
123extern long _filefre; /* last used entry in _actfile */
124
125/*
126 * standard files
127 */
128extern struct iorechd input;
129extern struct iorechd output;
130extern struct iorechd _err;
cbeb1e89
KM
131
132/*
133 * seek pointer struct for TELL, SEEK extensions
134 */
135struct seekptr {
136 long cnt;
137};