-/* PSPP - computes sample statistics.
+/* PSPP - a program for statistical analysis.
Copyright (C) 2006 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 the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
+ 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
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
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., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
static const char ebcdic_to_ascii[256];
void
-legacy_recode (enum legacy_encoding from, const char *src,
- enum legacy_encoding to, char *dst,
+legacy_recode (const char *from, const char *src,
+ const char *to, char *dst,
size_t size)
{
- if (from != to)
+ if (0 != strcmp (from, to))
{
const char *table;
size_t i;
- table = from == LEGACY_ASCII ? ascii_to_ebcdic : ebcdic_to_ascii;
+ table = (0 == strcmp (from, "PSPP-LEGACY-ASCII")) ? ascii_to_ebcdic : ebcdic_to_ascii;
for (i = 0; i < size; i++)
dst[i] = table[(unsigned char) src[i]];
}
}
char
-legacy_to_native (enum legacy_encoding from, char c)
+legacy_to_native (const char *from, char c)
{
legacy_recode (from, &c, LEGACY_NATIVE, &c, 1);
return c;
}
char
-legacy_from_native (enum legacy_encoding to, char c)
+legacy_from_native (const char *to, char c)
{
legacy_recode (LEGACY_NATIVE, &c, to, &c, 1);
return c;