(FILECREATED "15-Oct-86 11:50:41" {QV}<NOTECARDS>1.3K>UTILS>NCMAINTUTILS.;2 4719   

      changes to:  (FNS NCMaint.MKSYS1 NCU.Integrate)
		   (VARS NCMAINTUTILSCOMS)

      previous date: "13-Oct-86 21:01:51" {QV}<NOTECARDS>1.3K>UTILS>NCMAINTUTILS.;1)


(* Copyright (c) 1986 by Xerox Corporation. All rights reserved.)

(PRETTYCOMPRINT NCMAINTUTILSCOMS)

(RPAQQ NCMAINTUTILSCOMS ((P (IMPORTFILE 'FILEPKG))
			   (GLOBALVARS NCMaint.patch.files)
			   (FNS NCMaint.CheckPatchFile NCMaint.NCFileList NCU.Integrate)))
(IMPORTFILE 'FILEPKG)
(DECLARE: DOEVAL@COMPILE DONTCOPY

(GLOBALVARS NCMaint.patch.files)
)
(DEFINEQ

(NCMaint.CheckPatchFile
  [LAMBDA (patch.file)                                       (* Randy.Gobbel "10-Oct-86 18:02")
    (LET ((coms (FILECOMS patch.file))
	  (last.added.file)
	  (add.near.item)
	  (com.type)
	  (places))
         (for com in (EVAL coms)
	    do (SETQ com.type (CAR com))
		 (if [OR (FMEMB com.type FILEPKGTYPES)
			     (SETQ com.type (CDR (FASSOC com.type FILEPKGTYPES]
		     then (for item in (CDR com)
			       do (SETQ places (LDIFFERENCE (WHEREIS item com.type)
								  NCMaint.patch.files))
				    (if (NULL places)
					then (PRINTOUT T item "(" com.type "), file " patch.file 
							 ","
							 
						  " is not contained in any regular source file."
							 T)
					       (SETQ last.added.file (PROMPTFORWORD 
									     "Add to which file?"
											
										  last.added.file
											'
									       NCMaint.NCFileList))
					       (TERPRI)
					       (if last.added.file
						   then (SETQ add.near.item (PROMPTFORWORD
							      "Add near existing item:" add.near.item)
							    )
							  (ADDTOFILE item com.type last.added.file 
								       add.near.item])

(NCMaint.NCFileList
  [LAMBDA (prompt candidate)                                 (* Randy.Gobbel "10-Oct-86 15:49")
    NC.Files])

(NCU.Integrate
  [LAMBDA (from.dir to.dir)                                  (* Randy.Gobbel "14-Oct-86 20:59")
    (LET ((to.be.compiled)
	  (to.be.dumped)
	  (new.file)
	  (old.file)
	  (new.file.date)
	  (old.file.date)
	  (patch.file))
         [OR from.dir (SETQ from.dir (PROMPTFORWORD "Move from directory:" (DIRECTORYNAME
							    T]
         (FRESHLINE T)
         (OR to.dir (SETQ to.dir (PROMPTFORWORD "Move to directory: " from.dir)))
         (TERPRI)
         (CNDIR from.dir)
         (LOAD? 'NOTECARDS.DCOM)
         (LOAD? 'NOTECARDS 'PROP)
         (FRESHLINE T)
         (PRIN1 "Loading complete system...")
         (for file in NC.Files
	    do (LOAD? (CONCAT file ".DCOM"))
		 (LOAD? file 'PROP))
         (PRIN1 "loading done.")
         (TERPRI)
         (while (SETQ patch.file (PROMPTFORWORD "Load patch file:"))
	    do (ERSETQ (LOAD patch.file))
		 (push NCU.patch.files patch.file)
		 (FRESHLINE T))
         (TERPRI)
         (PRIN1 "Checking for orphan functions...")
         (for file in NCU.patch.files do (NCMaint.CheckPatchFile file))
         (PRIN1 "done")
         (TERPRI)
         (SETQ to.be.dumped (for file in NC.Files when (fetch TOBEDUMPED
								  of (LISTP (fetch FILEPROP
										   of file)))
				 collect file))
         (if to.be.dumped
	     then (PRIN1 "Dumping changed files...")
		    (MAKEFILES 'REMAKE to.be.dumped)
		    (PRIN1 "finished dumping")
		    (TERPRI))
         (PRIN1 "Copying to new directory...")
         (for file in NC.Files
	    do (SETQ new.file (CONCAT from.dir file))
		 (SETQ old.file (CONCAT to.dir file))
		 (SETQ new.file.date (GETFILEINFO new.file 'CREATIONDATE))
		 (SETQ old.file.date (if (INFILEP old.file)
					   then (GETFILEINFO old.file 'CREATIONDATE)
					 else "1-Jan-72 00:00:00"))
		 (if (GREATERP (IDATE new.file.date)
				   (IDATE old.file.date))
		     then (FRESHLINE T)
			    (PRIN1 new.file)
			    (PRIN1 "...")
			    (COPYFILE new.file old.file)
			    (push to.be.compiled old.file)))
         (PRIN1 "finished copying")
         (TERPRI)
         (CNDIR to.dir)
         (if to.be.compiled
	     then (PRIN1 "Compiling...")
		    (TERPRI)
		    (TCOMPL to.be.compiled)
		    (PRIN1 "finished compiling")
		    (TERPRI])
)
(PUTPROPS NCMAINTUTILS COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (620 4636 (NCMaint.CheckPatchFile 630 . 1891) (NCMaint.NCFileList 1893 . 2031) (
NCU.Integrate 2033 . 4634)))))
STOP