X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Fspv-driver.c;h=900a047af5f2a3fb921aaf75b191868df5d09460;hb=95cde62bdf5210c1c60dad5598a888b864f93161;hp=707e82abfa33afe34348743664bcc176a13a6fce;hpb=8f7af0acaf8a9253242d89fcdb26e285841f7833;p=pspp diff --git a/src/output/spv-driver.c b/src/output/spv-driver.c index 707e82abfa..900a047af5 100644 --- a/src/output/spv-driver.c +++ b/src/output/spv-driver.c @@ -24,6 +24,7 @@ #include "libpspp/cast.h" #include "output/cairo-chart.h" #include "output/output-item.h" +#include "output/page-setup.h" #include "output/spv/spv-writer.h" #include "gl/xalloc.h" @@ -49,27 +50,32 @@ 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 driver_options *o) { - struct output_driver *d; - 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), - device_type); - - char *error = spv_writer_open (fh_get_file_name (fh), &spv->writer); - if (spv->writer == NULL) + struct spv_writer *writer; + char *error = spv_writer_open (fh_get_file_name (fh), &writer); + if (!writer) { msg (ME, "%s", error); - goto error; + free (error); + return NULL; } - return d; - -error: - output_driver_destroy (d); - return NULL; + struct page_setup *ps = page_setup_parse (o); + spv_writer_set_page_setup (writer, ps); + page_setup_destroy (ps); + + struct spv_driver *spv = xmalloc (sizeof *spv); + *spv = (struct spv_driver) { + .driver = { + .class = &spv_driver_class, + .name = xstrdup (fh_get_file_name (fh)), + .device_type = device_type, + }, + .handle = fh, + .writer = writer, + }; + return &spv->driver; } static void