]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/tools/build/src/engine/command.h
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / tools / build / src / engine / command.h
CommitLineData
7c673cae
FG
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 "lists.h"
44#include "rules.h"
45#include "strings.h"
46
47
48typedef struct _cmd CMD;
49
50/*
51 * A list whose elements are either TARGETS or CMDS.
52 * CMDLIST is used only by CMD. A TARGET means that
53 * the CMD is the last updating action required to
54 * build the target. A CMD is the next CMD required
55 * to build the same target. (Note that a single action
56 * can update more than one target, so the CMDs form
57 * a DAG, not a straight linear list.)
58 */
59typedef struct _cmdlist {
60 struct _cmdlist * next;
61 union {
62 CMD * cmd;
63 TARGET * t;
64 } impl;
65 char iscmd;
66} CMDLIST;
67
68CMDLIST * cmdlist_append_cmd( CMDLIST *, CMD * );
69CMDLIST * cmdlist_append_target( CMDLIST *, TARGET * );
70void cmd_list_free( CMDLIST * );
71
72struct _cmd
73{
74 CMDLIST * next;
75 RULE * rule; /* rule->actions contains shell script */
76 LIST * shell; /* $(JAMSHELL) value */
77 LOL args; /* LISTs for $(<), $(>) */
78 string buf[ 1 ]; /* actual commands */
79 int noop; /* no-op commands should be faked instead of executed */
80 int asynccnt; /* number of outstanding dependencies */
81 TARGETS * lock; /* semaphores that are required by this cmd. */
82 TARGETS * unlock; /* semaphores that are released when this cmd finishes. */
83 char status; /* the command status */
84};
85
86CMD * cmd_new
87(
88 RULE * rule, /* rule (referenced) */
89 LIST * targets, /* $(<) (ownership transferred) */
90 LIST * sources, /* $(>) (ownership transferred) */
91 LIST * shell /* $(JAMSHELL) (ownership transferred) */
92);
93
94void cmd_release_targets_and_shell( CMD * );
95
96void cmd_free( CMD * );
97
98#define cmd_next( c ) ((c)->next)
99
100#endif