\f
/* Working with messages. */
+const char *
+msg_severity_to_string (enum msg_severity severity)
+{
+ switch (severity)
+ {
+ case MSG_S_ERROR:
+ return _("error");
+ case MSG_S_WARNING:
+ return _("warning");
+ case MSG_S_NOTE:
+ default:
+ return _("note");
+ }
+}
+
/* Duplicate a message */
struct msg *
msg_dup (const struct msg *m)
char *
msg_to_string (const struct msg *m, const char *command_name)
{
- const char *label;
struct string s;
ds_init_empty (&s);
ds_put_cstr (&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);
+ ds_put_format (&s, "%s: ", msg_severity_to_string (m->severity));
if (m->category == MSG_C_SYNTAX && command_name != NULL)
ds_put_format (&s, "%s: ", command_name);
#include "output/cairo.h"
#include "output/chart-item.h"
#include "output/driver-provider.h"
+#include "output/message-item.h"
#include "output/output-item.h"
#include "output/tab.h"
#include "output/table-item.h"
ds_clear (&title);
if (is_text_item (item))
ds_put_cstr (&title, text_item_get_text (to_text_item (item)));
+ else if (is_message_item (item))
+ {
+ const struct message_item *msg_item = to_message_item (item);
+ const struct msg *msg = message_item_get_msg (msg_item);
+ ds_put_format (&title, "%s: %s", _("Message"),
+ msg_severity_to_string (msg->severity));
+ }
else if (is_table_item (item))
{
const char *caption = table_item_get_caption (to_table_item (item));