1
0
mirror of synced 2026-05-01 22:16:57 +00:00

Rmk63 backccode peekccode eolc (#853)

* EXTERNALFORMAT,UNICODE,XCCS: Consistent naming of \PEEKCCODE(.EOL), \BACKCCODE returns the code

It was confusing that the naming of the peek functions was inconsistent with the inccode and backccode functions with respect to the EOLC qualifier.  Now uniformaly, the unqualified names (\PEEKCCODE, \BACKCCODE, \INCCODE) do not do any EOL interpretation.  The qualified-name functions (\PEEKCCODE.EOLC, \INCCODE.EOLC, \BACKCCODE.EOLC) do EOL interpretation.

Also, the \BACKCCODE interface is changed so that it returns the code corresponding to the bytes that it passed over.  This simplifies some of the callers.

* Clients of \PEEKCCODE \BACKCCODE and .EOL

Small changes either to fix inconsistencies (backing, reading, peeking with inconsistent EOL interpretation), updating the names in a few other cases, a few simplifications.

* glitches in ATERM, HARDCOPY updates
This commit is contained in:
rmkaplan
2022-07-21 10:36:19 -07:00
committed by GitHub
parent 5db76b4998
commit 6376579b1c
26 changed files with 855 additions and 813 deletions

View File

@@ -1,10 +1,11 @@
(DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10 FORMAT XCCS)
(FILECREATED " 7-Aug-2021 12:45:46" {DSK}<Users>kaplan>Local>medley3.5>git-medley>sources>PMAP.;7 60192
(DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
changes to%: (FNS \PAGEDREADP)
(FILECREATED "19-Jul-2022 23:17:41" {DSK}<users>kaplan>local>medley3.5>working-medley>sources>PMAP.;8 59726
previous date%: "23-Jun-2021 12:40:35"
{DSK}<Users>kaplan>Local>medley3.5>git-medley>sources>PMAP.;6)
:CHANGES-TO (FNS \PAGEDREADP)
:PREVIOUS-DATE " 7-Aug-2021 12:45:46"
{DSK}<users>kaplan>local>medley3.5>working-medley>sources>PMAP.;7)
(* ; "
@@ -14,8 +15,8 @@ Copyright (c) 1982-1988, 1990, 1993, 2002, 2021 by Venue & Xerox Corporation.
(PRETTYCOMPRINT PMAPCOMS)
(RPAQQ PMAPCOMS
( (* ;
 "Page mapping primitives. This file is shared with VAX.")
( (* ;
 "Page mapping primitives. This file is shared with VAX.")
(FNS ADDMAPBUFFER \ALLOCMAPBUFFER CHECKBUFFERREFVAL CLEARMAP \WRITEOUTBUFFERS \CLEARMAP
DOPMAP FINDPTRSBUFFER FORGETPAGES \GETMAPBUFFER LOCKMAP MAPAFTERCLOSE MAPBUFFERCOUNT
MAPPAGE MAPWORD \RELEASEBUFFER RELEASINGVMEMPAGE RESTOREMAP UNLOCKMAP \MAPPAGE
@@ -26,14 +27,13 @@ Copyright (c) 1982-1988, 1990, 1993, 2002, 2021 by Venue & Xerox Corporation.
(SYSTEMBUFFERLIST)
(MAPEMPTYBUFFERLIST))
(GLOBALVARS SYSTEMBUFFERLIST MAPEMPTYBUFFERLIST DEFAULTMAPFILE))
[COMS (* ;
 "Functions for page-mapped devices")
[COMS (* ; "Functions for page-mapped devices")
(DECLARE%: DONTCOPY (EXPORT (MACROS \RELEASECPAGE)))
(FNS \MAKE.PMAP.DEVICE \PAGEDBACKFILEPTR \PAGEDSETFILEPTR \PAGED.INCFILEPTR
\PAGEDGETFILEPTR \PAGEDGETEOFPTR \PAGEDREADP \PAGEDEOFP \PAGED.GETNEXTBUFFER
\PAGED.FORCEOUTPUT \UPDATEOF \READPAGES \WRITEPAGES)
(FNS \SETEOF \PAGED.SETEOFPTR \NEWLENGTHIS)
(DECLARE%: DONTEVAL@LOAD DOCOPY (* ; "For TEXTOFD")
(DECLARE%: DONTEVAL@LOAD DOCOPY (* ; "For TEXTOFD")
(P (PUTD '\PAGEDBIN (GETD '\BUFFERED.BIN)
T)
(PUTD '\PAGEDPEEKBIN (GETD '\BUFFERED.PEEKBIN)
@@ -546,13 +546,13 @@ Copyright (c) 1982-1988, 1990, 1993, 2002, 2021 by Venue & Xerox Corporation.
)
(* "FOLLOWING DEFINITIONS EXPORTED")
(PUTPROPS WORDCONTENTS BYTEMACRO ((PTR)
(\GETBASE PTR 0)))
(\GETBASE PTR 0)))
(PUTPROPS SETWORDCONTENTS BYTEMACRO ((PTR N)
(\PUTBASE PTR 0 N)))
(\PUTBASE PTR 0 N)))
(PUTPROPS WORDOFFSET BYTEMACRO ((PTR N)
(\ADDBASE PTR N)))
(\ADDBASE PTR N)))
(* "END EXPORTED DEFINITIONS")
@@ -575,16 +575,14 @@ Copyright (c) 1982-1988, 1990, 1993, 2002, 2021 by Venue & Xerox Corporation.
(* "FOLLOWING DEFINITIONS EXPORTED")(DECLARE%: EVAL@COMPILE
(PUTPROPS \RELEASECPAGE MACRO ((STREAM)
(PROGN (* ;
 "Must be under an UNINTERRUPTABLY !")
(COND
((fetch CBUFDIRTY of STREAM)
(\SETIODIRTY STREAM (fetch CPAGE
of STREAM))
(replace CBUFDIRTY of STREAM with
NIL)))
(replace CBUFSIZE of STREAM with 0)
(replace CBUFPTR of STREAM with NIL))))
(PROGN (* ;
 "Must be under an UNINTERRUPTABLY !")
(COND
((fetch CBUFDIRTY of STREAM)
(\SETIODIRTY STREAM (fetch CPAGE of STREAM))
(replace CBUFDIRTY of STREAM with NIL)))
(replace CBUFSIZE of STREAM with 0)
(replace CBUFPTR of STREAM with NIL))))
)
(* "END EXPORTED DEFINITIONS")
@@ -740,26 +738,27 @@ Copyright (c) 1982-1988, 1990, 1993, 2002, 2021 by Venue & Xerox Corporation.
OFFSET _ (fetch EOFFSET of STREAM])
(\PAGEDREADP
[LAMBDA (STREAM FLG) (* ; "Edited 7-Aug-2021 12:45 by rmk:")
[LAMBDA (STREAM FLG) (* ; "Edited 19-Jul-2022 23:17 by rmk")
(* ; "Edited 7-Aug-2021 12:45 by rmk:")
(* ;; "If FLG is NIL, a single EOL as the last character of the file doesn't count. This is a character operation, not a byte operation.")
(* ;; "If FLG is NIL, a single EOL as the last character of the file doesn't count. This is a character operation, not a byte operation.")
(AND (NOT (\PAGEDEOFP STREAM))
(OR (NOT (NULL FLG))
(NEQ EOL.TC (\SYNCODE \PRIMTERMSA (\PEEKCCODE STREAM)))
(NEQ EOL.TC (\SYNCODE \PRIMTERMSA (\PEEKCCODE.EOLC STREAM)))
(PROGN
(* ;; "We peeked at an EOL. Is there anything beyond that?")
(* ;; "We peeked at an EOL. Is there anything beyond that?")
(OR (ILESSP (ffetch CPAGE of STREAM)
(ffetch EPAGE of STREAM))
(PROGN
(* ;; "Yes if we aren't on the last page.")
(* ;; "Yes if we aren't on the last page.")
(* ;; "If on the last page, we know we are not at the end, because the just-peeked EOL is there. But we also don't know how many bytes the EOL occupied. So at this point we have to read the EOL, check to see if we are then at the EOF, and then back out the EOL")
(* ;; "If on the last page, we know we are not at the end, because the just-peeked EOL is there. But we also don't know how many bytes the EOL occupied. So at this point we have to read the EOL, check to see if we are then at the EOF, and then back out the EOL")
(\INCCODE.EOLC STREAM)
(PROG1 (NOT (\PAGEDEOFP STREAM))
(\BACKCCODE STREAM])
(\BACKCCODE.EOLC STREAM])
(\PAGEDEOFP
[LAMBDA (STREAM) (* ; "Edited 15-Jun-87 15:06 by jds")
@@ -1025,9 +1024,9 @@ Copyright (c) 1982-1988, 1990, 1993, 2002, 2021 by Venue & Xerox Corporation.
(DECLARE%: EVAL@COMPILE
(DATATYPE BUFFER (FILEPAGE# (VMEMPAGE XPOINTER)
BUFFERNEXT SYSNEXT (NOREFERENCE FLAG)
(USERMAPPED FLAG)
(IODIRTY FLAG)))
BUFFERNEXT SYSNEXT (NOREFERENCE FLAG)
(USERMAPPED FLAG)
(IODIRTY FLAG)))
)
(/DECLAREDATATYPE 'BUFFER '(POINTER XPOINTER POINTER POINTER FLAG FLAG FLAG)
@@ -1043,51 +1042,48 @@ EVAL@COMPILE
(DECLARE%: EVAL@COMPILE
(PUTPROPS GETBUFFERPTR MACRO ((BUFF)
(fetch VMEMPAGE of BUFF)))
(fetch VMEMPAGE of BUFF)))
(PUTPROPS CHECKBUFFERREF MACRO [OPENLAMBDA (BUFF)(* bvm%: "24-JUN-82 17:03")
(PUTPROPS CHECKBUFFERREF MACRO [OPENLAMBDA (BUFF) (* bvm%: "24-JUN-82 17:03")
(* ;; "checks the reference field of a buffer descriptor and if no one is referencing it, it creates a reference and changes the flag. The flag is set by the garbage collector when there are no longer any references to the buffer it describes.")
(* ;; "checks the reference field of a buffer descriptor and if no one is referencing it, it creates a reference and changes the flag. The flag is set by the garbage collector when there are no longer any references to the buffer it describes.")
(UNINTERRUPTABLY
(COND
((fetch NOREFERENCE of BUFF)
(UNINTERRUPTABLY
(COND
((fetch NOREFERENCE of BUFF)
(* ;; "this is a page the reference to which has been dropped, zero its reference count before returning it.")
(* ;; "this is a page the reference to which has been dropped, zero its reference count before returning it.")
(\DELREF (fetch VMEMPAGE of BUFF))
(replace NOREFERENCE of BUFF with NIL))))
])
(\DELREF (fetch VMEMPAGE of BUFF))
(replace NOREFERENCE of BUFF with NIL))))])
(PUTPROPS CPBUFFERP MACRO ((BUFFER STREAM)
(EQ (fetch CBUFPTR of STREAM)
(fetch VMEMPAGE of BUFFER))))
(EQ (fetch CBUFPTR of STREAM)
(fetch VMEMPAGE of BUFFER))))
(PUTPROPS BUFFERINUSEP MACRO [OPENLAMBDA (BUFFER STREAM)
(AND (NULL (fetch NOREFERENCE of BUFFER))
(OR (fetch USERMAPPED of BUFFER)
(CPBUFFERP BUFFER STREAM])
(AND (NULL (fetch NOREFERENCE of BUFFER))
(OR (fetch USERMAPPED of BUFFER)
(CPBUFFERP BUFFER STREAM])
(PUTPROPS UNDIRTY MACRO [OPENLAMBDA (BUFFER STREAM)
(replace IODIRTY of BUFFER with NIL)
(COND
((CPBUFFERP BUFFER STREAM)
(replace CBUFDIRTY of STREAM with NIL])
(replace IODIRTY of BUFFER with NIL)
(COND
((CPBUFFERP BUFFER STREAM)
(replace CBUFDIRTY of STREAM with NIL])
(PUTPROPS DIRTYP MACRO [OPENLAMBDA (BUFFER STREAM)
(* rmk%: "25-OCT-83 19:57")
(PUTPROPS DIRTYP MACRO [OPENLAMBDA (BUFFER STREAM) (* rmk%: "25-OCT-83 19:57")
(* ;; "determines if this buffer has been dirtied by the IO system. It can't determine if the user has done a putbase into the page if he got it from MAPPAGE.")
(* ;; "determines if this buffer has been dirtied by the IO system. It can't determine if the user has done a putbase into the page if he got it from MAPPAGE.")
(OR (fetch IODIRTY of BUFFER)
(AND STREAM (CPBUFFERP BUFFER STREAM)
(fetch CBUFDIRTY of STREAM])
(OR (fetch IODIRTY of BUFFER)
(AND STREAM (CPBUFFERP BUFFER STREAM)
(fetch CBUFDIRTY of STREAM])
)
(DECLARE%: EVAL@COMPILE
[I.S.OPR 'INBUFS NIL '(first (SETQ I.V. BODY) by (fetch BUFFERNEXT of I.V.)
until (NULL I.V.]
[I.S.OPR 'INBUFS NIL '(first (SETQ I.V. BODY) by (fetch BUFFERNEXT of I.V.) until (NULL I.V.]
)
)
@@ -1107,18 +1103,18 @@ EVAL@COMPILE
(PUTPROPS PMAP COPYRIGHT ("Venue & Xerox Corporation" 1982 1983 1984 1985 1986 1987 1988 1990 1993
2002 2021))
(DECLARE%: DONTCOPY
(FILEMAP (NIL (2527 29181 (ADDMAPBUFFER 2537 . 2713) (\ALLOCMAPBUFFER 2715 . 3316) (CHECKBUFFERREFVAL
3318 . 3893) (CLEARMAP 3895 . 4551) (\WRITEOUTBUFFERS 4553 . 5302) (\CLEARMAP 5304 . 8530) (DOPMAP
8532 . 8995) (FINDPTRSBUFFER 8997 . 9871) (FORGETPAGES 9873 . 12158) (\GETMAPBUFFER 12160 . 15282) (
LOCKMAP 15284 . 15491) (MAPAFTERCLOSE 15493 . 15796) (MAPBUFFERCOUNT 15798 . 16288) (MAPPAGE 16290 .
17799) (MAPWORD 17801 . 18114) (\RELEASEBUFFER 18116 . 18685) (RELEASINGVMEMPAGE 18687 . 19324) (
RESTOREMAP 19326 . 22123) (UNLOCKMAP 22125 . 22334) (\MAPPAGE 22336 . 27790) (\COLLECTDIRTYBUFS 27792
. 28572) (\SETIODIRTY 28574 . 29179)) (29182 30153 (WORDCONTENTS 29192 . 29361) (SETWORDCONTENTS
29363 . 29675) (/SETWORDCONTENTS 29677 . 29982) (WORDOFFSET 29984 . 30151)) (31859 51765 (
\MAKE.PMAP.DEVICE 31869 . 33197) (\PAGEDBACKFILEPTR 33199 . 35673) (\PAGEDSETFILEPTR 35675 . 37111) (
\PAGED.INCFILEPTR 37113 . 40137) (\PAGEDGETFILEPTR 40139 . 40382) (\PAGEDGETEOFPTR 40384 . 40802) (
\PAGEDREADP 40804 . 42044) (\PAGEDEOFP 42046 . 43663) (\PAGED.GETNEXTBUFFER 43665 . 47459) (
\PAGED.FORCEOUTPUT 47461 . 49909) (\UPDATEOF 49911 . 50743) (\READPAGES 50745 . 51205) (\WRITEPAGES
51207 . 51763)) (51766 55858 (\SETEOF 51776 . 52991) (\PAGED.SETEOFPTR 52993 . 54887) (\NEWLENGTHIS
54889 . 55856)) (56000 56380 (PPBUFS 56010 . 56378)))))
(FILEMAP (NIL (2457 29111 (ADDMAPBUFFER 2467 . 2643) (\ALLOCMAPBUFFER 2645 . 3246) (CHECKBUFFERREFVAL
3248 . 3823) (CLEARMAP 3825 . 4481) (\WRITEOUTBUFFERS 4483 . 5232) (\CLEARMAP 5234 . 8460) (DOPMAP
8462 . 8925) (FINDPTRSBUFFER 8927 . 9801) (FORGETPAGES 9803 . 12088) (\GETMAPBUFFER 12090 . 15212) (
LOCKMAP 15214 . 15421) (MAPAFTERCLOSE 15423 . 15726) (MAPBUFFERCOUNT 15728 . 16218) (MAPPAGE 16220 .
17729) (MAPWORD 17731 . 18044) (\RELEASEBUFFER 18046 . 18615) (RELEASINGVMEMPAGE 18617 . 19254) (
RESTOREMAP 19256 . 22053) (UNLOCKMAP 22055 . 22264) (\MAPPAGE 22266 . 27720) (\COLLECTDIRTYBUFS 27722
. 28502) (\SETIODIRTY 28504 . 29109)) (29112 30083 (WORDCONTENTS 29122 . 29291) (SETWORDCONTENTS
29293 . 29605) (/SETWORDCONTENTS 29607 . 29912) (WORDOFFSET 29914 . 30081)) (31555 51584 (
\MAKE.PMAP.DEVICE 31565 . 32893) (\PAGEDBACKFILEPTR 32895 . 35369) (\PAGEDSETFILEPTR 35371 . 36807) (
\PAGED.INCFILEPTR 36809 . 39833) (\PAGEDGETFILEPTR 39835 . 40078) (\PAGEDGETEOFPTR 40080 . 40498) (
\PAGEDREADP 40500 . 41863) (\PAGEDEOFP 41865 . 43482) (\PAGED.GETNEXTBUFFER 43484 . 47278) (
\PAGED.FORCEOUTPUT 47280 . 49728) (\UPDATEOF 49730 . 50562) (\READPAGES 50564 . 51024) (\WRITEPAGES
51026 . 51582)) (51585 55677 (\SETEOF 51595 . 52810) (\PAGED.SETEOFPTR 52812 . 54706) (\NEWLENGTHIS
54708 . 55675)) (55819 56199 (PPBUFS 55829 . 56197)))))
STOP