return NULL;
default:
+ *valignp = 0;
return xasprintf ("bad cell style valign %"PRIu32, in);
}
}
break;
default:
- assert (0);
+ abort ();
}
if (vm)
}
static char * WARN_UNUSED_RESULT
-decode_spvlb_area (const struct spvlb_area *in, struct area_style *out,
+decode_spvlb_area (const struct spvlb_area *in, struct table_area_style *out,
const char *encoding)
{
char *error;
if (error)
return error;
- *out = (struct area_style) {
+ *out = (struct table_area_style) {
.font_style = {
.bold = (in->style & 1) != 0,
.italic = (in->style & 2) != 0,
struct pivot_dimension *dimension,
const char *encoding)
{
- category->subs = xcalloc (n_categories, sizeof *category->subs);
+ category->subs = XCALLOC (n_categories, struct pivot_category *);
category->n_subs = 0;
category->allocated_subs = 0;
category->show_label = show_label;
/* Allocate and fill the array of leaves now that we know how many there
are. */
- out->data_leaves = xcalloc (out->n_leaves, sizeof *out->data_leaves);
- out->presentation_leaves = xcalloc (out->n_leaves,
- sizeof *out->presentation_leaves);
+ out->data_leaves = XCALLOC (out->n_leaves, struct pivot_category *);
+ out->presentation_leaves = XCALLOC (out->n_leaves, struct pivot_category *);
out->allocated_leaves = out->n_leaves;
error = fill_leaves (out->root, out);
if (error)
if (in->border_type >= PIVOT_N_BORDERS)
return xasprintf ("bad border type %"PRIu32, in->border_type);
- struct table_border_style *out = &table->borders[in->border_type];
+ struct table_border_style *out = &table->look.borders[in->border_type];
out->color = decode_spvlb_color_u32 (in->color);
return decode_spvlb_stroke (in->stroke_type, &out->stroke);
}
enum pivot_axis_type axis_type, struct pivot_table *table)
{
struct pivot_axis *axis = &table->axes[axis_type];
- axis->dimensions = xcalloc (n_dimensions, sizeof *axis->dimensions);
+ axis->dimensions = XCALLOC (n_dimensions, struct pivot_dimension *);
axis->n_dimensions = n_dimensions;
axis->extent = 1;
for (size_t i = 0; i < n_dimensions; i++)
}
/* Display settings. */
- out->show_numeric_markers = !in->ts->show_alphabetic_markers;
+ out->look.show_numeric_markers = !in->ts->show_alphabetic_markers;
out->rotate_inner_column_labels = in->header->rotate_inner_column_labels;
out->rotate_outer_row_labels = in->header->rotate_outer_row_labels;
- out->row_labels_in_corner = in->ts->show_row_labels_in_corner;
+ out->look.row_labels_in_corner = in->ts->show_row_labels_in_corner;
out->show_grid_lines = in->borders->show_grid_lines;
out->show_caption = true;
- out->footnote_marker_superscripts = in->ts->footnote_marker_superscripts;
- out->omit_empty = in->ts->omit_empty;
+ out->look.footnote_marker_superscripts = in->ts->footnote_marker_superscripts;
+ out->look.omit_empty = in->ts->omit_empty;
const struct spvlb_x1 *x1 = in->formats->x1;
if (x1)
}
/* Column and row display settings. */
- out->sizing[TABLE_VERT].range[0] = in->header->min_row_height;
- out->sizing[TABLE_VERT].range[1] = in->header->max_row_height;
- out->sizing[TABLE_HORZ].range[0] = in->header->min_col_width;
- out->sizing[TABLE_HORZ].range[1] = in->header->max_col_width;
+ out->look.width_ranges[TABLE_VERT][0] = in->header->min_row_height;
+ out->look.width_ranges[TABLE_VERT][1] = in->header->max_row_height;
+ out->look.width_ranges[TABLE_HORZ][0] = in->header->min_col_width;
+ out->look.width_ranges[TABLE_HORZ][1] = in->header->max_col_width;
convert_widths (in->formats->widths, in->formats->n_widths,
&out->sizing[TABLE_HORZ].widths,
&out->sizing[TABLE_HORZ].n_keeps);
out->notes = to_utf8_if_nonempty (in->ts->notes, encoding);
- out->table_look = to_utf8_if_nonempty (in->ts->table_look, encoding);
+ out->look.name = to_utf8_if_nonempty (in->ts->table_look, encoding);
/* Print settings. */
- out->print_all_layers = in->ps->all_layers;
- out->paginate_layers = in->ps->paginate_layers;
- out->shrink_to_fit[TABLE_HORZ] = in->ps->fit_width;
- out->shrink_to_fit[TABLE_VERT] = in->ps->fit_length;
- out->top_continuation = in->ps->top_continuation;
- out->bottom_continuation = in->ps->bottom_continuation;
- out->continuation = xstrdup (in->ps->continuation_string);
- out->n_orphan_lines = in->ps->n_orphan_lines;
+ out->look.print_all_layers = in->ps->all_layers;
+ out->look.paginate_layers = in->ps->paginate_layers;
+ out->look.shrink_to_fit[TABLE_HORZ] = in->ps->fit_width;
+ out->look.shrink_to_fit[TABLE_VERT] = in->ps->fit_length;
+ out->look.top_continuation = in->ps->top_continuation;
+ out->look.bottom_continuation = in->ps->bottom_continuation;
+ out->look.continuation = xstrdup (in->ps->continuation_string);
+ out->look.n_orphan_lines = in->ps->n_orphan_lines;
/* Format settings. */
out->epoch = in->formats->y0->epoch;
/* Styles. */
for (size_t i = 0; i < PIVOT_N_AREAS; i++)
{
- error = decode_spvlb_area (in->areas->areas[i], &out->areas[i],
+ error = decode_spvlb_area (in->areas->areas[i], &out->look.areas[i],
encoding);
if (error)
goto error;
/* Dimensions. */
out->n_dimensions = in->dimensions->n_dims;
- out->dimensions = xcalloc (out->n_dimensions, sizeof *out->dimensions);
+ out->dimensions = XCALLOC (out->n_dimensions, struct pivot_dimension *);
for (size_t i = 0; i < out->n_dimensions; i++)
{
error = decode_spvlb_dimension (out, in->dimensions->dims[i],