projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed bugs #11722 and #11676
[pspp]
/
src
/
tab.c
diff --git
a/src/tab.c
b/src/tab.c
index 118a77cd68df7f26b84af4c32b55a836c3d9a250..201f0d8221c45f29c3c96391577299561a0dc242 100644
(file)
--- a/
src/tab.c
+++ b/
src/tab.c
@@
-20,10
+20,10
@@
#include <config.h>
#include "tab.h"
#include <ctype.h>
#include <config.h>
#include "tab.h"
#include <ctype.h>
-#include <assert.h>
#include <stdarg.h>
#include <limits.h>
#include <stdlib.h>
#include <stdarg.h>
#include <limits.h>
#include <stdlib.h>
+#include "error.h"
#include "alloc.h"
#include "command.h"
#include "format.h"
#include "alloc.h"
#include "command.h"
#include "format.h"
@@
-38,19
+38,6
@@
\f
struct som_table_class tab_table_class;
\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. */
/* 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. */
@@
-223,6
+210,12
@@
void
tab_headers (struct tab_table *table, int l, int r, int t, int b)
{
assert (table != NULL);
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;
table->l = l;
table->r = r;
table->t = t;
@@
-433,7
+426,8
@@
text_format (struct tab_table *table, int opt, const char *text, va_list args,
else
len = strlen (text);
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);
if (opt & TAT_PRINTF)
local_free (text);
@@
-874,11
+868,12
@@
tab_flags (struct tab_table *t, unsigned flags)
void
tab_submit (struct tab_table *t)
{
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;
assert (t != NULL);
s.class = &tab_table_class;
s.ext = t;
+ s.type = SOM_TABLE;
som_submit (&s);
tab_destroy (t);
}
som_submit (&s);
tab_destroy (t);
}
@@
-933,9
+928,11
@@
int tab_hit;
/* Set the current table to TABLE. */
static void
/* 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 != NULL);
+ assert (table->type == SOM_TABLE);
+
t = table->ext;
tab_offset (t, 0, 0);
t = table->ext;
tab_offset (t, 0, 0);
@@
-1162,7
+1159,7
@@
tabi_title (int x, int y)
cp = stpcpy (cp, ". ");
if (!ls_empty_p (&t->title))
{
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;
cp += ls_length (&t->title);
}
*cp = 0;
@@
-1337,7
+1334,7
@@
render_strip (int x, int y, int r, int c1, int c2, int r1 UNUSED, int r2)
}
} else {
struct tab_joined_cell *j =
}
} 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)
{
if (j->hit != tab_hit)
{