|
|
1.1 root 1: /*
2: * An editor.
3: * Header file.
4: */
5:
6: #define ULARGE 65535L /* Largest unsigned value */
7: #define LNSIZE 2000 /* Initial size of line number table */
8: #define LBSIZE 512 /* Size of line buffer */
9: #define CBSIZE 512 /* Size of code buffer */
10: #define TBSIZE CBSIZE /* Size of temporary buffer */
11: #define SBSIZE 512 /* Replace substitute buffer size */
12: #define GBSIZE 512 /* Global command buffer size */
13: #define DBSIZE 512 /* Size of disk buffer cache */
14: #define BRSIZE 9 /* Number of \( ... \) allowed */
15: #define FNSIZE 64 /* File name size */
16: #define CKSIZE 64 /* Length of crypt key */
17: #define MKSIZE 26 /* Size of mark line table */
18: #define PGSIZE 22 /* Page size */
19:
20: /*
21: * Functions for finding out whether a character is a letter and
22: * to switch case from lower to upper and vice versa.
23: * Knows about ctype.h internals.
24: */
25: #define isallet(c) (_ctype[(c)+1]&(_L|_N))
26: #define toother(c) ((c)^' ')
27:
28: /*
29: * Click size definitions.
30: * These functions are used to get the block number and offset into
31: * the block given a seek pointer gotten from the line number table.
32: * It takes into account the size of the disk buffer (DBSIZE) and
33: * the fact that the seek pointer may be off by one (caused by the
34: * global command marking lines.
35: */
36: #define CLSIZE 16
37: #define blockn(a) ((a)>>6)
38: #define offset(a) (((a)&076) << 3)
39: #define linead() (tmpseek >> 3)
40:
41: /*
42: * Definition for stream directives in regular expressions.
43: * The order of these must not be changed. In particular,
44: * the `stream of' directives must immediately follow their
45: * single counterparts.
46: */
47: #define CSNUL 000 /* End of expression */
48: #define CSSOL 001 /* Match start of line */
49: #define CSEOL 002 /* End of line */
50: #define CSOPR 003 /* \( */
51: #define CSCPR 004 /* \) */
52: #define CSBRN 005 /* Match nth \( ... \) */
53: #define CSDOT 006 /* Any character */
54: #define CMDOT 007 /* Stream of any characters */
55: #define CSCHR 010 /* Match given character */
56: #define CMCHR 011 /* Match stream of given characters */
57: #define CSSCC 012 /* Char in single case */
58: #define CMSCC 013 /* Stream of chars in single case */
59: #define CSCCL 014 /* Character class */
60: #define CMCCL 015 /* Stream of character class */
61: #define CSNCL 016 /* Not character class */
62: #define CMNCL 017 /* Stream of not char class */
63:
64: /*
65: * Typedefs.
66: */
67: typedef unsigned LINE; /* Typedef for line table */
68:
69: /*
70: * Structure for remembering \( ... \).
71: */
72: typedef struct {
73: char *b_bp; /* Ptr to start of string matched */
74: char *b_ep; /* Ptr to end of string matched */
75: } BRACE;
76:
77: /*
78: * External function declarations.
79: */
80: extern char *calloc();
81: extern FILE *copen();
82: extern char *getdisk();
83: extern char *getenv();
84: extern char *getpass();
85: extern char *malloc();
86: extern char *match();
87: extern int readfil();
88: extern int readtty();
89: extern char *realloc();
90: extern char *strcpy();
91: extern FILE *xfopen();
92:
93: /*
94: * Global variables.
95: */
96: extern int cflag; /* Print character counts */
97: extern int mflag; /* Allow multiple commands per line */
98: extern int pflag; /* Editor prompts */
99: extern int oflag; /* Behaves like the old editor */
100: extern int sflag; /* Match patterns in single case */
101: extern int tflag; /* Set up for screen editor */
102: extern int vflag; /* Verbose error messages */
103: extern int intflag; /* Interrupt has been hit */
104: extern char *tfn; /* Temp file name */
105: extern FILE *tmp; /* Temp file pointer */
106: extern long tmpseek; /* Free space seek ptr in tmp file */
107: extern int rcurbno; /* Current read block number */
108: extern int wcurbno; /* Current write block number */
109: extern LINE *line; /* Pointer to line table */
110: extern int lnsize; /* Current size of line table */
111: extern int savechr; /* Character that was ungetx'ed */
112: extern int lastchr; /* Last character we read */
113: extern char *gcp; /* Global input pointer */
114: extern char linebuf[LBSIZE]; /* Line buffer */
115: extern char codebuf[CBSIZE]; /* Code buffer */
116: extern char tempbuf[TBSIZE]; /* Temporary buffer */
117: extern char subsbuf[SBSIZE]; /* Substitute buffer */
118: extern char globbuf[GBSIZE]; /* Buffer for global command */
119: extern char rdbcbuf[DBSIZE]; /* Disk buffer cache */
120: extern char wdbcbuf[DBSIZE]; /* Write buffer cache */
121: extern BRACE brace[1+BRSIZE]; /* For remembering \( \) */
122: extern char file[FNSIZE+1]; /* Filename */
123: extern LINE marklin[MKSIZE]; /* Mark line table */
124: extern int dotadd; /* Address of the current line */
125: extern int doladd; /* Address of last line */
126: extern char vcom; /* Verify command */
127: extern int saved; /* File saved since last written */
128: extern FILE *fp; /* File pointer for readfil */
129: extern long cct; /* Number of chars read in append */
130: extern long lct; /* Number of lines read in append */
131: extern int appflag; /* In append mode */
132: extern int addspec; /* Number of addresses specified */
133: extern int adderrr; /* Error in computing address */
134: extern int addpage; /* An ampersand was found */
135: extern int addques; /* A question mark was found */
136: extern int subnths; /* Which substitute wanted */
137: extern int subnewl; /* A newline is being replaced */
138: extern int subseek; /* Seek position of new line */
139: extern int suborig; /* Seek position of old line */
140: extern char *errstr; /* Pointer to last error message */
141: extern char *keyp; /* Pointer to crypt key */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.