X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fformats.c;h=a569c678a4b7c4bf1d165fef891e91fd20e23e79;hb=1481286583f3c9a3b084a38d23367314923814b6;hp=9ad6efc31bb94db3ed186cb8e14164a566547682;hpb=d807ad29cc0d3caa4f0e04ee4b75c70a225cfeaf;p=pspp diff --git a/src/formats.c b/src/formats.c index 9ad6efc31b..a569c678a4 100644 --- a/src/formats.c +++ b/src/formats.c @@ -14,8 +14,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ #include #include @@ -28,6 +28,9 @@ #include "str.h" #include "var.h" +#include "gettext.h" +#define _(msgid) gettext (msgid) + #include "debug-print.h" enum @@ -77,7 +80,7 @@ internal_cmd_formats (int which) if (token == '.') break; - if (!parse_variables (default_dict, &v, &cv, PV_SAME_TYPE)) + if (!parse_variables (default_dict, &v, &cv, PV_NUMERIC)) return CMD_PART_SUCCESS_MAYBE; type = v[0]->type; @@ -86,31 +89,11 @@ internal_cmd_formats (int which) msg (SE, _("`(' expected after variable list")); goto fail; } - if (!parse_format_specifier (&f, 0) || !check_output_specifier (&f, 1)) + if (!parse_format_specifier (&f, 0) + || !check_output_specifier (&f, true) + || !check_specifier_type (&f, NUMERIC, true)) goto fail; - /* Catch type mismatch errors. */ - if ((type == ALPHA) ^ (0 != (formats[f.type].cat & FCAT_STRING))) - { - msg (SE, _("Format %s may not be assigned to a %s variable."), - fmt_to_string (&f), type == NUMERIC ? _("numeric") : _("string")); - goto fail; - } - - /* This is an additional check for string variables. We can't - let the user specify an A8 format for a string variable with - width 4. */ - if (type == ALPHA) - { - /* Shortest string so far. */ - int min_len = INT_MAX; - - for (i = 0; i < cv; i++) - min_len = min (min_len, v[i]->width); - if (!check_string_specifier (&f, min_len)) - goto fail; - } - if (!lex_match (')')) { msg (SE, _("`)' expected after output format."));