1 typedef struct Addr Addr;
2 typedef struct Cmd Cmd;
5 char type; /* # (char addr), l (line addr), / ? . $ + - , ; */
8 Addr *aleft; /* left side of , and ; */
11 Addr *next; /* or right side of , and ; */
19 Addr *addr; /* address (range of text) */
20 String *re; /* regular expression for e.g. 'x' */
22 Cmd *cmd; /* target of x, g, {, etc. */
23 String *text; /* text of a, c, i; rhs of s */
24 Addr *addr; /* address for m, t */
26 Cmd *next; /* pointer to next element in {} */
28 ushort flag; /* whatever */
29 ushort cmdc; /* command character; 'x' etc. */
37 ushort cmdc; /* command character */
38 uchar text; /* takes a textual argument? */
39 uchar regexp; /* takes a regular expression? */
40 uchar addr; /* takes an address (m or t)? */
41 uchar defcmd; /* default command; 0==>none */
42 uchar defaddr; /* default address */
43 uchar count; /* takes a count e.g. s2/// */
44 char *token; /* takes text terminated by one of these */
45 int (*fn)(File*, Cmd*); /* function to call with parse tree */
48 enum Defaddr{ /* default addresses */
54 int nl_cmd(File*, Cmd*), a_cmd(File*, Cmd*), b_cmd(File*, Cmd*);
55 int c_cmd(File*, Cmd*), cd_cmd(File*, Cmd*), d_cmd(File*, Cmd*);
56 int D_cmd(File*, Cmd*), e_cmd(File*, Cmd*);
57 int f_cmd(File*, Cmd*), g_cmd(File*, Cmd*), i_cmd(File*, Cmd*);
58 int k_cmd(File*, Cmd*), m_cmd(File*, Cmd*), n_cmd(File*, Cmd*);
59 int p_cmd(File*, Cmd*), q_cmd(File*, Cmd*);
60 int s_cmd(File*, Cmd*), u_cmd(File*, Cmd*), w_cmd(File*, Cmd*);
61 int x_cmd(File*, Cmd*), X_cmd(File*, Cmd*), plan9_cmd(File*, Cmd*);
62 int eq_cmd(File*, Cmd*);
65 String *getregexp(int);
67 Address address(Addr*, Address, int);
68 int cmdexec(File*, Cmd*);