Skip to content

Commit

Permalink
FILEIO: EOL for input defaults to ANY, EXT-FORMAT can specify EOL
Browse files Browse the repository at this point in the history
As per technical meeting on 7/15/2024
  • Loading branch information
rmkaplan committed Jul 16, 2024
1 parent 1901571 commit 6a7e8c3
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 55 deletions.
125 changes: 70 additions & 55 deletions sources/FILEIO
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
(DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)

(FILECREATED " 8-Dec-2023 15:17:12" {WMEDLEY}<sources>FILEIO.;124 163555
(FILECREATED "15-Jul-2024 21:25:14" {WMEDLEY}<sources>FILEIO.;129 164231

:EDIT-BY rmk

:CHANGES-TO (FNS \GENERIC.CHARSET CHARSET ACCESS-CHARSET)
:CHANGES-TO (FNS \DO.PARAMS.AT.OPEN)

:PREVIOUS-DATE " 7-Dec-2023 23:54:02" {WMEDLEY}<sources>FILEIO.;121)
:PREVIOUS-DATE " 8-Dec-2023 15:17:12" {WMEDLEY}<sources>FILEIO.;124)


(PRETTYCOMPRINT FILEIOCOMS)
Expand Down Expand Up @@ -1446,14 +1446,17 @@
(GO RETRY])

(\DO.PARAMS.AT.OPEN
[LAMBDA (STREAM ACCESS PARAMETERS) (* ; "Edited 25-Aug-2023 08:43 by rmk")
[LAMBDA (STREAM ACCESS PARAMETERS) (* ; "Edited 15-Jul-2024 21:25 by rmk")
(* ; "Edited 25-Aug-2023 08:43 by rmk")
(* ; "Edited 6-Jul-2022 00:00 by rmk")
(* ; "Edited 19-Dec-2021 09:30 by rmk")
(* ; "Edited 14-Dec-2021 16:10 by rmk")
(* ; "Edited 13-Dec-2021 15:20 by rmk")
(* ; "Edited 29-Jun-2021 17:07 by rmk:")
(* ; "Edited 5-Oct-92 13:45 by jds")

(* ;; "RMK: July 2024: Default EOL to ANY on input streams, allow EXTERNAL FORMAT to be a (FORMAT EOL) list so CL:OPEN can get the EOL")

(* ;; "Does generic parameters when a file/stream is open. Called by \OPENFILE and OPENSTREAM")

(* ;; "RMK: August 2023: Added PUTSTREAMPROP as last resort.")
Expand All @@ -1465,22 +1468,34 @@

(DECLARE (USEDFREE STREAM-AFTER-OPEN-FNS))
(\EXTERNALFORMAT STREAM :DEFAULT)
(for X ATTR VAL in PARAMETERS do (COND
[(LISTP X)
(SETQ ATTR (CAR X))
(SETQ VAL (CAR (LISTP (CDR X]
(T (SETQ ATTR X)
(SETQ VAL T)))
(SELECTQ ATTR
(BUFFERS (SETFILEINFO STREAM 'BUFFERS VAL))
(ENDOFSTREAMOP (SETFILEINFO STREAM 'ENDOFSTREAMOP VAL))
(CHARSET (CHARSET STREAM VAL))
((FORMAT EXTERNALFORMAT :EXTERNAL-FORMAT)
(\EXTERNALFORMAT STREAM VAL))
(CONVHANKAKU (CONVHANKAKU STREAM VAL))
((EOL EOLCONVENTION EOLC)
(SETFILEINFO STREAM 'EOL VAL))
(PUTSTREAMPROP STREAM ATTR VAL)))
[for X ATTR VAL EOLFLAG in PARAMETERS
do (COND
[(LISTP X)
(SETQ ATTR (CAR X))
(SETQ VAL (CAR (LISTP (CDR X]
(T (SETQ ATTR X)
(SETQ VAL T)))
(SELECTQ ATTR
(BUFFERS (SETFILEINFO STREAM 'BUFFERS VAL))
(ENDOFSTREAMOP (SETFILEINFO STREAM 'ENDOFSTREAMOP VAL))
(CHARSET (CHARSET STREAM VAL))
((FORMAT EXTERNALFORMAT :EXTERNAL-FORMAT)
(SETQ EOLFLAG T)
(if (LISTP VAL)
then (\EXTERNALFORMAT STREAM (CAR VAL))
(* ; "VAL could be (:UTF-8 CR)")
(CL:IF (CADR VAL)
(SETFILEINFO STREAM 'EOL (CADR VAL)))
else (\EXTERNALFORMAT STREAM VAL)))
(CONVHANKAKU (CONVHANKAKU STREAM VAL))
((EOL EOLCONVENTION EOLC)
(SETQ EOLFLAG T)
(SETFILEINFO STREAM 'EOL VAL))
(PUTSTREAMPROP STREAM ATTR VAL)) finally (CL:UNLESS (OR EOLFLAG (\IOMODEP STREAM
'OUTPUT T))
(* ;
 "Default to ANY if not set explicitly or by external format")
(SETFILEINFO STREAM 'EOL 'ANY))]
(FOR FN IN STREAM-AFTER-OPEN-FNS DO (APPLY* FN STREAM ACCESS PARAMETERS])

(\RENAMEFILE
Expand Down Expand Up @@ -3115,39 +3130,39 @@ update the map")
(ADDTOVAR LAMA \IS.NOT.RANDACCESSP \ILLEGAL.DEVICEOP STREAMPROP)
)
(DECLARE%: DONTCOPY
(FILEMAP (NIL (27732 31848 (STREAMPROP 27742 . 28176) (GETSTREAMPROP 28178 . 28927) (PUTSTREAMPROP
28929 . 31696) (STREAMP 31698 . 31846)) (31891 35270 (\DEFPRINT.BY.NAME 31901 . 33053) (
\STREAM.DEFPRINT 33055 . 34963) (\FDEV.DEFPRINT 34965 . 35268)) (35528 40569 (\GETACCESS 35538 . 35992
) (\SETACCESS 35994 . 40567)) (60795 66764 (\DEFINEDEVICE 60805 . 63121) (\GETDEVICEFROMNAME 63123 .
63596) (\GETDEVICEFROMHOSTNAME 63598 . 64642) (\REMOVEDEVICE 64644 . 65767) (\REMOVEDEVICE.NAMES 65769
. 66762)) (66804 92336 (\CLOSEFILE 66814 . 67639) (\DELETEFILE 67641 . 67935) (\DEVICEEVENT 67937 .
69707) (\GENERATEFILES 69709 . 70656) (\GENERATENEXTFILE 70658 . 71309) (\GENERATEFILEINFO 71311 .
71772) (\GETFILENAME 71774 . 72163) (\GENERIC.OUTFILEP 72165 . 72635) (\OPENFILE 72637 . 75215) (
\DO.PARAMS.AT.OPEN 75217 . 77746) (\RENAMEFILE 77748 . 78172) (\REVALIDATEFILE 78174 . 80776) (
\PAGED.REVALIDATEFILELST 80778 . 82336) (\PAGED.REVALIDATEFILES 82338 . 84057) (\PAGED.REVALIDATEFILE
84059 . 86342) (\BUFFERED.REVALIDATEFILE 86344 . 88630) (\BUFFERED.REVALIDATEFILELST 88632 . 89816) (
\PRINT-REVALIDATION-RESULT 89818 . 90660) (\TRUNCATEFILE 90662 . 91053) (\FILE-CONFLICT 91055 . 92334)
) (92372 97035 (\GENERATENOFILES 92382 . 94478) (\NULLFILEGENERATOR 94480 . 94724) (\NOFILESNEXTFILEFN
94726 . 96717) (\NOFILESINFOFN 96719 . 97033)) (97154 99062 (\FILE.NOT.OPEN 97164 . 97677) (
\FILE.WONT.OPEN 97679 . 98007) (\ILLEGAL.DEVICEOP 98009 . 98291) (\IS.NOT.RANDACCESSP 98293 . 98739) (
\STREAM.NOT.OPEN 98741 . 99060)) (99197 101495 (\FDEVINSTANCE 99207 . 101493)) (102697 110071 (CNDIR
102707 . 104012) (DIRECTORYNAME 104014 . 108197) (DIRECTORYNAMEP 108199 . 108815) (HOSTNAMEP 108817 .
109624) (\ADD.CONNECTED.DIR 109626 . 110069)) (110116 138395 (\BACKFILEPTR 110126 . 110314) (
\BACKPEEKBIN 110316 . 110677) (\BACKBIN 110679 . 111030) (BIN 111032 . 111249) (\BIN 111251 . 111528)
(\BINS 111530 . 111816) (BOUT 111818 . 112180) (\BOUT 112182 . 112497) (\BOUTS 112499 . 112810) (
COPYBYTES 112812 . 116144) (COPYCHARS 116146 . 119812) (COPYFILE 119814 . 120878) (\COPYOPENFILE
120880 . 124079) (\INFER.FILE.TYPE 124081 . 125035) (EOFP 125037 . 125334) (FORCEOUTPUT 125336 .
125583) (\FLUSH.OPEN.STREAMS 125585 . 125941) (CHARSET 125943 . 127302) (ACCESS-CHARSET 127304 .
127832) (GETEOFPTR 127834 . 128084) (GETFILEINFO 128086 . 131279) (\TYPE.FROM.FILETYPE 131281 . 131751
) (\FILETYPE.FROM.TYPE 131753 . 131932) (GETFILEPTR 131934 . 132186) (SETFILEINFO 132188 . 136294) (
SETFILEPTR 136296 . 138015) (BOUT16 138017 . 138202) (BIN16 138204 . 138393)) (138498 145152 (
\GENERIC.BINS 138508 . 138788) (\GENERIC.BOUTS 138790 . 139055) (\GENERIC.RENAMEFILE 139057 . 140888)
(\GENERIC.OPENP 140890 . 142205) (\GENERIC.READP 142207 . 143359) (\GENERIC.CHARSET 143361 . 145150))
(145153 145492 (\MAP-OPEN-STREAMS 145163 . 145490)) (147347 149427 (\EOF.ACTION 147357 . 147608) (
\EOSERROR 147610 . 147803) (\GETEOFPTR 147805 . 147987) (\INCFILEPTR 147989 . 148339) (\PEEKBIN 148341
. 148532) (\SETCLOSEDFILELENGTH 148534 . 148868) (\SETEOFPTR 148870 . 149058) (\SETFILEPTR 149060 .
149425)) (149428 149970 (\FIXPOUT 149438 . 149738) (\FIXPIN 149740 . 149968)) (149971 150537 (\BOUTEOL
149981 . 150535)) (153433 163297 (\BUFFERED.BIN 153443 . 154295) (\BUFFERED.PEEKBIN 154297 . 155079)
(\BUFFERED.BOUT 155081 . 155941) (\BUFFERED.BINS 155943 . 159628) (\BUFFERED.BOUTS 159630 . 161431) (
\BUFFERED.COPYBYTES 161433 . 163295)))))
(FILEMAP (NIL (27711 31827 (STREAMPROP 27721 . 28155) (GETSTREAMPROP 28157 . 28906) (PUTSTREAMPROP
28908 . 31675) (STREAMP 31677 . 31825)) (31870 35249 (\DEFPRINT.BY.NAME 31880 . 33032) (
\STREAM.DEFPRINT 33034 . 34942) (\FDEV.DEFPRINT 34944 . 35247)) (35507 40548 (\GETACCESS 35517 . 35971
) (\SETACCESS 35973 . 40546)) (60774 66743 (\DEFINEDEVICE 60784 . 63100) (\GETDEVICEFROMNAME 63102 .
63575) (\GETDEVICEFROMHOSTNAME 63577 . 64621) (\REMOVEDEVICE 64623 . 65746) (\REMOVEDEVICE.NAMES 65748
. 66741)) (66783 93012 (\CLOSEFILE 66793 . 67618) (\DELETEFILE 67620 . 67914) (\DEVICEEVENT 67916 .
69686) (\GENERATEFILES 69688 . 70635) (\GENERATENEXTFILE 70637 . 71288) (\GENERATEFILEINFO 71290 .
71751) (\GETFILENAME 71753 . 72142) (\GENERIC.OUTFILEP 72144 . 72614) (\OPENFILE 72616 . 75194) (
\DO.PARAMS.AT.OPEN 75196 . 78422) (\RENAMEFILE 78424 . 78848) (\REVALIDATEFILE 78850 . 81452) (
\PAGED.REVALIDATEFILELST 81454 . 83012) (\PAGED.REVALIDATEFILES 83014 . 84733) (\PAGED.REVALIDATEFILE
84735 . 87018) (\BUFFERED.REVALIDATEFILE 87020 . 89306) (\BUFFERED.REVALIDATEFILELST 89308 . 90492) (
\PRINT-REVALIDATION-RESULT 90494 . 91336) (\TRUNCATEFILE 91338 . 91729) (\FILE-CONFLICT 91731 . 93010)
) (93048 97711 (\GENERATENOFILES 93058 . 95154) (\NULLFILEGENERATOR 95156 . 95400) (\NOFILESNEXTFILEFN
95402 . 97393) (\NOFILESINFOFN 97395 . 97709)) (97830 99738 (\FILE.NOT.OPEN 97840 . 98353) (
\FILE.WONT.OPEN 98355 . 98683) (\ILLEGAL.DEVICEOP 98685 . 98967) (\IS.NOT.RANDACCESSP 98969 . 99415) (
\STREAM.NOT.OPEN 99417 . 99736)) (99873 102171 (\FDEVINSTANCE 99883 . 102169)) (103373 110747 (CNDIR
103383 . 104688) (DIRECTORYNAME 104690 . 108873) (DIRECTORYNAMEP 108875 . 109491) (HOSTNAMEP 109493 .
110300) (\ADD.CONNECTED.DIR 110302 . 110745)) (110792 139071 (\BACKFILEPTR 110802 . 110990) (
\BACKPEEKBIN 110992 . 111353) (\BACKBIN 111355 . 111706) (BIN 111708 . 111925) (\BIN 111927 . 112204)
(\BINS 112206 . 112492) (BOUT 112494 . 112856) (\BOUT 112858 . 113173) (\BOUTS 113175 . 113486) (
COPYBYTES 113488 . 116820) (COPYCHARS 116822 . 120488) (COPYFILE 120490 . 121554) (\COPYOPENFILE
121556 . 124755) (\INFER.FILE.TYPE 124757 . 125711) (EOFP 125713 . 126010) (FORCEOUTPUT 126012 .
126259) (\FLUSH.OPEN.STREAMS 126261 . 126617) (CHARSET 126619 . 127978) (ACCESS-CHARSET 127980 .
128508) (GETEOFPTR 128510 . 128760) (GETFILEINFO 128762 . 131955) (\TYPE.FROM.FILETYPE 131957 . 132427
) (\FILETYPE.FROM.TYPE 132429 . 132608) (GETFILEPTR 132610 . 132862) (SETFILEINFO 132864 . 136970) (
SETFILEPTR 136972 . 138691) (BOUT16 138693 . 138878) (BIN16 138880 . 139069)) (139174 145828 (
\GENERIC.BINS 139184 . 139464) (\GENERIC.BOUTS 139466 . 139731) (\GENERIC.RENAMEFILE 139733 . 141564)
(\GENERIC.OPENP 141566 . 142881) (\GENERIC.READP 142883 . 144035) (\GENERIC.CHARSET 144037 . 145826))
(145829 146168 (\MAP-OPEN-STREAMS 145839 . 146166)) (148023 150103 (\EOF.ACTION 148033 . 148284) (
\EOSERROR 148286 . 148479) (\GETEOFPTR 148481 . 148663) (\INCFILEPTR 148665 . 149015) (\PEEKBIN 149017
. 149208) (\SETCLOSEDFILELENGTH 149210 . 149544) (\SETEOFPTR 149546 . 149734) (\SETFILEPTR 149736 .
150101)) (150104 150646 (\FIXPOUT 150114 . 150414) (\FIXPIN 150416 . 150644)) (150647 151213 (\BOUTEOL
150657 . 151211)) (154109 163973 (\BUFFERED.BIN 154119 . 154971) (\BUFFERED.PEEKBIN 154973 . 155755)
(\BUFFERED.BOUT 155757 . 156617) (\BUFFERED.BINS 156619 . 160304) (\BUFFERED.BOUTS 160306 . 162107) (
\BUFFERED.COPYBYTES 162109 . 163971)))))
STOP
Binary file modified sources/FILEIO.LCOM
Binary file not shown.

0 comments on commit 6a7e8c3

Please sign in to comment.