1
0
mirror of synced 2026-04-30 05:35:57 +00:00

TEXTOFD: Property OBJECTBYTE returned instead of image objects

This allows COMPARETEXT to work on TEDIT files
This commit is contained in:
rmkaplan
2021-12-22 10:49:23 -08:00
parent dcd83c3753
commit 89a71cb949
2 changed files with 371 additions and 317 deletions

View File

@@ -1,12 +1,11 @@
(DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10) (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
(FILECREATED "12-Oct-2021 15:38:41"  (FILECREATED "22-Dec-2021 10:29:27" {DSK}<Users>kaplan>Local>medley3.5>my-medley>library>TEXTOFD.;12 182752
{DSK}<Users>kaplan>Local>medley3.5>git-medley>library>TEXTOFD.;4 176302
changes to%: (FNS \TEDITOUTCCODEFN) :CHANGES-TO (FNS \TEXTBIN \TEXTPEEKBIN)
previous date%: " 7-Oct-2021 08:41:13" :PREVIOUS-DATE "22-Dec-2021 10:01:53"
{DSK}<Users>kaplan>Local>medley3.5>git-medley>library>TEXTOFD.;3) {DSK}<Users>kaplan>Local>medley3.5>my-medley>library>TEXTOFD.;11)
(* ; " (* ; "
@@ -31,7 +30,7 @@ Copyright (c) 1983-1991, 1993-1995, 1999-2001, 2021 by John Sybalsky & Xerox Cor
(FNS \CHTOPC \CHTOPCNO \CLEARPCTB \CREATEPIECEORSTREAM \DELETEPIECE \FINDPIECE (FNS \CHTOPC \CHTOPCNO \CLEARPCTB \CREATEPIECEORSTREAM \DELETEPIECE \FINDPIECE
\INSERTPIECE \MAKEPCTB \SPLITPIECE \INSERT.FIRST.PIECE)) \INSERTPIECE \MAKEPCTB \SPLITPIECE \INSERT.FIRST.PIECE))
(COMS (* ; (COMS (* ;
 "Generic-IO type operations support")  "Generic-IO type operations support")
(FNS \TEXTCLOSEF \TEXTCLOSEF-SUBTREE \TEXTDSPFONT \TEXTEOFP \TEXTGETEOFPTR (FNS \TEXTCLOSEF \TEXTCLOSEF-SUBTREE \TEXTDSPFONT \TEXTEOFP \TEXTGETEOFPTR
\TEXTGETFILEPTR \TEXTOPENF \TEXTOPENF-SUBTREE \TEXTOUTCHARFN \TEXTBACKFILEPTR \TEXTGETFILEPTR \TEXTOPENF \TEXTOPENF-SUBTREE \TEXTOUTCHARFN \TEXTBACKFILEPTR
\TEXTBOUT \TEDITOUTCCODEFN \TEXTSETEOF \TEXTSETFILEPTR \TEXTDSPXPOSITION \TEXTBOUT \TEDITOUTCCODEFN \TEXTSETEOF \TEXTSETFILEPTR \TEXTDSPXPOSITION
@@ -1913,214 +1912,248 @@ Copyright (c) 1983-1991, 1993-1995, 1999-2001, 2021 by John Sybalsky & Xerox Cor
(DEFINEQ (DEFINEQ
(\TEXTBIN (\TEXTBIN
[LAMBDA (STREAM) (* ; "Edited 28-Mar-94 15:33 by jds") [LAMBDA (STREAM)
(* ;; "Edited 22-Dec-2021 10:29 by rmk: Return value of OBJECTCHAR property for image objecdts")
(* ;; "Edited 28-Mar-94 15:33 by jds")
(* ;;; "Do BIN slow case for a text stream") (* ;;; "Do BIN slow case for a text stream")
(* ; (* ;
 "NB that PEEKBIN and BACKFILEPTR need to track changes in this code")  "NB that PEEKBIN and BACKFILEPTR need to track changes in this code")
(DECLARE (LOCALVARS . T)) (DECLARE (LOCALVARS . T))
(PROG (CH FILE STR PF PS PC PO NPC OPC SUBSTREAM) (LET (BYTE) (* ;
(COND  "RMK: Capture all return values for any special imageobject coercion")
[(ILESSP (fetch (STREAM COFFSET) of STREAM) [SETQ BYTE (PROG (CH FILE STR PF PS PC PO NPC OPC SUBSTREAM)
(fetch (STREAM CBUFSIZE) of STREAM)) (COND
[(ILESSP (fetch (STREAM COFFSET) of STREAM)
(fetch (STREAM CBUFSIZE) of STREAM))
(* ; (* ;
 "Simple case -- just do the usual BIN")  "Simple case -- just do the usual BIN")
(COND (COND
[(SETQ PO (fetch (PIECE POBJ) of (fetch (TEXTSTREAM PIECE) of STREAM [(SETQ PO (fetch (PIECE POBJ) of (fetch (TEXTSTREAM PIECE)
))) of STREAM)))
(* ; "Handle objects specially") (* ; "Handle objects specially")
(COND (COND
((SETQ SUBSTREAM (IMAGEOBJPROP PO 'SUBSTREAM)) ((SETQ SUBSTREAM (IMAGEOBJPROP PO 'SUBSTREAM))
(* ; (* ;
 "If this object has a substream in it, go to that substream")  "If this object has a substream in it, go to that substream")
(add (fetch (STREAM COFFSET) of STREAM) (add (fetch (STREAM COFFSET) of STREAM)
1) 1)
(RETURN (\BIN SUBSTREAM))) (RETURN (\BIN SUBSTREAM)))
(T (T
(* ;; "Otherwise, just return the object as BIN's result, and make sure we'll go to the next page next time.") (* ;; "Otherwise, just return the object as BIN's result, and make sure we'll go to the next page next time.")
(replace (STREAM COFFSET) of STREAM with (fetch (STREAM (replace (STREAM COFFSET) of STREAM
CBUFSIZE) with (fetch (STREAM CBUFSIZE) of STREAM))
of STREAM)) (replace (TEXTSTREAM CHARSLEFT) of STREAM with 0)
(replace (TEXTSTREAM CHARSLEFT) of STREAM with 0) (RETURN PO]
(RETURN PO] [(fetch (TEXTSTREAM FATSTREAMP) of STREAM)
[(fetch (TEXTSTREAM FATSTREAMP) of STREAM)
(* ; (* ;
 "This is a 16 bit BIN. grab 2 bytes.")  "This is a 16 bit BIN. grab 2 bytes.")
(* ; (* ;
 "WHAT HAPPENS IF THE SECOND BYTE IS ON ANOTHER PAGE??")  "WHAT HAPPENS IF THE SECOND BYTE IS ON ANOTHER PAGE??")
(RETURN (LOGOR (UNFOLD (\PAGEDBIN STREAM) (RETURN (LOGOR (UNFOLD (\PAGEDBIN STREAM)
256) 256)
(COND (COND
((ILESSP (fetch (STREAM COFFSET) of STREAM) ((ILESSP (fetch (STREAM COFFSET) of STREAM)
(fetch (STREAM CBUFSIZE) of STREAM)) (fetch (STREAM CBUFSIZE) of STREAM))
(* ; (* ;
 "This pair of characters doesn't straddle a file page bound. Just grab the next char.")  "This pair of characters doesn't straddle a file page bound. Just grab the next char.")
(\PAGEDBIN STREAM)) (\PAGEDBIN STREAM))
(T (* ; (T (* ;
 "Need to move to the next page on the backing file. Doing so also grabs the next character.")  "Need to move to the next page on the backing file. Doing so also grabs the next character.")
(\TEDIT.TEXTBIN.NEW.PAGE STREAM T] (\TEDIT.TEXTBIN.NEW.PAGE STREAM T]
(T (RETURN (\PAGEDBIN STREAM] (T (RETURN (\PAGEDBIN STREAM]
(T (* ; (T (* ;
 "We've either hit a page bound in a file, or a piece bound.")  "We've either hit a page bound in a file, or a piece bound.")
(RETURN (COND (RETURN (COND
[(ZEROP (fetch (TEXTSTREAM CHARSLEFT) of STREAM)) [(ZEROP (fetch (TEXTSTREAM CHARSLEFT) of STREAM))
(* ; "Time for a new piece.") (* ; "Time for a new piece.")
[repeatwhile (AND PC (ZEROP (fetch (PIECE PLEN) of PC))) [repeatwhile (AND PC (ZEROP (fetch (PIECE PLEN)
do (* ; of PC)))
 "Skip over any zero-length pieces at the end of the file.") do (* ;
(SETQ OPC (fetch (TEXTSTREAM PIECE) of STREAM))  "Skip over any zero-length pieces at the end of the file.")
(SETQ PC (replace (TEXTSTREAM PIECE) of STREAM (SETQ OPC (fetch (TEXTSTREAM PIECE) of STREAM))
with (AND OPC (fetch (PIECE NEXTPIECE) (SETQ PC (replace (TEXTSTREAM PIECE) of STREAM
of OPC] with (AND OPC (fetch (PIECE NEXTPIECE)
(replace (STREAM BINABLE) of STREAM with T) of OPC]
(replace (TEXTSTREAM FATSTREAMP) of STREAM with NIL) (replace (STREAM BINABLE) of STREAM with T)
(replace (TEXTSTREAM FATSTREAMP) of STREAM with NIL)
(* ; (* ;
 "Move to the next piece in the chain")  "Move to the next piece in the chain")
(COND (COND
[PC (* ; [PC (* ; "There IS a next piece to move to.")
 "There IS a next piece to move to.") (AND (fetch (TEXTSTREAM LOOKSUPDATEFN)
(AND (fetch (TEXTSTREAM LOOKSUPDATEFN) of STREAM) of STREAM)
(SETQ NPC (APPLY* (fetch (TEXTSTREAM LOOKSUPDATEFN) (SETQ NPC (APPLY* (fetch (TEXTSTREAM
of STREAM) LOOKSUPDATEFN
STREAM PC)) )
(replace (TEXTSTREAM PIECE) of STREAM of STREAM)
with (SETQ PC NPC))) STREAM PC))
(replace (TEXTSTREAM PIECE) of STREAM
with (SETQ PC NPC)))
(* ; (* ;
 "Take care of any piece-change uproar. uproar -- which may include picking a new piece to go to.")  "Take care of any piece-change uproar. uproar -- which may include picking a new piece to go to.")
[COND [COND
(NPC (* ; (NPC (* ;
 "If we got an NPC, this was taken care of by the LOOKSUPDATEFN")  "If we got an NPC, this was taken care of by the LOOKSUPDATEFN")
) )
([AND (SETQ PO (fetch (PIECE POBJ) of PC)) ([AND (SETQ PO (fetch (PIECE POBJ) of PC))
(SETQ SUBSTREAM (IMAGEOBJPROP PO 'SUBSTREAM] (SETQ SUBSTREAM (IMAGEOBJPROP
(\SETUPGETCH 1 (fetch (TEXTSTREAM TEXTOBJ) PO
of SUBSTREAM)) 'SUBSTREAM]
(replace (TEXTSTREAM CURRENTPARALOOKS) of STREAM (\SETUPGETCH 1 (fetch (TEXTSTREAM TEXTOBJ)
with (fetch (TEXTSTREAM CURRENTPARALOOKS) of SUBSTREAM))
of SUBSTREAM)) (replace (TEXTSTREAM CURRENTPARALOOKS)
(replace (TEXTSTREAM CURRENTLOOKS) of STREAM of STREAM with (fetch (TEXTSTREAM
with (fetch (TEXTSTREAM CURRENTLOOKS) of CURRENTPARALOOKS
SUBSTREAM ) of SUBSTREAM
))) ))
[(NEQ (fetch (PIECE PPARALOOKS) of OPC) (replace (TEXTSTREAM CURRENTLOOKS)
(fetch (PIECE PPARALOOKS) of PC)) of STREAM with (fetch (TEXTSTREAM
(replace (TEXTSTREAM CURRENTPARALOOKS) of STREAM CURRENTLOOKS)
with (\TEDIT.APPLY.PARASTYLES (fetch (PIECE of SUBSTREAM)))
PPARALOOKS [(NEQ (fetch (PIECE PPARALOOKS) of OPC)
) (fetch (PIECE PPARALOOKS) of PC))
of PC) (replace (TEXTSTREAM CURRENTPARALOOKS)
PC of STREAM with (\TEDIT.APPLY.PARASTYLES
(fetch (TEXTSTREAM TEXTOBJ) (fetch (PIECE PPARALOOKS)
of STREAM))) of PC)
(replace (TEXTSTREAM CURRENTLOOKS) of STREAM PC
with (\TEDIT.APPLY.STYLES (fetch (PIECE PLOOKS) (fetch (TEXTSTREAM TEXTOBJ)
of PC) of STREAM)))
PC (replace (TEXTSTREAM CURRENTLOOKS)
(fetch (TEXTSTREAM TEXTOBJ) of STREAM with (\TEDIT.APPLY.STYLES
of STREAM] (fetch (PIECE PLOOKS)
((NOT (EQCLOOKS (fetch (PIECE PLOOKS) of PC) of PC)
(fetch (PIECE PLOOKS) of OPC))) PC
(replace (TEXTSTREAM CURRENTLOOKS) of STREAM (fetch (TEXTSTREAM TEXTOBJ)
with (\TEDIT.APPLY.STYLES (fetch (PIECE PLOOKS) of STREAM]
of PC) ((NOT (EQCLOOKS (fetch (PIECE PLOOKS)
PC of PC)
(fetch (TEXTSTREAM TEXTOBJ) (fetch (PIECE PLOOKS) of OPC)))
of STREAM] (replace (TEXTSTREAM CURRENTLOOKS)
(COND of STREAM with (\TEDIT.APPLY.STYLES
((SETQ PS (fetch (PIECE PSTR) of PC)) (fetch (PIECE PLOOKS)
of PC)
PC
(fetch (TEXTSTREAM TEXTOBJ)
of STREAM]
(COND
((SETQ PS (fetch (PIECE PSTR) of PC))
(* ; "This piece lives in a string.") (* ; "This piece lives in a string.")
(\TEDIT.TEXTBIN.STRINGSETUP 0 (fetch (PIECE PLEN) (\TEDIT.TEXTBIN.STRINGSETUP
of PC) 0
STREAM PS) (fetch (PIECE PLEN) of PC)
STREAM PS)
(* ;; "Set the stream up so that it will use PS for BINs, starting at offset 0 (the front of the piece), and will run for as many chars as there are in the piece.") (* ;; "Set the stream up so that it will use PS for BINs, starting at offset 0 (the front of the piece), and will run for as many chars as there are in the piece.")
(* ; (* ;
 "Then actually grab the next character to hand back to the caller.")  "Then actually grab the next character to hand back to the caller.")
(\BIN STREAM)) (\BIN STREAM))
((SETQ PF (fetch (PIECE PFILE) of PC)) ((SETQ PF (fetch (PIECE PFILE) of PC))
(* ; "This piece lives on a file.") (* ; "This piece lives on a file.")
(\TEDIT.TEXTBIN.FILESETUP PC 0 (fetch (PIECE PLEN) (\TEDIT.TEXTBIN.FILESETUP PC 0
of PC) (fetch (PIECE PLEN) of PC)
STREAM PF (fetch (PIECE PFATP) of PC) STREAM PF (fetch (PIECE PFATP)
'PEEKBIN) of PC)
(\BIN STREAM)) 'PEEKBIN)
[(SETQ PO (fetch (PIECE POBJ) of PC)) (\BIN STREAM))
(replace (STREAM BINABLE) of STREAM with NIL) [(SETQ PO (fetch (PIECE POBJ) of PC))
(COND (replace (STREAM BINABLE) of STREAM
(SUBSTREAM (* ; with NIL)
 "There is a stream below this one, to feed chars upward.") (COND
(\SETUPGETCH 1 (fetch (TEXTSTREAM TEXTOBJ) (SUBSTREAM
of SUBSTREAM))
(freplace (STREAM COFFSET) of STREAM
with 0)
(freplace (TEXTSTREAM CHARSLEFT) of STREAM
with (fetch (PIECE PLEN) of PC))
(freplace (STREAM CBUFSIZE) of STREAM
with (fetch (PIECE PLEN) of PC))
(freplace (STREAM CPAGE) of STREAM
with 0)
(freplace (TEXTSTREAM PCSTARTCH) of STREAM
with 0)
(freplace (TEXTSTREAM PCSTARTPG) of STREAM
with 0)
(replace (TEXTSTREAM CURRENTPARALOOKS)
of STREAM with (fetch (TEXTSTREAM
CURRENTPARALOOKS
) of
SUBSTREAM))
(replace (TEXTSTREAM CURRENTLOOKS) of STREAM
with (fetch (TEXTSTREAM CURRENTLOOKS)
of SUBSTREAM))
(RETURN (\BIN SUBSTREAM)))
(T (replace (TEXTSTREAM CHARSLEFT) of STREAM
with 0)
(RETURN PO]
(T (ERROR "CAN'T GET TO NEXT PIECE"]
(T (* ;
 "There are no more pieces. Punt gracefully")
(COND
((fetch (STREAM ENDOFSTREAMOP) of STREAM)
(* ; (* ;
 "If there's an EOF handler, call it & return the result")  "There is a stream below this one, to feed chars upward.")
(RETURN (APPLY* (fetch (STREAM ENDOFSTREAMOP) of STREAM (\SETUPGETCH 1 (fetch (TEXTSTREAM
) TEXTOBJ)
STREAM))) of SUBSTREAM))
(T (* ; "Otherwise, return NIL") (freplace (STREAM COFFSET)
(RETURN NIL] of STREAM with 0)
[(SETQ PO (fetch (PIECE POBJ) of (fetch (TEXTSTREAM PIECE) (freplace (TEXTSTREAM CHARSLEFT)
of STREAM))) of STREAM
with (fetch (PIECE PLEN)
of PC))
(freplace (STREAM CBUFSIZE)
of STREAM
with (fetch (PIECE PLEN)
of PC))
(freplace (STREAM CPAGE)
of STREAM with 0)
(freplace (TEXTSTREAM PCSTARTCH)
of STREAM with 0)
(freplace (TEXTSTREAM PCSTARTPG)
of STREAM with 0)
(replace (TEXTSTREAM
CURRENTPARALOOKS)
of STREAM
with (fetch (TEXTSTREAM
CURRENTPARALOOKS
) of SUBSTREAM
))
(replace (TEXTSTREAM CURRENTLOOKS)
of STREAM
with (fetch (TEXTSTREAM
CURRENTLOOKS)
of SUBSTREAM))
(RETURN (\BIN SUBSTREAM)))
(T (replace (TEXTSTREAM CHARSLEFT)
of STREAM with 0)
(RETURN PO]
(T (ERROR "CAN'T GET TO NEXT PIECE"]
(T (* ;
 "There are no more pieces. Punt gracefully")
(COND
((fetch (STREAM ENDOFSTREAMOP) of STREAM)
(* ;
 "If there's an EOF handler, call it & return the result")
(RETURN (APPLY* (fetch (STREAM ENDOFSTREAMOP)
of STREAM)
STREAM)))
(T (* ; "Otherwise, return NIL")
(RETURN NIL]
[(SETQ PO (fetch (PIECE POBJ) of (fetch (TEXTSTREAM PIECE)
of STREAM)))
(* ; "This is an object") (* ; "This is an object")
(replace (STREAM BINABLE) of STREAM with NIL) (replace (STREAM BINABLE) of STREAM with NIL)
(COND (COND
(SUBSTREAM (* ; (SUBSTREAM (* ;
 "There is a stream below this one, to feed chars upward.")  "There is a stream below this one, to feed chars upward.")
(\SETUPGETCH 1 (fetch (TEXTSTREAM TEXTOBJ) of (\SETUPGETCH 1 (fetch (TEXTSTREAM TEXTOBJ)
SUBSTREAM)) of SUBSTREAM))
(freplace (STREAM COFFSET) of STREAM with 1) (freplace (STREAM COFFSET) of STREAM
(freplace (TEXTSTREAM CHARSLEFT) of STREAM with with 1)
0) (freplace (TEXTSTREAM CHARSLEFT) of STREAM
(freplace (STREAM CBUFSIZE) of STREAM with 0)
with (fetch (PIECE PLEN) of PC)) (freplace (STREAM CBUFSIZE) of STREAM
(freplace (STREAM CPAGE) of STREAM with 0) with (fetch (PIECE PLEN) of PC))
(freplace (TEXTSTREAM PCSTARTCH) of STREAM with (freplace (STREAM CPAGE) of STREAM with 0)
1) (freplace (TEXTSTREAM PCSTARTCH) of STREAM
(freplace (TEXTSTREAM PCSTARTPG) of STREAM with with 1)
0) (freplace (TEXTSTREAM PCSTARTPG) of STREAM
(replace (TEXTSTREAM CURRENTPARALOOKS) of STREAM with 0)
with (fetch (TEXTSTREAM CURRENTPARALOOKS) (replace (TEXTSTREAM CURRENTPARALOOKS)
of SUBSTREAM)) of STREAM with (fetch (TEXTSTREAM
(replace (TEXTSTREAM CURRENTLOOKS) of STREAM CURRENTPARALOOKS
with (fetch (TEXTSTREAM CURRENTLOOKS) of ) of SUBSTREAM)
SUBSTREAM )
)) (replace (TEXTSTREAM CURRENTLOOKS) of STREAM
(RETURN (\BIN SUBSTREAM))) with (fetch (TEXTSTREAM CURRENTLOOKS)
(T (replace (TEXTSTREAM CHARSLEFT) of STREAM with 0) of SUBSTREAM))
(RETURN PO] (RETURN (\BIN SUBSTREAM)))
(T (* ; (T (replace (TEXTSTREAM CHARSLEFT) of STREAM
 "Need to move to the next page in a file.") with 0)
(RETURN (\TEDIT.TEXTBIN.NEW.PAGE STREAM]) (RETURN PO]
(T (* ;
 "Need to move to the next page in a file.")
(RETURN (\TEDIT.TEXTBIN.NEW.PAGE STREAM]
(IF (IMAGEOBJP BYTE)
THEN (OR (GETTEXTPROP (FETCH (TEXTSTREAM TEXTOBJ) OF STREAM)
'OBJECTBYTE)
BYTE)
ELSE BYTE])
(\TEDIT.TEXTBIN.STRINGSETUP (\TEDIT.TEXTBIN.STRINGSETUP
[LAMBDA (CHOFFSET CHARSLEFT STREAM PS) (* ; "Edited 31-May-91 14:21 by jds") [LAMBDA (CHOFFSET CHARSLEFT STREAM PS) (* ; "Edited 31-May-91 14:21 by jds")
@@ -2353,123 +2386,144 @@ Copyright (c) 1983-1991, 1993-1995, 1999-2001, 2021 by John Sybalsky & Xerox Cor
(DEFINEQ (DEFINEQ
(\TEXTPEEKBIN (\TEXTPEEKBIN
[LAMBDA (STREAM NOERRORFLG) (* ; "Edited 28-Mar-94 15:34 by jds") [LAMBDA (STREAM NOERRORFLG)
(* ;; "Edited 22-Dec-2021 10:29 by rmk: Return OBJECTCHAR for image objects, if present")
(* ;; "Edited 28-Mar-94 15:34 by jds")
(* ; "DO PEEKBIN for a text stream") (* ; "DO PEEKBIN for a text stream")
(PROG (CH FILE STR PF PS PC PO SUBSTREAM) (LET (BYTE) (* ;
(SETQ PC (fetch (TEXTSTREAM PIECE) of STREAM))  "BYTE to capture all returns for imageobject coercion")
(COND [SETQ BYTE (PROG (CH FILE STR PF PS PC PO SUBSTREAM)
[(ILESSP (fetch (STREAM COFFSET) of STREAM) (SETQ PC (fetch (TEXTSTREAM PIECE) of STREAM))
(fetch (STREAM CBUFSIZE) of STREAM)) (COND
[(ILESSP (fetch (STREAM COFFSET) of STREAM)
(fetch (STREAM CBUFSIZE) of STREAM))
(* ; (* ;
 "Simple case -- just do the usual PEEKBIN")  "Simple case -- just do the usual PEEKBIN")
(COND
((AND PC (fetch (PIECE POBJ) of PC))
(RETURN (fetch (PIECE POBJ) of PC)))
[(fetch (TEXTSTREAM FATSTREAMP) of STREAM)
(* ;
 "This is a 16 bit PEEKBIN. Grab two chars...")
(RETURN (COND
[(\EOFP STREAM)
(COND (COND
(NOERRORFLG NIL) ((AND PC (SETQ PO (fetch (PIECE POBJ) of PC)))
(T (\PEEKBIN STREAM] (RETURN PO))
((ILESSP (fetch (STREAM COFFSET) of STREAM) [(fetch (TEXTSTREAM FATSTREAMP) of STREAM)
(SUB1 (fetch (STREAM CBUFSIZE) of STREAM)))
(* ; (* ;
 "We're sure of staying on the same page. Just grab the characters")  "This is a 16 bit PEEKBIN. Grab two chars...")
(PROG1 (LOGOR (UNFOLD (\PAGEDBIN STREAM) (RETURN (COND
256) [(\EOFP STREAM)
(\PAGEDPEEKBIN STREAM NOERRORFLG)) (COND
(\PAGEDBACKFILEPTR STREAM))) (NOERRORFLG NIL)
(T (SETQ PS (fetch (STREAM F1) of STREAM)) (T (\PEEKBIN STREAM]
(replace (STREAM COFFSET) of PS with (fetch ((ILESSP (fetch (STREAM COFFSET) of STREAM)
(STREAM COFFSET) (SUB1 (fetch (STREAM CBUFSIZE) of STREAM)))
of STREAM)) (* ;
(PROG1 (LOGOR (UNFOLD (\PAGEDBIN PS)  "We're sure of staying on the same page. Just grab the characters")
256) (PROG1 (LOGOR (UNFOLD (\PAGEDBIN STREAM)
(\PAGEDPEEKBIN PS NOERRORFLG)) 256)
(\PAGEDBACKFILEPTR PS] (\PAGEDPEEKBIN STREAM NOERRORFLG))
(T (RETURN (\PAGEDPEEKBIN STREAM NOERRORFLG] (\PAGEDBACKFILEPTR STREAM)))
[PC (* ; (T (SETQ PS (fetch (STREAM F1) of STREAM))
 "We've either hit a page bound in a file, or a piece bound.") (replace (STREAM COFFSET) of PS
(RETURN (COND with (fetch (STREAM COFFSET) of STREAM))
[(ZEROP (fetch (TEXTSTREAM CHARSLEFT) of STREAM)) (PROG1 (LOGOR (UNFOLD (\PAGEDBIN PS)
256)
(\PAGEDPEEKBIN PS NOERRORFLG))
(\PAGEDBACKFILEPTR PS]
(T (RETURN (\PAGEDPEEKBIN STREAM NOERRORFLG]
[PC (* ;
 "We've either hit a page bound in a file, or a piece bound.")
(RETURN (COND
[(ZEROP (fetch (TEXTSTREAM CHARSLEFT) of STREAM))
(* ; "Time for a new piece.") (* ; "Time for a new piece.")
(SETQ PC (replace (TEXTSTREAM PIECE) of STREAM (SETQ PC (replace (TEXTSTREAM PIECE) of STREAM
with (fetch (PIECE NEXTPIECE) of PC))) with (fetch (PIECE NEXTPIECE) of PC)))
(* ; (* ;
 "Move to the next piece in the chain")  "Move to the next piece in the chain")
(COND (COND
[PC (replace (TEXTSTREAM CURRENTLOOKS) of STREAM [PC (replace (TEXTSTREAM CURRENTLOOKS) of STREAM
with (\TEDIT.APPLY.STYLES (fetch (PIECE PLOOKS) with (\TEDIT.APPLY.STYLES (fetch (PIECE PLOOKS
of PC) )
PC of PC)
(fetch (TEXTSTREAM TEXTOBJ) of STREAM) PC
)) (fetch (TEXTSTREAM TEXTOBJ)
(COND of STREAM)))
[(SETQ PO (fetch (PIECE POBJ) of PC)) (COND
(replace (STREAM BINABLE) of STREAM with NIL) [(SETQ PO (fetch (PIECE POBJ) of PC))
(freplace (STREAM CBUFSIZE) of STREAM (replace (STREAM BINABLE) of STREAM
with (fetch (PIECE PLEN) of PC)) with NIL)
(freplace (STREAM COFFSET) of STREAM with 0) (freplace (STREAM CBUFSIZE) of STREAM
(COND with (fetch (PIECE PLEN) of PC))
(SUBSTREAM (* ; (freplace (STREAM COFFSET) of STREAM
 "There is a stream below this one, to feed chars upward.") with 0)
(\SETUPGETCH 1 (fetch (TEXTSTREAM TEXTOBJ) (COND
of SUBSTREAM)) (SUBSTREAM
(freplace (TEXTSTREAM CHARSLEFT) of STREAM (* ;
with (fetch (PIECE PLEN) of PC))  "There is a stream below this one, to feed chars upward.")
(freplace (STREAM CPAGE) of STREAM (\SETUPGETCH 1 (fetch (TEXTSTREAM
with 0) TEXTOBJ)
(freplace (TEXTSTREAM PCSTARTCH) of STREAM of SUBSTREAM))
with 0) (freplace (TEXTSTREAM CHARSLEFT)
(freplace (TEXTSTREAM PCSTARTPG) of STREAM of STREAM
with 0) with (fetch (PIECE PLEN)
(replace (TEXTSTREAM CURRENTPARALOOKS) of PC))
of STREAM with (fetch (TEXTSTREAM (freplace (STREAM CPAGE)
of STREAM with 0)
(freplace (TEXTSTREAM PCSTARTCH)
of STREAM with 0)
(freplace (TEXTSTREAM PCSTARTPG)
of STREAM with 0)
(replace (TEXTSTREAM
CURRENTPARALOOKS)
of STREAM
with (fetch (TEXTSTREAM
CURRENTPARALOOKS CURRENTPARALOOKS
) )
of SUBSTREAM)) of SUBSTREAM))
(replace (TEXTSTREAM CURRENTLOOKS) of (replace (TEXTSTREAM CURRENTLOOKS)
STREAM of STREAM
with (fetch (TEXTSTREAM CURRENTLOOKS) with (fetch (TEXTSTREAM
of SUBSTREAM)) CURRENTLOOKS)
(RETURN (\BIN SUBSTREAM))) of SUBSTREAM))
(T (replace (TEXTSTREAM CHARSLEFT) of STREAM (RETURN (\BIN SUBSTREAM)))
with 0) (T (replace (TEXTSTREAM CHARSLEFT)
(RETURN PO] of STREAM with 0)
((SETQ PS (fetch (PIECE PSTR) of PC)) (RETURN PO]
((SETQ PS (fetch (PIECE PSTR) of PC))
(* ; "This piece lives in a string.") (* ; "This piece lives in a string.")
(\TEDIT.TEXTBIN.STRINGSETUP 0 (fetch (PIECE PLEN) (\TEDIT.TEXTBIN.STRINGSETUP
of PC) 0
STREAM PS) (fetch (PIECE PLEN) of PC)
STREAM PS)
(* ;; "Set the stream up so that it will use PS for BINs, starting at offset 0 (the front of the piece), and will run for as many chars as there are in the piece.") (* ;; "Set the stream up so that it will use PS for BINs, starting at offset 0 (the front of the piece), and will run for as many chars as there are in the piece.")
(\PEEKBIN STREAM NOERRORFLG)) (\PEEKBIN STREAM NOERRORFLG))
((SETQ PF (fetch (PIECE PFILE) of PC)) ((SETQ PF (fetch (PIECE PFILE) of PC))
(* ; "This piece lives on a file.") (* ; "This piece lives on a file.")
(\TEDIT.TEXTBIN.FILESETUP PC 0 (fetch (PIECE PLEN) (\TEDIT.TEXTBIN.FILESETUP PC 0
of PC) (fetch (PIECE PLEN) of PC)
STREAM PF (fetch (PIECE PFATP) of PC) STREAM PF (fetch (PIECE PFATP)
'PEEKBIN NOERRORFLG)) of PC)
(T (ERROR "CAN'T GET TO NEXT PIECE"] 'PEEKBIN NOERRORFLG))
(NOERRORFLG (* ; (T (ERROR "CAN'T GET TO NEXT PIECE"]
 "There are no more pieces. Punt gracefully") (NOERRORFLG (* ;
(RETURN NIL))  "There are no more pieces. Punt gracefully")
(T (* ; "He wants it the hard way.") (RETURN NIL))
(APPLY* (fetch (STREAM ENDOFSTREAMOP) of STREAM) (T (* ; "He wants it the hard way.")
STREAM] (APPLY* (fetch (STREAM ENDOFSTREAMOP) of STREAM)
(T (* ; STREAM]
 "Need to move to the next page in a file.") (T (* ;
(RETURN (\TEDIT.PEEKBIN.NEW.PAGE STREAM NOERRORFLG]  "Need to move to the next page in a file.")
(NOERRORFLG (* ; (RETURN (\TEDIT.PEEKBIN.NEW.PAGE STREAM NOERRORFLG]
 "There are no more pieces. Punt gracefully") (NOERRORFLG (* ;
(RETURN NIL))  "There are no more pieces. Punt gracefully")
(T (* ; "He wants it the hard way.") (RETURN NIL))
(APPLY* (fetch (STREAM ENDOFSTREAMOP) of STREAM) (T (* ; "He wants it the hard way.")
STREAM]) (APPLY* (fetch (STREAM ENDOFSTREAMOP) of STREAM)
STREAM]
(IF (IMAGEOBJP BYTE)
THEN (OR (GETTEXTPROP (FETCH (TEXTSTREAM TEXTOBJ) OF STREAM)
'OBJECTBYTE)
BYTE)
ELSE BYTE])
(\TEDIT.PEEKBIN.NEW.PAGE (\TEDIT.PEEKBIN.NEW.PAGE
[LAMBDA (STREAM NOERRORFLG) (* ; "Edited 11-Jun-99 15:11 by rmk:") [LAMBDA (STREAM NOERRORFLG) (* ; "Edited 11-Jun-99 15:11 by rmk:")
@@ -2667,25 +2721,25 @@ Copyright (c) 1983-1991, 1993-1995, 1999-2001, 2021 by John Sybalsky & Xerox Cor
(PUTPROPS TEXTOFD COPYRIGHT ("John Sybalsky & Xerox Corporation" 1983 1984 1985 1986 1987 1988 1989 (PUTPROPS TEXTOFD COPYRIGHT ("John Sybalsky & Xerox Corporation" 1983 1984 1985 1986 1987 1988 1989
1990 1991 1993 1994 1995 1999 2000 2001 2021)) 1990 1991 1993 1994 1995 1999 2000 2001 2021))
(DECLARE%: DONTCOPY (DECLARE%: DONTCOPY
(FILEMAP (NIL (2989 53114 (COPYTEXTSTREAM 2999 . 6121) (OPENTEXTSTREAM 6123 . 21000) (REOPENTEXTSTREAM (FILEMAP (NIL (2992 53117 (COPYTEXTSTREAM 3002 . 6124) (OPENTEXTSTREAM 6126 . 21003) (REOPENTEXTSTREAM
21002 . 21424) (TEDIT.STREAMCHANGEDP 21426 . 21724) (TEXTSTREAMP 21726 . 22040) (TXTFILE 22042 . 21005 . 21427) (TEDIT.STREAMCHANGEDP 21429 . 21727) (TEXTSTREAMP 21729 . 22043) (TXTFILE 22045 .
22487) (\DELETECH 22489 . 33745) (\SETUPGETCH 33747 . 41026) (\TEDIT.REOPEN.STREAM 41028 . 42878) ( 22490) (\DELETECH 22492 . 33748) (\SETUPGETCH 33750 . 41029) (\TEDIT.REOPEN.STREAM 41031 . 42881) (
\TEDIT.COPYTEXTSTREAM.PIECEMAPFN 42880 . 45318) (\TEXTINIT 45320 . 51007) (\TEXTMARK 51009 . 51757) ( \TEDIT.COPYTEXTSTREAM.PIECEMAPFN 42883 . 45321) (\TEXTINIT 45323 . 51010) (\TEXTMARK 51012 . 51760) (
\TEXTTTYBOUT 51759 . 53112)) (53115 78547 (\INSERTCH 53125 . 76851) (\INSERTCR 76853 . 78545)) (78613 \TEXTTTYBOUT 51762 . 53115)) (53118 78550 (\INSERTCH 53128 . 76854) (\INSERTCR 76856 . 78548)) (78616
98929 (\CHTOPC 78623 . 79812) (\CHTOPCNO 79814 . 81076) (\CLEARPCTB 81078 . 81874) ( 98932 (\CHTOPC 78626 . 79815) (\CHTOPCNO 79817 . 81079) (\CLEARPCTB 81081 . 81877) (
\CREATEPIECEORSTREAM 81876 . 84850) (\DELETEPIECE 84852 . 85765) (\FINDPIECE 85767 . 86133) ( \CREATEPIECEORSTREAM 81879 . 84853) (\DELETEPIECE 84855 . 85768) (\FINDPIECE 85770 . 86136) (
\INSERTPIECE 86135 . 89145) (\MAKEPCTB 89147 . 91062) (\SPLITPIECE 91064 . 98023) (\INSERT.FIRST.PIECE \INSERTPIECE 86138 . 89148) (\MAKEPCTB 89150 . 91065) (\SPLITPIECE 91067 . 98026) (\INSERT.FIRST.PIECE
98025 . 98927)) (98981 123219 (\TEXTCLOSEF 98991 . 100218) (\TEXTCLOSEF-SUBTREE 100220 . 100926) ( 98028 . 98930)) (98984 123222 (\TEXTCLOSEF 98994 . 100221) (\TEXTCLOSEF-SUBTREE 100223 . 100929) (
\TEXTDSPFONT 100928 . 101920) (\TEXTEOFP 101922 . 103281) (\TEXTGETEOFPTR 103283 . 103493) ( \TEXTDSPFONT 100931 . 101923) (\TEXTEOFP 101925 . 103284) (\TEXTGETEOFPTR 103286 . 103496) (
\TEXTGETFILEPTR 103495 . 105558) (\TEXTOPENF 105560 . 106390) (\TEXTOPENF-SUBTREE 106392 . 107193) ( \TEXTGETFILEPTR 103498 . 105561) (\TEXTOPENF 105563 . 106393) (\TEXTOPENF-SUBTREE 106395 . 107196) (
\TEXTOUTCHARFN 107195 . 107543) (\TEXTBACKFILEPTR 107545 . 113446) (\TEXTBOUT 113448 . 116796) ( \TEXTOUTCHARFN 107198 . 107546) (\TEXTBACKFILEPTR 107548 . 113449) (\TEXTBOUT 113451 . 116799) (
\TEDITOUTCCODEFN 116798 . 118064) (\TEXTSETEOF 118066 . 118575) (\TEXTSETFILEPTR 118577 . 119802) ( \TEDITOUTCCODEFN 116801 . 118067) (\TEXTSETEOF 118069 . 118578) (\TEXTSETFILEPTR 118580 . 119805) (
\TEXTDSPXPOSITION 119804 . 120661) (\TEXTDSPYPOSITION 120663 . 121208) (\TEXTLEFTMARGIN 121210 . \TEXTDSPXPOSITION 119807 . 120664) (\TEXTDSPYPOSITION 120666 . 121211) (\TEXTLEFTMARGIN 121213 .
121693) (\TEXTRIGHTMARGIN 121695 . 122631) (\TEXTDSPCHARWIDTH 122633 . 122871) (\TEXTDSPSTRINGWIDTH 121696) (\TEXTRIGHTMARGIN 121698 . 122634) (\TEXTDSPCHARWIDTH 122636 . 122874) (\TEXTDSPSTRINGWIDTH
122873 . 123113) (\TEXTDSPLINEFEED 123115 . 123217)) (123220 156964 (\TEXTBIN 123230 . 140016) ( 122876 . 123116) (\TEXTDSPLINEFEED 123118 . 123220)) (123223 161060 (\TEXTBIN 123233 . 144112) (
\TEDIT.TEXTBIN.STRINGSETUP 140018 . 145731) (\TEDIT.TEXTBIN.FILESETUP 145733 . 152119) ( \TEDIT.TEXTBIN.STRINGSETUP 144114 . 149827) (\TEDIT.TEXTBIN.FILESETUP 149829 . 156215) (
\TEDIT.TEXTBIN.NEW.PAGE 152121 . 156962)) (156965 170373 (\TEXTPEEKBIN 156975 . 166114) ( \TEDIT.TEXTBIN.NEW.PAGE 156217 . 161058)) (161061 176823 (\TEXTPEEKBIN 161071 . 172564) (
\TEDIT.PEEKBIN.NEW.PAGE 166116 . 170371)) (170411 175629 (CGETTEXTPROP 170421 . 170897) (CTEXTPROP \TEDIT.PEEKBIN.NEW.PAGE 172566 . 176821)) (176861 182079 (CGETTEXTPROP 176871 . 177347) (CTEXTPROP
170899 . 173243) (GETTEXTPROP 173245 . 173840) (PUTTEXTPROP 173842 . 175167) (TEXTPROP 175169 . 175627 177349 . 179693) (GETTEXTPROP 179695 . 180290) (PUTTEXTPROP 180292 . 181617) (TEXTPROP 181619 . 182077
))))) )))))
STOP STOP

Binary file not shown.