rmk122--Next round on fonts and MCCS (#2280)
* A revision to the font, Unicode, Tedit, and other modules to implement the MCCS character coding as the standard for internal text strings. MCCS is a variant of XCCS with arrows switched with circumflex/underscore and $ switched with currency, and allows for additional code assignments over time. :MCCS replaces :XCCS as the default external format, especially for source files. The file XCCS is removed in favor of the file MCCS, which includes the XCCS external format for backward compatibility. * This includes a single Medley-font formatted font file for each of the family/size/face display fonts. The glyph assignments correspond to the MCCS character encoding (except for fonts with idiosyncratic encodings--Hippo, Symbol). All charsets from legacy font files are included in each file, and the character sets and glyphs in each file have also been extended by offline coercion from related families (e.g. Glyphs not in legacy Terminal are taken from legacy Modern). There should be fewer black boxes, and character-display shouldn't change when you switch fonts. * The Unicode mapping tables have been redefined to set up correspondences between Unicode and MCCS, not XCCS. Separate XCCS to/from MCCS mapping functions are provided in the file MCCS; they are no longer included in INTERPRESS. * TEDIT converts characters in legacy fonts to their new MCCS codes as it reads formatted files, marks the file as MCCS compatible and preserves the new codes on writing. * Default keyboard assignments produce the MCCS uparrow and leftarrow for shift-6 and shift-hyphen, use Function-6 for circumflex and Function-10 for underscore. See documentation in FONTCODECHANGES.TEDIT MCCS.TEDIT MEDLEYFONTFORMAT.TEDIT in docs/internal, and library/UNICODE.TEDIT.
This commit is contained in:
123
sources/FILEIO
123
sources/FILEIO
@@ -1,12 +1,13 @@
|
||||
(DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
|
||||
|
||||
(FILECREATED "25-Dec-2024 10:56:37" {WMEDLEY}<sources>FILEIO.;138 166550
|
||||
(FILECREATED "12-Sep-2025 08:19:06" {WMEDLEY}<sources>FILEIO.;141 166968
|
||||
|
||||
:EDIT-BY rmk
|
||||
|
||||
:CHANGES-TO (FNS SETFILEINFO \DO.PARAMS.AT.OPEN \RENAMEFILE)
|
||||
:CHANGES-TO (FNS COPYFILE COPYCHARS)
|
||||
|
||||
:PREVIOUS-DATE "18-Dec-2024 21:08:09" {WMEDLEY}<sources>FILEIO.;135)
|
||||
:PREVIOUS-DATE "24-Apr-2025 22:16:47"
|
||||
{DSK}<Users>kaplan>Local>medley3.5>working-medley>sources>FILEIO.;139)
|
||||
|
||||
|
||||
(PRETTYCOMPRINT FILEIOCOMS)
|
||||
@@ -2223,31 +2224,32 @@ update the map")
|
||||
])
|
||||
|
||||
(COPYCHARS
|
||||
[LAMBDA (SRCFIL DSTFIL START END) (* ; "Edited 13-Aug-2021 18:39 by rmk:")
|
||||
(* ; "Edited 14-Jun-2021 22:08 by rmk:")
|
||||
(* ; "Edited 8-Dec-95 16:38 by rmk:")
|
||||
(* ; "Edited 26-Mar-99 12:13 by rmk:")
|
||||
[LAMBDA (SRCFIL DSTFIL START END) (* ; "Edited 11-Sep-2025 20:47 by rmk")
|
||||
(* ; "Edited 13-Aug-2021 18:39 by rmk:")
|
||||
(* ; "Edited 14-Jun-2021 22:08 by rmk:")
|
||||
(* ; "Edited 8-Dec-95 16:38 by rmk:")
|
||||
(* ; "Edited 26-Mar-99 12:13 by rmk:")
|
||||
|
||||
(* ;; "This is similar to COPYBYTES except that conversion is done between the EOL convention and externalformat of the input and the EOL convention/external format of the output")
|
||||
(* ;; "This is similar to COPYBYTES except that conversion is done between the EOL convention and externalformat of the input and the EOL convention/external format of the output. This assumes that an ANY.EOLC source file is actually the same as the destination.")
|
||||
|
||||
[PROG ((SRCSTRM (\GETSTREAM SRCFIL))
|
||||
(DSTSTRM (\GETSTREAM DSTFIL))
|
||||
(ACTUALSTART 0)
|
||||
RAP ACTUALEND EOF SRCEOLC DSTEOLC CH)
|
||||
(CL:WHEN (AND (EQ (SETQ SRCEOLC (fetch EOLCONVENTION of SRCSTRM))
|
||||
(SETQ DSTEOLC (fetch EOLCONVENTION of DSTSTRM)))
|
||||
(CL:WHEN (AND (OR (EQ (SETQ SRCEOLC (fetch EOLCONVENTION of SRCSTRM))
|
||||
(SETQ DSTEOLC (fetch EOLCONVENTION of DSTSTRM)))
|
||||
(EQ ANY.EOLC (fetch EOLCONVENTION of SRCSTRM)))
|
||||
(EQ (FETCH EXTERNALFORMAT OF SRCSTRM)
|
||||
(FETCH EXTERNALFORMAT OF DSTSTRM)))
|
||||
(RETURN (COPYBYTES SRCSTRM DSTSTRM START END)))
|
||||
|
||||
(* ;; "Format or EOL convention are different. So first decode the START END specification")
|
||||
(* ;; "Format or EOL convention are different. So first decode the START END specification")
|
||||
|
||||
[COND
|
||||
((SETQ RAP (fetch RANDOMACCESSP of (fetch DEVICE of SRCSTRM)))
|
||||
(SETQ EOF (\GETEOFPTR SRCSTRM]
|
||||
(COND
|
||||
[END (OR RAP (ERROR "COPYCHARS: Source file is not random access" (fetch
|
||||
FULLFILENAME
|
||||
[END (OR RAP (ERROR "COPYCHARS: Source file is not random access" (fetch FULLFILENAME
|
||||
of SRCSTRM)))
|
||||
(OR (type? BYTEPTR (SETQ ACTUALSTART (FIX START)))
|
||||
(LISPERROR "ILLEGAL ARG" START))
|
||||
@@ -2265,26 +2267,27 @@ update the map")
|
||||
(RAP (SETQ ACTUALSTART (\GETFILEPTR SRCSTRM))
|
||||
(SETQ ACTUALEND EOF))
|
||||
(T
|
||||
(* ;;
|
||||
"Not random access and START and END are both NIL, just copy to the end of file,no need to count.")
|
||||
(* ;;
|
||||
"Not random access and START and END are both NIL, just copy to the end of file,no need to count.")
|
||||
|
||||
(until (\EOFP SRCSTRM) do (\OUTCHAR DSTSTRM (\INCCODE.EOLC SRCSTRM SRCEOLC)))
|
||||
(RETURN)))
|
||||
(CL:UNLESS (IGEQ ACTUALEND ACTUALSTART)
|
||||
(ERROR "Negative number of bytes to copy" (IDIFFERENCE ACTUALEND ACTUALSTART)))
|
||||
|
||||
(* ;; "We now know which bytes we need to copy, in the case that there is an EOL/format mismatch. If we assume that this is fairly unusual and that we don't want to assume here that we know how the CR and LF are byte-coded, we don't try to optimize for an EOL-only change. We just go generic.")
|
||||
(* ;; "We now know which bytes we need to copy, in the case that there is an EOL/format mismatch. If we assume that this is fairly unusual and that we don't want to assume here that we know how the CR and LF are byte-coded, we don't try to optimize for an EOL-only change. We just go generic.")
|
||||
|
||||
(* ;; "The \INCCODE.EOLC and \OUTCHAR handle all format and EOL issues.")
|
||||
(* ;; "The \INCCODE.EOLC and \OUTCHAR handle all format and EOL issues.")
|
||||
|
||||
(BIND (CNT _ (IDIFFERENCE ACTUALEND ACTUALSTART)) DECLARE (SPECVARS CNT)
|
||||
WHILE (IGREATERP CNT 0) DO (\OUTCHAR DSTSTRM (\INCCODE.EOLC SRCSTRM NIL
|
||||
'CNT CNT]
|
||||
WHILE (IGREATERP CNT 0) DO (\OUTCHAR DSTSTRM (\INCCODE.EOLC SRCSTRM NIL 'CNT CNT]
|
||||
T])
|
||||
|
||||
(COPYFILE
|
||||
[LAMBDA (FROMFILE TOFILE)
|
||||
|
||||
(* ;; "Edited 12-Sep-2025 08:18 by rmk")
|
||||
|
||||
(* ;; "Edited 18-Dec-2024 21:07 by rmk")
|
||||
|
||||
(* ;; "Edited 8-Jul-2022 10:41 by rmk")
|
||||
@@ -2304,7 +2307,7 @@ update the map")
|
||||
`((SEQUENTIAL T)
|
||||
(DON'TCACHE T)
|
||||
(CREATIONDATE ,(GETFILEINFO FROMSTREAM 'CREATIONDATE]
|
||||
'(AND RESETSTATE (SETQ OLDVALUE (CLOSEF OLDVALUE))
|
||||
'(AND RESETSTATE (SETQ OLDVALUE (CLOSEF? OLDVALUE))
|
||||
(DELFILE OLDVALUE]
|
||||
(COPYBYTES FROMSTREAM TOSTREAM)
|
||||
(CLOSEF FROMSTREAM)
|
||||
@@ -2440,10 +2443,11 @@ update the map")
|
||||
OLDVAL])
|
||||
|
||||
(ACCESS-CHARSET
|
||||
[LAMBDA (STREAM NEWVALUE DONTMARKFILE) (* ; "Edited 8-Dec-2023 15:05 by rmk")
|
||||
[LAMBDA (STREAM NEWVALUE DONTMARKFILE) (* ; "Edited 24-Apr-2025 22:15 by rmk")
|
||||
(* ; "Edited 8-Dec-2023 15:05 by rmk")
|
||||
(* ; "Edited 11-Sep-87 15:46 by bvm:")
|
||||
|
||||
(* ;; "Unless DONTMARKSTREAM, if STREAM is open for output, the external format function may modify the backing file as well as the stream, e.g. put in XCCS shifting bytes.")
|
||||
(* ;; "Unless DONTMARKSTREAM, if STREAM is open for output, the external format function may modify the backing file as well as the stream, e.g. put in MCCS shifting bytes.")
|
||||
|
||||
(FDEVOP 'CHARSETFN (fetch (STREAM DEVICE) of STREAM)
|
||||
STREAM NEWVALUE DONTMARKFILE])
|
||||
@@ -2715,10 +2719,11 @@ update the map")
|
||||
(\BACKCCODE.EOLC STRM)))])])
|
||||
|
||||
(\GENERIC.CHARSET
|
||||
[LAMBDA (STREAM NEWVALUE DONTMARKSTREAM) (* ; "Edited 8-Dec-2023 15:17 by rmk")
|
||||
[LAMBDA (STREAM NEWVALUE DONTMARKSTREAM) (* ; "Edited 24-Apr-2025 22:16 by rmk")
|
||||
(* ; "Edited 8-Dec-2023 15:17 by rmk")
|
||||
(* ; "Edited 11-Sep-87 16:20 by bvm:")
|
||||
|
||||
(* ;;; "sets or returns the current numeric character set for this stream. This applies the stream's FORMATCHARSETFN if it has one, and (if MARKSTREAM) that may change an output backing stream in some way (e.g. write XCCS charset shift bytes). Otherwise, this just sets the charset stream parameter to influence subsequent reading and writing behavior. Charset doesn't exist in some formats (e.g. UTF-8), the format function would be a noop in that case.")
|
||||
(* ;;; "sets or returns the current numeric character set for this stream. This applies the stream's FORMATCHARSETFN if it has one, and (if MARKSTREAM) that may change an output backing stream in some way (e.g. write MCCS charset shift bytes). Otherwise, this just sets the charset stream parameter to influence subsequent reading and writing behavior. Charset doesn't exist in some formats (e.g. UTF-8), the format function would be a noop in that case.")
|
||||
|
||||
(\DTEST STREAM 'STREAM)
|
||||
(LET ((EFORMAT (ffetch (STREAM EXTERNALFORMAT) of STREAM))
|
||||
@@ -3162,39 +3167,39 @@ update the map")
|
||||
(ADDTOVAR LAMA \IS.NOT.RANDACCESSP \ILLEGAL.DEVICEOP STREAMPROP)
|
||||
)
|
||||
(DECLARE%: DONTCOPY
|
||||
(FILEMAP (NIL (27735 31851 (STREAMPROP 27745 . 28179) (GETSTREAMPROP 28181 . 28930) (PUTSTREAMPROP
|
||||
28932 . 31699) (STREAMP 31701 . 31849)) (31894 35273 (\DEFPRINT.BY.NAME 31904 . 33056) (
|
||||
\STREAM.DEFPRINT 33058 . 34966) (\FDEV.DEFPRINT 34968 . 35271)) (35531 40572 (\GETACCESS 35541 . 35995
|
||||
) (\SETACCESS 35997 . 40570)) (60798 66767 (\DEFINEDEVICE 60808 . 63124) (\GETDEVICEFROMNAME 63126 .
|
||||
63599) (\GETDEVICEFROMHOSTNAME 63601 . 64645) (\REMOVEDEVICE 64647 . 65770) (\REMOVEDEVICE.NAMES 65772
|
||||
. 66765)) (66807 94538 (\CLOSEFILE 66817 . 67642) (\DELETEFILE 67644 . 67938) (\DEVICEEVENT 67940 .
|
||||
69710) (\GENERATEFILES 69712 . 70659) (\GENERATENEXTFILE 70661 . 71312) (\GENERATEFILEINFO 71314 .
|
||||
71775) (\GETFILENAME 71777 . 72166) (\GENERIC.OUTFILEP 72168 . 72638) (\OPENFILE 72640 . 75218) (
|
||||
\DO.PARAMS.AT.OPEN 75220 . 79416) (\RENAMEFILE 79418 . 80374) (\REVALIDATEFILE 80376 . 82978) (
|
||||
\PAGED.REVALIDATEFILELST 82980 . 84538) (\PAGED.REVALIDATEFILES 84540 . 86259) (\PAGED.REVALIDATEFILE
|
||||
86261 . 88544) (\BUFFERED.REVALIDATEFILE 88546 . 90832) (\BUFFERED.REVALIDATEFILELST 90834 . 92018) (
|
||||
\PRINT-REVALIDATION-RESULT 92020 . 92862) (\TRUNCATEFILE 92864 . 93255) (\FILE-CONFLICT 93257 . 94536)
|
||||
) (94574 99237 (\GENERATENOFILES 94584 . 96680) (\NULLFILEGENERATOR 96682 . 96926) (\NOFILESNEXTFILEFN
|
||||
96928 . 98919) (\NOFILESINFOFN 98921 . 99235)) (99356 101264 (\FILE.NOT.OPEN 99366 . 99879) (
|
||||
\FILE.WONT.OPEN 99881 . 100209) (\ILLEGAL.DEVICEOP 100211 . 100493) (\IS.NOT.RANDACCESSP 100495 .
|
||||
100941) (\STREAM.NOT.OPEN 100943 . 101262)) (101399 103697 (\FDEVINSTANCE 101409 . 103695)) (104899
|
||||
112273 (CNDIR 104909 . 106214) (DIRECTORYNAME 106216 . 110399) (DIRECTORYNAMEP 110401 . 111017) (
|
||||
HOSTNAMEP 111019 . 111826) (\ADD.CONNECTED.DIR 111828 . 112271)) (112318 140973 (\BACKFILEPTR 112328
|
||||
. 112516) (\BACKPEEKBIN 112518 . 112879) (\BACKBIN 112881 . 113232) (BIN 113234 . 113451) (\BIN
|
||||
113453 . 113730) (\BINS 113732 . 114018) (BOUT 114020 . 114382) (\BOUT 114384 . 114699) (\BOUTS 114701
|
||||
. 115012) (COPYBYTES 115014 . 118346) (COPYCHARS 118348 . 122014) (COPYFILE 122016 . 123325) (
|
||||
\COPYOPENFILE 123327 . 126526) (\INFER.FILE.TYPE 126528 . 127482) (EOFP 127484 . 127781) (FORCEOUTPUT
|
||||
127783 . 128030) (\FLUSH.OPEN.STREAMS 128032 . 128388) (CHARSET 128390 . 129749) (ACCESS-CHARSET
|
||||
129751 . 130279) (GETEOFPTR 130281 . 130531) (GETFILEINFO 130533 . 133726) (\TYPE.FROM.FILETYPE 133728
|
||||
. 134198) (\FILETYPE.FROM.TYPE 134200 . 134379) (GETFILEPTR 134381 . 134633) (SETFILEINFO 134635 .
|
||||
138872) (SETFILEPTR 138874 . 140593) (BOUT16 140595 . 140780) (BIN16 140782 . 140971)) (141076 148147
|
||||
(\GENERIC.BINS 141086 . 141366) (\GENERIC.BOUTS 141368 . 141633) (\GENERIC.RENAMEFILE 141635 . 143883)
|
||||
(\GENERIC.OPENP 143885 . 145200) (\GENERIC.READP 145202 . 146354) (\GENERIC.CHARSET 146356 . 148145))
|
||||
(148148 148487 (\MAP-OPEN-STREAMS 148158 . 148485)) (150342 152422 (\EOF.ACTION 150352 . 150603) (
|
||||
\EOSERROR 150605 . 150798) (\GETEOFPTR 150800 . 150982) (\INCFILEPTR 150984 . 151334) (\PEEKBIN 151336
|
||||
. 151527) (\SETCLOSEDFILELENGTH 151529 . 151863) (\SETEOFPTR 151865 . 152053) (\SETFILEPTR 152055 .
|
||||
152420)) (152423 152965 (\FIXPOUT 152433 . 152733) (\FIXPIN 152735 . 152963)) (152966 153532 (\BOUTEOL
|
||||
152976 . 153530)) (156428 166292 (\BUFFERED.BIN 156438 . 157290) (\BUFFERED.PEEKBIN 157292 . 158074)
|
||||
(\BUFFERED.BOUT 158076 . 158936) (\BUFFERED.BINS 158938 . 162623) (\BUFFERED.BOUTS 162625 . 164426) (
|
||||
\BUFFERED.COPYBYTES 164428 . 166290)))))
|
||||
(FILEMAP (NIL (27752 31868 (STREAMPROP 27762 . 28196) (GETSTREAMPROP 28198 . 28947) (PUTSTREAMPROP
|
||||
28949 . 31716) (STREAMP 31718 . 31866)) (31911 35290 (\DEFPRINT.BY.NAME 31921 . 33073) (
|
||||
\STREAM.DEFPRINT 33075 . 34983) (\FDEV.DEFPRINT 34985 . 35288)) (35548 40589 (\GETACCESS 35558 . 36012
|
||||
) (\SETACCESS 36014 . 40587)) (60815 66784 (\DEFINEDEVICE 60825 . 63141) (\GETDEVICEFROMNAME 63143 .
|
||||
63616) (\GETDEVICEFROMHOSTNAME 63618 . 64662) (\REMOVEDEVICE 64664 . 65787) (\REMOVEDEVICE.NAMES 65789
|
||||
. 66782)) (66824 94555 (\CLOSEFILE 66834 . 67659) (\DELETEFILE 67661 . 67955) (\DEVICEEVENT 67957 .
|
||||
69727) (\GENERATEFILES 69729 . 70676) (\GENERATENEXTFILE 70678 . 71329) (\GENERATEFILEINFO 71331 .
|
||||
71792) (\GETFILENAME 71794 . 72183) (\GENERIC.OUTFILEP 72185 . 72655) (\OPENFILE 72657 . 75235) (
|
||||
\DO.PARAMS.AT.OPEN 75237 . 79433) (\RENAMEFILE 79435 . 80391) (\REVALIDATEFILE 80393 . 82995) (
|
||||
\PAGED.REVALIDATEFILELST 82997 . 84555) (\PAGED.REVALIDATEFILES 84557 . 86276) (\PAGED.REVALIDATEFILE
|
||||
86278 . 88561) (\BUFFERED.REVALIDATEFILE 88563 . 90849) (\BUFFERED.REVALIDATEFILELST 90851 . 92035) (
|
||||
\PRINT-REVALIDATION-RESULT 92037 . 92879) (\TRUNCATEFILE 92881 . 93272) (\FILE-CONFLICT 93274 . 94553)
|
||||
) (94591 99254 (\GENERATENOFILES 94601 . 96697) (\NULLFILEGENERATOR 96699 . 96943) (\NOFILESNEXTFILEFN
|
||||
96945 . 98936) (\NOFILESINFOFN 98938 . 99252)) (99373 101281 (\FILE.NOT.OPEN 99383 . 99896) (
|
||||
\FILE.WONT.OPEN 99898 . 100226) (\ILLEGAL.DEVICEOP 100228 . 100510) (\IS.NOT.RANDACCESSP 100512 .
|
||||
100958) (\STREAM.NOT.OPEN 100960 . 101279)) (101416 103714 (\FDEVINSTANCE 101426 . 103712)) (104916
|
||||
112290 (CNDIR 104926 . 106231) (DIRECTORYNAME 106233 . 110416) (DIRECTORYNAMEP 110418 . 111034) (
|
||||
HOSTNAMEP 111036 . 111843) (\ADD.CONNECTED.DIR 111845 . 112288)) (112335 141282 (\BACKFILEPTR 112345
|
||||
. 112533) (\BACKPEEKBIN 112535 . 112896) (\BACKBIN 112898 . 113249) (BIN 113251 . 113468) (\BIN
|
||||
113470 . 113747) (\BINS 113749 . 114035) (BOUT 114037 . 114399) (\BOUT 114401 . 114716) (\BOUTS 114718
|
||||
. 115029) (COPYBYTES 115031 . 118363) (COPYCHARS 118365 . 122163) (COPYFILE 122165 . 123525) (
|
||||
\COPYOPENFILE 123527 . 126726) (\INFER.FILE.TYPE 126728 . 127682) (EOFP 127684 . 127981) (FORCEOUTPUT
|
||||
127983 . 128230) (\FLUSH.OPEN.STREAMS 128232 . 128588) (CHARSET 128590 . 129949) (ACCESS-CHARSET
|
||||
129951 . 130588) (GETEOFPTR 130590 . 130840) (GETFILEINFO 130842 . 134035) (\TYPE.FROM.FILETYPE 134037
|
||||
. 134507) (\FILETYPE.FROM.TYPE 134509 . 134688) (GETFILEPTR 134690 . 134942) (SETFILEINFO 134944 .
|
||||
139181) (SETFILEPTR 139183 . 140902) (BOUT16 140904 . 141089) (BIN16 141091 . 141280)) (141385 148565
|
||||
(\GENERIC.BINS 141395 . 141675) (\GENERIC.BOUTS 141677 . 141942) (\GENERIC.RENAMEFILE 141944 . 144192)
|
||||
(\GENERIC.OPENP 144194 . 145509) (\GENERIC.READP 145511 . 146663) (\GENERIC.CHARSET 146665 . 148563))
|
||||
(148566 148905 (\MAP-OPEN-STREAMS 148576 . 148903)) (150760 152840 (\EOF.ACTION 150770 . 151021) (
|
||||
\EOSERROR 151023 . 151216) (\GETEOFPTR 151218 . 151400) (\INCFILEPTR 151402 . 151752) (\PEEKBIN 151754
|
||||
. 151945) (\SETCLOSEDFILELENGTH 151947 . 152281) (\SETEOFPTR 152283 . 152471) (\SETFILEPTR 152473 .
|
||||
152838)) (152841 153383 (\FIXPOUT 152851 . 153151) (\FIXPIN 153153 . 153381)) (153384 153950 (\BOUTEOL
|
||||
153394 . 153948)) (156846 166710 (\BUFFERED.BIN 156856 . 157708) (\BUFFERED.PEEKBIN 157710 . 158492)
|
||||
(\BUFFERED.BOUT 158494 . 159354) (\BUFFERED.BINS 159356 . 163041) (\BUFFERED.BOUTS 163043 . 164844) (
|
||||
\BUFFERED.COPYBYTES 164846 . 166708)))))
|
||||
STOP
|
||||
|
||||
Reference in New Issue
Block a user