[Git][cmucl/cmucl][issue-139-add-alias-local-external-format] 3 commits: Add comment

Raymond Toy (@rtoy) gitlab at common-lisp.net
Thu Nov 3 23:17:40 UTC 2022



Raymond Toy pushed to branch issue-139-add-alias-local-external-format at cmucl / cmucl


Commits:
e413e19b by Raymond Toy at 2022-11-03T15:41:40-07:00
Add comment

- - - - -
15a17fae by Raymond Toy at 2022-11-03T16:16:28-07:00
Add test, more comments, and set alias earlier

Set the `:locale` alias early in the startup so it's available early.

Add simple test that the `:locale` alias exists.

Update the pot files due to changed docstrings.

- - - - -
af271f0b by Raymond Toy at 2022-11-03T16:17:19-07:00
Update release notes for :locale alias

- - - - -


5 changed files:

- src/code/save.lisp
- src/general-info/release-21e.md
- src/i18n/locale/cmucl-unix.pot
- src/i18n/locale/cmucl.pot
- tests/issues.lisp


Changes:

=====================================
src/code/save.lisp
=====================================
@@ -144,7 +144,7 @@
 
 (defun set-up-locale-external-format ()
   "Add external format alias for :locale to the format specified by
-  the envvar LANG and friends if available."
+  the locale as set by setlocale(3C)."
   (let ((codeset (unix::unix-get-locale-codeset)))
     (cond ((zerop (length codeset))
 	   ;; Codeset was the empty string, so just set :locale to
@@ -276,9 +276,13 @@
 	     ;; Set the runtime locale
 	     (unless (zerop (unix::unix-setlocale))
 	       (warn "os_setlocale failed"))
+	     ;; Load external format aliases now so we can aliases to
+	     ;; specify the external format.
 	     (stream::load-external-format-aliases)
 	     ;; Set the locale for lisp
 	     (intl::setlocale)
+	     ;; Set up :locale format
+	     (set-up-locale-external-format)
 	     (ext::process-command-strings process-command-line)
 	     (setf *editor-lisp-p* nil)
 	     (macrolet ((find-switch (name)
@@ -323,7 +327,6 @@
 	       (when process-command-line
 		 (ext::invoke-switch-demons *command-line-switches*
 					    *command-switch-demons*))
-	       (set-up-locale-external-format)
 	       (when (and print-herald
 			  (not (or quiet
 				   (and process-command-line


=====================================
src/general-info/release-21e.md
=====================================
@@ -60,6 +60,7 @@ public domain.
     * ~~#134~~ Handle the case of `(expt complex complex-rational)`
     * ~~#136~~ `ensure-directories-exist` should return the given pathspec
     * #139 `*default-external-format*` defaults to `:utf-8`
+    * #139 add alias for `:locale` external format
     * ~~#142~~ `(random 0)` signals incorrect error
     * ~~#147~~ `stream-line-column` method missing for `fundamental-character-output-stream`
     * ~~#149~~ Call setlocale(3C) on startup


=====================================
src/i18n/locale/cmucl-unix.pot
=====================================
@@ -1428,3 +1428,7 @@ msgstr ""
 msgid "Call setlocale(3c) with fixed args.  Returns 0 on success."
 msgstr ""
 
+#: src/code/unix.lisp
+msgid "Get the codeset from the locale"
+msgstr ""
+


=====================================
src/i18n/locale/cmucl.pot
=====================================
@@ -6714,6 +6714,12 @@ msgid ""
 "This is true if and only if the lisp was started with the -edit switch."
 msgstr ""
 
+#: src/code/save.lisp
+msgid ""
+"Add external format alias for :locale to the format specified by\n"
+"  the locale as set by setlocale(3C)."
+msgstr ""
+
 #: src/code/save.lisp
 msgid ""
 "Saves a CMU Common Lisp core image in the file of the specified name.  The\n"


=====================================
tests/issues.lisp
=====================================
@@ -720,31 +720,11 @@
       (assert-equal (map 'list #'char-name string)
 		    (map 'list #'char-name (read-line s))))))
 
-(define-test issue.139-default-external-format-write-file
+
+(define-test issue.139-locale-external-format
     (:tag :issues)
-  ;; Test that opening a file for writing uses the default :utf8.
-  ;; First write something out to the file.  Then read it back in
-  ;; using an explicit format of utf8 and verifying that we got the
-  ;; right contents.
-  (let ((string (concatenate 'string
-			     ;; This is "hello" in Korean
-			     '(#\Hangul_syllable_an
-			       #\Hangul_Syllable_Nyeong
-			       #\Hangul_Syllable_Ha
-			       #\Hangul_Syllable_Se
-			       #\Hangul_Syllable_Yo))))
-    (with-open-file (s (merge-pathnames "out-utf8.txt"
-					*test-path*)
-		       :direction :output
-		       :if-exists :supersede)
-      (write-line string s))
-    (with-open-file (s (merge-pathnames "out-utf8.txt"
-					*test-path*)
-		       :direction :input
-		       :external-format :utf-8)
-      (assert-equal (map 'list #'char-name string)
-		    (map 'list #'char-name (read-line s))))))
-  
+  ;; Just verify that :locale format exists
+  (assert-true (stream::find-external-format :locale nil)))
 
 (define-test issue.150
     (:tag :issues)



View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/f45d931fc9cc9e8b062847eadec03b1c85c25f0a...af271f0b18e636871bb970e1ebfb3501ecd8d324

-- 
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/f45d931fc9cc9e8b062847eadec03b1c85c25f0a...af271f0b18e636871bb970e1ebfb3501ecd8d324
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/20221103/29919f26/attachment-0001.html>


More information about the cmucl-cvs mailing list