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