X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Fspv-driver.c;h=7e22cf0c1bac7469904b4b545415683c407d3f53;hb=2f3f4d9b20e0cde593fad4137cdc48922a38c3da;hp=e2bc9b235066eee6d8694d837f91d399c6fa7aab;hpb=5f894a49a00de93333e64db483c193669c937a45;p=pspp diff --git a/src/output/spv-driver.c b/src/output/spv-driver.c index e2bc9b2350..7e22cf0c1b 100644 --- a/src/output/spv-driver.c +++ b/src/output/spv-driver.c @@ -23,12 +23,7 @@ #include "data/file-handle-def.h" #include "libpspp/cast.h" #include "output/cairo-chart.h" -#include "output/chart-item.h" -#include "output/group-item.h" -#include "output/image-item.h" -#include "output/page-setup-item.h" -#include "output/table-item.h" -#include "output/text-item.h" +#include "output/output-item.h" #include "output/spv/spv-writer.h" #include "gl/xalloc.h" @@ -54,12 +49,10 @@ spv_driver_cast (struct output_driver *driver) static struct output_driver * spv_create (struct file_handle *fh, enum settings_output_devices device_type, - struct string_map *o UNUSED) + struct string_map *o UNUSED) { struct output_driver *d; - struct spv_driver *spv; - - spv = xzalloc (sizeof *spv); + struct spv_driver *spv = XZALLOC (struct spv_driver); d = &spv->driver; spv->handle = fh; output_driver_init (&spv->driver, &spv_driver_class, fh_get_file_name (fh), @@ -69,12 +62,13 @@ spv_create (struct file_handle *fh, enum settings_output_devices device_type, if (spv->writer == NULL) { msg (ME, "%s", error); + free (error); goto error; } return d; - error: +error: output_driver_destroy (d); return NULL; } @@ -93,20 +87,31 @@ spv_destroy (struct output_driver *driver) static void spv_submit (struct output_driver *driver, - const struct output_item *output_item) + const struct output_item *output_item) { struct spv_driver *spv = spv_driver_cast (driver); spv_writer_write (spv->writer, output_item); } +static void +spv_setup (struct output_driver *driver, + const struct page_setup *ps) +{ + struct spv_driver *spv = spv_driver_cast (driver); + + spv_writer_set_page_setup (spv->writer, ps); +} + struct output_driver_factory spv_driver_factory = { "spv", "pspp.spv", spv_create }; static const struct output_driver_class spv_driver_class = { - "spv", - spv_destroy, - spv_submit, - NULL, + .name = "spv", + .destroy = spv_destroy, + .submit = spv_submit, + .setup = spv_setup, + .handles_show = true, + .handles_groups = true, };