-/* PSPP - computes sample statistics.
+/* PSPP - a program for statistical analysis.
Copyright (C) 1997-9, 2000, 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>
#include <data/format.h>
#include <data/missing-values.h>
#include <data/settings.h>
+#include <data/short-names.h>
#include <data/value-labels.h>
#include <data/variable.h>
return opts;
}
-
-/* Return a short variable name to be used as the continuation of the
- variable with the short name SN.
-
- FIXME: Need to resolve clashes somehow.
-
- */
-static const char *
-cont_var_name(const char *sn, int idx)
-{
- static char s[SHORT_NAME_LEN + 1];
-
- char abb[SHORT_NAME_LEN + 1 - 3]= {0};
-
- strncpy(abb, sn, SHORT_NAME_LEN - 3);
-
- snprintf(s, SHORT_NAME_LEN + 1, "%s%03d", abb, idx);
-
- return s;
-}
-
-
/* Opens the system file designated by file handle FH for writing
cases from dictionary D according to the given OPTS. If
COMPRESS is nonzero, the system file will be compressed.
write_header (w, d);
/* Write basic variable info. */
- dict_assign_short_names (d);
+ short_names_assign (d);
for (i = 0; i < dict_get_var_cnt (d); i++)
{
int count = 0;
do {
struct variable *var_cont = var_clone (v);
- var_set_short_name (var_cont, var_get_short_name (v));
+ var_set_short_name (var_cont, 0, var_get_short_name (v, 0));
if ( var_is_alpha (v))
{
if ( 0 != count )
{
var_clear_missing_values (var_cont);
- var_set_short_name (var_cont,
- cont_var_name (var_get_short_name (v),
- count));
+ var_set_short_name (var_cont, 0,
+ var_get_short_name (v, count));
var_clear_label (var_cont);
w->var_cnt_vls++;
}
sv.n_missing_values = nm;
write_format_spec (var_get_print_format (v), &sv.print);
write_format_spec (var_get_write_format (v), &sv.write);
- buf_copy_str_rpad (sv.name, sizeof sv.name, var_get_short_name (v));
+ buf_copy_str_rpad (sv.name, sizeof sv.name, var_get_short_name (v, 0));
buf_write (w, &sv, sizeof sv);
if (label != NULL)
continue;
ds_put_format (&vls_length_map, "%s=%05d",
- var_get_short_name (v), var_get_width (v));
+ var_get_short_name (v, 0), var_get_width (v));
ds_put_char (&vls_length_map, '\0');
ds_put_char (&vls_length_map, '\t');
}
if (i)
ds_put_char (&long_name_map, '\t');
ds_put_format (&long_name_map, "%s=%s",
- var_get_short_name (v), var_get_name (v));
+ var_get_short_name (v, 0), var_get_name (v));
}
lv_hdr.rec_type = 7;