[BACK]Return to suff.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / make

Diff for /src/usr.bin/make/suff.c between version 1.76 and 1.77

version 1.76, 2007/11/17 16:39:45 version 1.77, 2007/11/24 15:41:01
Line 207 
Line 207 
 static void SuffAddLevel(Lst, Src *);  static void SuffAddLevel(Lst, Src *);
 static Src *SuffFindThem(Lst, Lst);  static Src *SuffFindThem(Lst, Lst);
 static Src *SuffFindCmds(Src *, Lst);  static Src *SuffFindCmds(Src *, Lst);
 static void SuffExpandChildren(void *, void *);  static void SuffExpandChildren(LstNode, GNode *);
 static void SuffExpandVarChildren(LstNode, GNode *, GNode *);  static void SuffExpandVarChildren(LstNode, GNode *, GNode *);
 static void SuffExpandWildChildren(LstNode, GNode *, GNode *);  static void SuffExpandWildChildren(LstNode, GNode *, GNode *);
 static bool SuffApplyTransform(GNode *, GNode *, Suff *, Suff *);  static bool SuffApplyTransform(GNode *, GNode *, Suff *, Suff *);
Line 1138 
Line 1138 
                         Lst_Append(&pgn->children, after, gn);                          Lst_Append(&pgn->children, after, gn);
                         after = Lst_Adv(after);                          after = Lst_Adv(after);
                         Lst_AtEnd(&gn->parents, pgn);                          Lst_AtEnd(&gn->parents, pgn);
                         pgn->unmade++;                          if (!has_been_built(gn))
                                   pgn->unmade++;
                 }                  }
         }          }
         /* Free the result.  */          /* Free the result.  */
Line 1192 
Line 1193 
                         Lst_Append(&pgn->children, after, gn);                          Lst_Append(&pgn->children, after, gn);
                         after = Lst_Adv(after);                          after = Lst_Adv(after);
                         Lst_AtEnd(&gn->parents, pgn);                          Lst_AtEnd(&gn->parents, pgn);
                         pgn->unmade++;                          if (!has_been_built(gn))
                                   pgn->unmade++;
                 }                  }
         }          }
   
Line 1213 
Line 1215 
  *-----------------------------------------------------------------------   *-----------------------------------------------------------------------
  */   */
 static void  static void
 SuffExpandChildren(  SuffExpandChildren(LstNode ln, /* LstNode of child, so we can replace it */
     void        *cgnp,          /* Child to examine */      GNode *pgn)
     void        *pgnp)          /* Parent node being processed */  
 {  {
         GNode   *cgn = (GNode *)cgnp;          GNode   *cgn = (GNode *)Lst_Datum(ln);
         GNode   *pgn = (GNode *)pgnp;  
         LstNode ln;  
         /* New nodes effectively take the place of the child, so we place them  
          * after the child.  */  
         ln = Lst_Member(&pgn->children, cgn);  
   
         /* First do variable expansion -- this takes precedence over wildcard          /* First do variable expansion -- this takes precedence over wildcard
          * expansion. If the result contains wildcards, they'll be gotten to           * expansion. If the result contains wildcards, they'll be gotten to
Line 1242 
Line 1238 
         Lst_Remove(&pgn->children, ln);          Lst_Remove(&pgn->children, ln);
 }  }
   
   void
   expand_children_from(GNode *parent, LstNode from)
   {
           LstNode np, ln;
   
           for (ln = from; ln != NULL; ln = np) {
                   np = Lst_Adv(ln);
                   SuffExpandChildren(ln, parent);
           }
   }
   
 /*-  /*-
  *-----------------------------------------------------------------------   *-----------------------------------------------------------------------
  * SuffApplyTransform --   * SuffApplyTransform --
Line 1267 
Line 1274 
     Suff        *s)     /* Source suffix */      Suff        *s)     /* Source suffix */
 {  {
         LstNode ln;     /* General node */          LstNode ln;     /* General node */
         LstNode np;         /* Next node for loop */  
         char    *tname; /* Name of transformation rule */          char    *tname; /* Name of transformation rule */
         GNode   *gn;    /* Node for same */          GNode   *gn;    /* Node for same */
   
Line 1275 
Line 1281 
                 /* Not already linked, so form the proper links between the                  /* Not already linked, so form the proper links between the
                  * target and source.  */                   * target and source.  */
                 Lst_AtEnd(&sGn->parents, tGn);                  Lst_AtEnd(&sGn->parents, tGn);
                 tGn->unmade++;                  if (!has_been_built(sGn))
                           tGn->unmade++;
         }          }
   
         if ((sGn->type & OP_OPMASK) == OP_DOUBLEDEP) {          if ((sGn->type & OP_OPMASK) == OP_DOUBLEDEP) {
Line 1290 
Line 1297 
                                 /* Not already linked, so form the proper links                                  /* Not already linked, so form the proper links
                                  * between the target and source.  */                                   * between the target and source.  */
                                 Lst_AtEnd(&gn->parents, tGn);                                  Lst_AtEnd(&gn->parents, tGn);
                                 tGn->unmade++;                                  if (!has_been_built(gn))
                                           tGn->unmade++;
                         }                          }
                 }                  }
         }          }
Line 1318 
Line 1326 
         Make_HandleUse(gn, tGn);          Make_HandleUse(gn, tGn);
   
         /* Deal with wildcards and variables in any acquired sources.  */          /* Deal with wildcards and variables in any acquired sources.  */
         for (ln = Lst_Succ(ln); ln != NULL; ln = np) {          expand_children_from(tGn, Lst_Succ(ln));
                 np = Lst_Adv(ln);  
                 SuffExpandChildren(Lst_Datum(ln), tGn);  
         }  
   
         /* Keep track of another parent to which this beast is transformed so          /* Keep track of another parent to which this beast is transformed so
          * the .IMPSRC variable can be set correctly for the parent.  */           * the .IMPSRC variable can be set correctly for the parent.  */
Line 1387 
Line 1392 
         /* Create the link between the two nodes right off. */          /* Create the link between the two nodes right off. */
         if (Lst_AddNew(&gn->children, mem)) {          if (Lst_AddNew(&gn->children, mem)) {
                 Lst_AtEnd(&mem->parents, gn);                  Lst_AtEnd(&mem->parents, gn);
                 gn->unmade++;                  if (!has_been_built(mem))
                           gn->unmade++;
         }          }
   
         /* Copy variables from member node to this one.  */          /* Copy variables from member node to this one.  */
Line 1513 
Line 1519 
     GNode       *gn,        /* Node for which to find sources */      GNode       *gn,        /* Node for which to find sources */
     Lst         slst)      Lst         slst)
 {  {
         LstNode np;  
         LstNode ln;  
         LIST srcs;      /* List of sources at which to look */          LIST srcs;      /* List of sources at which to look */
         LIST targs;     /* List of targets to which things can be          LIST targs;     /* List of targets to which things can be
                          * transformed. They all have the same file,                           * transformed. They all have the same file,
Line 1608 
Line 1612 
   
         /* Now we've got the important local variables set, expand any sources          /* Now we've got the important local variables set, expand any sources
          * that still contain variables or wildcards in their names.  */           * that still contain variables or wildcards in their names.  */
         for (ln = Lst_First(&gn->children); ln != NULL; ln = np) {          expand_all_children(gn);
                 np = Lst_Adv(ln);  
                 SuffExpandChildren(Lst_Datum(ln), gn);  
         }  
   
         if (targ == NULL) {          if (targ == NULL) {
                 if (DEBUG(SUFF))                  if (DEBUG(SUFF))

Legend:
Removed from v.1.76  
changed lines
  Added in v.1.77