version 1.19, 2000/06/17 14:38:20 |
version 1.20, 2000/06/17 14:40:30 |
|
|
* flags are right (TARG_CREATE) |
* flags are right (TARG_CREATE) |
* |
* |
* Targ_FindList Given a list of names, find nodes for all |
* Targ_FindList Given a list of names, find nodes for all |
* of them. If a name doesn't exist and the |
* of them, creating nodes if needed. |
* TARG_NOCREATE flag was given, an error message |
|
* is printed. Else, if a name doesn't exist, |
|
* its node is created. |
|
* |
* |
* Targ_Ignore Return TRUE if errors should be ignored when |
* Targ_Ignore Return TRUE if errors should be ignored when |
* creating the given target. |
* creating the given target. |
|
|
* Targ_FindList -- |
* Targ_FindList -- |
* Make a complete list of GNodes from the given list of names |
* Make a complete list of GNodes from the given list of names |
* |
* |
* Results: |
|
* A complete list of graph nodes corresponding to all instances of all |
|
* the names in names. |
|
* |
|
* Side Effects: |
* Side Effects: |
* If flags is TARG_CREATE, nodes will be created for all names in |
* Nodes will be created for all names which do not yet have graph |
* names which do not yet have graph nodes. If flags is TARG_NOCREATE, |
* nodes. |
* an error message will be printed for each name which can't be found. |
* |
|
* A complete list of graph nodes corresponding to all instances of |
|
* all names is added to nodes. |
* ----------------------------------------------------------------------- |
* ----------------------------------------------------------------------- |
*/ |
*/ |
Lst |
void |
Targ_FindList(names, flags) |
Targ_FindList(nodes, names) |
Lst names; /* list of names to find */ |
Lst nodes; /* result list */ |
int flags; /* flags used if no node is found for a given |
Lst names; /* list of names to find */ |
* name */ |
|
{ |
{ |
Lst nodes; /* result list */ |
LstNode ln; /* name list element */ |
register LstNode ln; /* name list element */ |
GNode *gn; /* node in tLn */ |
register GNode *gn; /* node in tLn */ |
char *name; |
char *name; |
|
|
|
nodes = Lst_New(); |
for (ln = Lst_First(names); ln != NULL; ln = Lst_Succ(ln)) { |
|
|
if (Lst_Open (names) == FAILURE) { |
|
return (nodes); |
|
} |
|
while ((ln = Lst_Next (names)) != NULL) { |
|
name = (char *)Lst_Datum(ln); |
name = (char *)Lst_Datum(ln); |
gn = Targ_FindNode (name, flags); |
gn = Targ_FindNode(name, TARG_CREATE); |
if (gn != NULL) { |
/* |
/* |
* Note: Lst_AtEnd must come before the Lst_Concat so the nodes |
* Note: Lst_AtEnd must come before the Lst_Concat so the nodes |
* are added to the list in the order in which they were |
* are added to the list in the order in which they were |
* encountered in the makefile. |
* encountered in the makefile. |
*/ |
*/ |
Lst_AtEnd(nodes, gn); |
Lst_AtEnd(nodes, gn); |
if (gn->type & OP_DOUBLEDEP) |
if (gn->type & OP_DOUBLEDEP) { |
Lst_Concat(nodes, &gn->cohorts, LST_CONCNEW); |
Lst_Concat(nodes, &gn->cohorts, LST_CONCNEW); |
|
} |
|
} else if (flags == TARG_NOCREATE) { |
|
Error ("\"%s\" -- target unknown.", name); |
|
} |
|
} |
} |
Lst_Close (names); |
|
return (nodes); |
|
} |
} |
|
|
/*- |
/*- |