Patches: symbol case fixes

"Adam Warner" <[email protected]>
Newsgroups gmane.lisp.ilisp.devel
Message-ID <[email protected]>
Hi all,

There are some uppercase symbols remaining/introduced into ILISP which
could break the ANSI defined invert mode. This readtable mode switches the
case of all lowercase and all uppercase symbols. These fixes should also
be compatible with the non-ANSI-compatible "modern" mode because the
"modern" mode relies upon creating lowercase symbols that match the
lowercase symbols defined in the image.

To show why this can be so important, here's CMUCL in invert mode:

* (setf (readtable-case *readtable*) :invert)

:invert
* (eq :CMU :cmu)

nil
* '(#+cmu "This must be evaluated!")

("This must be evaluated!")
* '(#+CMU "This must be evaluated!")

nil
* '(#+:cmu "This must be evaluated!")

("This must be evaluated!")
* '(#+:CMU "This must be evaluated!")

nil

I believe ILISP works regardless of these fixes w/CMUCL and SBCL with the
Debian binaries because the files are compiled in the default mode! They
would break if the *.lisp files were loaded while in invert mode.

On the other hand ILISP is broken with CLISP in invert mode only if the
*.fas files are loaded. I suspect the CLISP byte compiler is broken. When
in invert mode the symbols in the fas file are switched. Here's (print
'(lowercase UPPERCASE MixedCase)) compiled in default and invert mode:

(SYSTEM::VERSION '(20030222.))
#0Y UTF-8
#Y(#:|(PRINT '(LOWERCASE UPPERCASE MIXEDCASE))-1|
   #17Y(00 00 00 00 00 00 00 00 00 01 DA 38 01 31 82 19 01)
   (COMMON-LISP::T . COMMON-LISP::T)
   (COMMON-LISP-USER::LOWERCASE COMMON-LISP-USER::UPPERCASE
    COMMON-LISP-USER::MIXEDCASE))

(system::version '(20030222.))
#0Y utf-8
#Y(#:|(print '(lowercase UPPERCASE MixedCase))-1|
   #17Y(00 00 00 00 00 00 00 00 00 01 DA 38 01 31 82 19 01)
   (common-lisp::t . common-lisp::t)
   (common-lisp-user::lowercase common-lisp-user::UPPERCASE
    common-lisp-user::MixedCase))

As the invert mode uppercases all lowercase symbols just like the default
mode the bytecode should look like this:

(SYSTEM::VERSION '(20030222.))
#0Y UTF-8
#Y(#:|(PRINT '(LOWERCASE uppercase MixedCase))-1|
   #17Y(00 00 00 00 00 00 00 00 00 01 DA 38 01 31 82 19 01)
   (COMMON-LISP::T . COMMON-LISP::T)
   (COMMON-LISP-USER::LOWERCASE COMMON-LISP-USER::uppercase
    COMMON-LISP-USER::MixedCase))

The problem with this bytecode error is that code that is compiled in the
default mode no longer works in invert mode! (Note that without upper or
lowercase symbols the bytecode should have been identical, which is the
point of using lowercase symbols in the ilisp source).

ILISP patches follow.

Thanks,
Adam


--- ilisp-pkg.lisp      2003-06-09 00:32:32.000000000 +1200
+++ /usr/lib/ilisp/ilisp-pkg.lisp       2003-06-08 22:57:52.000000000 +1200
@@ -44,7 +44,7 @@
 #-(and nil gcl)
 (defpackage :ilisp
   (:use :common-lisp
-       #+:CMU :conditions
+       #+:cmu :conditions
        ;; MOP packages.  This avoids tons of #+ noise in the find-src.lisp
        ;; code.
        ;; [in allegro, :mop and :clos are the same package, though it isn't
@@ -106,9 +106,9 @@
            #:ilisp-callers
            #:ilisp-source-files
            #:ilisp-print-info-message
-           #+:SBCL #:sbcl-trace
-           #+:CMU #:cmulisp-trace
-           #+(or :SBCL :CMU) #:source-file
+           #+:sbcl #:sbcl-trace
+           #+:cmu #:cmulisp-trace
+           #+(or :sbcl :cmu) #:source-file
           )
   )
 ;;; ILISP --


--- cl-ilisp.lisp       2003-06-09 00:32:32.000000000 +1200
+++ /usr/lib/ilisp/cl-ilisp.lisp        2003-06-08 23:00:18.000000000 +1200
@@ -774,9 +774,9 @@
 #-(or sbcl :cormanlisp)
 (eval-when (load eval)
   (when
-      #+(and :CMU (or :CMU17 :CMU18))
+      #+(and :cmu (or :cmu17 :cmu18))
       (eval:interpreted-function-p #'ilisp-matching-symbols)
-      #-(and :CMU (or :CMU17 :CMU18))
+      #-(and :cmu (or :cmu17 :cmu18))
       (not (compiled-function-p #'ilisp-matching-symbols))
       (ilisp-message *standard-output*
                     "File is not compiled, use M-x ilisp-compile-inits")))
@@ -784,9 +784,9 @@
 #+sbcl
 (eval-when (:load-toplevel :execute)
   (when
-      #+(and :CMU (or :CMU17 :CMU18))
+      #+(and :cmu (or :cmu17 :cmu18))
       (eval:interpreted-function-p #'ilisp-matching-symbols)
-      #-(and :CMU (or :CMU17 :CMU18))
+      #-(and :cmu (or :cmu17 :cmu18))
       (not (compiled-function-p #'ilisp-matching-symbols))
       (ilisp-message *standard-output*
                     "File is not compiled, use M-x ilisp-compile-inits")))




-------------------------------------------------------
This SF.net email is sponsored by:  Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.