(FILECREATED " 6-Jun-86 17:34:32" {QV}<NOTECARDS>1.3K>FGHPATCH061.;1 2435   

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


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

(PRETTYCOMPRINT FGHPATCH061COMS)

(RPAQQ FGHPATCH061COMS ((* * Fixes bug reported by RHT about ARG NOT PIECE LASTPIECE UNDER 
			     TEDIT.FORMATTEDP)
			  (FNS NC.PutTextSubstance)))
(* * Fixes bug reported by RHT about ARG NOT PIECE LASTPIECE UNDER TEDIT.FORMATTEDP)

(DEFINEQ

(NC.PutTextSubstance
  (LAMBDA (Card Stream)                                      (* fgh: " 6-Jun-86 17:32")
                                                             (* 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.)


    (LET ((Substance (NC.FetchSubstance Card))
	  StartPtr)

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


         (SETQ StartPtr (GETFILEPTR Stream))

          (* * The write down the text stream)


         (COND
	   ((NOT (ZEROP (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 (AND (NOT (ZEROP (fetch (TEXTOBJ TEXTLEN) of (TEXTOBJ Substance))))
		      (TEDIT.FORMATTEDFILEP Substance))
	     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 FGHPATCH061 COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (507 2353 (NC.PutTextSubstance 517 . 2351)))))
STOP