From 5f894a49a00de93333e64db483c193669c937a45 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sun, 10 Jan 2021 11:48:47 -0800 Subject: [PATCH] output: Rename page-eject-item to page-break-item. Seems like a better name to me. --- src/language/data-io/print.c | 4 +- src/output/automake.mk | 4 +- src/output/cairo-fsm.c | 13 ++--- src/output/cairo-pager.c | 1 - src/output/csv.c | 4 +- .../{page-eject-item.c => page-break-item.c} | 26 +++++----- .../{page-eject-item.h => page-break-item.h} | 50 +++++++++---------- src/output/pivot-output.c | 1 - src/output/spv-driver.c | 1 - src/output/spv/spv-writer.c | 4 +- 10 files changed, 53 insertions(+), 55 deletions(-) rename src/output/{page-eject-item.c => page-break-item.c} (67%) rename src/output/{page-eject-item.h => page-break-item.h} (56%) 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-eject-item.c b/src/output/page-break-item.c similarity index 67% rename from src/output/page-eject-item.c rename to src/output/page-break-item.c index 85bde8c959..477b640089 100644 --- a/src/output/page-eject-item.c +++ b/src/output/page-break-item.c @@ -16,7 +16,7 @@ #include -#include "output/page-eject-item.h" +#include "output/page-break-item.h" #include @@ -28,12 +28,12 @@ #include "gettext.h" #define _(msgid) gettext (msgid) -struct page_eject_item * -page_eject_item_create (void) +struct page_break_item * +page_break_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), + struct page_break_item *item = xmalloc (sizeof *item); + *item = (struct page_break_item) { + .output_item = OUTPUT_ITEM_INITIALIZER (&page_break_item_class), }; return item; } @@ -41,25 +41,25 @@ page_eject_item_create (void) /* Submits ITEM to the configured output drivers, and transfers ownership to the output subsystem. */ void -page_eject_item_submit (struct page_eject_item *item) +page_break_item_submit (struct page_break_item *item) { output_submit (&item->output_item); } static const char * -page_eject_item_get_label (const struct output_item *output_item UNUSED) +page_break_item_get_label (const struct output_item *output_item UNUSED) { return _("Page Break"); } static void -page_eject_item_destroy (struct output_item *output_item) +page_break_item_destroy (struct output_item *output_item) { - free (to_page_eject_item (output_item)); + free (to_page_break_item (output_item)); } -const struct output_item_class page_eject_item_class = +const struct output_item_class page_break_item_class = { - page_eject_item_get_label, - page_eject_item_destroy, + page_break_item_get_label, + page_break_item_destroy, }; diff --git a/src/output/page-eject-item.h b/src/output/page-break-item.h similarity index 56% rename from src/output/page-eject-item.h rename to src/output/page-break-item.h index b9cd67511c..dea001378b 100644 --- a/src/output/page-eject-item.h +++ b/src/output/page-break-item.h @@ -14,66 +14,66 @@ 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 +#ifndef OUTPUT_PAGE_BREAK_ITEM_H +#define OUTPUT_PAGE_BREAK_ITEM_H 1 -/* Page eject items. +/* Page break 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 +/* A page break item. */ +struct page_break_item { struct output_item output_item; }; -struct page_eject_item *page_eject_item_create (void); +struct page_break_item *page_break_item_create (void); -/* This boilerplate for page_eject_item, a subclass of output_item, was +/* 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_eject_item_class; +extern const struct output_item_class page_break_item_class; -/* Returns true if SUPER is a page_eject_item, otherwise false. */ +/* Returns true if SUPER is a page_break_item, otherwise false. */ static inline bool -is_page_eject_item (const struct output_item *super) +is_page_break_item (const struct output_item *super) { - return super->class == &page_eject_item_class; + return super->class == &page_break_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) +/* 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_eject_item (super)); - return UP_CAST (super, struct page_eject_item, output_item); + 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_eject_item_super (const struct page_eject_item *instance) +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_eject_item * -page_eject_item_ref (const struct page_eject_item *instance) +static inline struct page_break_item * +page_break_item_ref (const struct page_break_item *instance) { - return to_page_eject_item (output_item_ref (&instance->output_item)); + 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_eject_item_unref (struct page_eject_item *instance) +page_break_item_unref (struct page_break_item *instance) { output_item_unref (&instance->output_item); } @@ -81,11 +81,11 @@ page_eject_item_unref (struct page_eject_item *instance) /* 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) +page_break_item_is_shared (const struct page_break_item *instance) { return output_item_is_shared (&instance->output_item); } -void page_eject_item_submit (struct page_eject_item *); +void page_break_item_submit (struct page_break_item *); -#endif /* output/page-eject-item.h */ +#endif /* output/page-break-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)) { -- 2.30.2