output: Remove support for bottom and right side headers.
[pspp] / src / libpspp / message.c
index 83c7320168eef5a8ca4cf68baaa6c129bd98dd0d..07cc270787bab365b6b2a5f4e7d568e8ceeb0d3c 100644 (file)
@@ -112,6 +112,28 @@ msg_set_handler (const struct msg_handler *handler)
   msg_handler = *handler;
 }
 \f
+/* msg_point. */
+
+/* Takes POINT, adds to it the syntax in SYNTAX, incrementing the line number
+   for each new-line in SYNTAX and the column number for each column, and
+   returns the result. */
+struct msg_point
+msg_point_advance (struct msg_point point, struct substring syntax)
+{
+  for (;;)
+    {
+      size_t newline = ss_find_byte (syntax, '\n');
+      if (newline == SIZE_MAX)
+        break;
+      point.line++;
+      point.column = 1;
+      ss_advance (&syntax, newline + 1);
+    }
+
+  point.column += ss_utf8_count_columns (syntax);
+  return point;
+}
+\f
 /* msg_location. */
 
 void
@@ -174,6 +196,16 @@ msg_location_merge (struct msg_location **dstp, const struct msg_location *src)
     dst->end = src->end;
 }
 
+struct msg_location *
+msg_location_merged (const struct msg_location *a,
+                     const struct msg_location *b)
+{
+  struct msg_location *new = msg_location_dup (a);
+  if (b)
+    msg_location_merge (&new, b);
+  return new;
+}
+
 struct msg_location *
 msg_location_dup (const struct msg_location *src)
 {
@@ -391,7 +423,7 @@ msg_to_string (const struct msg *m)
 
           int c0 = ln == l0 ? loc->start.column : 1;
           int c1 = ln == l1 ? loc->end.column : ss_utf8_count_columns (line);
-          if (c0 > 0 && c1 >= c0)
+          if (c0 > 0 && c1 >= c0 && !loc->omit_underlines)
             {
               ds_put_cstr (&s, "\n      |");
               ds_put_byte_multiple (&s, ' ', c0);