dict = dict_create (get_default_encoding ());
fg = fmt_guesser_create ();
- printf ("%s:%d Column count %d\n", __FILE__, __LINE__, seps->column_cnt);
- for (column_idx = 0; column_idx < seps->column_cnt; column_idx++)
+ for (column_idx = 0; column_idx < ia->column_cnt; column_idx++)
{
struct variable *modified_var;
? p->modified_vars[column_idx] : NULL);
if (modified_var == NULL)
{
- struct column *column = &seps->columns[column_idx];
+ struct column *column = &ia->columns[column_idx];
struct variable *var;
struct fmt_spec format;
char *name;
static void
clear_fields (struct import_assistant *ia)
{
- struct separators_page *s = ia->separators;
-
- if (s->column_cnt > 0)
+ if (ia->column_cnt > 0)
{
struct column *col;
size_t row;
const char *line_start = ds_data (line);
const char *line_end = ds_end (line);
- for (col = s->columns; col < &s->columns[s->column_cnt]; col++)
+ for (col = ia->columns; col < &ia->columns[ia->column_cnt]; col++)
{
char *s = ss_data (col->contents[row]);
if (!(s >= line_start && s <= line_end))
}
}
- for (col = s->columns; col < &s->columns[s->column_cnt]; col++)
+ for (col = ia->columns; col < &ia->columns[ia->column_cnt]; col++)
{
free (col->name);
free (col->contents);
}
- free (s->columns);
- s->columns = NULL;
- s->column_cnt = 0;
+ free (ia->columns);
+ ia->columns = NULL;
+ ia->column_cnt = 0;
}
}
ss_get_bytes (&text, ss_cspan (text, ds_ss (&s->separators)),
&field);
- if (column_idx >= s->column_cnt)
+ if (column_idx >= ia->column_cnt)
{
struct column *column;
- if (s->column_cnt >= columns_allocated)
- s->columns = x2nrealloc (s->columns, &columns_allocated,
- sizeof *s->columns);
- column = &s->columns[s->column_cnt++];
+ if (ia->column_cnt >= columns_allocated)
+ ia->columns = x2nrealloc (ia->columns, &columns_allocated,
+ sizeof *ia->columns);
+ column = &ia->columns[ia->column_cnt++];
column->name = NULL;
column->width = 0;
column->contents = xcalloc (ia->file.line_cnt,
sizeof *column->contents);
}
- column = &s->columns[column_idx];
+ column = &ia->columns[column_idx];
column->contents[row] = field;
if (ss_length (field) > column->width)
column->width = ss_length (field);
dict = dict_create (get_default_encoding ());
name_row = f->variable_names && f->skip_lines ? f->skip_lines : 0;
- for (col = s->columns; col < &s->columns[s->column_cnt]; col++)
+ for (col = ia->columns; col < &ia->columns[ia->column_cnt]; col++)
{
char *hint, *name;
{
struct sheet_spec_page *ssp = ia->sheet_spec;
// struct file *file = &ia->file;
- struct separators_page *sepp = ia->separators;
int rows = 0;
struct ccase *c;
int col;
- sepp->column_cnt = dict_get_var_cnt (ssp->dict);
- sepp->columns = xcalloc (sepp->column_cnt, sizeof (*sepp->columns));
- for (col = 0; col < sepp->column_cnt ; ++col)
+ ia->column_cnt = dict_get_var_cnt (ssp->dict);
+ ia->columns = xcalloc (ia->column_cnt, sizeof (*ia->columns));
+ for (col = 0; col < ia->column_cnt ; ++col)
{
const struct variable *var = dict_get_var (ssp->dict, col);
- sepp->columns[col].name = xstrdup (var_get_name (var));
- sepp->columns[col].contents = NULL;
+ ia->columns[col].name = xstrdup (var_get_name (var));
+ ia->columns[col].contents = NULL;
}
for (; (c = casereader_read (ssp->reader)) != NULL; case_unref (c))
{
rows++;
- for (col = 0; col < sepp->column_cnt ; ++col)
+ for (col = 0; col < ia->column_cnt ; ++col)
{
char *ss;
const struct variable *var = dict_get_var (ssp->dict, col);
- sepp->columns[col].contents = xrealloc (sepp->columns[col].contents,
+ ia->columns[col].contents = xrealloc (ia->columns[col].contents,
sizeof (struct substring) * rows);
ss = data_out (case_data (c, var), dict_get_encoding (ssp->dict),
var_get_print_format (var));
- sepp->columns[col].contents[rows - 1] = ss_cstr (ss);
+ ia->columns[col].contents[rows - 1] = ss_cstr (ss);
}
if (rows > MAX_PREVIEW_LINES)
static char *
generate_syntax (const struct import_assistant *ia)
{
- struct sheet_spec_page *ssp = ia->sheet_spec;
-
struct string s = DS_EMPTY_INITIALIZER;
#if 0
column = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (tree_column),
"column-number"));
row = empty_list_store_iter_to_row (iter) + ia->first_line->skip_lines;
- field = ia->separators->columns[column].contents[row];
+ field = ia->columns[column].contents[row];
if (field.string != NULL)
{
GValue text = {0, };
if (!get_tooltip_location (widget, wx, wy, ia, &row, &column))
return FALSE;
- if (ia->separators->columns[column].contents[row].string != NULL)
+ if (ia->columns[column].contents[row].string != NULL)
return FALSE;
gtk_tooltip_set_text (tooltip,
char *tooltip;
bool ok;
- field = ia->separators->columns[column].contents[row];
+ field = ia->columns[column].contents[row];
var = dict_get_var (ia->formats->dict, column);
value_init (&val, var_get_width (var));
in = var_get_print_format (var);
char *name;
if (input)
- column = &ia->separators->columns[dict_idx];
+ column = &ia->columns[dict_idx];
else
var = dict_get_var (ia->formats->dict, dict_idx);
gtk_tree_selection_set_mode (gtk_tree_view_get_selection (tree_view),
GTK_SELECTION_NONE);
- for (i = 0; i < ia->separators->column_cnt; i++)
+ for (i = 0; i < ia->column_cnt; i++)
gtk_tree_view_append_column (tree_view,
make_data_column (ia, tree_view, input, i));
GtkCellRenderer *prop_renderer;
GtkCellRenderer *fixed_renderer;
+
};
struct string quotes; /* Quote characters. */
bool escape; /* Doubled quotes yield a quote mark? */
- /* The columns produced thereby. */
- struct column *columns; /* Information about each column. */
- size_t column_cnt; /* Number of columns. */
-
GtkWidget *page;
GtkWidget *custom_cb;
GtkWidget *custom_entry;
struct first_line_page *first_line;
struct separators_page *separators;
struct formats_page *formats;
+
+ /* The columns produced. */
+ struct column *columns; /* Information about each column. */
+ size_t column_cnt; /* Number of columns. */
};