Skip to content

Commit

Permalink
EXTERNALFORMAT macro and function implement EOL detection
Browse files Browse the repository at this point in the history
  • Loading branch information
rmkaplan committed Dec 18, 2024
1 parent 5967452 commit eb09861
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 17 deletions.
53 changes: 36 additions & 17 deletions sources/EXTERNALFORMAT
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
(DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)

(FILECREATED "17-Dec-2024 15:29:21" {WMEDLEY}<sources>EXTERNALFORMAT.;90 39713
(FILECREATED "17-Dec-2024 17:44:48" {WMEDLEY}<sources>EXTERNALFORMAT.;92 41401

:EDIT-BY rmk

:CHANGES-TO (FNS \CHECKEOLC.CRLF)
(MACROS \CHECKEOLC)
:CHANGES-TO (MACROS \CHECKEOLC)
(FNS \INCCODE.EOLC)

:PREVIOUS-DATE "19-Mar-2024 18:24:39" {WMEDLEY}<sources>EXTERNALFORMAT.;88)
:PREVIOUS-DATE "17-Dec-2024 17:00:58" {WMEDLEY}<sources>EXTERNALFORMAT.;91)


(PRETTYCOMPRINT EXTERNALFORMATCOMS)
Expand Down Expand Up @@ -538,7 +538,7 @@
FSTRING])

(\CHECKEOLC.CRLF
[LAMBDA (STREAM PEEKBINFLG COUNTP EOLC) (* ; "Edited 17-Dec-2024 15:28 by rmk")
[LAMBDA (STREAM PEEKBINFLG COUNTP EOLC) (* ; "Edited 17-Dec-2024 17:00 by rmk")
(* ; "Edited 6-Dec-2023 23:39 by rmk")
(* ; "Edited 17-Oct-2023 11:56 by rmk")
(* ; "Edited 6-Aug-2021 23:30 by rmk:")
Expand Down Expand Up @@ -566,7 +566,7 @@
(PROG1 (\PEEKCCODE STREAM T 'NOEOLC)

(* ;;
 "This has to be a call to \PEEKCODE that doesn't itself to the checkeolc")
 "This has to be a call to \PEEKCODE that doesn't itself do the checkeolc")

(* ;;
 "LF must be the next char after the CR. We back up over the CR that \INCCODE just read.")
Expand All @@ -575,9 +575,13 @@

(* ;; "Got the CRLF, it's an EOL")

(CL:WHEN (EQ ANY.EOLC (FFETCH (STREAM DETECTEDEOLCONVENTION)
OF STREAM))
(FREPLACE (STREAM DETECTEDEOLCONVENTION) OF STREAM WITH CRLF.EOLC
))
(CHARCODE EOL))
(T (SELECTC EOLC
((LIST ANY.EOLC)
((LIST ANY.EOLC 'ANY)
(CL:WHEN (EQ ANY.EOLC (FFETCH (STREAM
DETECTEDEOLCONVENTION
) OF STREAM))
Expand All @@ -601,6 +605,9 @@
(CHARCODE EOL))
(T (SELECTC EOLC
((LIST ANY.EOLC 'ANY)
(CL:WHEN (EQ ANY.EOLC (FFETCH (STREAM DETECTEDEOLCONVENTION)
OF STREAM))
(FREPLACE (STREAM DETECTEDEOLCONVENTION) OF STREAM WITH CR.EOLC))
(CHARCODE EOL))
(CHARCODE CR]
CH])
Expand All @@ -611,11 +618,23 @@
(PUTPROPS \CHECKEOLC MACRO (OPENLAMBDA (CH EOLC STRM PEEKBINFLG COUNTP)
(SELCHARQ CH
(LF (SELECTC (OR EOLC (FFETCH (STREAM EOLCONVENTION) OF STRM))
((LIST LF.EOLC ANY.EOLC 'LF 'ANY)
((LIST ANY.EOLC 'ANY)
(CL:WHEN (EQ ANY.EOLC (FFETCH (STREAM
DETECTEDEOLCONVENTION
) OF STREAM))
(FREPLACE (STREAM DETECTEDEOLCONVENTION)
OF STREAM WITH LF.EOLC))
(CHARCODE EOL))
((LIST LF.EOLC 'LF)
(CHARCODE EOL))
(CHARCODE LF)))
(CR (SELECTC (OR EOLC (FFETCH (STREAM EOLCONVENTION) OF STRM))
((LIST CR.EOLC 'CR)
(CL:WHEN (EQ ANY.EOLC (FFETCH (STREAM
DETECTEDEOLCONVENTION
) OF STREAM))
(FREPLACE (STREAM DETECTEDEOLCONVENTION)
OF STREAM WITH CR.EOLC))
(CHARCODE EOL))
((LIST ANY.EOLC CRLF.EOLC 'CRLF 'ANY)
(\CHECKEOLC.CRLF STRM PEEKBINFLG COUNTP EOLC))
Expand Down Expand Up @@ -746,13 +765,13 @@
(\CREATE.THROUGH.EXTERNALFORMAT)
)
(DECLARE%: DONTCOPY
(FILEMAP (NIL (6744 13577 (\EXTERNALFORMAT 6754 . 10532) (MAKE-EXTERNALFORMAT 10534 . 13104) (
\EXTERNALFORMAT.DEFPRINT 13106 . 13575)) (13578 16619 (\INSTALL.EXTERNALFORMAT 13588 . 15037) (
\REMOVE.EXTERNALFORMAT 15039 . 15870) (FIND-FORMAT 15872 . 16617)) (16620 17032 (SYSTEM-EXTERNALFORMAT
16630 . 17030)) (17381 34132 (\OUTCHAR 17391 . 18608) (\INCCODE 18610 . 19763) (\BACKCCODE 19765 .
21444) (\BACKCCODE.EOLC 21446 . 23636) (\PEEKCCODE 23638 . 23963) (\PEEKCCODE.EOLC 23965 . 24344) (
\INCCODE.EOLC 24346 . 26145) (\FORMATBYTESTREAM 26147 . 28591) (\FORMATBYTESTRING 28593 . 30293) (
\CHECKEOLC.CRLF 30295 . 34130)) (35414 37650 (\NULLDEVICE 35424 . 37326) (\NULL.OPENFILE 37328 . 37648
)) (37790 39617 (\CREATE.THROUGH.EXTERNALFORMAT 37800 . 38586) (\THROUGHIN 38588 . 39008) (
\THROUGHBACKCCODE 39010 . 39277) (\THROUGHOUTCHARFN 39279 . 39615)))))
(FILEMAP (NIL (6742 13575 (\EXTERNALFORMAT 6752 . 10530) (MAKE-EXTERNALFORMAT 10532 . 13102) (
\EXTERNALFORMAT.DEFPRINT 13104 . 13573)) (13576 16617 (\INSTALL.EXTERNALFORMAT 13586 . 15035) (
\REMOVE.EXTERNALFORMAT 15037 . 15868) (FIND-FORMAT 15870 . 16615)) (16618 17030 (SYSTEM-EXTERNALFORMAT
16628 . 17028)) (17379 34752 (\OUTCHAR 17389 . 18606) (\INCCODE 18608 . 19761) (\BACKCCODE 19763 .
21442) (\BACKCCODE.EOLC 21444 . 23634) (\PEEKCCODE 23636 . 23961) (\PEEKCCODE.EOLC 23963 . 24342) (
\INCCODE.EOLC 24344 . 26143) (\FORMATBYTESTREAM 26145 . 28589) (\FORMATBYTESTRING 28591 . 30291) (
\CHECKEOLC.CRLF 30293 . 34750)) (37102 39338 (\NULLDEVICE 37112 . 39014) (\NULL.OPENFILE 39016 . 39336
)) (39478 41305 (\CREATE.THROUGH.EXTERNALFORMAT 39488 . 40274) (\THROUGHIN 40276 . 40696) (
\THROUGHBACKCCODE 40698 . 40965) (\THROUGHOUTCHARFN 40967 . 41303)))))
STOP
Binary file modified sources/EXTERNALFORMAT.LCOM
Binary file not shown.

0 comments on commit eb09861

Please sign in to comment.