development version newLISP 8.7.10

Notices and updates
Locked
Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

development version newLISP 8.7.10

Post by Lutz »

- bug fixes and enhancements

for change notes and files see: http://newlisp.org/downloads/development/

Lutz

Dmi
Posts: 408
Joined: Sat Jun 04, 2005 4:16 pm
Location: Russia
Contact:

Post by Dmi »

(set-locale) seems not to be working when starting from init.lsp

Code: Select all

dmi@dc:newlisp$ locale
LANG=ru_RU.KOI8-R
LC_CTYPE="ru_RU.KOI8-R"
LC_NUMERIC=POSIX
LC_TIME=POSIX
LC_COLLATE="ru_RU.KOI8-R"
LC_MONETARY=POSIX
LC_MESSAGES=POSIX
LC_PAPER="ru_RU.KOI8-R"
LC_NAME="ru_RU.KOI8-R"
LC_ADDRESS="ru_RU.KOI8-R"
LC_TELEPHONE="ru_RU.KOI8-R"
LC_MEASUREMENT="ru_RU.KOI8-R"
LC_IDENTIFICATION="ru_RU.KOI8-R"
LC_ALL=
dmi@dc:newlisp$ pwd 
/usr/share/newlisp
dmi@dc:newlisp$ cat init.lsp
(println "test")
(set 'll (set-locale))
dmi@dc:newlisp$ newlisp
test
newLISP v.8.7.10 on linux, execute 'newlisp -h' for more info.

> ll
"C"
> (set-locale)
"LC_CTYPE=ru_RU.KOI8-R;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=C;
LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;
LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;
LC_IDENTIFICATION=C"
> 
...and seems not accepts well LC_COLLATE etc.
WBR, Dmi

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

You have to put this in your init.lsp (it's what I did here in USA):

Code: Select all

(set-locale ""ru_RU.KOI8-R")
Only doing (set-locale) without a parameter will just return the locale currently set in your system but not set it for newLISP. You may also try:

Code: Select all

(set-locale "")
This will set the default locale of your OS.

Code: Select all

newLISP v.8.7.10 on OSX UTF-8, execute 'newlisp -h' for more info.

> (set-locale)
"ru_RU.KOI8-R"
> 
The LC_XXXX settings are handled differently well on different systems. Make sure you plug in the right numbers from these constants from locale.h

Lutz

Dmi
Posts: 408
Joined: Sat Jun 04, 2005 4:16 pm
Location: Russia
Contact:

Post by Dmi »

Oh! Yes! This even described in manual :-)
(set-locale "") works fine just as I need.

Then, seems that I found a little side effect:
(set-locale) - w/o parameters, called from init.lsp or from any *.lsp file, specified as newlisp's argument - returns "C".
But in interactive mode (set-locale) seems to be working equal to (set-locale "") - i.e. get system locale and set it in newlisp environment - even when I interactively do (load "file-with-set-locale-command.lsp")

And... just for fun:
Cyrillic have a 5 main encodings: koi8, cp866, cp1251, iso-8859-5 and utf-8.
In fact on different servers at work (bringed by different admins) I has all of them in system shell environment :-)
WBR, Dmi

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

This is how it works internally:

If newLISP is compiled as UTF-8 version set to the locale preset on the platform doing the 'C'-call: setlocale(LC_ALL, "")

If newLISP is compiled as non-UTF-8 version set locale "C" doing the 'C'-call setlocale(LC_ALL, "C")

load init.lsp which may contain (set-locale ...) statements

load other files from the command-line which may contain (set-locale ...) statements

Lutz

Locked