X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Ftable.c;h=97a2793c55ea728c2cbe72cb6705469c8cf34f1c;hb=refs%2Fheads%2Fvariable-sets;hp=523a5ea75ab1243d1a33a3117567c3a22771fe28;hpb=f4bf263b680ffe5dd0befe040b84c179919bbb7d;p=pspp diff --git a/src/output/table.c b/src/output/table.c index 523a5ea75a..97a2793c55 100644 --- a/src/output/table.c +++ b/src/output/table.c @@ -245,9 +245,6 @@ cell_style_dump (const struct cell_style *c) c->margin[TABLE_VERT][0], c->margin[TABLE_VERT][1]); } - -static const bool debugging = true; - /* Creates and returns a new table with NC columns and NR rows and initially no header rows or columns. @@ -282,21 +279,13 @@ table_create (int nc, int nr, int hl, int hr, int ht, int hb) void table_vline (struct table *t, int style, int x, int y1, int y2) { - if (debugging) + if (x < 0 || x > t->n[H] || y1 < 0 || y1 > y2 || y2 >= t->n[V]) { - if (x < 0 || x > t->n[H] - || y1 < 0 || y1 >= t->n[V] - || y2 < 0 || y2 >= t->n[V]) - { - printf ("bad vline: x=%d y=(%d,%d) in table size (%d,%d)\n", - x, y1, y2, t->n[H], t->n[V]); - return; - } + printf ("bad vline: x=%d y=(%d,%d) in table size (%d,%d)\n", + x, y1, y2, t->n[H], t->n[V]); + abort (); } - assert (0 <= x && x <= t->n[H]); - assert (0 <= y1 && y1 <= y2 && y2 <= t->n[V]); - for (int y = y1; y <= y2; y++) t->rv[x + (t->n[H] + 1) * y] = style; } @@ -306,21 +295,13 @@ table_vline (struct table *t, int style, int x, int y1, int y2) void table_hline (struct table *t, int style, int x1, int x2, int y) { - if (debugging) + if (y < 0 || y > t->n[V] || x1 < 0 || x1 > x2 || x2 >= t->n[H]) { - if (y < 0 || y > t->n[V] - || x1 < 0 || x1 >= t->n[H] - || x2 < 0 || x2 >= t->n[H]) - { - printf ("bad hline: x=(%d,%d) y=%d in table size (%d,%d)\n", - x1, x2, y, t->n[H], t->n[V]); - return; - } + printf ("bad hline: x=(%d,%d) y=%d in table size (%d,%d)\n", + x1, x2, y, t->n[H], t->n[V]); + abort (); } - assert (0 <= y && y <= t->n[V]); - assert (0 <= x1 && x1 <= x2 && x2 < t->n[H]); - for (int x = x1; x <= x2; x++) t->rh[x + t->n[H] * y] = style; } @@ -335,6 +316,25 @@ table_put (struct table *table, int x1, int y1, int x2, int y2, assert (0 <= x1 && x1 <= x2 && x2 < table->n[H]); assert (0 <= y1 && y1 <= y2 && y2 < table->n[V]); + const bool debugging = false; + if (debugging) + { + printf ("put "); + if (x1 == x2) + printf ("%d", x1); + else + printf ("%d-%d", x1, x2); + printf (","); + if (y1 == y2) + printf ("%d", y1); + else + printf ("%d-%d", y1, y2); + + char *value_s = value ? pivot_value_to_string (value, NULL) : NULL; + printf (": \"%s\"\n", value_s ? value_s : ""); + free (value_s); + } + if (x1 == x2 && y1 == y2) { table->cc[x1 + y1 * table->n[H]] = CONST_CAST (struct pivot_value *, value);