mapnl option to window
[unix-history] / usr / src / usr.bin / window / context.h
CommitLineData
1fb887dd 1/*
7edc52ec 2 * @(#)context.h 3.6 %G%
1fb887dd
EW
3 */
4
b1189050
EW
5#include <stdio.h>
6
1fb887dd
EW
7struct context {
8 struct context *x_link; /* nested contexts */
a40a2f9a
EW
9 char x_type; /* tag for union */
10 union {
11 struct { /* input is a file */
12 char *X_filename; /* input file name */
13 FILE *X_fp; /* input stream */
14 short X_lineno; /* current line number */
15 char X_bol; /* at beginning of line */
16 char X_noerr; /* don't report errors */
17 struct ww *X_errwin; /* error window */
1fb887dd 18 } x_f;
a40a2f9a
EW
19 struct { /* input is a buffer */
20 char *X_buf; /* input buffer */
21 char *X_bufp; /* current position in buf */
bb4a0c0b
EW
22 struct value *X_arg; /* argument for alias */
23 int X_narg; /* number of arguments */
1fb887dd
EW
24 } x_b;
25 } x_un;
a40a2f9a
EW
26 /* holding place for current token */
27 int x_token; /* the token */
28 struct value x_val; /* values associated with token */
29 /* parser error flags */
30 unsigned x_erred :1; /* had an error */
31 unsigned x_synerred :1; /* had syntax error */
32 unsigned x_abort :1; /* fatal error */
1fb887dd
EW
33};
34#define x_buf x_un.x_b.X_buf
35#define x_bufp x_un.x_b.X_bufp
bb4a0c0b
EW
36#define x_arg x_un.x_b.X_arg
37#define x_narg x_un.x_b.X_narg
1fb887dd
EW
38#define x_filename x_un.x_f.X_filename
39#define x_fp x_un.x_f.X_fp
40#define x_lineno x_un.x_f.X_lineno
1fb887dd
EW
41#define x_bol x_un.x_f.X_bol
42#define x_errwin x_un.x_f.X_errwin
a40a2f9a 43#define x_noerr x_un.x_f.X_noerr
1fb887dd 44
a40a2f9a
EW
45 /* x_type values, 0 is reserved */
46#define X_FILE 1 /* input is a file */
47#define X_BUF 2 /* input is a buffer */
1fb887dd 48
a40a2f9a 49struct context cx; /* the current context */