table: Get rid of TAL_* constants.
authorBen Pfaff <blp@cs.stanford.edu>
Thu, 26 Dec 2019 01:02:43 +0000 (01:02 +0000)
committerBen Pfaff <blp@cs.stanford.edu>
Sun, 29 Dec 2019 05:28:10 +0000 (05:28 +0000)
These were the same as TABLE_STROKE_* so get rid of the extras.

src/output/html.c
src/output/render.c
src/output/table.c
src/output/table.h
tests/output/render-test.c

index f28476eae6661d05d27ce3fdfe0bcfb4af47b465..5233fc8fe55f0afb3746a7f8ed75a5d9d6554ca2 100644 (file)
@@ -341,22 +341,22 @@ border_to_css (int border)
 {
   switch (border)
     {
-    case TAL_NONE:
+    case TABLE_STROKE_NONE:
       return NULL;
 
-    case TAL_SOLID:
+    case TABLE_STROKE_SOLID:
       return "solid";
 
-    case TAL_DASHED:
+    case TABLE_STROKE_DASHED:
       return "dashed";
 
-    case TAL_THICK:
+    case TABLE_STROKE_THICK:
       return "thick solid";
 
-    case TAL_THIN:
+    case TABLE_STROKE_THIN:
       return "thin solid";
 
-    case TAL_DOUBLE:
+    case TABLE_STROKE_DOUBLE:
       return "double";
 
     default:
index 39cde176eeff6fa86f5c00ea100f0f426a964c96..423940b068eabaeff29b63e06ffea287820152c0 100644 (file)
@@ -463,17 +463,17 @@ rule_to_render_type (unsigned char type)
 {
   switch (type)
     {
-    case TAL_NONE:
+    case TABLE_STROKE_NONE:
       return RENDER_LINE_NONE;
-    case TAL_SOLID:
+    case TABLE_STROKE_SOLID:
       return RENDER_LINE_SINGLE;
-    case TAL_DASHED:
+    case TABLE_STROKE_DASHED:
       return RENDER_LINE_DASHED;
-    case TAL_THICK:
+    case TABLE_STROKE_THICK:
       return RENDER_LINE_THICK;
-    case TAL_THIN:
+    case TABLE_STROKE_THIN:
       return RENDER_LINE_THIN;
-    case TAL_DOUBLE:
+    case TABLE_STROKE_DOUBLE:
       return RENDER_LINE_DOUBLE;
     default:
       NOT_REACHED ();
@@ -497,15 +497,15 @@ measure_rule (const struct render_params *params, const struct table *table,
   for (d[b] = 0; d[b] < table->n[b]; d[b]++)
     rules |= 1u << table_get_rule (table, a, d[H], d[V], &color);
 
-  /* Turn off TAL_NONE because it has width 0 and we needn't bother.  However,
-     if the device doesn't support margins, make sure that there is at least a
-     small gap between cells (but we don't need any at the left or right edge
-     of the table). */
-  if (rules & (1u << TAL_NONE))
+  /* Turn off TABLE_STROKE_NONE because it has width 0 and we needn't bother.
+     However, if the device doesn't support margins, make sure that there is at
+     least a small gap between cells (but we don't need any at the left or
+     right edge of the table). */
+  if (rules & (1u << TABLE_STROKE_NONE))
     {
-      rules &= ~(1u << TAL_NONE);
+      rules &= ~(1u << TABLE_STROKE_NONE);
       if (z > 0 && z < table->n[a] && !params->supports_margins && a == H)
-        rules |= 1u << TAL_SOLID;
+        rules |= 1u << TABLE_STROKE_SOLID;
     }
 
   /* Calculate maximum width of the rules that are present. */
@@ -974,7 +974,7 @@ get_rule (const struct render_page *page, enum table_axis axis,
     {
       d[a] = d2;
       int r2 = table_get_rule (page->table, axis, d[H], d[V], color);
-      r = table_rule_combine (r, r2);
+      r = table_stroke_combine (r, r2);
     }
   return rule_to_render_type (r);
 }
index b6caf598c640463f5ec5b9ccbda0d6c769333da9..2fa40c9091fda608304757134f70ed819b07b3a7 100644 (file)
@@ -366,10 +366,10 @@ table_create (int nc, int nr, int hl, int hr, int ht, int hb)
   t->ct = pool_calloc (t->container, nr * nc, sizeof *t->ct);
 
   t->rh = pool_nmalloc (t->container, nc, nr + 1);
-  memset (t->rh, TAL_0, nc * (nr + 1));
+  memset (t->rh, TABLE_STROKE_NONE, nc * (nr + 1));
 
   t->rv = pool_nmalloc (t->container, nr, nc + 1);
-  memset (t->rv, TAL_0, nr * (nc + 1));
+  memset (t->rv, TABLE_STROKE_NONE, nr * (nc + 1));
 
   memset (t->styles, 0, sizeof t->styles);
   memset (t->rule_colors, 0, sizeof t->rule_colors);
@@ -590,7 +590,8 @@ add_joined_cell (struct table *table, int x1, int y1, int x2, int y2,
         }
     }
 
-  table_box (table, -1, -1, TAL_0, TAL_0, x1, y1, x2, y2);
+  table_box (table, -1, -1, TABLE_STROKE_NONE, TABLE_STROKE_NONE,
+             x1, y1, x2, y2);
 
   j = pool_alloc (table->container, sizeof *j);
   j->d[TABLE_HORZ][0] = x1;
index fb3ca946aa904ca849559c35208366d956c24e42..b3a9c41682e6bbb676d2ffbc3c1b3a176ca9aea0 100644 (file)
@@ -86,6 +86,15 @@ enum table_stroke
 
 const char *table_stroke_to_string (enum table_stroke);
 
+/* Given strokes A and B, returns a stroke that "combines" them, that is, that
+   gives a reasonable stroke choice for a rule for different reasons should
+   have both styles A and B. */
+static inline int
+table_stroke_combine (enum table_stroke a, enum table_stroke b)
+{
+  return a > b ? a : b;
+}
+
 struct table_border_style
   {
     enum table_stroke stroke;
@@ -181,29 +190,6 @@ enum
     TAB_JOIN = 1 << 14,
   };
 
-/* Styles for the rules around table cells. */
-enum
-  {
-    TAL_NONE = TABLE_STROKE_NONE,
-#define TAL_0 TAL_NONE
-    TAL_SOLID = TABLE_STROKE_SOLID,
-#define TAL_1 TAL_SOLID
-    TAL_DASHED = TABLE_STROKE_DASHED,
-    TAL_THICK = TABLE_STROKE_THICK,
-    TAL_THIN = TABLE_STROKE_THIN,
-    TAL_DOUBLE = TABLE_STROKE_DOUBLE,
-#define TAL_2 TAL_DOUBLE
-  };
-
-/* Given line styles A and B (each one of the TAL_* enumeration constants
-   above), returns a line style that "combines" them, that is, that gives a
-   reasonable line style choice for a rule for different reasons should have
-   both styles A and B. */
-static inline int table_rule_combine (int a, int b)
-{
-  return a > b ? a : b;
-}
-
 /* A table. */
 struct table
   {
index 35400216541d52a24ad5ba2160f9835dc1ebbef2..90b5867f873f263df2938a1deff03b6ca9cc976b 100644 (file)
@@ -422,24 +422,24 @@ read_table (FILE *stream)
             switch (*text++)
               {
               case '<':
-                table_vline (tab, TAL_1, c, r, r + rs - 1);
+                table_vline (tab, TABLE_STROKE_SOLID, c, r, r + rs - 1);
                 break;
 
               case '>':
-                table_vline (tab, TAL_1, c + cs, r, r + rs - 1);
+                table_vline (tab, TABLE_STROKE_SOLID, c + cs, r, r + rs - 1);
                 break;
 
               case '^':
-                table_hline (tab, TAL_1, c, c + cs - 1, r);
+                table_hline (tab, TABLE_STROKE_SOLID, c, c + cs - 1, r);
                 break;
 
               case ',':
-                table_hline (tab, TAL_1, c, c + cs - 1, r + rs);
+                table_hline (tab, TABLE_STROKE_SOLID, c, c + cs - 1, r + rs);
                 break;
 
               case '@':
-                table_box (tab, TAL_1, TAL_1, -1, -1, c, r,
-                         c + cs - 1, r + rs - 1);
+                table_box (tab, TABLE_STROKE_SOLID, TABLE_STROKE_SOLID,
+                           -1, -1, c, r, c + cs - 1, r + rs - 1);
                 break;
 
               case '(':