+msg_destroy (struct msg *m)
+{
+ free (m->where.file_name);
+ free (m->text);
+ free (m);
+}
+
+char *
+msg_to_string (const struct msg *m, const char *command_name)
+{
+ const char *label;
+ struct string s;
+
+ ds_init_empty (&s);
+
+ if (m->category != MSG_C_GENERAL
+ && (m->where.file_name || m->where.line_number != -1))
+ {
+ if (m->where.file_name)
+ ds_put_format (&s, "%s:", m->where.file_name);
+ if (m->where.line_number != -1)
+ ds_put_format (&s, "%d:", m->where.line_number);
+ ds_put_char (&s, ' ');
+ }
+
+ switch (m->severity)
+ {
+ case MSG_S_ERROR:
+ label = _("error");
+ break;
+ case MSG_S_WARNING:
+ label = _("warning");
+ break;
+ case MSG_S_NOTE:
+ default:
+ label = _("note");
+ break;
+ }
+ ds_put_format (&s, "%s: ", label);
+
+ if (m->category == MSG_C_SYNTAX && command_name != NULL)
+ ds_put_format (&s, "%s: ", command_name);
+
+ ds_put_cstr (&s, m->text);
+
+ return ds_cstr (&s);
+}
+\f
+
+/* Number of messages reported, by severity level. */
+static int counts[MSG_N_SEVERITIES];
+
+/* True after the maximum number of errors or warnings has been exceeded. */
+static bool too_many_errors;
+
+/* True after the maximum number of notes has been exceeded. */
+static bool too_many_notes;
+
+/* Checks whether we've had so many errors that it's time to quit
+ processing this syntax file. */
+bool
+msg_ui_too_many_errors (void)