1 /* PSPP - computes sample statistics.
2 Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
3 Written by Ben Pfaff <blp@gnu.org>.
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26 #include <data/procedure.h>
27 #include <data/variable.h>
28 #include <language/command.h>
29 #include <language/lexer/format-parser.h>
30 #include <language/lexer/lexer.h>
31 #include <language/lexer/variable-parser.h>
32 #include <libpspp/message.h>
33 #include <libpspp/misc.h>
34 #include <libpspp/str.h>
37 #define _(msgid) gettext (msgid)
45 static int internal_cmd_formats (int);
48 cmd_print_formats (void)
50 return internal_cmd_formats (FORMATS_PRINT);
54 cmd_write_formats (void)
56 return internal_cmd_formats (FORMATS_WRITE);
62 return internal_cmd_formats (FORMATS_PRINT | FORMATS_WRITE);
66 internal_cmd_formats (int which)
72 /* Format to set the variables to. */
75 /* Numeric or string. */
86 if (!parse_variables (dataset_dict (current_dataset), &v, &cv, PV_NUMERIC))
92 msg (SE, _("`(' expected after variable list."));
95 if (!parse_format_specifier (&f)
96 || !check_output_specifier (&f, true)
97 || !check_specifier_type (&f, NUMERIC, true))
100 if (!lex_match (')'))
102 msg (SE, _("`)' expected after output format."));
106 for (i = 0; i < cv; i++)
108 if (which & FORMATS_PRINT)
110 if (which & FORMATS_WRITE)