-void
-tab_set_format (struct tab_table *t, enum result_class rc,
- const struct fmt_spec *fmt)
-{
- t->fmtmap[rc] = *fmt;
-}
-
-
-/* Sets the width and height of a table, in columns and rows,
- respectively. Use only to reduce the size of a table, since it
- does not change the amount of allocated memory.
-
- This function is obsolete. Please do not add new uses of it. (Instead, use
- table_select() or one of its helper functions.) */
-void
-tab_resize (struct tab_table *t, int nc, int nr)
-{
- if (nc != -1)
- {
- assert (nc + t->col_ofs <= t->cf);
- table_set_nc (&t->table, nc + t->col_ofs);
- }
- if (nr != -1)
- {
- assert (nr + t->row_ofs <= tab_nr (t));
- table_set_nr (&t->table, nr + t->row_ofs);
- }
-}
-
-/* Changes either or both dimensions of a table and reallocates memory as
- necessary.
-
- This function is obsolete. Please do not add new uses of it. (Instead, use
- table_paste() or one of its helper functions to paste multiple tables
- together into a larger one.) */
-void
-tab_realloc (struct tab_table *t, int nc, int nr)
-{
- int ro, co;
-
- ro = t->row_ofs;
- co = t->col_ofs;
- if (ro || co)
- tab_offset (t, 0, 0);
-
- if (nc == -1)
- nc = tab_nc (t);
- if (nr == -1)
- nr = tab_nr (t);
-
- assert (nc == tab_nc (t));
-
- if (nc > t->cf)
- {
- int mr1 = MIN (nr, tab_nr (t));
- int mc1 = MIN (nc, tab_nc (t));
-
- void **new_cc;
- unsigned short *new_ct;
- int r;
-
- new_cc = pool_calloc (t->container, nr * nc, sizeof *new_cc);
- new_ct = pool_malloc (t->container, nr * nc);
- for (r = 0; r < mr1; r++)
- {
- memcpy (&new_cc[r * nc], &t->cc[r * tab_nc (t)],
- mc1 * sizeof *t->cc);
- memcpy (&new_ct[r * nc], &t->ct[r * tab_nc (t)],
- mc1 * sizeof *t->ct);
- memset (&new_ct[r * nc + tab_nc (t)], 0, nc - tab_nc (t));
- }
- pool_free (t->container, t->cc);
- pool_free (t->container, t->ct);
- t->cc = new_cc;
- t->ct = new_ct;
- t->cf = nc;
- }
- else if (nr != tab_nr (t))
- {
- t->cc = pool_nrealloc (t->container, t->cc, nr * nc, sizeof *t->cc);
- t->ct = pool_nrealloc (t->container, t->ct, nr * nc, sizeof *t->ct);
-
- t->rh = pool_nrealloc (t->container, t->rh, nc, nr + 1);
- t->rv = pool_nrealloc (t->container, t->rv, nr, nc + 1);
-
- if (nr > tab_nr (t))
- {
- memset (&t->rh[nc * (tab_nr (t) + 1)], TAL_0,
- (nr - tab_nr (t)) * nc);
- memset (&t->rv[(nc + 1) * tab_nr (t)], TAL_0,
- (nr - tab_nr (t)) * (nc + 1));
- }
- }
-
- memset (&t->ct[nc * tab_nr (t)], 0, nc * (nr - tab_nr (t)) * sizeof *t->ct);
- memset (&t->cc[nc * tab_nr (t)], 0, nc * (nr - tab_nr (t)) * sizeof *t->cc);
-
- table_set_nr (&t->table, nr);
- table_set_nc (&t->table, nc);
-
- if (ro || co)
- tab_offset (t, co, ro);
-}
-