added 2 new build-ins: Echo-n and O-Flush
[k8jam.git] / command.h
blob19f92d16321fc3ccb6170a30efe7fefc6ed50238
1 /*
2 * Copyright 1994 Christopher Seiwald.
4 * This file is part of Jam - see jam.c for Copyright information.
5 */
7 /*
8 * command.h - the CMD structure and routines to manipulate them
10 * Both ACTION and CMD contain a rule, targets, and sources. An
11 * ACTION describes a rule to be applied to the given targets and
12 * sources; a CMD is what actually gets executed by the shell. The
13 * differences are due to:
15 * ACTIONS must be combined if 'actions together' is given.
16 * ACTIONS must be split if 'actions piecemeal' is given.
17 * ACTIONS must have current sources omitted for 'actions updated'.
19 * The CMD datatype holds a single command that is to be executed
20 * against a target, and they can chain together to represent the
21 * full collection of commands used to update a target.
23 * Structures:
25 * CMD - an action, ready to be formatted into a buffer and executed
27 * External routines:
29 * cmd_new() - return a new CMD or 0 if too many args
30 * cmd_free() - delete CMD and its parts
31 * cmd_next() - walk the CMD chain
35 * CMD - an action, ready to be formatted into a buffer and executed
37 typedef struct _cmd CMD;
39 struct _cmd {
40 CMD *next;
41 CMD *tail; /* valid on in head */
42 RULE *rule; /* rule->actions contains shell script */
43 LIST *shell; /* $(SHELL) value */
44 LOL args; /* LISTs for $(<), $(>) */
45 char buf[MAXLINE]; /* actual commands */
46 } ;
49 CMD *cmd_new (
50 RULE *rule, /* rule (referenced) */
51 LIST *targets, /* $(<) (freed) */
52 LIST *sources, /* $(>) (freed) */
53 LIST *shell, /* $(SHELL) (freed) */
54 int maxline); /* max line length */
56 void cmd_free (CMD *cmd);
58 #define cmd_next(c) ((c)->next)