make fblk an unsigned to prevent illegal negative numbers
[unix-history] / usr / src / usr.bin / pascal / libpc / h00vars.h
CommitLineData
e9664031
KM
1/* Copyright (c) 1979 Regents of the University of California */
2
9ebeac9b 3/* sccsid[] = "@(#)h00vars.h 1.8 %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
492cc5d3 21#ifdef VAX
e9664031
KM
22#define STDLVL ((struct iorec *)(0x7ffffff1))
23#define GLVL ((struct iorec *)(0x7ffffff0))
492cc5d3
KM
24#else
25#define STDLVL ((struct iorec *)(0xfff1))
26#define GLVL ((struct iorec *)(0xfff0))
27#endif VAX
e9664031
KM
28#define FILNIL ((struct iorec *)(0))
29#define INPUT ((struct iorec *)(&input))
30#define OUTPUT ((struct iorec *)(&output))
31#define ERR ((struct iorec *)(&_err))
492cc5d3 32typedef enum {FALSE, TRUE} bool;
e9664031
KM
33
34/*
35 * runtime display structure
36 */
37struct display {
38 char *ap;
39 char *fp;
40};
41
42/*
43 * formal routine structure
44 */
45struct formalrtn {
f630942b
KM
46 long (*fentryaddr)(); /* formal entry point */
47 long fbn; /* block number of function */
48 struct display fdisp[ MAXLVL ]; /* saved at first passing */
e9664031
KM
49};
50
51/*
52 * program variables
53 */
54extern struct display _disply[MAXLVL];/* runtime display */
55extern int _argc; /* number of passed args */
56extern char **_argv; /* values of passed args */
57extern long _stlim; /* statement limit */
58extern long _stcnt; /* statement count */
b91a3590 59extern long _seed; /* random number seed */
e9664031
KM
60extern char *_maxptr; /* maximum valid pointer */
61extern char *_minptr; /* minimum valid pointer */
62extern long _pcpcount[]; /* pxp buffer */
63
64/*
65 * file structures
66 */
67struct iorechd {
68 char *fileptr; /* ptr to file window */
69 long lcount; /* number of lines printed */
70 long llimit; /* maximum number of text lines */
71 FILE *fbuf; /* FILE ptr */
72 struct iorec *fchain; /* chain to next file */
73 struct iorec *flev; /* ptr to associated file variable */
74 char *pfname; /* ptr to name of file */
75 short funit; /* file status flags */
9ebeac9b 76 unsigned short fblk; /* index into active file table */
e9664031
KM
77 long fsize; /* size of elements in the file */
78 char fname[NAMSIZ]; /* name of associated UNIX file */
79};
80
81struct iorec {
82 char *fileptr; /* ptr to file window */
83 long lcount; /* number of lines printed */
84 long llimit; /* maximum number of text lines */
85 FILE *fbuf; /* FILE ptr */
86 struct iorec *fchain; /* chain to next file */
87 struct iorec *flev; /* ptr to associated file variable */
88 char *pfname; /* ptr to name of file */
89 short funit; /* file status flags */
9ebeac9b 90 unsigned short fblk; /* index into active file table */
e9664031
KM
91 long fsize; /* size of elements in the file */
92 char fname[NAMSIZ]; /* name of associated UNIX file */
93 char buf[BUFSIZ]; /* I/O buffer */
94 char window[1]; /* file window element */
95};
96
97/*
98 * unit flags
99 */
1d9ef80b
KM
100#define SPEOLN 0x100 /* 1 => pseudo EOLN char read at EOF */
101#define FDEF 0x080 /* 1 => reserved file name */
102#define FTEXT 0x040 /* 1 => text file, process EOLN */
103#define FWRITE 0x020 /* 1 => open for writing */
104#define FREAD 0x010 /* 1 => open for reading */
105#define TEMP 0x008 /* 1 => temporary file */
106#define SYNC 0x004 /* 1 => window is out of sync */
107#define EOLN 0x002 /* 1 => at end of line */
108#define EOFF 0x001 /* 1 => at end of file */
e9664031
KM
109
110/*
111 * file routines
112 */
113extern struct iorec *GETNAME();
114extern char *MKTEMP();
115extern char *PALLOC();
116
117/*
118 * file record variables
119 */
120extern struct iorechd _fchain; /* head of active file chain */
121extern struct iorec *_actfile[]; /* table of active files */
122extern long _filefre; /* last used entry in _actfile */
123
124/*
125 * standard files
126 */
127extern struct iorechd input;
128extern struct iorechd output;
129extern struct iorechd _err;