]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/tools/build/src/engine/command.h
update ceph source to reef 18.1.2
[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
1e59de90
TL
7/* This file is ALSO:
8 * Copyright 2022 René Ferdinand Rivera Morell
9 * Distributed under the Boost Software License, Version 1.0.
10 * (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
11 */
12
7c673cae
FG
13/*
14 * command.h - the CMD structure and routines to manipulate them
15 *
16 * Both ACTION and CMD contain a rule, targets, and sources. An
17 * ACTION describes a rule to be applied to the given targets and
18 * sources; a CMD is what actually gets executed by the shell. The
19 * differences are due to:
20 *
21 * ACTIONS must be combined if 'actions together' is given.
22 * ACTIONS must be split if 'actions piecemeal' is given.
23 * ACTIONS must have current sources omitted for 'actions updated'.
24 *
25 * The CMD datatype holds a single command that is to be executed
26 * against a target, and they can chain together to represent the
27 * full collection of commands used to update a target.
28 *
29 * Structures:
30 *
31 * CMD - an action, ready to be formatted into a buffer and executed.
32 *
33 * External routines:
34 *
35 * cmd_new() - return a new CMD or 0 if too many args.
36 * cmd_free() - delete CMD and its parts.
37 * cmd_next() - walk the CMD chain.
38 * cmd_release_targets_and_shell() - CMD forgets about its targets & shell.
39 */
40
41
42/*
43 * CMD - an action, ready to be formatted into a buffer and executed.
44 */
45
46#ifndef COMMAND_SW20111118_H
47#define COMMAND_SW20111118_H
48
92f5a8d4 49#include "config.h"
7c673cae 50#include "lists.h"
1e59de90 51#include "mem.h"
7c673cae 52#include "rules.h"
f67539c2 53#include "jam_strings.h"
7c673cae
FG
54
55
56typedef struct _cmd CMD;
57
58/*
59 * A list whose elements are either TARGETS or CMDS.
60 * CMDLIST is used only by CMD. A TARGET means that
61 * the CMD is the last updating action required to
62 * build the target. A CMD is the next CMD required
63 * to build the same target. (Note that a single action
64 * can update more than one target, so the CMDs form
65 * a DAG, not a straight linear list.)
66 */
67typedef struct _cmdlist {
68 struct _cmdlist * next;
69 union {
70 CMD * cmd;
71 TARGET * t;
72 } impl;
73 char iscmd;
74} CMDLIST;
75
76CMDLIST * cmdlist_append_cmd( CMDLIST *, CMD * );
77CMDLIST * cmdlist_append_target( CMDLIST *, TARGET * );
78void cmd_list_free( CMDLIST * );
79
80struct _cmd
81{
82 CMDLIST * next;
83 RULE * rule; /* rule->actions contains shell script */
84 LIST * shell; /* $(JAMSHELL) value */
85 LOL args; /* LISTs for $(<), $(>) */
86 string buf[ 1 ]; /* actual commands */
87 int noop; /* no-op commands should be faked instead of executed */
88 int asynccnt; /* number of outstanding dependencies */
1e59de90
TL
89 targets_ptr lock; /* semaphores that are required by this cmd. */
90 targets_uptr unlock; /* semaphores that are released when this cmd finishes. */
7c673cae
FG
91 char status; /* the command status */
92};
93
94CMD * cmd_new
95(
96 RULE * rule, /* rule (referenced) */
97 LIST * targets, /* $(<) (ownership transferred) */
98 LIST * sources, /* $(>) (ownership transferred) */
99 LIST * shell /* $(JAMSHELL) (ownership transferred) */
100);
101
102void cmd_release_targets_and_shell( CMD * );
103
104void cmd_free( CMD * );
105
106#define cmd_next( c ) ((c)->next)
107
108#endif