X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Futilities%2Fset.q;h=d264a00ef95880dc4a16155eb1305f6836f77e64;hb=b9a18d43ace66798d4f2eaaab063fd06b30d5f8f;hp=37388f9264162e2c346c4f7b7a3edc637aa8bcce;hpb=ee7be3e962a4faba54d7bc01364365b51167242c;p=pspp-builds.git diff --git a/src/language/utilities/set.q b/src/language/utilities/set.q index 37388f92..d264a00e 100644 --- a/src/language/utilities/set.q +++ b/src/language/utilities/set.q @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2006, 2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -86,6 +87,7 @@ int tgetnum (const char *); journal=custom; log=custom; length=custom; + locale=custom; listing=custom; lowres=lores:auto/on/off; lpi=integer "x>0" "%s must be greater than 0"; @@ -361,6 +363,41 @@ stc_custom_length (struct lexer *lexer, struct dataset *ds UNUSED, struct cmd_se return 1; } +static int +stc_custom_locale (struct lexer *lexer, struct dataset *ds UNUSED, + struct cmd_set *cmd UNUSED, void *aux UNUSED) +{ + const struct string *s; + + lex_match (lexer, '='); + + if ( !lex_force_string (lexer)) + return 0; + + s = lex_tokstr (lexer); + + /* First try this string as an encoding name */ + if ( valid_encoding (ds_cstr (s))) + set_default_encoding (ds_cstr (s)); + + /* Now try as a locale name (or alias) */ + else if (set_encoding_from_locale (ds_cstr (s))) + { + } + else + { + msg (ME, _("%s is not a recognised encoding or locale name"), + ds_cstr (s)); + return 0; + } + + lex_get (lexer); + + return 1; +} + + + static int stc_custom_seed (struct lexer *lexer, struct dataset *ds UNUSED, struct cmd_set *cmd UNUSED, void *aux UNUSED) { @@ -589,6 +626,12 @@ show_length (const struct dataset *ds UNUSED) msg (SN, _("LENGTH is %d."), settings_get_viewlength ()); } +static void +show_locale (const struct dataset *ds UNUSED) +{ + msg (SN, _("LOCALE is %s"), get_default_encoding ()); +} + static void show_mxerrs (const struct dataset *ds UNUSED) { @@ -744,6 +787,7 @@ const struct show_sbc show_table[] = {"ERRORS", show_errors}, {"FORMAT", show_format}, {"LENGTH", show_length}, + {"LOCALE", show_locale}, {"MXERRS", show_mxerrs}, {"MXLOOPS", show_mxloops}, {"MXWARNS", show_mxwarns},