From: Ben Pfaff Date: Sun, 10 Jan 2021 19:48:47 +0000 (-0800) Subject: output: Rename page-eject-item to page-break-item. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f894a49a00de93333e64db483c193669c937a45;p=pspp output: Rename page-eject-item to page-break-item. Seems like a better name to me. --- diff --git a/src/language/data-io/print.c b/src/language/data-io/print.c index 1c63f9c2ce..b021d8eba7 100644 --- a/src/language/data-io/print.c +++ b/src/language/data-io/print.c @@ -42,7 +42,7 @@ #include "libpspp/u8-line.h" #include "output/pivot-table.h" #include "output/table.h" -#include "output/page-eject-item.h" +#include "output/page-break-item.h" #include "output/text-item.h" #include "gl/xalloc.h" @@ -556,7 +556,7 @@ print_text_flush_records (struct print_trns *trns, struct u8_line *line, { *eject = false; if (trns->writer == NULL) - page_eject_item_submit (page_eject_item_create ()); + page_break_item_submit (page_break_item_create ()); else leader = '1'; } diff --git a/src/output/automake.mk b/src/output/automake.mk index 005fb59d7e..4ee2da3556 100644 --- a/src/output/automake.mk +++ b/src/output/automake.mk @@ -83,8 +83,8 @@ src_output_liboutput_la_SOURCES = \ src/output/output-item-provider.h \ src/output/output-item.c \ src/output/output-item.h \ - src/output/page-eject-item.c \ - src/output/page-eject-item.h \ + src/output/page-break-item.c \ + src/output/page-break-item.h \ src/output/page-setup-item.c \ src/output/page-setup-item.h \ src/output/pivot-output.c \ diff --git a/src/output/cairo-fsm.c b/src/output/cairo-fsm.c index 2df3975434..fcbbbc649c 100644 --- a/src/output/cairo-fsm.c +++ b/src/output/cairo-fsm.c @@ -40,7 +40,7 @@ #include "output/group-item.h" #include "output/image-item.h" #include "output/message-item.h" -#include "output/page-eject-item.h" +#include "output/page-break-item.h" #include "output/page-setup-item.h" #include "output/pivot-output.h" #include "output/pivot-table.h" @@ -995,7 +995,7 @@ xr_fsm_create (const struct output_item *item_, if (is_table_item (item_) || is_chart_item (item_) || is_image_item (item_) - || is_page_eject_item (item_)) + || is_page_break_item (item_)) item = output_item_ref (item_); else if (is_message_item (item_)) item = table_item_super ( @@ -1026,7 +1026,7 @@ xr_fsm_create (const struct output_item *item_, assert (is_table_item (item) || is_chart_item (item) || is_image_item (item) - || is_page_eject_item (item)); + || is_page_break_item (item)); size_t *layer_indexes = NULL; if (is_table_item (item)) @@ -1214,7 +1214,7 @@ xr_fsm_draw_region (struct xr_fsm *fsm, cairo_t *cr, draw_image (to_image_item (fsm->item)->image, cr); else if (is_chart_item (fsm->item)) xr_draw_chart (to_chart_item (fsm->item), cr, CHART_WIDTH, CHART_HEIGHT); - else if (is_page_eject_item (fsm->item)) + else if (is_page_break_item (fsm->item)) { /* Nothing to do. */ } @@ -1310,7 +1310,7 @@ error: } static int -xr_fsm_draw_eject (struct xr_fsm *fsm, int space) +xr_fsm_draw_page_break (struct xr_fsm *fsm, int space) { if (space >= fsm->rp.size[V]) fsm->done = true; @@ -1330,7 +1330,8 @@ xr_fsm_draw_slice (struct xr_fsm *fsm, cairo_t *cr, int space) int used = (is_table_item (fsm->item) ? xr_fsm_draw_table (fsm, space) : is_chart_item (fsm->item) ? xr_fsm_draw_chart (fsm, space) : is_image_item (fsm->item) ? xr_fsm_draw_image (fsm, space) - : is_page_eject_item (fsm->item) ? xr_fsm_draw_eject (fsm, space) + : is_page_break_item (fsm->item) ? xr_fsm_draw_page_break (fsm, + space) : (abort (), 0)); fsm->cairo = NULL; cairo_restore (cr); diff --git a/src/output/cairo-pager.c b/src/output/cairo-pager.c index 311a3b546a..057ad41c6c 100644 --- a/src/output/cairo-pager.c +++ b/src/output/cairo-pager.c @@ -27,7 +27,6 @@ #include "output/driver-provider.h" #include "output/group-item.h" #include "output/message-item.h" -#include "output/page-eject-item.h" #include "output/page-setup-item.h" #include "output/table-item.h" #include "output/text-item.h" diff --git a/src/output/csv.c b/src/output/csv.c index 69f12b16f2..b97bfda600 100644 --- a/src/output/csv.c +++ b/src/output/csv.c @@ -30,7 +30,7 @@ #include "output/driver-provider.h" #include "output/options.h" #include "output/message-item.h" -#include "output/page-eject-item.h" +#include "output/page-break-item.h" #include "output/pivot-output.h" #include "output/pivot-table.h" #include "output/table-item.h" @@ -277,7 +277,7 @@ csv_submit (struct output_driver *driver, else csv_output_lines (csv, text); } - else if (is_page_eject_item (output_item)) + else if (is_page_break_item (output_item)) { csv_put_separator (csv); csv_output_lines (csv, ""); diff --git a/src/output/page-break-item.c b/src/output/page-break-item.c new file mode 100644 index 0000000000..477b640089 --- /dev/null +++ b/src/output/page-break-item.c @@ -0,0 +1,65 @@ +/* PSPP - a program for statistical analysis. + Copyright (C) 2020 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 + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include + +#include "output/page-break-item.h" + +#include + +#include "output/driver-provider.h" +#include "output/output-item-provider.h" + +#include "gl/xalloc.h" + +#include "gettext.h" +#define _(msgid) gettext (msgid) + +struct page_break_item * +page_break_item_create (void) +{ + struct page_break_item *item = xmalloc (sizeof *item); + *item = (struct page_break_item) { + .output_item = OUTPUT_ITEM_INITIALIZER (&page_break_item_class), + }; + return item; +} + +/* Submits ITEM to the configured output drivers, and transfers ownership to + the output subsystem. */ +void +page_break_item_submit (struct page_break_item *item) +{ + output_submit (&item->output_item); +} + +static const char * +page_break_item_get_label (const struct output_item *output_item UNUSED) +{ + return _("Page Break"); +} + +static void +page_break_item_destroy (struct output_item *output_item) +{ + free (to_page_break_item (output_item)); +} + +const struct output_item_class page_break_item_class = + { + page_break_item_get_label, + page_break_item_destroy, + }; diff --git a/src/output/page-break-item.h b/src/output/page-break-item.h new file mode 100644 index 0000000000..dea001378b --- /dev/null +++ b/src/output/page-break-item.h @@ -0,0 +1,91 @@ +/* PSPP - a program for statistical analysis. + Copyright (C) 2020 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 + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifndef OUTPUT_PAGE_BREAK_ITEM_H +#define OUTPUT_PAGE_BREAK_ITEM_H 1 + +/* Page break items. + + This ejects the page (for output devices that have pages). */ + +#include +#include "output/output-item.h" + +/* A page break item. */ +struct page_break_item + { + struct output_item output_item; + }; + +struct page_break_item *page_break_item_create (void); + +/* This boilerplate for page_break_item, a subclass of output_item, was + autogenerated by mk-class-boilerplate. */ + +#include +#include "libpspp/cast.h" + +extern const struct output_item_class page_break_item_class; + +/* Returns true if SUPER is a page_break_item, otherwise false. */ +static inline bool +is_page_break_item (const struct output_item *super) +{ + return super->class == &page_break_item_class; +} + +/* Returns SUPER converted to page_break_item. SUPER must be a page_break_item, as + reported by is_page_break_item. */ +static inline struct page_break_item * +to_page_break_item (const struct output_item *super) +{ + assert (is_page_break_item (super)); + return UP_CAST (super, struct page_break_item, output_item); +} + +/* Returns INSTANCE converted to output_item. */ +static inline struct output_item * +page_break_item_super (const struct page_break_item *instance) +{ + return CONST_CAST (struct output_item *, &instance->output_item); +} + +/* Increments INSTANCE's reference count and returns INSTANCE. */ +static inline struct page_break_item * +page_break_item_ref (const struct page_break_item *instance) +{ + return to_page_break_item (output_item_ref (&instance->output_item)); +} + +/* Decrements INSTANCE's reference count, then destroys INSTANCE if + the reference count is now zero. */ +static inline void +page_break_item_unref (struct page_break_item *instance) +{ + output_item_unref (&instance->output_item); +} + +/* Returns true if INSTANCE's reference count is greater than 1, + false otherwise. */ +static inline bool +page_break_item_is_shared (const struct page_break_item *instance) +{ + return output_item_is_shared (&instance->output_item); +} + +void page_break_item_submit (struct page_break_item *); + +#endif /* output/page-break-item.h */ diff --git a/src/output/page-eject-item.c b/src/output/page-eject-item.c deleted file mode 100644 index 85bde8c959..0000000000 --- a/src/output/page-eject-item.c +++ /dev/null @@ -1,65 +0,0 @@ -/* PSPP - a program for statistical analysis. - Copyright (C) 2020 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 - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#include - -#include "output/page-eject-item.h" - -#include - -#include "output/driver-provider.h" -#include "output/output-item-provider.h" - -#include "gl/xalloc.h" - -#include "gettext.h" -#define _(msgid) gettext (msgid) - -struct page_eject_item * -page_eject_item_create (void) -{ - struct page_eject_item *item = xmalloc (sizeof *item); - *item = (struct page_eject_item) { - .output_item = OUTPUT_ITEM_INITIALIZER (&page_eject_item_class), - }; - return item; -} - -/* Submits ITEM to the configured output drivers, and transfers ownership to - the output subsystem. */ -void -page_eject_item_submit (struct page_eject_item *item) -{ - output_submit (&item->output_item); -} - -static const char * -page_eject_item_get_label (const struct output_item *output_item UNUSED) -{ - return _("Page Break"); -} - -static void -page_eject_item_destroy (struct output_item *output_item) -{ - free (to_page_eject_item (output_item)); -} - -const struct output_item_class page_eject_item_class = - { - page_eject_item_get_label, - page_eject_item_destroy, - }; diff --git a/src/output/page-eject-item.h b/src/output/page-eject-item.h deleted file mode 100644 index b9cd67511c..0000000000 --- a/src/output/page-eject-item.h +++ /dev/null @@ -1,91 +0,0 @@ -/* PSPP - a program for statistical analysis. - Copyright (C) 2020 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 - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#ifndef OUTPUT_PAGE_EJECT_ITEM_H -#define OUTPUT_PAGE_EJECT_ITEM_H 1 - -/* Page eject items. - - This ejects the page (for output devices that have pages). */ - -#include -#include "output/output-item.h" - -/* A page eject item. */ -struct page_eject_item - { - struct output_item output_item; - }; - -struct page_eject_item *page_eject_item_create (void); - -/* This boilerplate for page_eject_item, a subclass of output_item, was - autogenerated by mk-class-boilerplate. */ - -#include -#include "libpspp/cast.h" - -extern const struct output_item_class page_eject_item_class; - -/* Returns true if SUPER is a page_eject_item, otherwise false. */ -static inline bool -is_page_eject_item (const struct output_item *super) -{ - return super->class == &page_eject_item_class; -} - -/* Returns SUPER converted to page_eject_item. SUPER must be a page_eject_item, as - reported by is_page_eject_item. */ -static inline struct page_eject_item * -to_page_eject_item (const struct output_item *super) -{ - assert (is_page_eject_item (super)); - return UP_CAST (super, struct page_eject_item, output_item); -} - -/* Returns INSTANCE converted to output_item. */ -static inline struct output_item * -page_eject_item_super (const struct page_eject_item *instance) -{ - return CONST_CAST (struct output_item *, &instance->output_item); -} - -/* Increments INSTANCE's reference count and returns INSTANCE. */ -static inline struct page_eject_item * -page_eject_item_ref (const struct page_eject_item *instance) -{ - return to_page_eject_item (output_item_ref (&instance->output_item)); -} - -/* Decrements INSTANCE's reference count, then destroys INSTANCE if - the reference count is now zero. */ -static inline void -page_eject_item_unref (struct page_eject_item *instance) -{ - output_item_unref (&instance->output_item); -} - -/* Returns true if INSTANCE's reference count is greater than 1, - false otherwise. */ -static inline bool -page_eject_item_is_shared (const struct page_eject_item *instance) -{ - return output_item_is_shared (&instance->output_item); -} - -void page_eject_item_submit (struct page_eject_item *); - -#endif /* output/page-eject-item.h */ diff --git a/src/output/pivot-output.c b/src/output/pivot-output.c index 15df5c7306..bea33985eb 100644 --- a/src/output/pivot-output.c +++ b/src/output/pivot-output.c @@ -23,7 +23,6 @@ #include "data/settings.h" #include "libpspp/assertion.h" #include "libpspp/pool.h" -#include "output/page-eject-item.h" #include "output/pivot-table.h" #include "output/table-item.h" #include "output/table-provider.h" diff --git a/src/output/spv-driver.c b/src/output/spv-driver.c index 75c8e82f04..e2bc9b2350 100644 --- a/src/output/spv-driver.c +++ b/src/output/spv-driver.c @@ -26,7 +26,6 @@ #include "output/chart-item.h" #include "output/group-item.h" #include "output/image-item.h" -#include "output/page-eject-item.h" #include "output/page-setup-item.h" #include "output/table-item.h" #include "output/text-item.h" diff --git a/src/output/spv/spv-writer.c b/src/output/spv/spv-writer.c index 03a415146d..7f8f1e4155 100644 --- a/src/output/spv/spv-writer.c +++ b/src/output/spv/spv-writer.c @@ -38,7 +38,7 @@ #include "output/driver.h" #include "output/group-item.h" #include "output/image-item.h" -#include "output/page-eject-item.h" +#include "output/page-break-item.h" #include "output/page-setup-item.h" #include "output/pivot-table.h" #include "output/table-item.h" @@ -1117,7 +1117,7 @@ spv_writer_write (struct spv_writer *w, const struct output_item *item) command_id); free (command_id); } - else if (is_page_eject_item (item)) + else if (is_page_break_item (item)) w->need_page_break = true; else if (is_page_setup_item (item)) {