(FILECREATED "15-Sep-86 16:31:26" {QV}<NOTECARDS>1.3K>NEXT>KIRKPATCH026.;1 2231   

      changes to:  (VARS KIRKPATCH026COMS x))


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

(PRETTYCOMPRINT KIRKPATCH026COMS)

(RPAQQ KIRKPATCH026COMS ((* * fixes copy card part bug in NCDATABASE reported by randy)
			   (FNS NC.CopyCardPart)))
(* * fixes copy card part bug in NCDATABASE reported by randy)

(DEFINEQ

(NC.CopyCardPart
  (LAMBDA (CardPartTypeNum Card FromStream ToStream FromPtr ToPtr)
                                                             (* kirk: "15-Sep-86 16:14")

          (* * Copy a card part from one stream to another)



          (* * This function is used by both Compact to new file and CompactInPlace. Returns Length The Length result is used
	  by Compact to new file as a success flag. Length is used by CompactInPlace to compute the next place to write.)


    (LET (Length EndPtr)
         (SETFILEPTR FromStream FromPtr)
         (SETFILEPTR ToStream ToPtr)
         (if (SETQ Length (FIXP (NC.ReadPtr FromStream 3)))
	     then (SETQ EndPtr (PLUS FromPtr Length))
		    (until (if (CAR (ERSETQ (OR (COPYBYTES FromStream ToStream FromPtr 
								       EndPtr)
							  0)))
				 then (RETURN Length)
			       else (if (EQ (ERRORN)
						  22)
					  then             (* file system resources exceeded)
						 (ERROR "Trouble copying card."
							  (CONCAT "Try freeing at least "
								    (MAX 1 (IQUOTIENT
									     (IDIFFERENCE EndPtr 
											  FromPtr)
									     512))
								    " pages in "
								    (FILENAMEFIELD ToStream
										     (QUOTE HOST))
								    (FILENAMEFIELD ToStream
										     (QUOTE 
											DIRECTORY))
								    "."
								    (CHARACTER 13)
								    
						       "Then click here, type OK, and hit RETURN"))
						 NIL
					else (RETURN NIL))))
	   else (NC.PrintMsg NIL T "Bad NoteFile. Please Inspect and Repair." (CHARACTER 13))
		  NIL))))
)
(PUTPROPS KIRKPATCH026 COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (431 2148 (NC.CopyCardPart 441 . 2146)))))
STOP