From: Ben Pfaff Date: Wed, 31 Dec 2003 06:40:48 +0000 (+0000) Subject: Tue Dec 30 22:37:04 2003 Ben Pfaff X-Git-Tag: v0.4.0~399 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp-builds.git;a=commitdiff_plain;h=10c96b7648d6987bc21a727210dfadf433d5ccb2 Tue Dec 30 22:37:04 2003 Ben Pfaff * devices: Add "squeeze=on top-margin=0 bottom-margin=0" to raw-ascii to make test output more readable. Tue Dec 30 22:35:16 2003 Ben Pfaff * ascii.c: (ascii_option) Fix implementation of headers option. Tue Dec 30 22:32:53 2003 Ben Pfaff * ascii.c: Add a "squeeze" option to the ASCII driver to squeeze multiple blank lines into one. (struct ascii_driver_ext) Add squeeze_blank_lines option. (ascii_preopen_driver) Initialize squeeze_blank_lines. (static var option_tab) Add squeeze entry. (ascii_option) Set squeeze_blank_lines. (output_lines) Implement squeezing blank lines. --- diff --git a/config/ChangeLog b/config/ChangeLog index 12f1ea87..2b5db6b1 100644 --- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,3 +1,8 @@ +Tue Dec 30 22:37:04 2003 Ben Pfaff + + * devices: Add "squeeze=on top-margin=0 bottom-margin=0" to + raw-ascii to make test output more readable. + Sun May 24 22:40:13 1998 Ben Pfaff * ps-prologue: Add %%DocumentMedia: comment. diff --git a/config/devices b/config/devices index 47c953e9..d9abd198 100644 --- a/config/devices +++ b/config/devices @@ -59,7 +59,8 @@ tty-ascii:ascii:screen:char-set=ascii output-file=${tty-output-file} \ list-ascii:ascii:listing:length=66 width=79 char-set=ascii \ output-file=${list-output-file} ${no-attributes} raw-ascii:ascii:screen:width=9999 length=9999 char-set=ascii \ - output-file=${list-output-file} ${no-attributes} headers=off paginate=off + output-file=${list-output-file} ${no-attributes} headers=off paginate=off \ + squeeze=on top-margin=0 bottom-margin=0 # ASCII devices that support bold & underline via backspacing. tty-ascii-bi:ascii:screen:char-set=ascii output-file=${tty-output-file} diff --git a/src/ChangeLog b/src/ChangeLog index cbf7e312..e1e6ad58 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,17 @@ +Tue Dec 30 22:35:16 2003 Ben Pfaff + + * ascii.c: (ascii_option) Fix implementation of headers option. + +Tue Dec 30 22:32:53 2003 Ben Pfaff + + * ascii.c: Add a "squeeze" option to the ASCII driver to squeeze + multiple blank lines into one. + (struct ascii_driver_ext) Add squeeze_blank_lines option. + (ascii_preopen_driver) Initialize squeeze_blank_lines. + (static var option_tab) Add squeeze entry. + (ascii_option) Set squeeze_blank_lines. + (output_lines) Implement squeezing blank lines. + Wed Dec 31 07:19:46 WST 2003 John Darrington * Removed redundant code from output.h diff --git a/src/ascii.c b/src/ascii.c index 10345005..60bd1837 100644 --- a/src/ascii.c +++ b/src/ascii.c @@ -49,6 +49,7 @@ width=130 lpi=6 Only used to determine font size. cpi=10 + squeeze=off|on Squeeze multiple newlines into exactly one. left-margin=0 right-margin=0 @@ -161,6 +162,7 @@ struct ascii_driver_ext struct len_string fonts[FSTY_COUNT]; /* Font styles; NULL=overstrike. */ int overstrike_style; /* OVS_SINGLE or OVS_LINE. */ int carriage_return_style; /* Carriage return style. */ + int squeeze_blank_lines; /* 1=squeeze multiple blank lines into one. */ /* Internal state. */ struct file_ext file; /* Output file. */ @@ -235,6 +237,7 @@ ascii_preopen_driver (struct outp_driver *this) ls_null (&x->fonts[i]); x->overstrike_style = OVS_SINGLE; x->carriage_return_style = CRS_BS; + x->squeeze_blank_lines = 0; x->file.filename = NULL; x->file.mode = "wb"; x->file.file = NULL; @@ -438,6 +441,7 @@ static struct outp_option option_tab[] = {"overstrike-style", 3, 0}, {"tab-width", nonneg_int_arg, 4}, {"carriage-return-style", 4, 0}, + {"squeeze", boolean_arg, 2}, {"", 0, 0}, }; static struct outp_option_info option_info; @@ -622,11 +626,14 @@ ascii_option (struct outp_driver *this, const char *key, switch (subcat) { case 0: - x->headers = 0; + x->headers = setting; break; case 1: x->paginate = setting; break; + case 2: + x->squeeze_blank_lines = setting; + break; default: assert (0); } @@ -1332,9 +1339,8 @@ static void output_lines (struct outp_driver *this, int first, int count) { struct ascii_driver_ext *ext = this->ext; + int line_num; - unsigned short *p = &ext->page[ext->w * first]; - int *len = &ext->line_len[first]; struct len_string *newline = &ext->ops[OPS_NEWLINE]; int n_chars; @@ -1343,15 +1349,24 @@ output_lines (struct outp_driver *this, int first, int count) if (NULL == ext->file.file) return; - while (count--) /* Iterate over all the lines to be output. */ + /* Iterate over all the lines to be output. */ + for (line_num = first; line_num < first + count; line_num++) { - unsigned short *end_p; + unsigned short *p = &ext->page[ext->w * line_num]; + unsigned short *end_p = p + ext->line_len[line_num]; unsigned short *bp, *ep; unsigned short attr = 0; - end_p = p + *len++; assert (end_p >= p); + /* Squeeze multiple blank lines into a single blank line if + requested. */ + if (ext->squeeze_blank_lines + && line_num > first + && ext->line_len[line_num] == 0 + && ext->line_len[line_num - 1] == 0) + continue; + /* Output every character in the line in the appropriate manner. */ n_passes = 1; @@ -1469,7 +1484,6 @@ output_lines (struct outp_driver *this, int first, int count) ep = bp; } } - p += ext->w; output_string (this, ls_value (newline), ls_end (newline)); }