output: Add debugging code to rendering and table code.
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 22 Jan 2023 20:39:11 +0000 (12:39 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Fri, 27 Jan 2023 19:49:09 +0000 (11:49 -0800)
src/output/render.c
src/output/table.c

index 99f3f8baf1073ccc117de8ff62d2a59e257e5d15..76f5017fa322d3e859e99df394cc82f33d4a3863 100644 (file)
@@ -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];
 
index f67bf0a07822a1a8e11b92c43583d26a7a280444..97a2793c55ea728c2cbe72cb6705469c8cf34f1c 100644 (file)
@@ -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);