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}
+Tue Dec 30 22:35:16 2003 Ben Pfaff <blp@gnu.org>
+
+ * ascii.c: (ascii_option) Fix implementation of headers option.
+
+Tue Dec 30 22:32:53 2003 Ben Pfaff <blp@gnu.org>
+
+ * 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 <john@darrington.wattle.id.au>
* Removed redundant code from output.h
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
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. */
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;
{"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;
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);
}
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;
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;
ep = bp;
}
}
- p += ext->w;
output_string (this, ls_value (newline), ls_end (newline));
}