- str_uppercase (name);
-
- if (dict_create_var (dict, name, 0))
- return 1;
-
- /* Add numeric extensions until acceptable. */
- {
- const int len = (int) strlen (name);
- char n[SHORT_NAME_LEN + 1];
- int i;
-
- for (i = 1; i < 10000000; i++)
- {
- int ofs = MIN (7 - intlog10 (i), len);
- memcpy (n, name, ofs);
- sprintf (&n[ofs], "%d", i);
-
- if (dict_create_var (dict, n, 0))
- return 1;
- }
- }
-
- msg (SE, _("Could not create acceptable variant for variable %s."), name);
- return 0;
-}
-
-/* Make a new dictionary for all the new variable names. */
-static int
-build_dictionary (struct dictionary *dict, struct flip_pgm *flip)
-{
- dict_create_var_assert (dict, "CASE_LBL", 8);
-
- if (flip->new_names_head == NULL)
- {
- int i;
-
- if (flip->case_cnt > 99999)
- {
- msg (SE, _("Cannot create more than 99999 variable names."));
- return 0;
- }
-
- for (i = 0; i < flip->case_cnt; i++)
- {
- struct variable *v;
- char s[SHORT_NAME_LEN + 1];
-
- sprintf (s, "VAR%03d", i);
- v = dict_create_var_assert (dict, s, 0);
- }
- }
- else
- {
- struct varname *v;
-
- for (v = flip->new_names_head; v; v = v->next)
- if (!make_new_var (dict, v->name))
- return 0;
- }
-
- return 1;
-}
-
-/* Creates a flip sink based on FLIP. */
-static struct case_sink *
-flip_sink_create (struct dataset *ds, struct flip_pgm *flip)
-{
- size_t i;
-
- flip->output_buf = pool_nalloc (flip->pool,
- flip->var_cnt, sizeof *flip->output_buf);
-
- flip->file = pool_tmpfile (flip->pool);
- if (flip->file == NULL)
- {
- msg (SE, _("Could not create temporary file for FLIP: %s."),
- strerror (errno));
- return NULL;
- }