(FILECREATED "20-Aug-86 18:48:00" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH091.;1 2499   

      changes to:  (VARS RHTPATCH091COMS)
		   (FNS NC.PutTextSubstance))


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

(PRETTYCOMPRINT RHTPATCH091COMS)

(RPAQQ RHTPATCH091COMS ((* * Change to NCTEXTCARD)
			  (FNS NC.PutTextSubstance)))
(* * Change to NCTEXTCARD)

(DEFINEQ

(NC.PutTextSubstance
  (LAMBDA (Card Stream)                                      (* rht: "20-Aug-86 18:46")
                                                             (* Put text substance from card ID on the database 
							     file)

          (* * rht 9/13/85: Now doesn't try to write piece table at all if substance has zero length.)



          (* * fgh 11/13/85 Updated to handle NoteFile, Card objects.)



          (* * fgh 11/20/85 removed code to handle start and end pointers)



          (* * rht 1/23/86: Now takes Stream as arg instead of computing from Card.)



          (* * fgh 2/6/86 Now returns a version number.)



          (* * Now checks to make sure that TEXTLEN > 0 before FORMATTEDP call.)



          (* * rht 8/20/86: No longer trust TEDIT.FORMATTEDFILEP. Now decide whether there's formatting info based on how 
	  many bytes were written down by TEDIT.PUT.PCTB.)


    (LET ((Substance (NC.FetchSubstance Card))
	  StartPtr StartFormatPtr EOFPtr TextLen)

          (* * Save the location of the start of this text stream.)


         (SETQ StartPtr (GETFILEPTR Stream))

          (* * The write down the text stream)


         (COND
	   ((NOT (ZEROP (SETQ TextLen (fetch (TEXTOBJ TEXTLEN) of (TEXTOBJ Substance))))
		   )
	     (TEDIT.PUT.PCTB (TEXTOBJ Substance)
			       Stream)))

          (* * fix up the file absolute pointerts to be file textstream relative pointers.)


         (if (GREATERP (DIFFERENCE (GETFILEPTR Stream)
					 StartPtr)
			   TextLen)
	     then (SETFILEPTR Stream (IDIFFERENCE (SETQ EOFPtr (GETEOFPTR Stream))
							8))
		    (SETQ StartFormatPtr (\DWIN Stream))
		    (SETFILEPTR Stream (IDIFFERENCE EOFPtr 8))
		    (\DWOUT Stream (DIFFERENCE StartFormatPtr StartPtr)))

          (* * Set stream file ptr to eof.)


         (SETFILEPTR Stream -1)
     0)))
)
(PUTPROPS RHTPATCH091 COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (387 2417 (NC.PutTextSubstance 397 . 2415)))))
STOP