Raymond Toy pushed to branch issue-139-add-alias-local-external-format at cmucl / cmucl
Commits:
-
ee9f2d02
by Raymond Toy at 2022-11-22T08:34:24-08:00
-
eb17d936
by Raymond Toy at 2022-11-22T13:44:34-08:00
4 changed files:
Changes:
... | ... | @@ -2918,10 +2918,7 @@ |
2918 | 2918 | |
2919 | 2919 | (defun unix-get-locale-codeset ()
|
2920 | 2920 | _N"Get the codeset from the locale"
|
2921 | - (with-alien ((codeset (array c-call:char 512)))
|
|
2922 | - (alien-funcall
|
|
2921 | + (cast (alien-funcall
|
|
2923 | 2922 | (extern-alien "os_get_locale_codeset"
|
2924 | - (function void (* char) int))
|
|
2925 | - (cast codeset (* c-call:char))
|
|
2926 | - 512)
|
|
2927 | - (cast codeset c-string))) |
|
2923 | + (function (* char))))
|
|
2924 | + c-string)) |
... | ... | @@ -1428,6 +1428,13 @@ 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 ""
|
|
1433 | +"Get LC_MESSAGES from the current locale. If we can't, return\n"
|
|
1434 | +" NIL. A call to UNIX-SETLOCALE must have been done previously before\n"
|
|
1435 | +" calling this so that the correct locale is returned."
|
|
1436 | +msgstr ""
|
|
1437 | + |
|
1431 | 1438 | #: src/code/unix.lisp
|
1432 | 1439 | msgid "Get the codeset from the locale"
|
1433 | 1440 | msgstr ""
|
... | ... | @@ -798,12 +798,8 @@ os_get_lc_messages(char *buf, int len) |
798 | 798 | return locale ? 0 : -1;
|
799 | 799 | }
|
800 | 800 | |
801 | -void
|
|
802 | -os_get_locale_codeset(char* codeset, int len)
|
|
801 | +char *
|
|
802 | +os_get_locale_codeset()
|
|
803 | 803 | {
|
804 | - char *code;
|
|
805 | -
|
|
806 | - code = nl_langinfo(CODESET);
|
|
807 | - |
|
808 | - strncpy(codeset, code, len);
|
|
804 | + return nl_langinfo(CODESET);
|
|
809 | 805 | } |
... | ... | @@ -727,24 +727,24 @@ |
727 | 727 | ;; using an explicit format of utf8 and verifying that we got the
|
728 | 728 | ;; right contents.
|
729 | 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))))
|
|
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 | 736 | (with-open-file (s (merge-pathnames "out-utf8.txt"
|
737 | - *test-path*)
|
|
738 | - :direction :output
|
|
739 | - :if-exists :supersede)
|
|
737 | + *test-path*)
|
|
738 | + :direction :output
|
|
739 | + :if-exists :supersede)
|
|
740 | 740 | (write-line string s))
|
741 | 741 | (with-open-file (s (merge-pathnames "out-utf8.txt"
|
742 | - *test-path*)
|
|
743 | - :direction :input
|
|
744 | - :external-format :utf-8)
|
|
742 | + *test-path*)
|
|
743 | + :direction :input
|
|
744 | + :external-format :utf-8)
|
|
745 | 745 | (assert-equal (map 'list #'char-name string)
|
746 | - (map 'list #'char-name (read-line s))))))
|
|
747 | - |
|
746 | + (map 'list #'char-name (read-line s))))))
|
|
747 | +
|
|
748 | 748 | (define-test issue.139-locale-external-format
|
749 | 749 | (:tag :issues)
|
750 | 750 | ;; Just verify that :locale format exists
|