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

Commits:

5 changed files:

Changes:

  • src/code/save.lisp
    ... ... @@ -144,7 +144,7 @@
    144 144
     
    
    145 145
     (defun set-up-locale-external-format ()
    
    146 146
       "Add external format alias for :locale to the format specified by
    
    147
    -  the envvar LANG and friends if available."
    
    147
    +  the locale as set by setlocale(3C)."
    
    148 148
       (let ((codeset (unix::unix-get-locale-codeset)))
    
    149 149
         (cond ((zerop (length codeset))
    
    150 150
     	   ;; Codeset was the empty string, so just set :locale to
    
    ... ... @@ -276,9 +276,13 @@
    276 276
     	     ;; Set the runtime locale
    
    277 277
     	     (unless (zerop (unix::unix-setlocale))
    
    278 278
     	       (warn "os_setlocale failed"))
    
    279
    +	     ;; Load external format aliases now so we can aliases to
    
    280
    +	     ;; specify the external format.
    
    279 281
     	     (stream::load-external-format-aliases)
    
    280 282
     	     ;; Set the locale for lisp
    
    281 283
     	     (intl::setlocale)
    
    284
    +	     ;; Set up :locale format
    
    285
    +	     (set-up-locale-external-format)
    
    282 286
     	     (ext::process-command-strings process-command-line)
    
    283 287
     	     (setf *editor-lisp-p* nil)
    
    284 288
     	     (macrolet ((find-switch (name)
    
    ... ... @@ -323,7 +327,6 @@
    323 327
     	       (when process-command-line
    
    324 328
     		 (ext::invoke-switch-demons *command-line-switches*
    
    325 329
     					    *command-switch-demons*))
    
    326
    -	       (set-up-locale-external-format)
    
    327 330
     	       (when (and print-herald
    
    328 331
     			  (not (or quiet
    
    329 332
     				   (and process-command-line
    

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

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

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

  • tests/issues.lisp
    ... ... @@ -720,31 +720,11 @@
    720 720
           (assert-equal (map 'list #'char-name string)
    
    721 721
     		    (map 'list #'char-name (read-line s))))))
    
    722 722
     
    
    723
    -(define-test issue.139-default-external-format-write-file
    
    723
    +
    
    724
    +(define-test issue.139-locale-external-format
    
    724 725
         (:tag :issues)
    
    725
    -  ;; Test that opening a file for writing uses the default :utf8.
    
    726
    -  ;; First write something out to the file.  Then read it back in
    
    727
    -  ;; using an explicit format of utf8 and verifying that we got the
    
    728
    -  ;; right contents.
    
    729
    -  (let ((string (concatenate 'string
    
    730
    -			     ;; This is "hello" in Korean
    
    731
    -			     '(#\Hangul_syllable_an
    
    732
    -			       #\Hangul_Syllable_Nyeong
    
    733
    -			       #\Hangul_Syllable_Ha
    
    734
    -			       #\Hangul_Syllable_Se
    
    735
    -			       #\Hangul_Syllable_Yo))))
    
    736
    -    (with-open-file (s (merge-pathnames "out-utf8.txt"
    
    737
    -					*test-path*)
    
    738
    -		       :direction :output
    
    739
    -		       :if-exists :supersede)
    
    740
    -      (write-line string s))
    
    741
    -    (with-open-file (s (merge-pathnames "out-utf8.txt"
    
    742
    -					*test-path*)
    
    743
    -		       :direction :input
    
    744
    -		       :external-format :utf-8)
    
    745
    -      (assert-equal (map 'list #'char-name string)
    
    746
    -		    (map 'list #'char-name (read-line s))))))
    
    747
    -  
    
    726
    +  ;; Just verify that :locale format exists
    
    727
    +  (assert-true (stream::find-external-format :locale nil)))
    
    748 728
     
    
    749 729
     (define-test issue.150
    
    750 730
         (:tag :issues)