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

Diff for /src/usr.bin/make/parse.c between version 1.44 and 1.45

version 1.44, 2000/06/17 14:40:29 version 1.45, 2000/06/17 14:43:36
Line 115 
Line 115 
  */   */
 #define CONTINUE        1  #define CONTINUE        1
 #define DONE            0  #define DONE            0
 static Lst          targets;    /* targets we're working on */  static LIST             targets;        /* targets we're working on */
 #ifdef CLEANUP  #ifdef CLEANUP
 static LIST         targCmds;   /* command lines for targets */  static LIST             targCmds;       /* command lines for targets */
 #endif  #endif
 static Boolean      inLine;     /* true if currently in a dependency  static Boolean          inLine;         /* true if currently in a dependency
                                  * line or its commands */                                           * line or its commands */
 typedef struct {  typedef struct {
     char *str;      char *str;
     char *ptr;      char *ptr;
Line 507 
Line 507 
         /*          /*
          * Replace the node in the targets list with the new copy           * Replace the node in the targets list with the new copy
          */           */
         ln = Lst_Member(targets, gn);          ln = Lst_Member(&targets, gn);
         Lst_Replace(ln, cohort);          Lst_Replace(ln, cohort);
         gn = cohort;          gn = cohort;
     }      }
Line 590 
Line 590 
         if (keywd != -1) {          if (keywd != -1) {
             int op = parseKeywords[keywd].op;              int op = parseKeywords[keywd].op;
             if (op != 0) {              if (op != 0) {
                 Lst_Find(targets, ParseDoOp, &op);                  Lst_Find(&targets, ParseDoOp, &op);
                 return;                  return;
             }              }
             if (parseKeywords[keywd].spec == Wait) {              if (parseKeywords[keywd].spec == Wait) {
Line 650 
Line 650 
         if (tOp) {          if (tOp) {
             gn->type |= tOp;              gn->type |= tOp;
         } else {          } else {
             Lst_ForEach(targets, ParseLinkSrc, gn);              Lst_ForEach(&targets, ParseLinkSrc, gn);
         }          }
         if ((gn->type & OP_OPMASK) == OP_DOUBLEDEP) {          if ((gn->type & OP_OPMASK) == OP_DOUBLEDEP) {
             register GNode      *cohort;              register GNode      *cohort;
Line 661 
Line 661 
                 if (tOp) {                  if (tOp) {
                     cohort->type |= tOp;                      cohort->type |= tOp;
                 } else {                  } else {
                     Lst_ForEach(targets, ParseLinkSrc, cohort);                      Lst_ForEach(&targets, ParseLinkSrc, cohort);
                 }                  }
             }              }
         }          }
Line 781 
Line 781 
     GNode          *gn;         /* a general purpose temporary node */      GNode          *gn;         /* a general purpose temporary node */
     int             op;         /* the operator on the line */      int             op;         /* the operator on the line */
     char            savec;      /* a place to save a character */      char            savec;      /* a place to save a character */
     Lst             paths;      /* List of search paths to alter when parsing      LIST            paths;      /* List of search paths to alter when parsing
                                  * a list of .PATH targets */                                   * a list of .PATH targets */
     int             tOp;        /* operator from special target */      int             tOp;        /* operator from special target */
     LIST            curTargs;   /* list of target names to be found and added      LIST            curTargs;   /* list of target names to be found and added
Line 792 
Line 792 
   
     specType = Not;      specType = Not;
     waiting = 0;      waiting = 0;
     paths = (Lst)NULL;      Lst_Init(&paths);
   
     Lst_Init(&curTargs);      Lst_Init(&curTargs);
     Lst_Init(&curSrcs);      Lst_Init(&curSrcs);
Line 858 
Line 858 
              * went well and FAILURE if there was an error in the               * went well and FAILURE if there was an error in the
              * specification. On error, line should remain untouched.               * specification. On error, line should remain untouched.
              */               */
             if (Arch_ParseArchive (&line, targets, VAR_CMD) != SUCCESS) {              if (Arch_ParseArchive(&line, &targets, VAR_CMD) != SUCCESS) {
                 Parse_Error (PARSE_FATAL,                  Parse_Error (PARSE_FATAL,
                              "Error in archive specification: \"%s\"", line);                               "Error in archive specification: \"%s\"", line);
                 return;                  return;
Line 927 
Line 927 
                  */                   */
                 switch (specType) {                  switch (specType) {
                     case ExPath:                      case ExPath:
                         if (paths == NULL)                          Lst_AtEnd(&paths, &dirSearchPath);
                             paths = Lst_New();  
                         Lst_AtEnd(paths, &dirSearchPath);  
                         break;                          break;
                     case Main:                      case Main:
                         if (!Lst_IsEmpty(&create)) {                          if (!Lst_IsEmpty(&create)) {
Line 941 
Line 939 
                     case Interrupt:                      case Interrupt:
                         gn = Targ_FindNode(line, TARG_CREATE);                          gn = Targ_FindNode(line, TARG_CREATE);
                         gn->type |= OP_NOTMAIN;                          gn->type |= OP_NOTMAIN;
                         Lst_AtEnd(targets, gn);                          Lst_AtEnd(&targets, gn);
                         break;                          break;
                     case Default:                      case Default:
                         gn = Targ_NewGN(".DEFAULT");                          gn = Targ_NewGN(".DEFAULT");
                         gn->type |= (OP_NOTMAIN|OP_TRANSFORM);                          gn->type |= (OP_NOTMAIN|OP_TRANSFORM);
                         Lst_AtEnd(targets, gn);                          Lst_AtEnd(&targets, gn);
                         DEFAULT = gn;                          DEFAULT = gn;
                         break;                          break;
                     case NotParallel:                      case NotParallel:
Line 974 
Line 972 
                 Lst     path;                  Lst     path;
   
                 specType = ExPath;                  specType = ExPath;
                 path = Suff_GetPath (&line[5]);                  path = Suff_GetPath(&line[5]);
                 if (path == NULL) {                  if (path == NULL) {
                     Parse_Error (PARSE_FATAL,                      Parse_Error(PARSE_FATAL,
                                  "Suffix '%s' not defined (yet)",                                   "Suffix '%s' not defined (yet)",
                                  &line[5]);                                   &line[5]);
                     return;                      return;
                 } else {                  } else
                     if (paths == NULL)                      Lst_AtEnd(&paths, path);
                         paths = Lst_New();  
                     Lst_AtEnd(paths, path);  
                 }  
             }              }
         }          }
   
Line 1025 
Line 1020 
                 }                  }
   
                 if (gn != NULL)                  if (gn != NULL)
                     Lst_AtEnd(targets, gn);                      Lst_AtEnd(&targets, gn);
             }              }
         } else if (specType == ExPath && *line != '.' && *line != '\0') {          } else if (specType == ExPath && *line != '.' && *line != '\0') {
             Parse_Error(PARSE_WARNING, "Extra target (%s) ignored", line);              Parse_Error(PARSE_WARNING, "Extra target (%s) ignored", line);
Line 1059 
Line 1054 
     /* Don't need the list of target names any more */      /* Don't need the list of target names any more */
     Lst_Destroy(&curTargs, NOFREE);      Lst_Destroy(&curTargs, NOFREE);
   
     if (!Lst_IsEmpty(targets)) {      if (!Lst_IsEmpty(&targets)) {
         switch(specType) {          switch(specType) {
             default:              default:
                 Parse_Error(PARSE_WARNING, "Special and mundane targets don't mix. Mundane ones ignored");                  Parse_Error(PARSE_WARNING, "Special and mundane targets don't mix. Mundane ones ignored");
Line 1100 
Line 1095 
   
     cp++;                       /* Advance beyond operator */      cp++;                       /* Advance beyond operator */
   
     Lst_Find(targets, ParseDoOp, &op);      Lst_Find(&targets, ParseDoOp, &op);
   
     /*      /*
      * Get to the first source       * Get to the first source
Line 1134 
Line 1129 
                 beSilent = TRUE;                  beSilent = TRUE;
                 break;                  break;
             case ExPath:              case ExPath:
                 Lst_Every(paths, ParseClearPath);                  Lst_Every(&paths, ParseClearPath);
                 break;                  break;
             default:              default:
                 break;                  break;
Line 1200 
Line 1195 
                     Suff_AddSuffix (line);                      Suff_AddSuffix (line);
                     break;                      break;
                 case ExPath:                  case ExPath:
                     Lst_ForEach(paths, ParseAddDir, line);                      Lst_ForEach(&paths, ParseAddDir, line);
                     break;                      break;
                 case Includes:                  case Includes:
                     Suff_AddInclude (line);                      Suff_AddInclude (line);
Line 1223 
Line 1218 
             }              }
             line = cp;              line = cp;
         }          }
         if (paths)          Lst_Destroy(&paths, NOFREE);
             Lst_Delete(paths, NOFREE);  
     } else {      } else {
         while (*line) {          while (*line) {
             /*              /*
Line 1284 
Line 1278 
          * the first dependency line that is actually a real target           * the first dependency line that is actually a real target
          * (i.e. isn't a .USE or .EXEC rule) to be made.           * (i.e. isn't a .USE or .EXEC rule) to be made.
          */           */
         Lst_Find(targets, ParseFindMain, NULL);          Lst_Find(&targets, ParseFindMain, NULL);
     }      }
   
     /* Finally, destroy the list of sources.  */      /* Finally, destroy the list of sources.  */
Line 2406 
Line 2400 
 ParseFinishLine()  ParseFinishLine()
 {  {
     if (inLine) {      if (inLine) {
         Lst_Every(targets, Suff_EndTransform);          Lst_Every(&targets, Suff_EndTransform);
         Lst_Delete(targets, ParseHasCommands);          Lst_Destroy(&targets, ParseHasCommands);
         targets = NULL;          Lst_Init(&targets);
         inLine = FALSE;          inLine = FALSE;
     }      }
 }  }
Line 2499 
Line 2493 
                          * in a dependency spec, add the command to the list of                           * in a dependency spec, add the command to the list of
                          * commands of all targets in the dependency spec                           * commands of all targets in the dependency spec
                          */                           */
                         Lst_ForEach(targets, ParseAddCmd, cp);                          Lst_ForEach(&targets, ParseAddCmd, cp);
 #ifdef CLEANUP  #ifdef CLEANUP
                         Lst_AtEnd(&targCmds, line);                          Lst_AtEnd(&targCmds, line);
 #endif  #endif
Line 2571 
Line 2565 
                     free (line);                      free (line);
                     line = cp;                      line = cp;
   
                     /*                      /* Need a new list for the target nodes */
                      * Need a non-circular list for the target nodes                      Lst_Destroy(&targets, NOFREE);
                      */                      Lst_Init(&targets);
                     if (targets)  
                         Lst_Delete(targets, NOFREE);  
   
                     targets = Lst_New();  
                     inLine = TRUE;                      inLine = TRUE;
   
                     ParseDoDependency (line);                      ParseDoDependency (line);
Line 2622 
Line 2612 
     Lst_Init(&parseIncPath);      Lst_Init(&parseIncPath);
     Lst_Init(&sysIncPath);      Lst_Init(&sysIncPath);
     Lst_Init(&includes);      Lst_Init(&includes);
       Lst_Init(&targets);
 #ifdef CLEANUP  #ifdef CLEANUP
     Lst_Init(&targCmds);      Lst_Init(&targCmds);
     Lst_Init(&fileNames);      Lst_Init(&fileNames);
Line 2634 
Line 2625 
 #ifdef CLEANUP  #ifdef CLEANUP
     Lst_Destroy(&targCmds, (SimpleProc)free);      Lst_Destroy(&targCmds, (SimpleProc)free);
     Lst_Destroy(&fileNames, (void (*) __P((ClientData))) free);      Lst_Destroy(&fileNames, (void (*) __P((ClientData))) free);
     if (targets)      Lst_Delete(&targets, NOFREE);
         Lst_Delete(targets, NOFREE);  
     Lst_Destroy(&sysIncPath, Dir_Destroy);      Lst_Destroy(&sysIncPath, Dir_Destroy);
     Lst_Destroy(&parseIncPath, Dir_Destroy);      Lst_Destroy(&parseIncPath, Dir_Destroy);
     Lst_Destroy(&includes, NOFREE);     /* Should be empty now */      Lst_Destroy(&includes, NOFREE);     /* Should be empty now */
Line 2664 
Line 2654 
         /*NOTREACHED*/          /*NOTREACHED*/
     else if (mainNode->type & OP_DOUBLEDEP) {      else if (mainNode->type & OP_DOUBLEDEP) {
         Lst_AtEnd(listmain, mainNode);          Lst_AtEnd(listmain, mainNode);
         Lst_Concat(listmain, &mainNode->cohorts, LST_CONCNEW);          Lst_Concat(listmain, &mainNode->cohorts);
     }      }
     else      else
         Lst_AtEnd(listmain, mainNode);          Lst_AtEnd(listmain, mainNode);

Legend:
Removed from v.1.44  
changed lines
  Added in v.1.45