You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- 02111-1307, USA. */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA. */
#include <config.h>
#include "tab.h"
#include <ctype.h>
-#include <assert.h>
#include <stdarg.h>
#include <limits.h>
#include <stdlib.h>
+#include "error.h"
#include "alloc.h"
#include "command.h"
#include "format.h"
\f
struct som_table_class tab_table_class;
-#if DEBUGGING
-#define DEFFIRST(NAME, LABEL) LABEL,
-#define DEFTAB(NAME, LABEL) LABEL,
-/*
-static const char *tab_names[] =
- {
-#include "tab.def"
- };
-*/
-#undef DEFFIRST
-#undef DEFTAB
-#endif
-
/* Creates a table with NC columns and NR rows. If REALLOCABLE is
nonzero then the table's size can be increased later; otherwise,
its size can only be reduced. */
int mr1 = min (nr, t->nr);
int mc1 = min (nc, t->nc);
- struct len_string *new_cc;
+ struct fixed_string *new_cc;
unsigned char *new_ct;
int r;
tab_headers (struct tab_table *table, int l, int r, int t, int b)
{
assert (table != NULL);
+ assert (l < table->nc);
+ assert (r < table->nc);
+ assert (t < table->nr);
+ assert (b < table->nr);
+
+
table->l = l;
table->r = r;
table->t = t;
the resultant string into S in TABLE's pool. */
static void
text_format (struct tab_table *table, int opt, const char *text, va_list args,
- struct len_string *s)
+ struct fixed_string *s)
{
int len;
else
len = strlen (text);
- ls_create_buffer (table->container, s, text, len);
+ ls_create_buffer (s, text, len);
+ pool_register (table->container, free, s->string);
if (opt & TAT_PRINTF)
local_free (text);
opt |= TAB_JOIN;
{
- struct len_string *cc = &table->cc[x1 + y1 * table->cf];
+ struct fixed_string *cc = &table->cc[x1 + y1 * table->cf];
unsigned char *ct = &table->ct[x1 + y1 * table->cf];
const int ofs = table->cf - (x2 - x1);
/* Sets cell (C,R) in TABLE, with options OPT, to contents STRING. */
void
tab_raw (struct tab_table *table, int c, int r, unsigned opt,
- struct len_string *string)
+ struct fixed_string *string)
{
assert (table != NULL && string != NULL);
void
tab_submit (struct tab_table *t)
{
- struct som_table s;
+ struct som_entity s;
assert (t != NULL);
s.class = &tab_table_class;
s.ext = t;
+ s.type = SOM_TABLE;
som_submit (&s);
tab_destroy (t);
}
/* Set the current table to TABLE. */
static void
-tabi_table (struct som_table *table)
+tabi_table (struct som_entity *table)
{
assert (table != NULL);
+ assert (table->type == SOM_TABLE);
+
t = table->ext;
tab_offset (t, 0, 0);
cp = stpcpy (cp, ". ");
if (!ls_empty_p (&t->title))
{
- memcpy (cp, ls_value (&t->title), ls_length (&t->title));
+ memcpy (cp, ls_c_str (&t->title), ls_length (&t->title));
cp += ls_length (&t->title);
}
*cp = 0;
}
} else {
struct tab_joined_cell *j =
- (struct tab_joined_cell *) ls_value (&t->cc[index]);
+ (struct tab_joined_cell *) ls_c_str (&t->cc[index]);
if (j->hit != tab_hit)
{