From: Ben Pfaff Date: Sun, 22 Jan 2023 20:39:11 +0000 (-0800) Subject: output: Add debugging code to rendering and table code. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=684cd61c11313517223159e0df662c3d6bf8b139;p=pspp output: Add debugging code to rendering and table code. --- diff --git a/src/output/render.c b/src/output/render.c index 99f3f8baf1..76f5017fa3 100644 --- a/src/output/render.c +++ b/src/output/render.c @@ -1047,6 +1047,25 @@ static void render_cell (const struct render_page *page, const int ofs[TABLE_N_AXES], const struct table_cell *cell) { + const bool debugging = false; + if (debugging) + { + printf ("render "); + if (cell->d[H][0] + 1 == cell->d[H][1]) + printf ("%d", cell->d[H][0]); + else + printf ("%d-%d", cell->d[H][0], cell->d[H][1] - 1); + printf (","); + if (cell->d[V][0] + 1 == cell->d[V][1]) + printf ("%d", cell->d[V][0]); + else + printf ("%d-%d", cell->d[V][0], cell->d[V][1] - 1); + + char *value = pivot_value_to_string (cell->value, NULL); + printf (": \"%s\"\n", value); + free (value); + } + int bb[TABLE_N_AXES][2]; int clip[TABLE_N_AXES][2]; diff --git a/src/output/table.c b/src/output/table.c index f67bf0a078..97a2793c55 100644 --- a/src/output/table.c +++ b/src/output/table.c @@ -316,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);