projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix typo which cause the binary not to depend upon any libraries
[pspp]
/
src
/
output
/
table.c
diff --git
a/src/output/table.c
b/src/output/table.c
index 1b120124a4ce8022893d153e2b0d91117070ee41..d488f3aa68b60e590709b442cc79e3e433d620c4 100644
(file)
--- a/
src/output/table.c
+++ b/
src/output/table.c
@@
-1,6
+1,5
@@
/* PSPP - computes sample statistics.
/* PSPP - computes sample statistics.
- Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
- Written by Ben Pfaff <blp@gnu.org>.
+ Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@
-18,26
+17,33
@@
02110-1301, USA. */
#include <config.h>
02110-1301, USA. */
#include <config.h>
+
#include "table.h"
#include "table.h"
+
#include <ctype.h>
#include <stdarg.h>
#include <limits.h>
#include <stdlib.h>
#include <ctype.h>
#include <stdarg.h>
#include <limits.h>
#include <stdlib.h>
+
+#include "output.h"
+#include "manager.h"
+
+#include <data/data-out.h>
+#include <data/format.h>
+#include <data/value.h>
#include <libpspp/alloc.h>
#include <libpspp/alloc.h>
+#include <libpspp/assertion.h>
#include <libpspp/compiler.h>
#include <libpspp/compiler.h>
-#include <data/format.h>
#include <libpspp/magic.h>
#include <libpspp/misc.h>
#include <libpspp/magic.h>
#include <libpspp/misc.h>
-#include "minmax.h"
-#include "output.h"
#include <libpspp/pool.h>
#include <libpspp/pool.h>
-#include "manager.h"
-#include
<data/variable.h>
+
+#include
"minmax.h"
#include "gettext.h"
#define _(msgid) gettext (msgid)
\f
#include "gettext.h"
#define _(msgid) gettext (msgid)
\f
-struct som_table_class tab_table_class;
+
const
struct som_table_class tab_table_class;
static char *command_name;
/* Returns the font to use for a cell with the given OPTIONS. */
static char *command_name;
/* Returns the font to use for a cell with the given OPTIONS. */
@@
-86,6
+92,7
@@
void
tab_destroy (struct tab_table *t)
{
assert (t != NULL);
tab_destroy (struct tab_table *t)
{
assert (t != NULL);
+ free (t->title);
pool_destroy (t->container);
}
pool_destroy (t->container);
}
@@
-134,8
+141,8
@@
tab_realloc (struct tab_table *t, int nc, int nr)
if (nc > t->cf)
{
if (nc > t->cf)
{
- int mr1 =
min
(nr, t->nr);
- int mc1 =
min
(nc, t->nc);
+ int mr1 =
MIN
(nr, t->nr);
+ int mc1 =
MIN
(nc, t->nc);
struct substring *new_cc;
unsigned char *new_ct;
struct substring *new_cc;
unsigned char *new_ct;
@@
-267,7
+274,7
@@
tab_hline (struct tab_table * t, int style, int x1, int x2, int y)
y += t->row_ofs;
assert (y >= 0);
y += t->row_ofs;
assert (y >= 0);
- assert (y < t->nr);
+ assert (y <
=
t->nr);
assert (x2 >= x1 );
assert (x1 >= 0 );
assert (x2 < t->nc);
assert (x2 >= x1 );
assert (x1 >= 0 );
assert (x2 < t->nc);
@@
-305,7
+312,7
@@
tab_box (struct tab_table *t, int f_h, int f_v, int i_h, int i_v,
x2, t->col_ofs, x2 + t->col_ofs,
y2, t->row_ofs, y2 + t->row_ofs,
t->nc, t->nr);
x2, t->col_ofs, x2 + t->col_ofs,
y2, t->row_ofs, y2 + t->row_ofs,
t->nc, t->nr);
-
abort
();
+
NOT_REACHED
();
}
#endif
}
#endif
@@
-434,10
+441,10
@@
tab_natural_width (struct tab_table *t, struct outp_driver *d, int c)
if (width == 0)
{
if (width == 0)
{
- width = d->prop_em_width * 8;
-#if DEBUGGING
- printf ("warning: table column %d contains no data.\n", c);
-#endif
+ /* FIXME: This is an ugly kluge to compensate for the fact
+ that we don't let joined cells contribute to column
+ widths. */
+ width = d->prop_em_width * 8;
}
{
}
{
@@
-534,7
+541,7
@@
tab_value (struct tab_table *table, int c, int r, unsigned char opt,
table->cc[c + r * table->cf] = ss_buffer (contents, f->w);
table->ct[c + r * table->cf] = opt;
table->cc[c + r * table->cf] = ss_buffer (contents, f->w);
table->ct[c + r * table->cf] = opt;
- data_out (
contents, f, v
);
+ data_out (
v, f, contents
);
}
/* Sets cell (C,R) in TABLE, with options OPT, to have value VAL
}
/* Sets cell (C,R) in TABLE, with options OPT, to have value VAL
@@
-556,7
+563,7
@@
tab_float (struct tab_table *table, int c, int r, unsigned char opt,
assert (r >= 0);
assert (r < table->nr);
assert (r >= 0);
assert (r < table->nr);
- f =
make_output_forma
t (FMT_F, w, d);
+ f =
fmt_for_outpu
t (FMT_F, w, d);
#if DEBUGGING
if (c + table->col_ofs < 0 || r + table->row_ofs < 0
#if DEBUGGING
if (c + table->col_ofs < 0 || r + table->row_ofs < 0
@@
-573,7
+580,7
@@
tab_float (struct tab_table *table, int c, int r, unsigned char opt,
#endif
double_value.f = val;
#endif
double_value.f = val;
- data_out (
buf, &f, &double_value
);
+ data_out (
&double_value, &f, buf
);
cp = buf;
while (isspace ((unsigned char) *cp) && cp < &buf[w])
cp = buf;
while (isspace ((unsigned char) *cp) && cp < &buf[w])
@@
-801,15
+808,15
@@
tab_offset (struct tab_table *t, int col, int row)
assert (t != NULL);
#if DEBUGGING
assert (t != NULL);
#if DEBUGGING
- if (row < -1 || row >
=
t->nr)
+ if (row < -1 || row > t->nr)
{
printf ("tab_offset(): row=%d in %d-row table\n", row, t->nr);
{
printf ("tab_offset(): row=%d in %d-row table\n", row, t->nr);
-
abort
();
+
NOT_REACHED
();
}
}
- if (col < -1 || col >
=
t->nc)
+ if (col < -1 || col > t->nc)
{
printf ("tab_offset(): col=%d in %d-column table\n", col, t->nc);
{
printf ("tab_offset(): col=%d in %d-column table\n", col, t->nc);
-
abort
();
+
NOT_REACHED
();
}
#endif
}
#endif
@@
-836,7
+843,7
@@
tab_next_row (struct tab_table *t)
\f
static struct tab_table *t;
static struct outp_driver *d;
\f
static struct tab_table *t;
static struct outp_driver *d;
-int tab_hit;
+
static
int tab_hit;
/* Set the current table to TABLE. */
static void
/* Set the current table to TABLE. */
static void
@@
-870,7
+877,7
@@
rule_to_spacing_type (unsigned char type)
case TAL_2:
return OUTP_L_DOUBLE;
default:
case TAL_2:
return OUTP_L_DOUBLE;
default:
-
abort
();
+
NOT_REACHED
();
}
}
}
}
@@
-1218,7
+1225,7
@@
tabi_render (int c0, int r0, int c1, int r1)
y = render_rows (y, c0, c1, (t->nr - t->b) * 2, t->nr * 2 + 1);
}
y = render_rows (y, c0, c1, (t->nr - t->b) * 2, t->nr * 2 + 1);
}
-struct som_table_class tab_table_class =
+
const
struct som_table_class tab_table_class =
{
tabi_table,
tabi_driver,
{
tabi_table,
tabi_driver,
@@
-1256,7
+1263,7
@@
translate_justification (unsigned int opt)
case TAB_CENTER:
return OUTP_CENTER;
default:
case TAB_CENTER:
return OUTP_CENTER;
default:
-
abort
();
+
NOT_REACHED
();
}
}
}
}
@@
-1275,7
+1282,7
@@
rule_to_draw_type (unsigned char type)
case TAL_2:
return OUTP_L_DOUBLE;
default:
case TAL_2:
return OUTP_L_DOUBLE;
default:
-
abort
();
+
NOT_REACHED
();
}
}
}
}