(FILECREATED "10-Sep-86 18:58:31" {QV}<NOTECARDS>1.3K>NEXT>NCVPROPAGATE.;8 4988   

      changes to:  (FNS NCV.UpdateCompileHeader)

      previous date: " 3-Sep-86 17:22:13" {QV}<NOTECARDS>1.3K>NEXT>NCVPROPAGATE.;7)


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

(PRETTYCOMPRINT NCVPROPAGATECOMS)

(RPAQQ NCVPROPAGATECOMS ((* * help in copying and creating new versions of the NoteCards system)
			   (FNS NCV.PropagateNext NCV.Propagate NCV.CopyChangedFiles 
				NCV.CopyCompiledFileOf NCV.CopyChangedFile NCV.EQUALFileP 
				NCV.UpdateCompileHeader)))
(* * help in copying and creating new versions of the NoteCards system)

(DEFINEQ

(NCV.PropagateNext
  (LAMBDA (PotentialFiles)                                   (* kirk: "18-Aug-86 14:06")
    (OR PotentialFiles (SETQ PotentialFiles NC.Files))
    (NCV.Propagate PotentialFiles (QUOTE {QV}<NoteCards>1.3K>NEXT>)
		     (QUOTE {QV}<NoteCards>1.3K>))))

(NCV.Propagate
  (LAMBDA (PotentialFiles SourceDirectory DestinationDirectory)
                                                             (* kirk: "25-Aug-86 13:14")
    (OR PotentialFiles NC.Files)
    (OR SourceDirectory (PROGN (PRIN1 "Must specify source directory.")
				   (ERROR!)))
    (OR DestinationDirectory (SETQ DestinationDirectory (DIRECTORYNAME T)))
    (CNDIR DestinationDirectory)
    (LET ((ChangedFiles (NCV.CopyChangedFiles PotentialFiles SourceDirectory DestinationDirectory))
	  (for each in ChangedFiles do (NCV.CopyCompiledFileOf each SourceDirectory 
								       DestinationDirectory)))
         (if NIL
	     then (for each in NC.CoreFiles unless (EQ each NOTECARDS)
		       do (NLSETQ (LOAD each (QUOTE PROP))) 
                                                             (* they dont ALL depend on each other, could identify 
							     the essential ones and only load them + ChangedFiles)
			   )
		    (TCOMPL ChangedFiles)))))

(NCV.CopyChangedFiles
  (LAMBDA (PotentialFiles SourceDirectory DestinationDirectory)
                                                             (* kirk: "18-Aug-86 13:06")
    (OR SourceDirectory (PROGN (PRIN1 "Must specify source directory.")
				   (ERROR!)))
    (OR DestinationDirectory (SETQ DestinationDirectory (DIRECTORYNAME T)))
    (for each in (MKLIST PotentialFiles) collect (NCV.CopyChangedFile each SourceDirectory 
									     DestinationDirectory))))

(NCV.CopyCompiledFileOf
  (LAMBDA (SourceCodeFile SourceDirectory DestinationDirectory)
                                                             (* kirk: "27-Aug-86 10:51")
    (LET ((FileName (CONCAT (FILENAMEFIELD SourceCodeFile (QUOTE NAME))
			      (QUOTE .DCOM)))
	  DestDCOMFile)
         (SETQ DestDCOMFile (COPYFILE (CONCAT SourceDirectory FileName)
					  (CONCAT DestinationDirectory FileName)))
         (NCV.UpdateCompileHeader DestDCOMFile SourceCodeFile DestinationDirectory))))

(NCV.CopyChangedFile
  (LAMBDA (FileName SourceDirectory DestinationDirectory)    (* kirk: "18-Aug-86 20:59")
    (OR SourceDirectory (PROGN (PRIN1 "Must specify source directory.")
				   (ERROR!)))
    (OR DestinationDirectory (SETQ DestinationDirectory (DIRECTORYNAME T)))
    (LET ((FromFile (CONCAT SourceDirectory FileName))
	  (ToFile (CONCAT DestinationDirectory FileName)))
         (if (NOT (NCV.EQUALFileP FromFile ToFile))
	     then (PRIN1 (CONCAT "Copying " FromFile " to " ToFile))
		    (COPYFILE FromFile ToFile)))))

(NCV.EQUALFileP
  (LAMBDA (File1 File2)                                      (* kirk: "18-Aug-86 11:17")
    (EQ (CAR (NLSETQ (GETFILEINFO File1 (QUOTE ICREATIONDATE))))
	  (CAR (NLSETQ (GETFILEINFO File2 (QUOTE ICREATIONDATE)))))))

(NCV.UpdateCompileHeader
  (LAMBDA (DestDCOMFileName SourceCodeFileName DestinationDirectory)
                                                             (* kirk: " 4-Sep-86 20:19")
    (LET (stream CompileHeader OldStart padding)
         (SETQ stream (OPENSTREAM FileName (QUOTE BOTH)))
         (SETQ CompileHeader (READ stream))
         (if (GEQ (SETQ padding
			(DIFFERENCE (this needs to be the old source file name and version number)
				      SourceCodeFileName))
		      0)
	     then (if (SETQ OldStart (STRPOS DestinationDirectory CompileHeader))
			then (RPLSTRING CompileHeader OldStart DestinationDirectory)
			       (SETFILEPTR stream 0)
			       (PRIN2 CompileHeader stream)
			       (for i from 1 to padding do (PRINTCCODE 32)))
		    (besure to CLOSEF the stream)))))
)
(PUTPROPS NCVPROPAGATE COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (666 4905 (NCV.PropagateNext 676 . 973) (NCV.Propagate 975 . 2057) (NCV.CopyChangedFiles
 2059 . 2586) (NCV.CopyCompiledFileOf 2588 . 3129) (NCV.CopyChangedFile 3131 . 3736) (NCV.EQUALFileP 
3738 . 4014) (NCV.UpdateCompileHeader 4016 . 4903)))))
STOP