#include "libpspp/cast.h"
#include "libpspp/message.h"
#include "output/driver-provider.h"
-#include "output/message-item.h"
+#include "output/output-item.h"
#include "gl/fwriteerror.h"
#include "gl/xalloc.h"
msglog_create (const char *file_name)
{
enum settings_output_devices type;
- struct msglog_driver *ml;
FILE *file;
struct file_handle *handle = fh_create_file (NULL, file_name, NULL, fh_default_properties ());
? SETTINGS_DEVICE_TERMINAL
: SETTINGS_DEVICE_UNFILTERED);
- ml = xzalloc (sizeof *ml);
+ struct msglog_driver *ml = XZALLOC (struct msglog_driver);
ml->handle = handle;
output_driver_init (&ml->driver, &msglog_class, file_name, type);
ml->file = file;
{
struct msglog_driver *ml = msglog_driver_cast (driver);
- if (is_message_item (item))
+ if (item->type == OUTPUT_ITEM_MESSAGE)
{
- const struct message_item *message_item = to_message_item (item);
- char *s = msg_to_string (message_item_get_msg (message_item));
+ char *s = msg_to_string (item->message);
fprintf (ml->file, "%s\n", s);
free (s);
}
static const struct output_driver_class msglog_class =
{
- "msglog",
- msglog_destroy,
- msglog_submit,
- NULL
+ .name = "msglog",
+ .destroy = msglog_destroy,
+ .submit = msglog_submit,
};