+ int n_msgs, max_msgs;
+
+ if (too_many_errors
+ || (too_many_notes && m->severity == MSG_S_NOTE)
+ || (warnings_off && m->severity == MSG_S_WARNING) )
+ return;
+
+ ship_message (m);
+
+ counts[m->severity]++;
+ max_msgs = settings_get_max_messages (m->severity);
+ n_msgs = counts[m->severity];
+ if (m->severity == MSG_S_WARNING)
+ n_msgs += counts[MSG_S_ERROR];
+ if (n_msgs > max_msgs)
+ {
+ if (m->severity == MSG_S_NOTE)
+ {
+ too_many_notes = true;
+ submit_note (xasprintf (_("Notes (%d) exceed limit (%d). "
+ "Suppressing further notes."),
+ n_msgs, max_msgs));
+ }
+ else
+ {
+ too_many_errors = true;
+ if (m->severity == MSG_S_WARNING)
+ submit_note (xasprintf (_("Warnings (%d) exceed limit (%d). Syntax processing will be halted."),
+ n_msgs, max_msgs));
+ else
+ submit_note (xasprintf (_("Errors (%d) exceed limit (%d). Syntax processing will be halted."),
+ n_msgs, max_msgs));
+ }
+ }
+}
+
+
+/* Emits M as an error message.
+ Frees allocated data in M. */
+void
+msg_emit (struct msg *m)
+{
+ m->shipped = false;
+ if (!messages_disabled)
+ process_msg (m);
+
+ free (m->text);
+}
+
+/* Disables message output until the next call to msg_enable. If
+ this function is called multiple times, msg_enable must be
+ called an equal number of times before messages are actually
+ re-enabled. */
+void
+msg_disable (void)
+{
+ messages_disabled++;
+}
+
+/* Enables message output that was disabled by msg_disable. */
+void
+msg_enable (void)
+{
+ assert (messages_disabled > 0);
+ messages_disabled--;
+}
+\f
+/* Private functions. */
+
+void
+request_bug_report (const char *msg)
+{
+ fprintf (stderr, "******************************************************\n");
+ fprintf (stderr, "You have discovered a bug in PSPP. Please report this\n");
+ fprintf (stderr, "to " PACKAGE_BUGREPORT ". Please include this entire\n");
+ fprintf (stderr, "message, *plus* several lines of output just above it.\n");
+ fprintf (stderr, "For the best chance at having the bug fixed, also\n");
+ fprintf (stderr, "include the syntax file that triggered it and a sample\n");
+ fprintf (stderr, "of any data file used for input.\n");
+ fprintf (stderr, "proximate cause: %s\n", msg);
+ fprintf (stderr, "version: %s\n", stat_version);
+ fprintf (stderr, "host_system: %s\n", host_system);
+ fprintf (stderr, "build_system: %s\n", build_system);
+ fprintf (stderr, "locale_dir: %s\n", locale_dir);
+ fprintf (stderr, "compiler version: %s\n",
+#ifdef __VERSION__
+ __VERSION__
+#else
+ "Unknown"
+#endif
+ );
+ fprintf (stderr, "******************************************************\n");