X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Futilities%2Fset.q;h=301cc645e8583257e80a69d599902710c5ede594;hb=685be7e2f49916d06005ba8588dcf9d0be896aac;hp=f90e3e14de3d8e675b7988879a79c3a2cca83b67;hpb=a6f1c88d9d4dee24e1f79048c8a5d8274f68c405;p=pspp diff --git a/src/language/utilities/set.q b/src/language/utilities/set.q index f90e3e14de..301cc645e8 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, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2006, 2009, 2010, 2011, 2012, 2013, 2014, 2015 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 @@ -80,6 +80,7 @@ int tgetnum (const char *); epoch=custom; errors=custom; format=custom; + fuzzbits=integer; headers=headers:no/yes/blank; highres=hires:on/off; histogram=string; @@ -136,7 +137,6 @@ cmd_set (struct lexer *lexer, struct dataset *ds) if (!parse_set (lexer, ds, &cmd, NULL)) { - free_set (&cmd); return CMD_FAILURE; } @@ -153,6 +153,14 @@ cmd_set (struct lexer *lexer, struct dataset *ds) if (cmd.sbc_decimal) settings_set_decimal_char (cmd.dec == STC_DOT ? '.' : ','); + if (cmd.sbc_fuzzbits) + { + int fuzzbits = cmd.n_fuzzbits[0]; + if (fuzzbits >= 0 && fuzzbits <= 20) + settings_set_fuzzbits (fuzzbits); + else + msg (SE, _("%s must be between 0 and 20."), "FUZZBITS"); + } if (cmd.sbc_include) settings_set_include (cmd.inc == STC_ON); @@ -338,20 +346,14 @@ stc_custom_tnumbers (struct lexer *lexer, lex_match (lexer, T_EQUALS); if (lex_match_id (lexer, "VALUES")) - { - settings_set_value_style (SETTINGS_VAL_STYLE_VALUES); - } + settings_set_show_values (SETTINGS_VALUE_SHOW_VALUE); else if (lex_match_id (lexer, "LABELS")) - { - settings_set_value_style (SETTINGS_VAL_STYLE_LABELS); - } + settings_set_show_values (SETTINGS_VALUE_SHOW_LABEL); else if (lex_match_id (lexer, "BOTH")) - { - settings_set_value_style (SETTINGS_VAL_STYLE_BOTH); - } + settings_set_show_values (SETTINGS_VALUE_SHOW_BOTH); else { - lex_error_expecting (lexer, "VALUES", "LABELS", "BOTH", NULL_SENTINEL); + lex_error_expecting (lexer, "VALUES", "LABELS", "BOTH"); return 0; } @@ -367,20 +369,14 @@ stc_custom_tvars (struct lexer *lexer, lex_match (lexer, T_EQUALS); if (lex_match_id (lexer, "NAMES")) - { - settings_set_var_style (SETTINGS_VAR_STYLE_NAMES); - } + settings_set_show_variables (SETTINGS_VALUE_SHOW_VALUE); else if (lex_match_id (lexer, "LABELS")) - { - settings_set_var_style (SETTINGS_VAR_STYLE_LABELS); - } + settings_set_show_variables (SETTINGS_VALUE_SHOW_LABEL); else if (lex_match_id (lexer, "BOTH")) - { - settings_set_var_style (SETTINGS_VAR_STYLE_BOTH); - } + settings_set_show_variables (SETTINGS_VALUE_SHOW_BOTH); else { - lex_error_expecting (lexer, "NAMES", "LABELS", "BOTH", NULL_SENTINEL); + lex_error_expecting (lexer, "NAMES", "LABELS", "BOTH"); return 0; } @@ -559,7 +555,7 @@ stc_custom_format (struct lexer *lexer, struct dataset *ds UNUSED, struct cmd_se if (!fmt_check_output (&fmt)) return 0; - + if (fmt_is_string (fmt.type)) { char str[FMT_STRING_LEN_MAX + 1]; @@ -710,6 +706,12 @@ show_format (const struct dataset *ds UNUSED) return xstrdup (fmt_to_string (settings_get_format (), str)); } +static char * +show_fuzzbits (const struct dataset *ds UNUSED) +{ + return xasprintf ("%d", settings_get_fuzzbits ()); +} + static char * show_journal (const struct dataset *ds UNUSED) { @@ -892,7 +894,7 @@ show_current_directory (const struct dataset *ds UNUSED) { len <<= 1; buf = xrealloc (buf, len); - } + } while (NULL == (wd = getcwd (buf, len))); return wd; @@ -907,7 +909,7 @@ show_tempdir (const struct dataset *ds UNUSED) static char * show_version (const struct dataset *ds UNUSED) { - return strdup (version); + return strdup (announced_version); } static char * @@ -952,6 +954,7 @@ const struct show_sbc show_table[] = {"ENVIRONMENT", show_system}, {"ERRORS", show_errors}, {"FORMAT", show_format}, + {"FUZZBITS", show_fuzzbits}, {"JOURNAL", show_journal}, {"LENGTH", show_length}, {"LOCALE", show_locale},