In scsh 0.5 the string "\x4A" is flagged
as invalid, but "\x4:" is accepted in its
place!
I went back to my earlier (0.4) version,
and found the same thing.
Now, as far as I can tell, in scsh/scsh-read.scm,
you've handled this with:
(lambda (base base-name)
(let* ((c (readc))
(d (- (char->ascii c) (char->ascii #\0))))
(if (and (<= 0 d) (< d base)) d
(reading-error port
(string-append "invalid "
base-name
" code in string.")
d))))
where, to my mind, something like:
(lambda (base base-name)
(let* ((c (readc))
(asc (char->ascii c))
(asc0 (char->ascii #\0))
(asc9 (char->ascii #\9))
(little-A (char->ascii #\a))
(big-A (char->ascii #\A))
(d
(cond
((>= asc little-A) (+ (- asc little-A) 10))
((>= asc big-A) (+ (- asc big-A) 10))
((<= asc0 asc asc9) (- asc asc0))
(else (+ base 1)))))
(if (< d base) d
(reading-error port
(string-append "invalid "
base-name
" code found in string.")
asc))))
would be better. (Apologies for any C flavour
in that code - I'm new to scheme and haven't used
/any/ lisps in many a year.)
However, when I tried making the above changes,
nothing happened. The code seems to be hard-wired
into initial.image in some way that I can't figure.
BTW - the two calls to read hex digits - shouldn't
they be in a let* rather than a let, like the octal
ones? Or am I missing something?
imw
|