[Git][cmucl/cmucl][issue-162-filename-encoding-no-encoding] Use :null instead of :no-encoding for no filename encoding
Raymond Toy (@rtoy)
gitlab at common-lisp.net
Thu Jan 19 23:31:53 UTC 2023
Raymond Toy pushed to branch issue-162-filename-encoding-no-encoding at cmucl / cmucl
Commits:
7c44d848 by Raymond Toy at 2023-01-19T15:30:06-08:00
Use :null instead of :no-encoding for no filename encoding
The advantage of using `:null` is that it's a recognized external
format (that aliases to `:void`). So if we inadvertently use `:null`
as a filename encoding somewhere unexpected, it will cause an
error (because the `:void` encoding does).
- - - - -
3 changed files:
- src/code/extfmts.lisp
- src/code/lispinit.lisp
- src/code/unix.lisp
Changes:
=====================================
src/code/extfmts.lisp
=====================================
@@ -373,7 +373,7 @@
;; Set filename encoding to NIL to bypass any encoding; it's not
;; needed to open the aliases file. NIL means the pathname string is passed as is where only the low 8 bits of the
(let ((*package* (find-package "KEYWORD"))
- (unix::*filename-encoding* :no-encoding))
+ (unix::*filename-encoding* :null))
(with-open-file (stm "ext-formats:aliases" :if-does-not-exist nil
:external-format :iso8859-1)
(when stm
@@ -493,7 +493,7 @@
;; encoding to NIL because we don't need any special
;; encoding to open the format files.
(let* ((*print-readably* nil)
- (unix::*filename-encoding* :no-encoding)
+ (unix::*filename-encoding* :null)
(*package* (find-package "STREAM"))
(lisp::*enable-package-locked-errors* nil)
(s (open (format nil "ext-formats:~(~A~).lisp" name)
@@ -1157,7 +1157,7 @@ character and illegal outputs are replaced by a question mark.")
(unless (find-external-format filenames)
(error (intl:gettext "Can't find external-format ~S.") filenames))
(setq filenames (ef-name (find-external-format filenames)))
- (when (and (not (eq unix::*filename-encoding* :no-encoding))
+ (when (and (not (eq unix::*filename-encoding* :null))
(not (eq unix::*filename-encoding* filenames)))
(cerror (intl:gettext "Change it anyway.")
(intl:gettext "The external-format for encoding filenames is already set.")))
=====================================
src/code/lispinit.lisp
=====================================
@@ -343,7 +343,7 @@
#-gengc (setf unix::*interrupt-pending* nil)
(setf *type-system-initialized* nil)
(setf *break-on-signals* nil)
- (setf unix::*filename-encoding* :no-encoding)
+ (setf unix::*filename-encoding* :null)
#+gengc (setf conditions::*handler-clusters* nil)
(setq intl::*default-domain* "cmucl")
(setq intl::*locale* "C")
=====================================
src/code/unix.lisp
=====================================
@@ -28,17 +28,17 @@
(defvar *filename-encoding* :no-encoding
"The encoding to use for converting a namestring to a string that can
be used by the operations system. It must be a valid
- external-format name or :NO-ENCODING. :NO-ENCODING means the string
+ external-format name or :NULL. :NULL means the string
is passed as is to the operating system. The operating system will
get the low 8 bits of each UTF-16 code unit of the string.")
(eval-when (:compile-toplevel :load-toplevel :execute)
(defmacro %name->file (string)
- `(if (eql *filename-encoding* :no-encoding)
+ `(if (eql *filename-encoding* :nul)
,string
(string-encode ,string *filename-encoding*)))
(defmacro %file->name (string)
- `(if (eql *filename-encoding* :no-encoding)
+ `(if (eql *filename-encoding* :null)
,string
(string-decode ,string *filename-encoding*))))
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/7c44d848ce1724bf5cfed2eb9b926e469f21bf99
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/7c44d848ce1724bf5cfed2eb9b926e469f21bf99
You're receiving this email because of your account on gitlab.common-lisp.net.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cmucl-cvs/attachments/20230119/a76af3d7/attachment-0001.html>
More information about the cmucl-cvs
mailing list