Skip to content

Commit 97fdcbd

Browse files
authored
LLREAD: Add character names One, Two... for digits 0, 1 ... (#2060)
Currently, (CHARCODE 1) produces 49, just like (CHARCODE a) produces 97. That's because CHARCODE.DECODE interprets a single character (that is not also defined as a cHARACTERNAME) input as exactly that character, and gets its character code. But a character name in the charset,charnum format is treated in a different way. If either part of the name is a number, it is interpreted as an octal number, to make it easier to match against the XCCS specifications. So (CHARCODE Meta,1) does not map to the position of digit 1 in the Meta (currently 1) character set (= 256+49=305), it maps to 256+1=257. In order to get 305, you have to specify Meta,61 (where 61 is the octal equivalent of 49). That's rather opaque, and I found that TEDITKEY had a workaround based on the obscure fact that CHARCODE.DECODE adds 128 for each # it sees in the beginning of a character name. So ##1 adds 2*128 to 49 to get 305, corresponding to digit 1 in the Meta character set. But that depends on the fact that Meta is currently defined as charset 1, it won't work when we move Meta up to the Unicode/XCCS undefined region of the code space. This PR adds (Zero 48) (One 49)...(Nine 57) to the initial value of CHARACTERNAMES in LLREAD, so that 305 for example can be specified as Meta,One. This is more obvious than Meta,61 and will remain valid when Meta is moved, unlike the ## hack..
2 parents a4da0ec + d9f5bd5 commit 97fdcbd

File tree

2 files changed

+29
-24
lines changed

2 files changed

+29
-24
lines changed

sources/LLREAD

+29-24
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
(DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
22

3-
(FILECREATED "30-Jul-2023 17:42:27" {WMEDLEY}<sources>LLREAD.;105 90277
3+
(FILECREATED " 8-Mar-2025 09:05:43" {WMEDLEY}<sources>LLREAD.;107 90353
44

55
:EDIT-BY rmk
66

7-
:CHANGES-TO (FNS \SUBREAD)
7+
:CHANGES-TO (VARS LLREADCOMS)
88

9-
:PREVIOUS-DATE "17-Jun-2023 13:12:06" {WMEDLEY}<sources>LLREAD.;104)
9+
:PREVIOUS-DATE "30-Jul-2023 17:42:27" {WMEDLEY}<sources>LLREAD.;105)
1010

1111

12-
(* ; "
13-
Copyright (c) 1981-1988, 1990-1991, 1993, 2021 by Venue & Xerox Corporation.
14-
")
15-
1612
(PRETTYCOMPRINT LLREADCOMS)
1713

1814
(RPAQQ LLREADCOMS
@@ -38,7 +34,8 @@ Copyright (c) 1981-1988, 1990-1991, 1993, 2021 by Venue & Xerox Corporation.
3834
(FNS CHARACTER.READ CHARCODE.DECODE)
3935
(FNS HEXNUM? OCTALNUM?)
4036
(ALISTS (CHARACTERNAMES Page Form FF Rubout Del Null Escape Esc Bell Tab Backspace Bs
41-
Newline CR EOL Return Tenexeol Space Sp Linefeed LF)
37+
Newline CR EOL Return Tenexeol Space Sp Linefeed LF Zero One Two Three
38+
Four Five Six Seven Eight Nine)
4239
(CHARACTERSETNAMES Meta Function Greek Cyrillic Hira Hiragana Kata Katakana
4340
Kanji)))
4441
(DECLARE%: DOEVAL@COMPILE DONTCOPY (CONSTANTS * READTYPES)
@@ -1548,7 +1545,17 @@ Copyright (c) 1981-1988, 1990-1991, 1993, 2021 by Venue & Xerox Corporation.
15481545
(Space 32)
15491546
(Sp 32)
15501547
(Linefeed 10)
1551-
(LF 10))
1548+
(LF 10)
1549+
(Zero 48)
1550+
(One 49)
1551+
(Two 50)
1552+
(Three 51)
1553+
(Four 52)
1554+
(Five 53)
1555+
(Six 54)
1556+
(Seven 55)
1557+
(Eight 56)
1558+
(Nine 57))
15521559

15531560
(ADDTOVAR CHARACTERSETNAMES (Meta 1)
15541561
(Function 2)
@@ -1661,20 +1668,18 @@ Copyright (c) 1981-1988, 1990-1991, 1993, 2021 by Venue & Xerox Corporation.
16611668

16621669
(ADDTOVAR LAMA CL:PARSE-INTEGER CL:READ-DELIMITED-LIST CL:READ-PRESERVING-WHITESPACE CL:READ)
16631670
)
1664-
(PUTPROPS LLREAD COPYRIGHT ("Venue & Xerox Corporation" 1981 1982 1983 1984 1985 1986 1987 1988 1990
1665-
1991 1993 2021))
16661671
(DECLARE%: DONTCOPY
1667-
(FILEMAP (NIL (3442 11886 (LASTC 3452 . 3758) (PEEKC 3760 . 4148) (PEEKCCODE 4150 . 4561) (RATOM 4563
1668-
. 5644) (READ 5646 . 6206) (READC 6208 . 6849) (READCCODE 6851 . 7610) (READP 7612 . 8164) (
1669-
SETREADMACROFLG 8166 . 8465) (SKIPSEPRCODES 8467 . 9547) (SKIPSEPRS 9549 . 9935) (SKREAD 9937 . 11884)
1670-
) (11932 20541 (CL:READ 11942 . 12491) (CL:READ-PRESERVING-WHITESPACE 12493 . 13215) (
1671-
CL:READ-DELIMITED-LIST 13217 . 14132) (CL:PARSE-INTEGER 14134 . 20539)) (20634 33111 (RSTRING 20644 .
1672-
21376) (READ-EXTENDED-TOKEN 21378 . 25250) (\RSTRING2 25252 . 33109)) (33147 63880 (\TOP-LEVEL-READ
1673-
33157 . 35140) (\SUBREAD 35142 . 60296) (\SUBREADCONCAT 60298 . 60921) (\ORIG-READ.SYMBOL 60923 .
1674-
61991) (\ORIG-INVALID.SYMBOL 61993 . 62892) (\APPLYREADMACRO 62894 . 63310) (INREADMACROP 63312 .
1675-
63878)) (64039 64214 (READQUOTE 64049 . 64212)) (64239 76143 (READVBAR 64249 . 65580) (READHASHMACRO
1676-
65582 . 71392) (DEFMACRO-LAMBDA-LIST-KEYWORD-P 71394 . 71614) (DIGITBASEP 71616 . 72350) (
1677-
READNUMBERINBASE 72352 . 74238) (ESTIMATE-DIMENSIONALITY 74240 . 74565) (SKIP.HASH.COMMENT 74567 .
1678-
75535) (CMLREAD.FEATURE.PARSER 75537 . 76141)) (76187 82531 (CHARACTER.READ 76197 . 77451) (
1679-
CHARCODE.DECODE 77453 . 82529)) (82532 85702 (HEXNUM? 82542 . 84885) (OCTALNUM? 84887 . 85700)))))
1672+
(FILEMAP (NIL (3437 11881 (LASTC 3447 . 3753) (PEEKC 3755 . 4143) (PEEKCCODE 4145 . 4556) (RATOM 4558
1673+
. 5639) (READ 5641 . 6201) (READC 6203 . 6844) (READCCODE 6846 . 7605) (READP 7607 . 8159) (
1674+
SETREADMACROFLG 8161 . 8460) (SKIPSEPRCODES 8462 . 9542) (SKIPSEPRS 9544 . 9930) (SKREAD 9932 . 11879)
1675+
) (11927 20536 (CL:READ 11937 . 12486) (CL:READ-PRESERVING-WHITESPACE 12488 . 13210) (
1676+
CL:READ-DELIMITED-LIST 13212 . 14127) (CL:PARSE-INTEGER 14129 . 20534)) (20629 33106 (RSTRING 20639 .
1677+
21371) (READ-EXTENDED-TOKEN 21373 . 25245) (\RSTRING2 25247 . 33104)) (33142 63875 (\TOP-LEVEL-READ
1678+
33152 . 35135) (\SUBREAD 35137 . 60291) (\SUBREADCONCAT 60293 . 60916) (\ORIG-READ.SYMBOL 60918 .
1679+
61986) (\ORIG-INVALID.SYMBOL 61988 . 62887) (\APPLYREADMACRO 62889 . 63305) (INREADMACROP 63307 .
1680+
63873)) (64034 64209 (READQUOTE 64044 . 64207)) (64234 76138 (READVBAR 64244 . 65575) (READHASHMACRO
1681+
65577 . 71387) (DEFMACRO-LAMBDA-LIST-KEYWORD-P 71389 . 71609) (DIGITBASEP 71611 . 72345) (
1682+
READNUMBERINBASE 72347 . 74233) (ESTIMATE-DIMENSIONALITY 74235 . 74560) (SKIP.HASH.COMMENT 74562 .
1683+
75530) (CMLREAD.FEATURE.PARSER 75532 . 76136)) (76182 82526 (CHARACTER.READ 76192 . 77446) (
1684+
CHARCODE.DECODE 77448 . 82524)) (82527 85697 (HEXNUM? 82537 . 84880) (OCTALNUM? 84882 . 85695)))))
16801685
STOP

sources/LLREAD.LCOM

29 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)