zip-writer: Add functions for writing a member over multiple calls.
[pspp] / src / output / spv / spv-legacy-decoder.c
index 09924cf8e0453d6c6e3b6637165221d3db01fa30..b8005de5be890d3412c39090f68c557f58c44a0f 100644 (file)
@@ -203,7 +203,9 @@ spv_map_insert (struct hmap *map, double from, const char *to,
       else
         {
           union value v = { .f = mapping->to.d };
-          mapping->to.s = data_out_stretchy (&v, NULL, format, NULL);
+          mapping->to.s = data_out_stretchy (&v, NULL, format,
+                                             settings_get_fmt_settings (),
+                                             NULL);
           mapping->to.width = strlen (mapping->to.s);
         }
     }
@@ -671,12 +673,12 @@ decode_label_frame (struct pivot_table *table,
   if (lf->label->purpose == SPVDX_PURPOSE_TITLE)
     {
       target = &table->title;
-      area = &table->look.areas[PIVOT_AREA_TITLE];
+      area = &table->look->areas[PIVOT_AREA_TITLE];
     }
   else if (lf->label->purpose == SPVDX_PURPOSE_SUB_TITLE)
     {
       target = &table->caption;
-      area = &table->look.areas[PIVOT_AREA_CAPTION];
+      area = &table->look->areas[PIVOT_AREA_CAPTION];
     }
   else if (lf->label->purpose == SPVDX_PURPOSE_FOOTNOTE)
     {
@@ -684,7 +686,7 @@ decode_label_frame (struct pivot_table *table,
           && lf->label->text[0]->uses_reference != INT_MIN)
         {
           target = NULL;
-          area = &table->look.areas[PIVOT_AREA_FOOTER];
+          area = &table->look->areas[PIVOT_AREA_FOOTER];
         }
       else
         return NULL;
@@ -692,7 +694,7 @@ decode_label_frame (struct pivot_table *table,
   else if (lf->label->purpose == SPVDX_PURPOSE_LAYER)
     {
       target = NULL;
-      area = &table->look.areas[PIVOT_AREA_LAYERS];
+      area = &table->look->areas[PIVOT_AREA_LAYERS];
     }
   else
     return NULL;
@@ -803,7 +805,8 @@ decode_spvdx_source_variable (const struct spvxml_node *node,
             if (label_series->values[i].width < 0)
               {
                 union value v = { .f = label_series->values[i].d };
-                dest = data_out_stretchy (&v, "UTF-8", &s->format, NULL);
+                dest = data_out_stretchy (&v, "UTF-8", &s->format,
+                                          settings_get_fmt_settings (), NULL);
               }
             else
               dest = label_series->values[i].s;
@@ -965,8 +968,8 @@ pivot_value_from_data_value (const struct spv_data_value *data,
               && len == 23
               && data->s[len] == '\0')
             {
-              double date = calendar_gregorian_to_offset (year, month, day,
-                                                          NULL);
+              double date = calendar_gregorian_to_offset (
+                year, month, day, settings_get_fmt_settings (), NULL);
               if (date != SYSMIS)
                 {
                   v->type = PIVOT_VALUE_NUMERIC;
@@ -1081,9 +1084,9 @@ add_dimension (struct spv_series **series, size_t n,
     {
       struct table_area_style *area
         = (axis_type == PIVOT_AXIS_COLUMN
-           ? &table->look.areas[PIVOT_AREA_COLUMN_LABELS]
+           ? &table->look->areas[PIVOT_AREA_COLUMN_LABELS]
            : axis_type == PIVOT_AXIS_ROW
-           ? &table->look.areas[PIVOT_AREA_ROW_LABELS]
+           ? &table->look->areas[PIVOT_AREA_ROW_LABELS]
            : NULL);
       if (area && fl->axis->label)
         {
@@ -1101,7 +1104,7 @@ add_dimension (struct spv_series **series, size_t n,
         decode_spvdx_style_incremental (
           fl2->axis->major_ticks->style,
           fl2->axis->major_ticks->tick_frame_style,
-          &table->look.areas[PIVOT_AREA_ROW_LABELS]);
+          &table->look->areas[PIVOT_AREA_ROW_LABELS]);
     }
 
   const struct spvdx_facet_level *fl3 = find_facet_level (v, base_facet_level);
@@ -1418,8 +1421,8 @@ apply_styles_to_value (struct pivot_table *table,
     {
       if (sf->reset > 0)
         {
-          free (value->footnotes);
-          value->footnotes = NULL;
+          free (value->footnote_indexes);
+          value->footnote_indexes = NULL;
           value->n_footnotes = 0;
         }
 
@@ -1494,9 +1497,9 @@ decode_set_cell_properties__ (struct pivot_table *table,
       /* Sets alt_fg_color and alt_bg_color. */
       struct table_area_style area;
       decode_spvdx_style (labeling, graph, &area);
-      table->look.areas[PIVOT_AREA_DATA].font_style.fg[1]
+      table->look->areas[PIVOT_AREA_DATA].font_style.fg[1]
         = area.font_style.fg[0];
-      table->look.areas[PIVOT_AREA_DATA].font_style.bg[1]
+      table->look->areas[PIVOT_AREA_DATA].font_style.bg[1]
         = area.font_style.bg[0];
       table_area_style_uninit (&area);
     }
@@ -1532,8 +1535,8 @@ decode_set_cell_properties__ (struct pivot_table *table,
             {
               const struct table_area_style *base_area_style
                 = (c->dimension->axis_type == PIVOT_AXIS_ROW
-                   ? &table->look.areas[PIVOT_AREA_ROW_LABELS]
-                   : &table->look.areas[PIVOT_AREA_COLUMN_LABELS]);
+                   ? &table->look->areas[PIVOT_AREA_ROW_LABELS]
+                   : &table->look->areas[PIVOT_AREA_COLUMN_LABELS]);
               apply_styles_to_value (table, c->name, set_format,
                                      base_area_style, major_ticks, frame);
             }
@@ -1626,7 +1629,7 @@ decode_set_cell_properties__ (struct pivot_table *table,
                 goto skip;
             }
           apply_styles_to_value (table, cell->value, set_format,
-                                 &table->look.areas[PIVOT_AREA_DATA],
+                                 &table->look->areas[PIVOT_AREA_DATA],
                                  labeling, interval);
 
         skip: ;
@@ -1697,7 +1700,7 @@ decode_set_cell_properties (struct pivot_table *table, struct hmap *series_map,
               struct pivot_cell *cell;
               HMAP_FOR_EACH (cell, struct pivot_cell, hmap_node, &table->cells)
                 apply_styles_to_value (table, cell->value, set_format,
-                                       &table->look.areas[PIVOT_AREA_DATA],
+                                       &table->look->areas[PIVOT_AREA_DATA],
                                        NULL, NULL);
             }
         }
@@ -1760,7 +1763,9 @@ decode_spvdx_table (const struct spvdx_visualization *v, const char *subtype,
                     struct spv_data *data, struct pivot_table **outp)
 {
   struct pivot_table *table = pivot_table_create__ (NULL, subtype);
+
   pivot_table_set_look (table, look);
+  table->look = pivot_table_look_unshare (table->look);
 
   struct hmap series_map = HMAP_INITIALIZER (series_map);
   struct hmap format_map = HMAP_INITIALIZER (format_map);
@@ -1778,8 +1783,8 @@ decode_spvdx_table (const struct spvdx_visualization *v, const char *subtype,
                   &min_width, &max_width, &n)
           && v->graph->cell_style->width[n] == '\0')
         {
-          table->look.width_ranges[TABLE_HORZ][0] = min_width;
-          table->look.width_ranges[TABLE_HORZ][1] = max_width;
+          table->look->width_ranges[TABLE_HORZ][0] = min_width;
+          table->look->width_ranges[TABLE_HORZ][1] = max_width;
         }
     }
 
@@ -1845,10 +1850,10 @@ decode_spvdx_table (const struct spvdx_visualization *v, const char *subtype,
       }
   if (v->graph->interval->labeling->style)
     {
-      table_area_style_uninit (&table->look.areas[PIVOT_AREA_DATA]);
+      table_area_style_uninit (&table->look->areas[PIVOT_AREA_DATA]);
       decode_spvdx_style (v->graph->interval->labeling->style,
                           v->graph->cell_style,
-                          &table->look.areas[PIVOT_AREA_DATA]);
+                          &table->look->areas[PIVOT_AREA_DATA]);
     }
 
   /* Decode all of the sourceVariable and derivedVariable  */