table_set_nr (&t->table, nr);
t->title = NULL;
+ t->caption = NULL;
t->cf = nc;
t->cc = pool_calloc (t->container, nr * nc, sizeof *t->cc);
t->ct = pool_malloc (t->container, nr * nc);
va_end (args);
}
+/* Set the caption of table T to CAPTION, which is formatted as if
+ passed to printf(). */
+void
+tab_caption (struct tab_table *t, const char *caption, ...)
+{
+ va_list args;
+
+ free (t->caption);
+ va_start (args, caption);
+ t->caption = xvasprintf (caption, args);
+ va_end (args);
+}
+
/* Easy, type-safe way to submit a tab table to som. */
void
tab_submit (struct tab_table *t)
{
- table_item_submit (table_item_create (&t->table, t->title));
+ table_item_submit (table_item_create (&t->table, t->title, t->caption));
}
\f
/* Editing. */
struct tab_table *t = tab_cast (table);
free (t->title);
t->title = NULL;
+ free (t->caption);
+ t->caption = NULL;
pool_destroy (t->container);
}