|
|
1.1 root 1: /*
2: * Copyright (c) 1983 Regents of the University of California.
3: * All rights reserved.
4: *
5: * Redistribution and use in source and binary forms are permitted
6: * provided that the above copyright notice and this paragraph are
7: * duplicated in all such forms and that any documentation,
8: * advertising materials, and other materials related to such
9: * distribution and use acknowledge that the software was developed
10: * by the University of California, Berkeley. The name of the
11: * University may not be used to endorse or promote products derived
12: * from this software without specific prior written permission.
13: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14: * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15: * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16: *
17: * @(#)context.h 3.9 (Berkeley) 6/29/88
18: */
19:
20: #include <stdio.h>
21:
22: struct context {
23: struct context *x_link; /* nested contexts */
24: char x_type; /* tag for union */
25: union {
26: struct { /* input is a file */
27: char *X_filename; /* input file name */
28: FILE *X_fp; /* input stream */
29: short X_lineno; /* current line number */
30: char X_bol; /* at beginning of line */
31: char X_noerr; /* don't report errors */
32: struct ww *X_errwin; /* error window */
33: } x_f;
34: struct { /* input is a buffer */
35: char *X_buf; /* input buffer */
36: char *X_bufp; /* current position in buf */
37: struct value *X_arg; /* argument for alias */
38: int X_narg; /* number of arguments */
39: } x_b;
40: } x_un;
41: /* holding place for current token */
42: int x_token; /* the token */
43: struct value x_val; /* values associated with token */
44: /* parser error flags */
45: unsigned x_erred :1; /* had an error */
46: unsigned x_synerred :1; /* had syntax error */
47: unsigned x_abort :1; /* fatal error */
48: };
49: #define x_buf x_un.x_b.X_buf
50: #define x_bufp x_un.x_b.X_bufp
51: #define x_arg x_un.x_b.X_arg
52: #define x_narg x_un.x_b.X_narg
53: #define x_filename x_un.x_f.X_filename
54: #define x_fp x_un.x_f.X_fp
55: #define x_lineno x_un.x_f.X_lineno
56: #define x_bol x_un.x_f.X_bol
57: #define x_errwin x_un.x_f.X_errwin
58: #define x_noerr x_un.x_f.X_noerr
59:
60: /* x_type values, 0 is reserved */
61: #define X_FILE 1 /* input is a file */
62: #define X_BUF 2 /* input is a buffer */
63:
64: struct context cx; /* the current context */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.