Added code to handle DragonFly tags in expected results files.
[dragonfly.git] / usr.bin / make / GNode.h
1 #ifndef GNode_h_39503bf2
2 #define GNode_h_39503bf2
3 /*
4  * Copyright (c) 2004, 2005 by Max Okumoto
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to Berkeley by
8  * Adam de Boor.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. All advertising materials mentioning features or use of this software
19  *    must display the following acknowledgement:
20  *      This product includes software developed by the University of
21  *      California, Berkeley and its contributors.
22  * 4. Neither the name of the University nor the names of its contributors
23  *    may be used to endorse or promote products derived from this software
24  *    without specific prior written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36  * SUCH DAMAGE.
37  *
38  * $DragonFly: src/usr.bin/make/GNode.h,v 1.1 2005/01/06 11:41:47 okumoto Exp $
39  */
40
41 #include "sprite.h"
42 #include "lst.h"
43
44 struct _Suff;
45
46 /*-
47  * The structure for an individual graph node. Each node has several
48  * pieces of data associated with it.
49  *      1) the name of the target it describes
50  *      2) the location of the target file in the filesystem.
51  *      3) the type of operator used to define its sources (qv. parse.c)
52  *      4) whether it is involved in this invocation of make
53  *      5) whether the target has been remade
54  *      6) whether any of its children has been remade
55  *      7) the number of its children that are, as yet, unmade
56  *      8) its modification time
57  *      9) the modification time of its youngest child (qv. make.c)
58  *      10) a list of nodes for which this is a source
59  *      11) a list of nodes on which this depends
60  *      12) a list of nodes that depend on this, as gleaned from the
61  *          transformation rules.
62  *      13) a list of nodes of the same name created by the :: operator
63  *      14) a list of nodes that must be made (if they're made) before
64  *          this node can be, but that do no enter into the datedness of
65  *          this node.
66  *      15) a list of nodes that must be made (if they're made) after
67  *          this node is, but that do not depend on this node, in the
68  *          normal sense.
69  *      16) a Lst of ``local'' variables that are specific to this target
70  *         and this target only (qv. var.c [$@ $< $?, etc.])
71  *      17) a Lst of strings that are commands to be given to a shell
72  *         to create this target.
73  */
74 typedef struct GNode {
75         char    *name;  /* The target's name */
76         char    *path;  /* The full pathname of the file */
77         int     type;   /* Its type (see the OP flags, below) */
78         int     order;  /* Its wait weight */
79
80         Boolean make;   /* TRUE if this target needs to be remade */
81
82         /* Set to reflect the state of processing on this node */
83         enum {
84                 UNMADE,         /* Not examined yet */
85
86                 BEINGMADE,      /* Target is already being made.
87                                  * Indicates a cycle in the graph.
88                                  * (compat mode only) */
89
90                 MADE,           /* Was out-of-date and has been made */
91
92                 UPTODATE,       /* Was already up-to-date */
93
94                 ERROR,          /* An error occured while it was being
95                                  * made (used only in compat mode) */
96
97                 ABORTED,        /* The target was aborted due to an
98                                  * error making an inferior (compat). */
99
100                 CYCLE,          /* Marked as potentially being part of
101                                  * a graph cycle.  If we come back to
102                                  * a node marked this way, it is printed
103                                  * and 'made' is changed to ENDCYCLE. */
104
105                 ENDCYCLE        /* The cycle has been completely printed.
106                                  * Go back and unmark all its members. */
107         } made;
108
109         Boolean childMade;      /* TRUE if one of this target's children
110                                  * was made */
111         int     unmade;         /* The number of unmade children */
112         int     mtime;          /* Its modification time */
113         int     cmtime;         /* Modification time of its youngest child */
114         Lst     iParents;       /* Links to parents for which this is an
115                                  * implied source, if any */
116         Lst     cohorts;        /* Other nodes for the :: operator */
117         Lst     parents;        /* Nodes that depend on this one */
118         Lst     children;       /* Nodes on which this one depends */
119         Lst     successors;     /* Nodes that must be made after this one */
120         Lst     preds;          /* Nodes that must be made before this one */
121
122         Lst     context;        /* The local variables */
123         Lst     commands;       /* Creation commands */
124
125         /* current command executing in compat mode */
126         LstNode *compat_command;
127
128         struct _Suff    *suffix;        /* Suffix for the node (determined
129                                          * by Suff_FindDeps and opaque to
130                                          * everyone but the Suff module) */
131 } GNode;
132
133 #endif /* GNode_h_39503bf2 */