/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-9, 2000, 2006, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 1997-9, 2000, 2006, 2009, 2010, 2011, 2012 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
#include "libpspp/compiler.h"
#include "libpspp/i18n.h"
#include "libpspp/integer-format.h"
-#include "libpspp/legacy-encoding.h"
#include "libpspp/misc.h"
#include "libpspp/str.h"
#include "settings.h"
/* We're going to parse these into numbers. For this purpose we want to
deal with them in the local "C" encoding. Any character not in that
encoding wouldn't be valid anyhow. */
- dest_encoding = LEGACY_NATIVE;
+ dest_encoding = C_ENCODING;
}
else if (cat & (FMT_CAT_BINARY | FMT_CAT_LEGACY))
{
{
/* We want the hex digits in the local "C" encoding, even though the
result may not be in that encoding. */
- dest_encoding = LEGACY_NATIVE;
+ dest_encoding = C_ENCODING;
}
else
{
return false;
}
- s = recode_string (LEGACY_NATIVE, input_encoding,
+ s = recode_string (C_ENCODING, input_encoding,
ss_data (input), ss_length (input));
retval = (format == FMT_Z
? strchr (s, '.') == NULL
struct string tmp;
- bool explicit_decimals = false;
int save_errno;
char *tail;
ds_extend (&tmp, 64);
/* Prefix character may precede sign. */
- if (!ss_is_empty (style->prefix))
+ if (style->prefix.s[0] != '\0')
{
- ss_match_byte (&i->input, ss_first (style->prefix));
+ ss_match_byte (&i->input, style->prefix.s[0]);
ss_ltrim (&i->input, ss_cstr (CC_SPACES));
}
}
/* Prefix character may follow sign. */
- if (!ss_is_empty (style->prefix))
+ if (style->prefix.s[0] != '\0')
{
- ss_match_byte (&i->input, ss_first (style->prefix));
+ ss_match_byte (&i->input, style->prefix.s[0]);
ss_ltrim (&i->input, ss_cstr (CC_SPACES));
}
/* Decimal point and following digits. */
if (ss_match_byte (&i->input, style->decimal))
{
- explicit_decimals = true;
ds_put_byte (&tmp, '.');
while (c_isdigit (ss_first (i->input)))
ds_put_byte (&tmp, ss_get_byte (&i->input));
&& !ss_is_empty (i->input)
&& strchr ("eEdD-+", ss_first (i->input)))
{
- explicit_decimals = true;
ds_put_byte (&tmp, 'e');
if (strchr ("eEdD", ss_first (i->input)))
}
/* Suffix character. */
- if (!ss_is_empty (style->suffix))
- ss_match_byte (&i->input, ss_first (style->suffix));
+ if (style->suffix.s[0] != '\0')
+ ss_match_byte (&i->input, style->suffix.s[0]);
if (!ss_is_empty (i->input))
{
*cp++ = ss_get_byte (&i->input);
*cp = '\0';
- *time += strtod (buf, NULL);
+ *time += c_strtod (buf, NULL);
return NULL;
}
double time = 0, date = 0;
enum time_sign time_sign = SIGN_NO_TIME;
- const char *template = fmt_date_template (i->format);
+ const char *template = fmt_date_template (i->format, 0);
size_t template_width = strlen (template);
char *error;
case '-':
case '/':
case '.':
- case 'X':
error = parse_date_delimiter (i);
break;
case ':':
error = parse_time_delimiter (i);
case ' ':
- parse_spaces (i);
- error = NULL;
+ if (i->format != FMT_MOYR)
+ {
+ parse_spaces (i);
+ error = NULL;
+ }
+ else
+ error = parse_date_delimiter (i);
break;
default:
assert (count == 1);