1 /* $Header: cmd.h,v 2.0 88/06/05 00:08:28 root Exp $
4 * Revision 2.0 88/06/05 00:08:28 root
5 * Baseline version 2.0.
17 extern char *cmdname[];
39 #endif /* DEBUGGING */
41 #define CF_OPTIMIZE 077 /* type of optimization */
42 #define CF_FIRSTNEG 0100/* conditional is ($register NE 'string') */
43 #define CF_NESURE 0200 /* if short doesn't match we're sure */
44 #define CF_EQSURE 0400 /* if short does match we're sure */
45 #define CF_COND 01000 /* test c_expr as conditional first, if not null. */
46 /* Set for everything except do {} while currently */
47 #define CF_LOOP 02000 /* loop on the c_expr conditional (loop modifiers) */
48 #define CF_INVERT 04000 /* it's an "unless" or an "until" */
49 #define CF_ONCE 010000 /* we've already pushed the label on the stack */
50 #define CF_FLIP 020000 /* on a match do flipflop */
52 #define CFT_FALSE 0 /* c_expr is always false */
53 #define CFT_TRUE 1 /* c_expr is always true */
54 #define CFT_REG 2 /* c_expr is a simple register */
55 #define CFT_ANCHOR 3 /* c_expr is an anchored search /^.../ */
56 #define CFT_STROP 4 /* c_expr is a string comparison */
57 #define CFT_SCAN 5 /* c_expr is an unanchored search /.../ */
58 #define CFT_GETS 6 /* c_expr is <filehandle> */
59 #define CFT_EVAL 7 /* c_expr is not optimized, so call eval() */
60 #define CFT_UNFLIP 8 /* 2nd half of range not optimized */
61 #define CFT_CHOP 9 /* c_expr is a chop on a register */
62 #define CFT_ARRAY 10 /* this is a foreach loop */
63 #define CFT_INDGETS 11 /* c_expr is <$variable> */
64 #define CFT_NUMOP 12 /* c_expr is a numeric comparison */
68 extern char *cmdopt[];
87 #endif /* DEBUGGING */
90 STAB *ac_stab; /* a symbol table entry */
91 ARG *ac_expr; /* any associated expression */
95 CMD *cc_true; /* normal code to do on if and while */
96 CMD *cc_alt; /* else code or continue code */
100 CMD *c_next; /* the next command at this level */
101 ARG *c_expr; /* conditional expression */
102 CMD *c_head; /* head of this command list */
103 STR *c_short; /* string to match as shortcut */
104 STAB *c_stab; /* a symbol table entry, mostly for fp */
105 SPAT *c_spat; /* pattern used by optimization */
106 char *c_label; /* label for this construct */
108 struct acmd acmd; /* normal command */
109 struct ccmd ccmd; /* compound command */
111 short c_slen; /* len of c_short, if not null */
112 short c_flags; /* optimization flags--see above */
113 char *c_file; /* file the following line # is from */
114 line_t c_line; /* line # of this command */
115 char c_type; /* what this command does */
118 #define Nullcmd Null(CMD*)
120 EXT CMD *main_root INIT(Nullcmd);
121 EXT CMD *eval_root INIT(Nullcmd);