X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Fdriver.c;h=acc58cf999cdd7b77d533f54edc9ce17db954550;hb=refs%2Fbuilds%2F20120727001907%2Fpspp;hp=0da3e6a0f6549b6fb6f3dd99edf19c7c6ffb884b;hpb=9ade26c8349b4434008c46cf09bc7473ec743972;p=pspp diff --git a/src/output/driver.c b/src/output/driver.c index 0da3e6a0f6..acc58cf999 100644 --- a/src/output/driver.c +++ b/src/output/driver.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2007, 2009, 2010, 2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -50,6 +50,9 @@ static const struct output_driver_factory *factories[]; /* Drivers currently registered with output_driver_register(). */ static struct llx_list drivers = LLX_INITIALIZER (drivers); +/* TEXT_ITEM_SYNTAX being accumulated until another kind of output arrives. */ +static struct string deferred_syntax = DS_EMPTY_INITIALIZER; + void output_close (void) { @@ -69,10 +72,8 @@ output_get_supported_formats (struct string_set *formats) string_set_insert (formats, (*fp)->extension); } -/* Submits ITEM to the configured output drivers, and transfers ownership to - the output subsystem. */ -void -output_submit (struct output_item *item) +static void +output_submit__ (struct output_item *item) { struct llx *llx, *next; @@ -104,6 +105,40 @@ output_submit (struct output_item *item) output_item_unref (item); } +static void +flush_deferred_syntax (void) +{ + if (!ds_is_empty (&deferred_syntax)) + { + char *syntax = ds_steal_cstr (&deferred_syntax); + output_submit__ (text_item_super ( + text_item_create_nocopy (TEXT_ITEM_SYNTAX, syntax))); + } +} + +static bool +is_syntax_item (const struct output_item *item) +{ + return (is_text_item (item) + && text_item_get_type (to_text_item (item)) == TEXT_ITEM_SYNTAX); +} + +/* Submits ITEM to the configured output drivers, and transfers ownership to + the output subsystem. */ +void +output_submit (struct output_item *item) +{ + if (is_syntax_item (item)) + { + ds_put_cstr (&deferred_syntax, text_item_get_text (to_text_item (item))); + output_item_unref (item); + return; + } + + flush_deferred_syntax (); + output_submit__ (item); +} + /* Flushes output to screen devices, so that the user can see output that doesn't fill up an entire page. */ void @@ -111,6 +146,7 @@ output_flush (void) { struct llx *llx; + flush_deferred_syntax (); for (llx = llx_head (&drivers); llx != llx_null (&drivers); llx = llx_next (llx)) { @@ -199,7 +235,7 @@ extern const struct output_driver_factory txt_driver_factory; extern const struct output_driver_factory list_driver_factory; extern const struct output_driver_factory html_driver_factory; extern const struct output_driver_factory csv_driver_factory; -#ifdef ODT_SUPPORT +#ifdef ODF_WRITE_SUPPORT extern const struct output_driver_factory odt_driver_factory; #endif #ifdef HAVE_CAIRO @@ -214,7 +250,7 @@ static const struct output_driver_factory *factories[] = &list_driver_factory, &html_driver_factory, &csv_driver_factory, -#ifdef ODT_SUPPORT +#ifdef ODF_WRITE_SUPPORT &odt_driver_factory, #endif #ifdef HAVE_CAIRO @@ -279,9 +315,8 @@ output_driver_create (struct string_map *options) device_type = SETTINGS_DEVICE_LISTING; else { - /* TRANSLATORS: Don't translate the words `terminal' or `listing'. */ - error (0, 0, _("%s is not a valid device type (the choices are " - "`terminal' and `listing')"), device_string); + error (0, 0, _("%s is not a valid device type (the choices are `%s' and `%s')"), + device_string, "terminal", "listing"); device_type = default_device_type (file_name); }