-struct table *table_unshare (struct table *);
-
-/* Returns the number of columns or rows, respectively, in T. */
-static inline int table_nc (const struct table *t)
- { return t->n[TABLE_HORZ]; }
-static inline int table_nr (const struct table *t)
- { return t->n[TABLE_VERT]; }
-
-/* Returns the number of left, right, top, or bottom headers, respectively, in
- T. */
-static inline int table_hl (const struct table *t)
- { return t->h[TABLE_HORZ][0]; }
-static inline int table_hr (const struct table *t)
- { return t->h[TABLE_HORZ][1]; }
-static inline int table_ht (const struct table *t)
- { return t->h[TABLE_VERT][0]; }
-static inline int table_hb (const struct table *t)
- { return t->h[TABLE_VERT][1]; }
-
-/* Set headers. */
-void table_set_hl (struct table *, int hl);
-void table_set_hr (struct table *, int hr);
-void table_set_ht (struct table *, int ht);
-void table_set_hb (struct table *, int hb);
-\f
-/* Table classes. */
-
-/* Simple kinds of tables. */
-struct table *table_from_string (unsigned int options, const char *);
-struct table *table_from_string_span (unsigned int options, const char *,
- int colspan, int rowspan);
-struct table *table_from_variables (unsigned int options,
- struct variable **, size_t);
-struct table *table_from_casereader (const struct casereader *,
- size_t column,
- const char *heading,
- const struct fmt_spec *);
-
-/* Combining tables. */
-struct table *table_paste (struct table *, struct table *,
- enum table_axis orientation);
-struct table *table_hpaste (struct table *left, struct table *right);
-struct table *table_vpaste (struct table *top, struct table *bottom);
-
-/* Taking subsets of tables. */
-struct table *table_select (struct table *, int rect[TABLE_N_AXES][2]);
-struct table *table_select_slice (struct table *, enum table_axis,
- int z0, int z1, bool add_headers);
-struct table *table_select_columns (struct table *,
- int x0, int x1, bool add_headers);
-struct table *table_select_rows (struct table *,
- int y0, int y1, bool add_headers);
-
-/* Miscellaneous table operations. */
-struct table *table_transpose (struct table *);
+
+/* Rule masks. */
+#define TAB_RULE_TYPE_MASK 7
+#define TAB_RULE_TYPE_SHIFT 0
+#define TAB_RULE_STYLE_MASK (31 << TAB_RULE_STYLE_SHIFT)
+#define TAB_RULE_STYLE_SHIFT 3
+
+/* Tables. */
+struct table *table_create (int nc, int nr, int hl, int hr, int ht, int hb);
+
+/* Rules. */
+void table_hline (struct table *, int style, int x1, int x2, int y);
+void table_vline (struct table *, int style, int x, int y1, int y2);
+void table_box (struct table *, int f_h, int f_v, int i_h, int i_v,
+ int x1, int y1, int x2, int y2);
+
+/* Cells. */
+void table_text (struct table *, int c, int r, unsigned opt, const char *);
+void table_text_format (struct table *, int c, int r, unsigned opt,
+ const char *, ...)
+ PRINTF_FORMAT (5, 6);
+void table_joint_text (struct table *, int x1, int y1, int x2, int y2,
+ unsigned opt, const char *);
+
+void table_add_subscripts (struct table *, int x, int y,
+ char **subscripts, size_t n_subscripts);
+
+/* Footnotes.
+
+ Use table_create_footnote() to create the footnotes themselves, then use
+ table_add_footnote() to create a reference from a table cell to a footnote.
+ There are two steps because a footnote may have multiple references. */
+struct footnote *table_create_footnote (struct table *, size_t idx,
+ const char *content,
+ const char *marker,
+ struct table_area_style *);
+void table_add_footnote (struct table *, int x, int y, struct footnote *);
+
+void table_add_style (struct table *, int x, int y, struct table_area_style *);
+
+bool table_cell_is_empty (const struct table *, int c, int r);