2 * Copyright 1994 Christopher Seiwald.
3 * This file is part of Jam - see jam.c for Copyright information.
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, version 3 of the License ONLY.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 * command.h - the CMD structure and routines to manipulate them
20 * Both ACTION and CMD contain a rule, targets, and sources. An
21 * ACTION describes a rule to be applied to the given targets and
22 * sources; a CMD is what actually gets executed by the shell. The
23 * differences are due to:
25 * ACTIONS must be combined if 'actions together' is given.
26 * ACTIONS must be split if 'actions piecemeal' is given.
27 * ACTIONS must have current sources omitted for 'actions updated'.
29 * The CMD datatype holds a single command that is to be executed
30 * against a target, and they can chain together to represent the
31 * full collection of commands used to update a target.
35 * CMD - an action, ready to be formatted into a buffer and executed
39 * cmd_new() - return a new CMD or 0 if too many args
40 * cmd_free() - delete CMD and its parts
41 * cmd_next() - walk the CMD chain
43 #ifndef JAMH_COMMAND_H
44 #define JAMH_COMMAND_H
51 * CMD - an action, ready to be formatted into a buffer and executed
53 typedef struct _cmd CMD
;
56 CMD
*tail
; /* valid on in head */
57 RULE
*rule
; /* rule->actions contains shell script */
58 LIST
*shell
; /* $(SHELL) value */
59 LOL args
; /* LISTs for $(<), $(>) */
60 //char buf[MAXLINE]; /* actual commands */
66 RULE
*rule
, /* rule (referenced) */
67 LIST
*targets
, /* $(<) (freed) */
68 LIST
*sources
, /* $(>) (freed) */
69 LIST
*shell
, /* $(SHELL) (freed) */
70 int maxline
/* max line length */
73 extern void cmd_free (CMD
*cmd
);
76 #define cmd_next(c) ((c)->next)