]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/src/engine/command.h
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / tools / build / src / engine / command.h
1 /*
2 * Copyright 1994 Christopher Seiwald.
3 *
4 * This file is part of Jam - see jam.c for Copyright information.
5 */
6
7 /*
8 * command.h - the CMD structure and routines to manipulate them
9 *
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:
14 *
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'.
18 *
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.
22 *
23 * Structures:
24 *
25 * CMD - an action, ready to be formatted into a buffer and executed.
26 *
27 * External routines:
28 *
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.
32 * cmd_release_targets_and_shell() - CMD forgets about its targets & shell.
33 */
34
35
36 /*
37 * CMD - an action, ready to be formatted into a buffer and executed.
38 */
39
40 #ifndef COMMAND_SW20111118_H
41 #define COMMAND_SW20111118_H
42
43 #include "config.h"
44 #include "lists.h"
45 #include "rules.h"
46 #include "strings.h"
47
48
49 typedef struct _cmd CMD;
50
51 /*
52 * A list whose elements are either TARGETS or CMDS.
53 * CMDLIST is used only by CMD. A TARGET means that
54 * the CMD is the last updating action required to
55 * build the target. A CMD is the next CMD required
56 * to build the same target. (Note that a single action
57 * can update more than one target, so the CMDs form
58 * a DAG, not a straight linear list.)
59 */
60 typedef struct _cmdlist {
61 struct _cmdlist * next;
62 union {
63 CMD * cmd;
64 TARGET * t;
65 } impl;
66 char iscmd;
67 } CMDLIST;
68
69 CMDLIST * cmdlist_append_cmd( CMDLIST *, CMD * );
70 CMDLIST * cmdlist_append_target( CMDLIST *, TARGET * );
71 void cmd_list_free( CMDLIST * );
72
73 struct _cmd
74 {
75 CMDLIST * next;
76 RULE * rule; /* rule->actions contains shell script */
77 LIST * shell; /* $(JAMSHELL) value */
78 LOL args; /* LISTs for $(<), $(>) */
79 string buf[ 1 ]; /* actual commands */
80 int noop; /* no-op commands should be faked instead of executed */
81 int asynccnt; /* number of outstanding dependencies */
82 TARGETS * lock; /* semaphores that are required by this cmd. */
83 TARGETS * unlock; /* semaphores that are released when this cmd finishes. */
84 char status; /* the command status */
85 };
86
87 CMD * cmd_new
88 (
89 RULE * rule, /* rule (referenced) */
90 LIST * targets, /* $(<) (ownership transferred) */
91 LIST * sources, /* $(>) (ownership transferred) */
92 LIST * shell /* $(JAMSHELL) (ownership transferred) */
93 );
94
95 void cmd_release_targets_and_shell( CMD * );
96
97 void cmd_free( CMD * );
98
99 #define cmd_next( c ) ((c)->next)
100
101 #endif