X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Fmanager.c;h=0b2fdfe1cf2ab53fc1fdaaf4ce3decf23b14f0ad;hb=a1edd7f28a94b05b3fd48850e80dd0b96bead96e;hp=6e76605d6663540f1cbbbd15967b5c5c235ce9aa;hpb=480a0746507ce73d26f528b56dc3ed80195096e0;p=pspp-builds.git diff --git a/src/output/manager.c b/src/output/manager.c index 6e76605d..0b2fdfe1 100644 --- a/src/output/manager.c +++ b/src/output/manager.c @@ -1,20 +1,18 @@ -/* PSPP - computes sample statistics. - Copyright (C) 1997-9, 2000 Free Software Foundation, Inc. +/* PSPP - a program for statistical analysis. + Copyright (C) 1997-9, 2000, 2007 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 2 of the - License, or (at your option) any later version. + 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. + 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. */ + along with this program. If not, see . */ #include #include "manager.h" @@ -49,12 +47,22 @@ som_eject_page (void) outp_eject_page (d); } +/* Flushes output on all active devices. */ +void +som_flush (void) +{ + struct outp_driver *d; + + for (d = outp_drivers (NULL); d; d = outp_drivers (d)) + outp_flush (d); +} + /* Skip down a single line on all active devices. */ void som_blank_line (void) { struct outp_driver *d; - + for (d = outp_drivers (NULL); d; d = outp_drivers (d)) if (d->page_open && d->cp_y != 0) d->cp_y += d->font_height; @@ -93,11 +101,11 @@ som_submit (struct som_entity *t) { #if DEBUGGING static int entry; - + assert (entry++ == 0); #endif - if ( t->type == SOM_TABLE) + if ( t->type == SOM_TABLE) { t->class->table (t); t->class->flags (&flags); @@ -122,17 +130,17 @@ som_submit (struct som_entity *t) if (!(flags & SOMF_NO_TITLE)) subtable_num++; - + } - + { struct outp_driver *d; - + for (d = outp_drivers (NULL); d; d = outp_drivers (d)) output_entity (d, t); } - + #if DEBUGGING assert (--entry == 0); #endif @@ -153,12 +161,12 @@ output_entity (struct outp_driver *driver, struct som_entity *entity) } t = entity; - + t->class->driver (d); t->class->area (&tw, &th); fits_width = t->class->fits_width (d->width); fits_length = t->class->fits_length (d->length); - if (!fits_width || !fits_length) + if (!fits_width || !fits_length) { int tl, tr, tt, tb; tl = fits_width ? hl : 0; @@ -169,17 +177,17 @@ output_entity (struct outp_driver *driver, struct som_entity *entity) t->class->driver (d); t->class->area (&tw, &th); } - + if (!(flags & SOMF_NO_SPACING) && d->cp_y != 0) d->cp_y += d->font_height; - + if (cs != SOM_COL_NONE && 2 * (tw + d->prop_em_width) <= d->width && nr - (ht + hb) > 5) render_columns (); else if (tw < d->width && th + d->cp_y < d->length) render_simple (); - else + else render_segments (); t->class->set_headers (hl, hr, ht, hb); @@ -192,14 +200,14 @@ render_columns (void) int y0, y1; int max_len = 0; int index = 0; - + assert (cs == SOM_COL_DOWN); assert (d->cp_x == 0); for (y0 = ht; y0 < nr - hb; y0 = y1) { int len; - + t->class->cumulate (SOM_ROWS, y0, &y1, d->length - d->cp_y, &len); if (y0 == y1) @@ -214,7 +222,7 @@ render_columns (void) t->class->title (index++, 0); t->class->render (0, y0, nc, y1); - + d->cp_x += tw + 2 * d->prop_em_width; if (d->cp_x + tw > d->width) { @@ -224,7 +232,7 @@ render_columns (void) } } } - + if (d->cp_x > 0) { d->cp_x = 0; @@ -249,17 +257,17 @@ static void render_segments (void) { int count = 0; - + int x_index; int x0, x1; - + assert (d->cp_x == 0); for (x_index = 0, x0 = hl; x0 < nc - hr; x0 = x1, x_index++) { int y_index; int y0, y1; - + t->class->cumulate (SOM_COLUMNS, x0, &x1, d->width, NULL); if (x_index == 0 && x1 != nc - hr) x_index++; @@ -267,10 +275,10 @@ render_segments (void) for (y_index = 0, y0 = ht; y0 < nr - hb; y0 = y1, y_index++) { int len; - + if (count++ != 0 && d->cp_y != 0) d->cp_y += d->font_height; - + t->class->cumulate (SOM_ROWS, y0, &y1, d->length - d->cp_y, &len); if (y_index == 0 && y1 != nr - hb) y_index++; @@ -285,7 +293,7 @@ render_segments (void) t->class->title (x_index ? x_index : y_index, x_index ? y_index : 0); t->class->render (x0, y0, x1, y1); - + d->cp_y += len; } }