1: /* $Header: cmd.h,v 1.0.1.1 88/01/28 10:23:07 root Exp $
   2:  *
   3:  * $Log:	cmd.h,v $
   4:  * Revision 1.0.1.1  88/01/28  10:23:07  root
   5:  * patch8: added eval_root for eval operator.
   6:  *
   7:  * Revision 1.0  87/12/18  13:04:59  root
   8:  * Initial revision
   9:  *
  10:  */
  11: 
  12: #define C_NULL 0
  13: #define C_IF 1
  14: #define C_WHILE 2
  15: #define C_EXPR 3
  16: #define C_BLOCK 4
  17: 
  18: #ifndef DOINIT
  19: extern char *cmdname[];
  20: #else
  21: char *cmdname[] = {
  22:     "NULL",
  23:     "IF",
  24:     "WHILE",
  25:     "EXPR",
  26:     "BLOCK",
  27:     "5",
  28:     "6",
  29:     "7",
  30:     "8",
  31:     "9",
  32:     "10",
  33:     "11",
  34:     "12",
  35:     "13",
  36:     "14",
  37:     "15",
  38:     "16"
  39: };
  40: #endif
  41: 
  42: #define CF_OPTIMIZE 077 /* type of optimization */
  43: #define CF_FIRSTNEG 0100/* conditional is ($register NE 'string') */
  44: #define CF_NESURE 0200  /* if first doesn't match we're sure */
  45: #define CF_EQSURE 0400  /* if first does match we're sure */
  46: #define CF_COND 01000   /* test c_expr as conditional first, if not null. */
  47:             /* Set for everything except do {} while currently */
  48: #define CF_LOOP 02000   /* loop on the c_expr conditional (loop modifiers) */
  49: #define CF_INVERT 04000 /* it's an "unless" or an "until" */
  50: #define CF_ONCE 010000  /* we've already pushed the label on the stack */
  51: #define CF_FLIP 020000  /* on a match do flipflop */
  52: 
  53: #define CFT_FALSE 0 /* c_expr is always false */
  54: #define CFT_TRUE 1  /* c_expr is always true */
  55: #define CFT_REG 2   /* c_expr is a simple register */
  56: #define CFT_ANCHOR 3    /* c_expr is an anchored search /^.../ */
  57: #define CFT_STROP 4 /* c_expr is a string comparison */
  58: #define CFT_SCAN 5  /* c_expr is an unanchored search /.../ */
  59: #define CFT_GETS 6  /* c_expr is $reg = <filehandle> */
  60: #define CFT_EVAL 7  /* c_expr is not optimized, so call eval() */
  61: #define CFT_UNFLIP 8    /* 2nd half of range not optimized */
  62: #define CFT_CHOP 9  /* c_expr is a chop on a register */
  63: 
  64: #ifndef DOINIT
  65: extern char *cmdopt[];
  66: #else
  67: char *cmdopt[] = {
  68:     "FALSE",
  69:     "TRUE",
  70:     "REG",
  71:     "ANCHOR",
  72:     "STROP",
  73:     "SCAN",
  74:     "GETS",
  75:     "EVAL",
  76:     "UNFLIP",
  77:     "CHOP",
  78:     "10"
  79: };
  80: #endif
  81: 
  82: struct acmd {
  83:     STAB    *ac_stab;   /* a symbol table entry */
  84:     ARG     *ac_expr;   /* any associated expression */
  85: };
  86: 
  87: struct ccmd {
  88:     CMD     *cc_true;   /* normal code to do on if and while */
  89:     CMD     *cc_alt;    /* else code or continue code */
  90: };
  91: 
  92: struct cmd {
  93:     CMD     *c_next;    /* the next command at this level */
  94:     ARG     *c_expr;    /* conditional expression */
  95:     CMD     *c_head;    /* head of this command list */
  96:     STR     *c_first;   /* head of string to match as shortcut */
  97:     STAB    *c_stab;    /* a symbol table entry, mostly for fp */
  98:     SPAT    *c_spat;    /* pattern used by optimization */
  99:     char    *c_label;   /* label for this construct */
 100:     union ucmd {
 101:     struct acmd acmd;   /* normal command */
 102:     struct ccmd ccmd;   /* compound command */
 103:     } ucmd;
 104:     short   c_flen;     /* len of c_first, if not null */
 105:     short   c_flags;    /* optimization flags--see above */
 106:     char    c_type;     /* what this command does */
 107: };
 108: 
 109: #define Nullcmd Null(CMD*)
 110: 
 111: EXT CMD *main_root INIT(Nullcmd);
 112: EXT CMD *eval_root INIT(Nullcmd);
 113: 
 114: struct compcmd {
 115:     CMD *comp_true;
 116:     CMD *comp_alt;
 117: };
 118: 
 119: #ifndef DOINIT
 120: extern struct compcmd Nullccmd;
 121: #else
 122: struct compcmd Nullccmd = {Nullcmd, Nullcmd};
 123: #endif
 124: void opt_arg();
 125: void evalstatic();
 126: STR *cmd_exec();

Defined variables

Nullccmd declared in line 120; defined in line 122; never used
cmdname declared in line 19; defined in line 21; used 3 times
cmdopt declared in line 65; defined in line 67; used 1 times

Defined struct's

acmd defined in line 82; used 2 times
  • in line 101(2)
ccmd defined in line 87; used 2 times
  • in line 102(2)
cmd defined in line 92; used 2 times
compcmd defined in line 114; used 6 times

Defined union's

ucmd defined in line 100; never used

Defined macros

CFT_ANCHOR defined in line 56; never used
CFT_CHOP defined in line 62; never used
CFT_EVAL defined in line 60; never used
CFT_FALSE defined in line 53; never used
CFT_GETS defined in line 59; never used
CFT_REG defined in line 55; never used
CFT_SCAN defined in line 58; never used
CFT_STROP defined in line 57; never used
CFT_TRUE defined in line 54; never used
CFT_UNFLIP defined in line 61; never used
CF_ONCE defined in line 50; used 6 times
C_EXPR defined in line 15; used 4 times
C_NULL defined in line 12; used 1 times
C_WHILE defined in line 14; used 5 times

Usage of this include

Last modified: 2002-12-19
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 3000
Valid CSS Valid XHTML 1.0 Strict