output: Remove support for bottom and right side headers.
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 22 Jan 2023 00:56:40 +0000 (16:56 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Sat, 28 Jan 2023 18:18:49 +0000 (10:18 -0800)
src/output/html.c
src/output/odt.c
src/output/pivot-output.c
src/output/render.c
src/output/table.c
src/output/table.h
src/output/tex.c

index 6c5348a871df9f2a959bfda4d1b7d10d4f311043..b864920cd5e92e2a2d9a2b5abe6cc1b6b7e67a2f 100644 (file)
@@ -673,10 +673,10 @@ html_output_table_layer (struct html_driver *html, const struct pivot_table *pt,
           table_get_cell (body, x, y, &cell);
           if (x == cell.d[TABLE_HORZ][0] && y == cell.d[TABLE_VERT][0])
             {
-              bool is_header = (y < body->h[V][0]
-                                || y >= body->n[V] - body->h[V][1]
-                                || x < body->h[H][0]
-                                || x >= body->n[H] - body->h[H][1]);
+              bool is_header = (y < body->h[V]
+                                || y >= body->n[V]
+                                || x < body->h[H]
+                                || x >= body->n[H]);
               const char *tag = is_header ? "th" : "td";
               html_put_table_cell (html, pt, &cell, tag, body);
             }
index abb30cb530c7c1c85b3edd46afdd825fbe573fe6..923552863bdcb80645e84c5017d736e6f05054d8 100644 (file)
@@ -495,7 +495,7 @@ write_table_layer (struct odt_driver *odt, const struct pivot_table *pt,
 
 
   /* Deal with row headers */
-  if (body->h[V][0] > 0)
+  if (body->h[V] > 0)
     xmlTextWriterStartElement (odt->content_wtr, _xml("table:table-header-rows"));
 
 
@@ -532,7 +532,7 @@ write_table_layer (struct odt_driver *odt, const struct pivot_table *pt,
 
               xmlTextWriterStartElement (odt->content_wtr, _xml("text:p"));
 
-              if (r < body->h[V][0] || c < body->h[H][0])
+              if (r < body->h[V] || c < body->h[H])
                 xmlTextWriterWriteAttribute (odt->content_wtr, _xml("text:style-name"), _xml("Table_20_Heading"));
               else
                 xmlTextWriterWriteAttribute (odt->content_wtr, _xml("text:style-name"), _xml("Table_20_Contents"));
@@ -551,7 +551,7 @@ write_table_layer (struct odt_driver *odt, const struct pivot_table *pt,
 
       xmlTextWriterEndElement (odt->content_wtr); /* row */
 
-      int ht = body->h[V][0];
+      int ht = body->h[V];
       if (ht > 0 && r == ht - 1)
        xmlTextWriterEndElement (odt->content_wtr); /* table-header-rows */
     }
index 3666ffbcee00b0c88df8b1f8743cff77b094e1f0..6d5d8b015cdd1b2fcce5c47ac4a166491992fe74 100644 (file)
@@ -358,7 +358,7 @@ static struct table *
 create_aux_table (const struct pivot_table *pt, int nc, int nr,
                   int style_idx)
 {
-  struct table *table = table_create (nc, nr, 0, 0, 0, 0);
+  struct table *table = table_create (nc, nr, 0, 0);
   table->styles[style_idx] = table_area_style_override (
       table->container, &pt->look->areas[style_idx], NULL, NULL, false);
   return table;
@@ -518,7 +518,7 @@ pivot_output (const struct pivot_table *pt,
   };
   struct table *body = table_create (data[H] + stub[H],
                                      data[V] + stub[V],
-                                     stub[H], 0, stub[V], 0);
+                                     stub[H], stub[V]);
   for (size_t i = 0; i < PIVOT_N_AREAS; i++)
     body->styles[i] = table_area_style_override (
       body->container, &pt->look->areas[i], NULL, NULL, false);
index 76f5017fa322d3e859e99df394cc82f33d4a3863..aae6f7901fc8c76131554f1cd7ec56479e4f04af 100644 (file)
@@ -58,16 +58,16 @@ struct render_page
 
     /* Region of 'table' to render.
 
-       The horizontal cells rendered are the leftmost h[H][0], then
-       r[H][0] through r[H][1], exclusive, then the rightmost h[H][1].
+       The horizontal cells rendered are the leftmost h[H], then
+       r[H] through r[H][1].
 
-       The vertical cells rendered are the topmost h[V][0], then r[V][0]
-       through r[V][1], exclusive, then the bottommost h[V][1].
+       The vertical cells rendered are the topmost h[V], then r[V][0]
+       through r[V][1].
 
-       n[H] = h[H][0] + (r[H][1] - r[H][0]) + h[H][1]
-       n[V] = h[V][0] + (r[V][1] - r[V][0]) + h[V][1]
+       n[H] = h[H] + (r[H][1] - r[H][0])
+       n[V] = h[V] + (r[V][1] - r[V][0])
     */
-    int h[TABLE_N_AXES][2];
+    int h[TABLE_N_AXES];
     int r[TABLE_N_AXES][2];
     int n[TABLE_N_AXES];
 
@@ -128,20 +128,6 @@ struct render_page
        When is_edge_cutoff is true for a given edge, the 'overflows' hmap will
        contain a node for each cell along that edge. */
     bool is_edge_cutoff[TABLE_N_AXES][2];
-
-    /* If part of a joined cell would be cut off by breaking a table along
-       'axis' at the rule with offset 'z' (where 0 <= z <= n[axis]), then
-       join_crossing[axis][z] is the thickness of the rule that would be cut
-       off.
-
-       This is used to know to allocate extra space for breaking at such a
-       position, so that part of the cell's content is not lost.
-
-       This affects breaking a table only when headers are present.  When
-       headers are not present, the rule's thickness is used for cell content,
-       so no part of the cell's content is lost (and in fact it is duplicated
-       across both pages). */
-    int *join_crossing[TABLE_N_AXES];
   };
 
 static struct render_page *render_page_create (const struct render_params *,
@@ -200,12 +186,7 @@ table_width (const struct render_page *page, int axis)
 static int
 headers_width (const struct render_page *page, int axis)
 {
-  int h0 = page->h[axis][0];
-  int w0 = axis_width (page, axis, rule_ofs (0), cell_ofs (h0));
-  int n = page->n[axis];
-  int h1 = page->h[axis][1];
-  int w1 = axis_width (page, axis, rule_ofs_r (page, axis, h1), cell_ofs (n));
-  return w0 + w1;
+  return axis_width (page, axis, rule_ofs (0), cell_ofs (page->h[axis]));
 }
 
 /* Returns the width of cell X along AXIS in PAGE. */
@@ -242,9 +223,8 @@ joined_width (const struct render_page *page, int axis, int x0, int x1)
 static int
 max_cell_width (const struct render_page *page, int axis)
 {
-  int n = page->n[axis];
-  int x0 = page->h[axis][0];
-  int x1 = n - page->h[axis][1];
+  int x0 = page->h[axis];
+  int x1 = page->n[axis];
 
   int max = 0;
   for (int x = x0; x < x1; x++)
@@ -514,10 +494,7 @@ render_page_allocate__ (const struct render_params *params,
   page->n[V] = n[V];
 
   for (int i = 0; i < TABLE_N_AXES; i++)
-    {
-      page->cp[i] = xcalloc ((2 * n[i] + 2) , sizeof *page->cp[i]);
-      page->join_crossing[i] = xcalloc ((n[i] + 1) , sizeof *page->join_crossing[i]);
-    }
+    page->cp[i] = xcalloc ((2 * n[i] + 2) , sizeof *page->cp[i]);
 
   hmap_init (&page->overflows);
   memset (page->is_edge_cutoff, 0, sizeof page->is_edge_cutoff);
@@ -534,10 +511,9 @@ render_page_allocate (const struct render_params *params, struct table *table)
   struct render_page *page = render_page_allocate__ (params, table, table->n);
   for (enum table_axis a = 0; a < TABLE_N_AXES; a++)
     {
-      page->h[a][0] = table->h[a][0];
-      page->h[a][1] = table->h[a][1];
-      page->r[a][0] = table->h[a][0];
-      page->r[a][1] = table->n[a] - table->h[a][1];
+      page->h[a] = table->h[a];
+      page->r[a][0] = table->h[a];
+      page->r[a][1] = table->n[a];
     }
   return page;
 }
@@ -600,14 +576,6 @@ create_page_with_interpolated_widths (const struct render_params *params,
   return page;
 }
 \f
-static void
-set_join_crossings (struct render_page *page, enum table_axis axis,
-                    const struct table_cell *cell, int *rules)
-{
-  for (int z = cell->d[axis][0] + 1; z <= cell->d[axis][1] - 1; z++)
-    page->join_crossing[axis][z] = rules[z];
-}
-
 /* Maps a contiguous range of cells from a page to the underlying table along
    the horizontal or vertical dimension. */
 struct map
@@ -623,24 +591,19 @@ static void
 get_map (const struct render_page *page, enum table_axis a, int z,
          struct map *m)
 {
-  if (z < page->h[a][0])
+  if (z < page->h[a])
     {
       m->p0 = 0;
       m->t0 = 0;
-      m->n = page->h[a][0];
+      m->n = page->h[a];
     }
-  else if (z < page->n[a] - page->h[a][1])
+  else
     {
-      m->p0 = page->h[a][0];
+      assert (z < page->n[a]);
+      m->p0 = page->h[a];
       m->t0 = page->r[a][0];
       m->n = page->r[a][1] - page->r[a][0];
     }
-  else
-    {
-      m->p0 = page->n[a] - page->h[a][1];
-      m->t0 = page->table->n[a] - page->table->h[a][1];
-      m->n = page->h[a][1];
-    }
 }
 
 /* Initializes CELL with the contents of the table cell at column X and row Y
@@ -799,21 +762,13 @@ render_page_create (const struct render_params *params, struct table *table,
         struct table_cell cell;
 
         render_get_cell (page, x, y, &cell);
-        if (y == cell.d[V][0])
+        if (y == cell.d[V][0] && table_cell_rowspan (&cell) == 1)
           {
-            if (table_cell_rowspan (&cell) == 1)
-              {
-                int w = joined_width (page, H, cell.d[H][0], cell.d[H][1]);
-                int h = params->ops->measure_cell_height (params->aux,
-                                                          &cell, w);
-                if (h > r->unspanned)
-                  r->unspanned = r->width = h;
-              }
-            else
-              set_join_crossings (page, V, &cell, rules[V]);
-
-            if (table_cell_colspan (&cell) > 1)
-              set_join_crossings (page, H, &cell, rules[H]);
+            int w = joined_width (page, H, cell.d[H][0], cell.d[H][1]);
+            int h = params->ops->measure_cell_height (params->aux,
+                                                      &cell, w);
+            if (h > r->unspanned)
+              r->unspanned = r->width = h;
           }
         x = cell.d[H][1];
       }
@@ -848,7 +803,7 @@ render_page_create (const struct render_params *params, struct table *table,
       if (hw * 2 >= page->params->size[axis]
           || hw + max_cell_width (page, axis) > page->params->size[axis])
         {
-          page->h[axis][0] = page->h[axis][1] = 0;
+          page->h[axis] = 0;
           page->r[axis][0] = 0;
           page->r[axis][1] = page->n[axis];
         }
@@ -885,10 +840,7 @@ render_page_unref (struct render_page *page)
       table_unref (page->table);
 
       for (int i = 0; i < TABLE_N_AXES; ++i)
-       {
-         free (page->join_crossing[i]);
-         free (page->cp[i]);
-       }
+        free (page->cp[i]);
 
       free (page);
     }
@@ -930,19 +882,14 @@ get_rule (const struct render_page *page, enum table_axis axis,
   int d2 = -1;
 
   enum table_axis a = axis;
-  if (d[a] < page->h[a][0])
+  if (d[a] < page->h[a])
     /* Nothing to do */;
-  else if (d[a] <= page->n[a] - page->h[a][1])
+  else if (d[a] <= page->n[a])
     {
-      if (page->h[a][0] && d[a] == page->h[a][0])
-        d2 = page->h[a][0];
-      else if (page->h[a][1] && d[a] == page->n[a] - page->h[a][1])
-        d2 = page->table->n[a] - page->h[a][1];
-      d[a] += page->r[a][0] - page->h[a][0];
+      if (page->h[a] && d[a] == page->h[a])
+        d2 = page->h[a];
+      d[a] += page->r[a][0] - page->h[a];
     }
-  else
-    d[a] += ((page->table->n[a] - page->table->h[a][1])
-             - (page->n[a] - page->h[a][1]));
 
   enum table_axis b = !axis;
   struct map m;
@@ -1123,10 +1070,9 @@ render_cell (const struct render_page *page, const int ofs[TABLE_N_AXES],
       spill[axis][1] = rule_width (page, axis, cell->d[axis][1]) / 2;
     }
 
-  int color_idx = (cell->d[V][0] < page->h[V][0]
-                   || page->n[V] - (cell->d[V][0] + 1) < page->h[V][1]
+  int color_idx = (cell->d[V][0] < page->h[V]
                    ? 0
-                   : (cell->d[V][0] - page->h[V][0]) & 1);
+                   : (cell->d[V][0] - page->h[V]) & 1);
   page->params->ops->draw_cell (page->params->aux, cell, color_idx,
                                 bb, valign_offset, spill, clip);
 }
@@ -1266,7 +1212,7 @@ render_break_init (struct render_break *b, struct render_page *page,
 {
   b->page = page;
   b->axis = axis;
-  b->z = page->h[axis][0];
+  b->z = page->h[axis];
   b->pixel = 0;
   b->hw = headers_width (page, axis);
 }
@@ -1302,7 +1248,7 @@ render_break_has_next (const struct render_break *b)
   const struct render_page *page = b->page;
   enum table_axis axis = b->axis;
 
-  return page != NULL && b->z < page->n[axis] - page->h[axis][1];
+  return page != NULL && b->z < page->n[axis];
 }
 
 /* Returns a new render_page that is up to SIZE pixels wide along B's axis.
@@ -1322,7 +1268,7 @@ render_break_next (struct render_break *b, int size)
 
   int pixel = 0;
   int z;
-  for (z = b->z; z < page->n[axis] - page->h[axis][1]; z++)
+  for (z = b->z; z < page->n[axis]; z++)
     {
       int needed = needed_size (b, z + 1);
       if (needed > size)
@@ -1336,9 +1282,7 @@ render_break_next (struct render_break *b, int size)
                  cell.
 
                  This is similar to code for the left side in needed_size(). */
-              int rule_allowance = (page->h[axis][1]
-                                    ? 0
-                                    : rule_width (page, axis, z));
+              int rule_allowance = rule_width (page, axis, z);
 
               /* The amount that, if we added cell 'z', the rendering would
                  overfill the allocated 'size'. */
@@ -1423,7 +1367,7 @@ needed_size (const struct render_break *b, int cell)
   enum table_axis axis = b->axis;
 
   /* Width of left header not including its rightmost rule.  */
-  int size = axis_width (page, axis, 0, rule_ofs (page->h[axis][0]));
+  int size = axis_width (page, axis, 0, rule_ofs (page->h[axis]));
 
   /* If we have a pixel offset and there is no left header, then we omit the
      leftmost rule of the body.  Otherwise the rendering is deceptive because
@@ -1433,24 +1377,15 @@ needed_size (const struct render_break *b, int cell)
      rightmost rule in the header and the leftmost rule in the body.  We assume
      that the width of a merged rule is the larger of the widths of either rule
      invidiually. */
-  if (b->pixel == 0 || page->h[axis][0])
-    size += MAX (rule_width (page, axis, page->h[axis][0]),
+  if (b->pixel == 0 || page->h[axis])
+    size += MAX (rule_width (page, axis, page->h[axis]),
                  rule_width (page, axis, b->z));
 
   /* Width of body, minus any pixel offset in the leftmost cell. */
   size += joined_width (page, axis, b->z, cell) - b->pixel;
 
   /* Width of rightmost rule in body merged with leftmost rule in headers. */
-  size += MAX (rule_width_r (page, axis, page->h[axis][1]),
-               rule_width (page, axis, cell));
-
-  /* Width of right header not including its leftmost rule. */
-  size += axis_width (page, axis, rule_ofs_r (page, axis, page->h[axis][1]),
-                      rule_ofs_r (page, axis, 0));
-
-  /* Join crossing. */
-  if (page->h[axis][0] && page->h[axis][1])
-    size += page->join_crossing[axis][b->z];
+  size += MAX (rule_width_r (page, axis, 0), rule_width (page, axis, cell));
 
   return size;
 }
@@ -1763,8 +1698,7 @@ render_page_select (const struct render_page *page, enum table_axis axis,
 
   /* Optimize case where all of PAGE is selected by just incrementing the
      reference count. */
-  if (z0 == page->h[a][0] && p0 == 0
-      && z1 == page->n[a] - page->h[a][1] && p1 == 0)
+  if (z0 == page->h[a] && p0 == 0 && z1 == page->n[a] && p1 == 0)
     {
       struct render_page *page_rw = CONST_CAST (struct render_page *, page);
       page_rw->ref_cnt++;
@@ -1772,15 +1706,14 @@ render_page_select (const struct render_page *page, enum table_axis axis,
     }
 
   /* Allocate subpage. */
-  int trim[2] = { z0 - page->h[a][0], (page->n[a] - page->h[a][1]) - z1 };
+  int trim[2] = { z0 - page->h[a], page->n[a] - z1 };
   int n[TABLE_N_AXES] = { [H] = page->n[H], [V] = page->n[V] };
   n[a] -= trim[0] + trim[1];
   struct render_page *subpage = render_page_allocate__ (
     page->params, table_ref (page->table), n);
   for (enum table_axis k = 0; k < TABLE_N_AXES; k++)
     {
-      subpage->h[k][0] = page->h[k][0];
-      subpage->h[k][1] = page->h[k][1];
+      subpage->h[k] = page->h[k];
       subpage->r[k][0] = page->r[k][0];
       subpage->r[k][1] = page->r[k][1];
     }
@@ -1790,31 +1723,17 @@ render_page_select (const struct render_page *page, enum table_axis axis,
   /* An edge is cut off if it was cut off in PAGE or if we're trimming pixels
      off that side of the page and there are no headers. */
   subpage->is_edge_cutoff[a][0] =
-    subpage->h[a][0] == 0 && (p0 || (z0 == 0 && page->is_edge_cutoff[a][0]));
+    subpage->h[a] == 0 && (p0 || (z0 == 0 && page->is_edge_cutoff[a][0]));
   subpage->is_edge_cutoff[a][1] =
-    subpage->h[a][1] == 0 && (p1 || (z1 == page->n[a]
-                                     && page->is_edge_cutoff[a][1]));
+    p1 || (z1 == page->n[a] && page->is_edge_cutoff[a][1]);
   subpage->is_edge_cutoff[b][0] = page->is_edge_cutoff[b][0];
   subpage->is_edge_cutoff[b][1] = page->is_edge_cutoff[b][1];
 
-  /* Select join crossings from PAGE into subpage. */
-  int *jc = subpage->join_crossing[a];
-  for (int z = 0; z < page->h[a][0]; z++)
-    *jc++ = page->join_crossing[a][z];
-  for (int z = z0; z <= z1; z++)
-    *jc++ = page->join_crossing[a][z];
-  for (int z = page->n[a] - page->h[a][1]; z < page->n[a]; z++)
-    *jc++ = page->join_crossing[a][z];
-  assert (jc == &subpage->join_crossing[a][subpage->n[a] + 1]);
-
-  memcpy (subpage->join_crossing[b], page->join_crossing[b],
-          (subpage->n[b] + 1) * sizeof **subpage->join_crossing);
-
   /* Select widths from PAGE into subpage. */
   int *scp = page->cp[a];
   int *dcp = subpage->cp[a];
   *dcp = 0;
-  for (int z = 0; z <= rule_ofs (subpage->h[a][0]); z++, dcp++)
+  for (int z = 0; z <= rule_ofs (subpage->h[a]); z++, dcp++)
     {
       int w = !z && subpage->is_edge_cutoff[a][0] ? 0 : scp[z + 1] - scp[z];
       dcp[1] = dcp[0] + w;
@@ -1823,15 +1742,11 @@ render_page_select (const struct render_page *page, enum table_axis axis,
     {
       dcp[1] = dcp[0] + (scp[z + 1] - scp[z]);
       if (z == cell_ofs (z0))
-        {
-          dcp[1] -= p0;
-          if (page->h[a][0] && page->h[a][1])
-            dcp[1] += page->join_crossing[a][z / 2];
-        }
+        dcp[1] -= p0;
       if (z == cell_ofs (z1 - 1))
         dcp[1] -= p1;
     }
-  for (int z = rule_ofs_r (page, a, subpage->h[a][1]);
+  for (int z = rule_ofs_r (page, a, 0);
        z <= rule_ofs_r (page, a, 0); z++, dcp++)
     {
       if (z == rule_ofs_r (page, a, 0) && subpage->is_edge_cutoff[a][1])
@@ -1856,7 +1771,7 @@ render_page_select (const struct render_page *page, enum table_axis axis,
     .subpage = subpage,
   };
 
-  if (!page->h[a][0] || z0 > page->h[a][0] || p0)
+  if (!page->h[a] || z0 > page->h[a] || p0)
     for (int z = 0; z < page->n[b];)
       {
         int d[TABLE_N_AXES];
@@ -1872,43 +1787,33 @@ render_page_select (const struct render_page *page, enum table_axis axis,
             struct render_overflow *ro = insert_overflow (&s, &cell);
 
             if (overflow0)
-              {
-                ro->overflow[a][0] += p0 + axis_width (
-                  page, a, cell_ofs (cell.d[a][0]), cell_ofs (z0));
-                if (page->h[a][0] && page->h[a][1])
-                  ro->overflow[a][0] -= page->join_crossing[a][cell.d[a][0]
-                                                               + 1];
-              }
+              ro->overflow[a][0] += p0 + axis_width (
+                page, a, cell_ofs (cell.d[a][0]), cell_ofs (z0));
 
             if (overflow1)
-              {
-                ro->overflow[a][1] += p1 + axis_width (
-                  page, a, cell_ofs (z1), cell_ofs (cell.d[a][1]));
-                if (page->h[a][0] && page->h[a][1])
-                  ro->overflow[a][1] -= page->join_crossing[a][cell.d[a][1]];
-              }
+              ro->overflow[a][1] += p1 + axis_width (
+                page, a, cell_ofs (z1), cell_ofs (cell.d[a][1]));
           }
         z = cell.d[b][1];
       }
 
-  if (!page->h[a][1] || z1 < page->n[a] - page->h[a][1] || p1)
-    for (int z = 0; z < page->n[b];)
-      {
-        int d[TABLE_N_AXES];
-        d[a] = z1 - 1;
-        d[b] = z;
+  for (int z = 0; z < page->n[b];)
+    {
+      int d[TABLE_N_AXES];
+      d[a] = z1 - 1;
+      d[b] = z;
 
-        struct table_cell cell;
-        render_get_cell (page, d[H], d[V], &cell);
-        if ((cell.d[a][1] > z1 || (cell.d[a][1] == z1 && p1))
-            && find_overflow_for_cell (&s, &cell) == NULL)
-          {
-            struct render_overflow *ro = insert_overflow (&s, &cell);
-            ro->overflow[a][1] += p1 + axis_width (page, a, cell_ofs (z1),
-                                                   cell_ofs (cell.d[a][1]));
-          }
-        z = cell.d[b][1];
-      }
+      struct table_cell cell;
+      render_get_cell (page, d[H], d[V], &cell);
+      if ((cell.d[a][1] > z1 || (cell.d[a][1] == z1 && p1))
+          && find_overflow_for_cell (&s, &cell) == NULL)
+        {
+          struct render_overflow *ro = insert_overflow (&s, &cell);
+          ro->overflow[a][1] += p1 + axis_width (page, a, cell_ofs (z1),
+                                                 cell_ofs (cell.d[a][1]));
+        }
+      z = cell.d[b][1];
+    }
 
   /* Copy overflows from PAGE into subpage. */
   struct render_overflow *ro;
@@ -1936,7 +1841,7 @@ cell_to_subpage (struct render_page_selection *s,
 {
   enum table_axis a = s->a;
   enum table_axis b = s->b;
-  int ha0 = s->subpage->h[a][0];
+  int ha0 = s->subpage->h[a];
 
   subcell[a] = MAX (cell->d[a][0] - s->z0 + ha0, ha0);
   subcell[b] = cell->d[b][0];
index 97a2793c55ea728c2cbe72cb6705469c8cf34f1c..3d07eb40d47563b27c059ee36d0473ce94d85c47 100644 (file)
@@ -249,20 +249,20 @@ cell_style_dump (const struct cell_style *c)
    header rows or columns.
 
    Sets the number of header rows on each side of TABLE to HL on the
-   left, HR on the right, HT on the top, HB on the bottom.  Header rows
+   left, HT on the top.  Header rows
    are repeated when a table is broken across multiple columns or
    multiple pages.
 
    The table's cells are initially empty. */
 struct table *
-table_create (int nc, int nr, int hl, int hr, int ht, int hb)
+table_create (int nc, int nr, int hl, int ht)
 {
   struct pool *pool = pool_create ();
   struct table *t = pool_alloc (pool, sizeof *t);
   *t = (struct table) {
     .container = pool,
     .n = { [H] = nc, [V] = nr },
-    .h = { [H] = { hl, hr }, [V] = { ht, hb } },
+    .h = { [H] = hl, [V] = ht },
     .ref_cnt = 1,
     .cc = pool_calloc (pool, nr * nc, sizeof *t->cc),
     .cp = pool_calloc (pool, nr * nc, sizeof *t->cp),
index 1fe78d8e767ab2e69bd636a643cfb3737d76b439..42bdf299e73605efe37d4f8a253ee4839db8ebb4 100644 (file)
@@ -205,11 +205,9 @@ struct table
        broken across more than one page for output, headers rows and columns
        are repeated on each page.
 
-       h[TABLE_HORZ][0]: Left header columns.
-       h[TABLE_HORZ][1]: Right header columns.
-       h[TABLE_VERT][0]: Top header rows.
-       h[TABLE_VERT][1]: Bottom header rows. */
-    int h[TABLE_N_AXES][2];
+       h[TABLE_HORZ]: Left header columns.
+       h[TABLE_VERT]: Top header rows. */
+    int h[TABLE_N_AXES];
 
     /* Reference count.  A table may be shared between multiple owners,
        indicated by a reference count greater than 1.  When this is the case,
@@ -239,7 +237,7 @@ void table_unref (struct table *);
 bool table_is_shared (const struct table *);
 
 /* Tables. */
-struct table *table_create (int nc, int nr, int hl, int hr, int ht, int hb);
+struct table *table_create (int nc, int nr, int hl, int ht);
 
 /* Rules. */
 void table_hline (struct table *, int style, int x1, int x2, int y);
index de111ec13f47b74177b0a48aed47046a59053e39..cbfaa13618edcac4a9525ceb7adba2e1e0286c8e 100644 (file)
@@ -501,7 +501,7 @@ tex_output_table_layer (struct tex_driver *tex, const struct pivot_table *pt,
   for (int y = 0; y < body->n[V]; y++)
     {
       enum { H = TABLE_HORZ, V = TABLE_VERT };
-      bool is_column_header = y < body->h[V][0] || y >= body->n[V] - body->h[V][1];
+      bool is_column_header = y < body->h[V] || y >= body->n[V];
       int prev_x = -1;
       int skipped = 0;
       for (int x = 0; x < body->n[H];)