table-transpose: Remove.
authorBen Pfaff <blp@cs.stanford.edu>
Wed, 23 Jan 2019 04:27:44 +0000 (20:27 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Wed, 23 Jan 2019 04:29:06 +0000 (20:29 -0800)
This had only only user, which this commit also removes.

src/output/automake.mk
src/output/table-transpose.c [deleted file]
src/output/table.h
tests/output/render-test.c
tests/output/render.at

index 636e9a798052d1c57a40f026183df396c7175fb4..4593ea1172c20bb39c9cbcca9024d55bdf1f0e8b 100644 (file)
@@ -79,7 +79,6 @@ src_output_liboutput_la_SOURCES = \
        src/output/table-paste.c \
        src/output/table-provider.h \
        src/output/table-select.c \
-       src/output/table-transpose.c \
        src/output/table.c \
        src/output/table.h \
        src/output/text-item.c \
diff --git a/src/output/table-transpose.c b/src/output/table-transpose.c
deleted file mode 100644 (file)
index aa617b3..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-/* PSPP - a program for statistical analysis.
-   Copyright (C) 2009, 2011 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation, either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-#include "libpspp/assertion.h"
-#include "libpspp/cast.h"
-#include "output/table-provider.h"
-
-#include "gl/minmax.h"
-#include "gl/xalloc.h"
-
-struct table_transpose
-  {
-    struct table table;
-    struct table *subtable;
-  };
-
-static const struct table_class table_transpose_class;
-
-static struct table_transpose *
-table_transpose_cast (const struct table *table)
-{
-  assert (table->klass == &table_transpose_class);
-  return UP_CAST (table, struct table_transpose, table);
-}
-
-/* Takes ownership of SUBTABLE and returns a new table whose contents are
-   SUBTABLE with rows and columns transposed. */
-struct table *
-table_transpose (struct table *subtable)
-{
-  if (subtable->n[TABLE_HORZ] == subtable->n[TABLE_VERT]
-      && subtable->n[TABLE_HORZ] <= 1)
-    return subtable;
-  else if (subtable->klass == &table_transpose_class)
-    {
-      struct table_transpose *tt = table_transpose_cast (subtable);
-      struct table *table = table_ref (tt->subtable);
-      table_unref (subtable);
-      return table;
-    }
-  else
-    {
-      struct table_transpose *tt;
-      int axis;
-
-      tt = xmalloc (sizeof *tt);
-      table_init (&tt->table, &table_transpose_class);
-      tt->subtable = subtable;
-
-      for (axis = 0; axis < TABLE_N_AXES; axis++)
-        {
-          tt->table.n[axis] = subtable->n[!axis];
-          tt->table.h[axis][0] = subtable->h[!axis][0];
-          tt->table.h[axis][1] = subtable->h[!axis][1];
-        }
-      return &tt->table;
-    }
-}
-
-static void
-table_transpose_destroy (struct table *ti)
-{
-  struct table_transpose *tt = table_transpose_cast (ti);
-  table_unref (tt->subtable);
-  free (tt);
-}
-
-static void
-swap (int *x, int *y)
-{
-  int t = *x;
-  *x = *y;
-  *y = t;
-}
-
-static void
-table_transpose_get_cell (const struct table *ti, int x, int y,
-                          struct table_cell *cell)
-{
-  struct table_transpose *tt = table_transpose_cast (ti);
-  int i;
-
-  table_get_cell (tt->subtable, y, x, cell);
-  for (i = 0; i < 2; i++)
-    swap (&cell->d[TABLE_HORZ][i], &cell->d[TABLE_VERT][i]);
-}
-
-static int
-table_transpose_get_rule (const struct table *ti,
-                          enum table_axis axis,
-                          int x, int y, struct cell_color *color)
-{
-  struct table_transpose *tt = table_transpose_cast (ti);
-  return table_get_rule (tt->subtable, !axis, y, x, color);
-}
-
-static const struct table_class table_transpose_class =
-  {
-    table_transpose_destroy,
-    table_transpose_get_cell,
-    table_transpose_get_rule,
-    NULL,                       /* paste */
-    NULL,                       /* select */
-  };
index 40cae3a22cabaf56e6dbcafc3d07dc83e75262d0..54995600cb1fa2313ebf9103b21a4a74180c2e4d 100644 (file)
@@ -286,7 +286,4 @@ struct table *table_select_columns (struct table *,
 struct table *table_select_rows (struct table *,
                                  int y0, int y1, bool add_headers);
 
-/* Miscellaneous table operations. */
-struct table *table_transpose (struct table *);
-
 #endif /* output/table.h */
index 421b9be0663dd6a2abc8793fba4e2e995e239a99..4c559a53d970d358bffa16ddbe1084a8f9472f77 100644 (file)
@@ -36,9 +36,6 @@
 #include "gl/xalloc.h"
 #include "gl/xvasprintf.h"
 
-/* --transpose: Transpose the table before outputting? */
-static int transpose;
-
 /* --emphasis: ASCII driver emphasis option. */
 static bool bold;
 static bool underline;
@@ -115,8 +112,6 @@ main (int argc, char **argv)
         }
 
       table = tables[n_tables - 1];
-      if (transpose)
-        table = table_transpose (table);
       table_item_submit (table_item_create (table, NULL, NULL));
       free (tables);
     }
@@ -252,7 +247,6 @@ parse_options (int argc, char **argv)
           {"width", required_argument, NULL, OPT_WIDTH},
           {"length", required_argument, NULL, OPT_LENGTH},
           {"min-break", required_argument, NULL, OPT_MIN_BREAK},
-          {"transpose", no_argument, &transpose, 1},
           {"emphasis", required_argument, NULL, OPT_EMPHASIS},
           {"box", required_argument, NULL, OPT_BOX},
           {"draw-mode", no_argument, &draw_mode, 1},
index bc2328063941582ec004ecb4bc8d1e893fc5be7e..e54025560d11a695d9dd27e5c57ed7d15e5c7e0c 100644 (file)
@@ -314,13 +314,48 @@ AT_CLEANUP
 AT_SETUP([3 columns with many joined cells])
 AT_KEYWORDS([render rendering])
 AT_CAPTURE_FILE([input])
-AT_DATA([input], [3 19
-m4_foreach([x], [a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s], [x
-])@1
-m4_for([x], [2], [19], [1], [1*2 @x\nab\ncd
-])@20
+AT_DATA([input], [19 3
+a
+@1
+2*1 @11\nab\ncd
+b
+2*1 @2\nab\ncd
+c
+2*1 @12\nab\ncd
+d
+2*1 @3\nab\ncd
+e
+2*1 @13\nab\ncd
+f
+2*1 @4\nab\ncd
+g
+2*1 @14\nab\ncd
+h
+2*1 @5\nab\ncd
+i
+2*1 @15\nab\ncd
+j
+2*1 @6\nab\ncd
+k
+2*1 @16\nab\ncd
+l
+2*1 @7\nab\ncd
+m
+2*1 @17\nab\ncd
+n
+2*1 @8\nab\ncd
+o
+2*1 @18\nab\ncd
+p
+2*1 @9\nab\ncd
+q
+2*1 @19\nab\ncd
+r
+2*1 @10\nab\ncd
+s
+@20
 ])
-AT_CHECK([render-test --transpose input], [0], [dnl
+AT_CHECK([render-test input], [0], [dnl
  +--+--+
 a| 1|11|
  +--+ab|