1/*
2 * This file was generated by the mknodes program.
3 */
4
5#include <zircon/types.h>
6
7#define NCMD 0
8#define NPIPE 1
9#define NREDIR 2
10#define NBACKGND 3
11#define NSUBSHELL 4
12#define NAND 5
13#define NOR 6
14#define NSEMI 7
15#define NIF 8
16#define NWHILE 9
17#define NUNTIL 10
18#define NFOR 11
19#define NCASE 12
20#define NCLIST 13
21#define NDEFUN 14
22#define NARG 15
23#define NTO 16
24#define NCLOBBER 17
25#define NFROM 18
26#define NFROMTO 19
27#define NAPPEND 20
28#define NTOFD 21
29#define NFROMFD 22
30#define NHERE 23
31#define NXHERE 24
32#define NNOT 25
33
34
35
36struct ncmd {
37      int type;
38      int linno;
39      union node *assign;
40      union node *args;
41      union node *redirect;
42};
43
44
45struct npipe {
46      int type;
47      int backgnd;
48      struct nodelist *cmdlist;
49};
50
51
52struct nredir {
53      int type;
54      int linno;
55      union node *n;
56      union node *redirect;
57};
58
59
60struct nbinary {
61      int type;
62      union node *ch1;
63      union node *ch2;
64};
65
66
67struct nif {
68      int type;
69      union node *test;
70      union node *ifpart;
71      union node *elsepart;
72};
73
74
75struct nfor {
76      int type;
77      int linno;
78      union node *args;
79      union node *body;
80      char *var;
81};
82
83
84struct ncase {
85      int type;
86      int linno;
87      union node *expr;
88      union node *cases;
89};
90
91
92struct nclist {
93      int type;
94      union node *next;
95      union node *pattern;
96      union node *body;
97};
98
99
100struct ndefun {
101      int type;
102      int linno;
103      char *text;
104      union node *body;
105};
106
107
108struct narg {
109      int type;
110      union node *next;
111      char *text;
112      struct nodelist *backquote;
113};
114
115
116struct nfile {
117      int type;
118      union node *next;
119      int fd;
120      union node *fname;
121      char *expfname;
122};
123
124
125struct ndup {
126      int type;
127      union node *next;
128      int fd;
129      int dupfd;
130      union node *vname;
131};
132
133
134struct nhere {
135      int type;
136      union node *next;
137      int fd;
138      union node *doc;
139};
140
141
142struct nnot {
143      int type;
144      union node *com;
145};
146
147
148union node {
149      int type;
150      struct ncmd ncmd;
151      struct npipe npipe;
152      struct nredir nredir;
153      struct nbinary nbinary;
154      struct nif nif;
155      struct nfor nfor;
156      struct ncase ncase;
157      struct nclist nclist;
158      struct ndefun ndefun;
159      struct narg narg;
160      struct nfile nfile;
161      struct ndup ndup;
162      struct nhere nhere;
163      struct nnot nnot;
164};
165
166
167struct nodelist {
168	struct nodelist *next;
169	union node *n;
170};
171
172
173struct funcnode {
174	int count;
175	union node n;
176};
177
178
179struct funcnode *copyfunc(union node *);
180void freefunc(struct funcnode *);
181zx_status_t codec_encode(struct nodelist *nlist, zx_handle_t *vmo);
182struct nodelist* codec_decode(char *buffer, size_t length);
183