/* 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 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
/* 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
/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-9, 2000, 2006, 2009 Free Software Foundation, Inc.
+ Copyright (C) 1997-9, 2000, 2006, 2009, 2011 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
assert (fmt_check_output (format));
converters[format->type] (input, format, output);
- if (0 != strcmp (encoding, LEGACY_NATIVE)
+ if (0 != strcmp (encoding, C_ENCODING)
&& fmt_get_category (format->type) != FMT_CAT_BINARY)
{
- char *s = recode_string (encoding, LEGACY_NATIVE, output, format->w );
+ char *s = recode_string (encoding, C_ENCODING, output, format->w );
memcpy (output, s, format->w);
free (s);
}
/* 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 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/hmap.h>
+#include <libpspp/i18n.h>
#include <libpspp/ll.h>
#include <libpspp/message.h>
#include <libpspp/str.h>
fh_default_properties (void)
{
static const struct fh_properties default_properties
- = {FH_MODE_TEXT, 1024, 4, LEGACY_NATIVE};
+ = {FH_MODE_TEXT, 1024, 4, C_ENCODING};
return &default_properties;
}
fh_get_legacy_encoding (const struct file_handle *handle)
{
assert (handle->referent & (FH_REF_FILE | FH_REF_INLINE));
- return (handle->referent == FH_REF_FILE ? handle->encoding : LEGACY_NATIVE);
+ return (handle->referent == FH_REF_FILE ? handle->encoding : C_ENCODING);
}
/* Returns the scratch file handle associated with HANDLE.
{
struct print_trns *trns = trns_;
bool eject = trns->eject;
- char encoded_space = recode_byte (trns->encoding, LEGACY_NATIVE, ' ');
+ char encoded_space = recode_byte (trns->encoding, C_ENCODING, ' ');
int record = 1;
struct prt_out_spec *spec;
else
{
ds_put_substring (&trns->line, ds_ss (&spec->string));
- if (0 != strcmp (trns->encoding, LEGACY_NATIVE))
+ if (0 != strcmp (trns->encoding, C_ENCODING))
{
size_t length = ds_length (&spec->string);
char *data = ss_data (ds_tail (&trns->line, length));
- char *s = recode_string (trns->encoding, LEGACY_NATIVE, data, length);
+ char *s = recode_string (trns->encoding, C_ENCODING, data, length);
memcpy (data, s, length);
free (s);
}
else
leader = '1';
}
- line[0] = recode_byte (trns->encoding, LEGACY_NATIVE, leader);
+ line[0] = recode_byte (trns->encoding, C_ENCODING, leader);
if (trns->writer == NULL)
tab_output_text (TAB_FIX, &line[1]);
#include <data/vector.h>
#include <language/expressions/public.h>
#include <libpspp/compiler.h>
+#include <libpspp/i18n.h>
#include <libpspp/message.h>
#include <libpspp/misc.h>
#include <libpspp/str.h>
if (s.length > f->w)
s.length = f->w;
- error = data_in (s, LEGACY_NATIVE, f->type, &out, 0, NULL);
+ error = data_in (s, C_ENCODING, f->type, &out, 0, NULL);
if (error == NULL)
- data_in_imply_decimals (s, LEGACY_NATIVE, f->type, f->d, &out);
+ data_in_imply_decimals (s, C_ENCODING, f->type, f->d, &out);
else
{
msg (SE, "Cannot parse `%.*s' as format %s: %s",
v.f = x;
assert (!fmt_is_string (f->type));
- s = data_out (&v, LEGACY_NATIVE, f);
+ s = data_out (&v, C_ENCODING, f);
dst = alloc_string (e, strlen (s));
strcpy (dst.string, s);
free (s);
/* PSPP - a program for statistical analysis.
- Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006, 2009, 2010, 2011 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 "data/value.h"
#include "language/lexer/lexer.h"
#include "libpspp/cast.h"
+#include "libpspp/i18n.h"
#include "libpspp/message.h"
#include "libpspp/str.h"
assert (fmt_get_category (*format) != FMT_CAT_STRING);
- if (!data_in_msg (lex_tokss (lexer), LEGACY_NATIVE,
- *format, &v, 0, NULL))
+ if (!data_in_msg (lex_tokss (lexer), C_ENCODING, *format, &v, 0, NULL))
return false;
lex_get (lexer);
/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-9, 2000, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 1997-9, 2000, 2009, 2010, 2011 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/assertion.h"
#include "libpspp/cast.h"
#include "libpspp/compiler.h"
+#include "libpspp/i18n.h"
#include "libpspp/message.h"
#include "libpspp/pool.h"
#include "libpspp/str.h"
char *error;
error = data_in (ss_buffer (CHAR_CAST_BUG (char *, value), width),
- LEGACY_NATIVE, FMT_F, &uv, 0, encoding);
+ C_ENCODING, FMT_F, &uv, 0, encoding);
match = error == NULL;
free (error);
#define UTF8 "UTF-8"
+/* The encoding of literal strings in PSPP source code, as seen at execution
+ time. In fact this is likely to be some extended ASCII encoding, such as
+ UTF-8 or ISO-8859-1, but ASCII is adequate for our purposes. */
+#define C_ENCODING "ASCII"
+
struct pool;
char recode_byte (const char *to, const char *from, char);
/* PSPP - a program for statistical analysis.
- Copyright (C) 2006 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2011 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
legacy_to_native (const char *from, char c)
{
char x;
- char *s = recode_string (LEGACY_NATIVE, from, &c, 1);
+ char *s = recode_string (C_ENCODING, from, &c, 1);
x = s[0];
free (s);
return x;
legacy_from_native (const char *to, char c)
{
char x;
- char *s = recode_string (to, LEGACY_NATIVE, &c, 1);
+ char *s = recode_string (to, C_ENCODING, &c, 1);
x = s[0];
free (s);
return x;
/* PSPP - a program for statistical analysis.
- Copyright (C) 2006 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2011 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>
-#if 'A' == 0x41
-#define LEGACY_NATIVE "ASCII"
-#elif 'A' == 0xc1
-#define LEGACY_NATIVE "EBCDIC-US"
-#else
-#error Cannot detect native character set.
-#endif
-
char legacy_to_native (const char *from, char) PURE_FUNCTION;
char legacy_from_native (const char *to, char) PURE_FUNCTION;
-
#endif /* libpspp/legacy-encoding.h */
/* 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 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 <data/dictionary.h>
#include <libpspp/assertion.h>
#include <libpspp/compiler.h>
+#include <libpspp/i18n.h>
#include <libpspp/misc.h>
#include <libpspp/pool.h>
#include <output/driver.h>
#endif
double_value.f = val;
- s = data_out_pool (&double_value, LEGACY_NATIVE, &f, table->container);
+ s = data_out_pool (&double_value, C_ENCODING, &f, table->container);
table->cc[c + r * table->cf] = s + strspn (s, " ");
table->ct[c + r * table->cf] = opt;
#endif
double_value.f = val;
- s = data_out_pool (&double_value, LEGACY_NATIVE, fmt, table->container);
+ s = data_out_pool (&double_value, C_ENCODING, fmt, table->container);
table->cc[c + r * table->cf] = s + strspn (s, " ");
table->ct[c + r * table->cf] = opt;
}
#include "language/data-io/data-parser.h"
#include "language/lexer/lexer.h"
#include "libpspp/assertion.h"
+#include "libpspp/i18n.h"
#include "libpspp/message.h"
#include "ui/gui/checkbox-treeview.h"
#include "ui/gui/descriptives-dialog.h"
{
char *error;
- error = data_in (field, LEGACY_NATIVE, in->type, &val,
- var_get_width (var),
+ error = data_in (field, C_ENCODING, in->type, &val, var_get_width (var),
dict_get_encoding (ia->formats.dict));
if (error != NULL)
{
/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2008, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2008, 2010, 2011 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 "data/value.h"
#include "libpspp/assertion.h"
#include "libpspp/cast.h"
+#include "libpspp/i18n.h"
#include "libpspp/message.h"
#include "libpspp/str.h"
s = data_out (&v_in, "FIXME", format);
/* FIXME: UTF8 encoded strings will fail here */
- error = data_in (ss_cstr (s), LEGACY_NATIVE,
- format->type, &v_out, 0, NULL);
+ error = data_in (ss_cstr (s), C_ENCODING, format->type, &v_out, 0, NULL);
ok = error == NULL;
free (error);