[Git][cmucl/cmucl][issue-234-make-ascii-format-builtin] Clean up impl of %find-external-format

Raymond Toy (@rtoy) gitlab at common-lisp.net
Thu Jul 6 23:41:07 UTC 2023



Raymond Toy pushed to branch issue-234-make-ascii-format-builtin at cmucl / cmucl


Commits:
8ff9f737 by Raymond Toy at 2023-07-06T16:38:53-07:00
Clean up impl of %find-external-format

Simplify code in `%find-external-format` to use the same code for all
the built-in formats.  Add new constant `+builtin-externalf-formats+`
to list all the external formats that are built into lisp.

- - - - -


1 changed file:

- src/code/extfmts.lisp


Changes:

=====================================
src/code/extfmts.lisp
=====================================
@@ -461,18 +461,18 @@
 	       (format t "~&~A~%"
 		       (intl:gettext (or (ef-documentation ef) "")))))))))
 
+(defconstant +builtin-external-formats+ '(:utf-8 :iso8859-1 :ascii)
+  "List of external formats that are builtin so that they don't need to
+  be loaded on first use.")
+
 (defun %find-external-format (name)
   ;; avoid loading files, etc., early in the boot sequence
-  (when (or (eq name :iso8859-1)
-	    (and (eq name :default) (eq *default-external-format* :iso8859-1)))
-    (return-from %find-external-format
-      (gethash :iso8859-1 *external-formats*)))
-  (when (eq name :utf-8)
-    (return-from %find-external-format
-      (gethash :utf-8 *external-formats*)))
-  (when (eq name :ascii)
+  (when (and (eq name :default)
+	     (eq *default-external-format* :iso8859-1))
+    (setf name :iso8859-1))
+  (when (member name +builtin-external-formats+ :test 'eq)
     (return-from %find-external-format
-      (gethash :ascii *external-formats*)))
+      (gethash name *external-formats*)))
 
   (when (zerop (hash-table-count *external-format-aliases*))
     (setf (gethash :latin1 *external-format-aliases*) :iso8859-1)



View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/8ff9f73774da81f757cde042bd4535eb84c3287b

-- 
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/8ff9f73774da81f757cde042bd4535eb84c3287b
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/20230706/3c0149f9/attachment-0001.html>


More information about the cmucl-cvs mailing list