1
0
mirror of synced 2026-01-13 23:47:27 +00:00

HARDCOPY: COPY.TEXT.TO.IMAGE had Unicode-incompatible end-of-file shortcut

Also used byte and not character-code operation in CRLF check
This commit is contained in:
rmkaplan 2021-09-29 22:26:11 -07:00
parent 388d54b713
commit 65a2d8000e
2 changed files with 63 additions and 58 deletions

View File

@ -1,11 +1,12 @@
(DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
(FILECREATED "20-Sep-2021 10:59:58" 
{DSK}<Users>kaplan>Local>medley3.5>git-medley>sources>HARDCOPY.;2 103730
changes to%: (VARS HARDCOPYCOMS)
(FILECREATED "29-Sep-2021 08:53:30" 
{DSK}<Users>kaplan>Local>medley3.5>git-medley>sources>HARDCOPY.;5 103898
previous date%: " 5-May-2021 19:41:55"
{DSK}<Users>kaplan>Local>medley3.5>git-medley>sources>HARDCOPY.;1)
changes to%: (FNS COPY.TEXT.TO.IMAGE)
previous date%: "20-Sep-2021 10:59:58"
{DSK}<Users>kaplan>Local>medley3.5>git-medley>sources>HARDCOPY.;3)
(* ; "
@ -722,10 +723,10 @@ Copyright (c) 1984-1993, 1999, 2018, 2021 by Venue & Xerox Corporation.
(CLOSEF IMAGESTREAM])])
(COPY.TEXT.TO.IMAGE
[LAMBDA (INFILE IMAGESTREAM FONTS TABS) (* ; "Edited 5-May-2021 19:41 by rmk:")
(* ; "Edited 10-Apr-95 21:23 by rmk:")
[LAMBDA (INFILE IMAGESTREAM FONTS TABS) (* ; "Edited 29-Sep-2021 08:53 by rmk:")
(* ; "Edited 10-Apr-95 21:23 by rmk:")
(* ;; "Copy text to an image stream, obeying PSPOOL control characters")
(* ;; "Copy text to an image stream, obeying PSPOOL control characters")
(LET*
((IMAGESTREAM (GETSTREAM IMAGESTREAM 'OUTPUT))
@ -734,15 +735,19 @@ Copyright (c) 1984-1993, 1999, 2018, 2021 by Venue & Xerox Corporation.
(MAXFONT (ARRAYSIZE FONTARRAY))
(INSTRM (GETSTREAM INFILE 'INPUT))
DEFAULTTAB C FC)
(replace (STREAM ENDOFSTREAMOP) of INSTRM with (FUNCTION ZERO))
(* ;;
 "RMK: EOS function is NILL, not ZERO. 0 in low-order bits is OK in UNICODE, when we switch")
(replace (STREAM ENDOFSTREAMOP) of INSTRM with (FUNCTION NILL))
(do
(COND
((AND [EQ 0 (LOGAND 255 (SETQ C (\INCCODE INSTRM]
(EOFP INSTRM))
((NULL (SETQ C (\INCCODE INSTRM)))
(replace (STREAM ENDOFSTREAMOP) of INSTRM with NIL)
(RETURN))
((AND RIGHTMAR (> (DSPXPOSITION NIL IMAGESTREAM)
RIGHTMAR)) (* ;
 "Not to walk off the right edge of the paper")
RIGHTMAR)) (* ;
 "Not to walk off the right edge of the paper")
(TERPRI IMAGESTREAM)))
(COND
([> C (CONSTANT (APPLY (FUNCTION MAX)
@ -750,16 +755,16 @@ Copyright (c) 1984-1993, 1999, 2018, 2021 by Venue & Xerox Corporation.
(\OUTCHAR IMAGESTREAM C))
(T
(SELCHARQ C
(^F (* ; "Font shift")
(^F (* ; "Font shift")
(* ;;
 "For FX-XP-9 printer:SETXY interpress command to avoid printer's BUG(Take)")
(* ;;
 "For FX-XP-9 printer:SETXY interpress command to avoid printer's BUG(Take)")
(DSPXPOSITION (IPLUS (DSPXPOSITION NIL IMAGESTREAM)
1)
IMAGESTREAM)
[SELCHARQ (SETQ FC (\INCCODE INSTRM))
(^T (* ; "tab to absolute pos.")
(^T (* ; "tab to absolute pos.")
(COND
((EQ 0 (SETQ FC (\INCCODE INSTRM)))
(\OUTCHAR IMAGESTREAM (CHARCODE ^F))
@ -769,7 +774,7 @@ Copyright (c) 1984-1993, 1999, 2018, 2021 by Venue & Xerox Corporation.
(\OUTCHAR IMAGESTREAM FC))
(T
(* ;; "TEXTDEFAULTTABS is a hack, since it depends on the units of the stream. Should really be a property of the stream or imagetype, or defined in terms of standard scale")
(* ;; "TEXTDEFAULTTABS is a hack, since it depends on the units of the stream. Should really be a property of the stream or imagetype, or defined in terms of standard scale")
[SETQ FC
(IF TABS
@ -787,7 +792,7 @@ Copyright (c) 1984-1993, 1999, 2018, 2021 by Venue & Xerox Corporation.
(NULL (\OUTCHAR IMAGESTREAM (CHARCODE ^F))
(AND (\EOFP INSTRM)
(RETURN))
(\OUTCHAR IMAGESTREAM FC) (* ; "EOS after ^F")
(\OUTCHAR IMAGESTREAM FC) (* ; "EOS after ^F")
)
(COND
((AND (>= MAXFONT FC)
@ -797,13 +802,13 @@ Copyright (c) 1984-1993, 1999, 2018, 2021 by Venue & Xerox Corporation.
(T (\OUTCHAR IMAGESTREAM (CHARCODE ^F))
(\OUTCHAR IMAGESTREAM C])
(CR
(* ;; "Assumes that CR and possibly following LF denote a single EOL, independent of the EOL convention and independent of whether the file was opened binary or text. Originally, this function tried to discriminate, treating an LF in a CR-mode file as a line-feed and a CR in an LF file as a carriage-return. But these formatting effects cannot be guaranteed across text-file transfers (which is all that it makes sense to print), so it is silly to take them seriously. Given that just this information can be lost in text-mode file transfers, we make adopt here the 99%% correct solution, which is to treat all instances of CR, CRLF, and LF as end-of-line.")
(* ;; "Assumes that CR and possibly following LF denote a single EOL, independent of the EOL convention and independent of whether the file was opened binary or text. Originally, this function tried to discriminate, treating an LF in a CR-mode file as a line-feed and a CR in an LF file as a carriage-return. But these formatting effects cannot be guaranteed across text-file transfers (which is all that it makes sense to print), so it is silly to take them seriously. Given that just this information can be lost in text-mode file transfers, we make adopt here the 99%% correct solution, which is to treat all instances of CR, CRLF, and LF as end-of-line.")
(TERPRI IMAGESTREAM)
(COND
((EQ (CHARCODE LF)
(\PEEKBIN INSTRM T))
(BIN INSTRM))))
(\PEEKCCODE.NOEOLC INSTRM T))
(\INCCODE INSTRM))))
(TAB (OR (LET* [(LEFTMARGIN (DSPLEFTMARGIN NIL IMAGESTREAM))
(TAB.WIDTH (TIMES (CHARWIDTH (CHARCODE SPACE)
IMAGESTREAM)
@ -815,7 +820,7 @@ Copyright (c) 1984-1993, 1999, 2018, 2021 by Venue & Xerox Corporation.
CURRENT.X)
0 IMAGESTREAM)))
(\OUTCHAR IMAGESTREAM C)))
(LF (* ; "See comment at CR")
(LF (* ; "See comment at CR")
(TERPRI IMAGESTREAM))
(NULL (AND (EOFP INSTRM)
(RETURN))
@ -1088,39 +1093,39 @@ Copyright (c) 1984-1993, 1999, 2018, 2021 by Venue & Xerox Corporation.
(PUTPROPS HARDCOPY COPYRIGHT ("Venue & Xerox Corporation" 1984 1985 1986 1987 1988 1989 1990 1991 1992
1993 1999 2018 2021))
(DECLARE%: DONTCOPY
(FILEMAP (NIL (6176 10360 (HARDCOPY.SOMEHOW 6186 . 7544) (HARDCOPYIMAGEW 7546 . 7698) (
HARDCOPYIMAGEW.TOFILE 7700 . 8008) (HARDCOPYIMAGEW.TOPRINTER 8010 . 8675) (HARDCOPYREGION.TOFILE 8677
. 8975) (HARDCOPYREGION.TOPRINTER 8977 . 9599) (COPY.WINDOW.TO.BITMAP 9601 . 10358)) (10432 20982 (
MakeMenuOfPrinters 10442 . 11667) (PRINTERS.WHENSELECTEDFN 11669 . 13411) (MakeMenuOfImageTypes 13413
. 13931) (GetNewPrinterFromUser 13933 . 14361) (PopUpWindowAndGetAtom 14363 . 15748) (
PopUpWindowAndGetList 15750 . 17316) (NewPrinter 17318 . 18266) (GetPrinterName 18268 . 18548) (
GetImageFile 18550 . 20837) (FetchDefaultPrinter 20839 . 20980)) (21017 21555 (
ExtensionForPrintFileType 21027 . 21220) (PRINTFILETYPE.FROM.EXTENSION 21222 . 21553)) (21610 37994 (
DEFAULTPRINTER 21620 . 21780) (CAN.PRINT.DIRECTLY 21782 . 21938) (CONVERT.FILE.TO.TYPE.FOR.PRINTER
21940 . 22984) (EMPRESS 22986 . 23299) (HARDCOPYW 23301 . 26261) (LISTFILES1 26263 . 26436) (
PRINTER.BITMAPFILE 26438 . 26685) (PRINTER.BITMAPSCALE 26687 . 26952) (PRINTER.SCRATCH.FILE 26954 .
27077) (PRINTERPROP 27079 . 27262) (PRINTERSTATUS 27264 . 27453) (PRINTERTYPE 27455 . 29764) (
PRINTERNAME 29766 . 30068) (PRINTFILEPROP 30070 . 30261) (PRINTFILETYPE 30263 . 32207) (
\EXPECTED.FILE.TYPE 32209 . 32991) (SEND.FILE.TO.PRINTER 32993 . 37992)) (37995 42977 (PRINTERDEVICE
38005 . 42975)) (43792 51993 (TEXTTOIMAGEFILE 43802 . 45992) (COPY.TEXT.TO.IMAGE 45994 . 51991)) (
51994 53129 (\BLTSHADE.GENERICPRINTER 52004 . 53127)) (53257 72009 (MAKEHARDCOPYSTREAM 53267 . 54271)
(UNMAKEHARDCOPYSTREAM 54273 . 54957) (HARDCOPYSTREAMTYPE 54959 . 55238) (\CHARWIDTH.HDCPYDISPLAY 55240
. 55671) (\DSPFONT.HDCPYDISPLAY 55673 . 57078) (\DSPRIGHTMARGIN.HDCPYDISPLAY 57080 . 57657) (
\DSPXPOSITION.HDCPYDISPLAY 57659 . 57920) (\DSPYPOSITION.HDCPYDISPLAY 57922 . 58183) (
\STRINGWIDTH.HDCPYDISPLAY 58185 . 58692) (\STRINGWIDTH.HCPYDISPLAYAUX 58694 . 61026) (\HDCPYBLTCHAR
61028 . 63563) (\HDCPYDISPLAY.FIX.XPOS 63565 . 63985) (\HDCPYDISPLAY.FIX.YPOS 63987 . 64407) (
\HDCPYDISPLAYINIT 64409 . 65186) (\HDCPYDSPPRINTCHAR 65188 . 67348) (\SLOWHDCPYBLTCHAR 67350 . 70853)
(\CHANGECHARSET.HDCPYDISPLAY 70855 . 72007)) (72731 103028 (MAKEHARDCOPYMODESTREAM 72741 . 74650) (
UNMAKEHARDCOPYMODESTREAM 74652 . 75730) (\BLTSHADE.HCPYMODE 75732 . 76179) (\BITBLT.HCPYMODE 76181 .
76803) (\BRUSHCONVERT.HCPYMODE 76805 . 77042) (\CHANGECHARSET.HCPYMODE 77044 . 78811) (
\DASHINGCONVERT.HCPYMODE 78813 . 79076) (\CHARWIDTH.HCPYMODE 79078 . 79365) (\DRAWLINE.HCPYMODE 79367
. 79679) (\DRAWCURVE.HCPYMODE 79681 . 80110) (\DRAWCIRCLE.HCPYMODE 80112 . 80507) (
\DRAWELLIPSE.HCPYMODE 80509 . 81021) (\DSPFONT.HCPYMODE 81023 . 82179) (\DSPLEFTMARGIN.HCPYMODE 82181
. 82765) (\DSPLINEFEED.HCPYMODE 82767 . 83177) (\DSPRIGHTMARGIN.HCPYMODE 83179 . 83808) (
\DSPSPACEFACTOR.HCPYMODE 83810 . 84331) (\DSPXPOSITION.HCPYMODE 84333 . 84914) (\DSPYPOSITION.HCPYMODE
84916 . 85321) (\MOVETO.HCPYMODE 85323 . 85475) (\FONTCREATE.HCPYMODE.PRESS 85477 . 86489) (
\CREATECHARSET.HCPYMODE.PRESS 86491 . 87462) (\FONTCREATE.HCPYMODE.INTERPRESS 87464 . 88498) (
\CREATECHARSET.HCPYMODE.INTERPRESS 88500 . 89488) (\STRINGWIDTH.HCPYMODE 89490 . 89924) (
\HCPYMODEBLTCHAR 89926 . 92895) (\HCPYMODEDISPLAYINIT 92897 . 95828) (\HCPYMODEDSPPRINTCHAR 95830 .
98011) (\SLOWHCPYMODEBLTCHAR 98013 . 101527) (\SFFixY.HCPYMODE 101529 . 103026)))))
(FILEMAP (NIL (6182 10366 (HARDCOPY.SOMEHOW 6192 . 7550) (HARDCOPYIMAGEW 7552 . 7704) (
HARDCOPYIMAGEW.TOFILE 7706 . 8014) (HARDCOPYIMAGEW.TOPRINTER 8016 . 8681) (HARDCOPYREGION.TOFILE 8683
. 8981) (HARDCOPYREGION.TOPRINTER 8983 . 9605) (COPY.WINDOW.TO.BITMAP 9607 . 10364)) (10438 20988 (
MakeMenuOfPrinters 10448 . 11673) (PRINTERS.WHENSELECTEDFN 11675 . 13417) (MakeMenuOfImageTypes 13419
. 13937) (GetNewPrinterFromUser 13939 . 14367) (PopUpWindowAndGetAtom 14369 . 15754) (
PopUpWindowAndGetList 15756 . 17322) (NewPrinter 17324 . 18272) (GetPrinterName 18274 . 18554) (
GetImageFile 18556 . 20843) (FetchDefaultPrinter 20845 . 20986)) (21023 21561 (
ExtensionForPrintFileType 21033 . 21226) (PRINTFILETYPE.FROM.EXTENSION 21228 . 21559)) (21616 38000 (
DEFAULTPRINTER 21626 . 21786) (CAN.PRINT.DIRECTLY 21788 . 21944) (CONVERT.FILE.TO.TYPE.FOR.PRINTER
21946 . 22990) (EMPRESS 22992 . 23305) (HARDCOPYW 23307 . 26267) (LISTFILES1 26269 . 26442) (
PRINTER.BITMAPFILE 26444 . 26691) (PRINTER.BITMAPSCALE 26693 . 26958) (PRINTER.SCRATCH.FILE 26960 .
27083) (PRINTERPROP 27085 . 27268) (PRINTERSTATUS 27270 . 27459) (PRINTERTYPE 27461 . 29770) (
PRINTERNAME 29772 . 30074) (PRINTFILEPROP 30076 . 30267) (PRINTFILETYPE 30269 . 32213) (
\EXPECTED.FILE.TYPE 32215 . 32997) (SEND.FILE.TO.PRINTER 32999 . 37998)) (38001 42983 (PRINTERDEVICE
38011 . 42981)) (43798 52161 (TEXTTOIMAGEFILE 43808 . 45998) (COPY.TEXT.TO.IMAGE 46000 . 52159)) (
52162 53297 (\BLTSHADE.GENERICPRINTER 52172 . 53295)) (53425 72177 (MAKEHARDCOPYSTREAM 53435 . 54439)
(UNMAKEHARDCOPYSTREAM 54441 . 55125) (HARDCOPYSTREAMTYPE 55127 . 55406) (\CHARWIDTH.HDCPYDISPLAY 55408
. 55839) (\DSPFONT.HDCPYDISPLAY 55841 . 57246) (\DSPRIGHTMARGIN.HDCPYDISPLAY 57248 . 57825) (
\DSPXPOSITION.HDCPYDISPLAY 57827 . 58088) (\DSPYPOSITION.HDCPYDISPLAY 58090 . 58351) (
\STRINGWIDTH.HDCPYDISPLAY 58353 . 58860) (\STRINGWIDTH.HCPYDISPLAYAUX 58862 . 61194) (\HDCPYBLTCHAR
61196 . 63731) (\HDCPYDISPLAY.FIX.XPOS 63733 . 64153) (\HDCPYDISPLAY.FIX.YPOS 64155 . 64575) (
\HDCPYDISPLAYINIT 64577 . 65354) (\HDCPYDSPPRINTCHAR 65356 . 67516) (\SLOWHDCPYBLTCHAR 67518 . 71021)
(\CHANGECHARSET.HDCPYDISPLAY 71023 . 72175)) (72899 103196 (MAKEHARDCOPYMODESTREAM 72909 . 74818) (
UNMAKEHARDCOPYMODESTREAM 74820 . 75898) (\BLTSHADE.HCPYMODE 75900 . 76347) (\BITBLT.HCPYMODE 76349 .
76971) (\BRUSHCONVERT.HCPYMODE 76973 . 77210) (\CHANGECHARSET.HCPYMODE 77212 . 78979) (
\DASHINGCONVERT.HCPYMODE 78981 . 79244) (\CHARWIDTH.HCPYMODE 79246 . 79533) (\DRAWLINE.HCPYMODE 79535
. 79847) (\DRAWCURVE.HCPYMODE 79849 . 80278) (\DRAWCIRCLE.HCPYMODE 80280 . 80675) (
\DRAWELLIPSE.HCPYMODE 80677 . 81189) (\DSPFONT.HCPYMODE 81191 . 82347) (\DSPLEFTMARGIN.HCPYMODE 82349
. 82933) (\DSPLINEFEED.HCPYMODE 82935 . 83345) (\DSPRIGHTMARGIN.HCPYMODE 83347 . 83976) (
\DSPSPACEFACTOR.HCPYMODE 83978 . 84499) (\DSPXPOSITION.HCPYMODE 84501 . 85082) (\DSPYPOSITION.HCPYMODE
85084 . 85489) (\MOVETO.HCPYMODE 85491 . 85643) (\FONTCREATE.HCPYMODE.PRESS 85645 . 86657) (
\CREATECHARSET.HCPYMODE.PRESS 86659 . 87630) (\FONTCREATE.HCPYMODE.INTERPRESS 87632 . 88666) (
\CREATECHARSET.HCPYMODE.INTERPRESS 88668 . 89656) (\STRINGWIDTH.HCPYMODE 89658 . 90092) (
\HCPYMODEBLTCHAR 90094 . 93063) (\HCPYMODEDISPLAYINIT 93065 . 95996) (\HCPYMODEDSPPRINTCHAR 95998 .
98179) (\SLOWHCPYMODEBLTCHAR 98181 . 101695) (\SFFixY.HCPYMODE 101697 . 103194)))))
STOP

Binary file not shown.