summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwlemb <wlemb>2001-10-20 22:37:21 +0000
committerwlemb <wlemb>2001-10-20 22:37:21 +0000
commitabb77de1a36f925cdb8e28e5c76465880d63fa19 (patch)
tree04319bf7fd8e945dd153fdc064220a69c4cb353c
parentb7ab606ed851fa982fe3c53081f2c5c6b3e104e0 (diff)
downloadgroff-abb77de1a36f925cdb8e28e5c76465880d63fa19.tar.gz
Undo change from 2001-08-28.
* src/roff/troff/input.cc (have_input): New global variable. (token::next): Set `have_input' for \f, \H, \R, \s, and \S if not in compatibility mode. (process_input_stack): Use it.
-rw-r--r--ChangeLog9
-rw-r--r--src/roff/troff/input.cc60
-rw-r--r--src/roff/troff/token.h1
3 files changed, 36 insertions, 34 deletions
diff --git a/ChangeLog b/ChangeLog
index ed68f68b..048a5ef9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2001-10-20 Werner LEMBERG <wl@gnu.org>
+
+ Undo change from 2001-08-28.
+
+ * src/roff/troff/input.cc (have_input): New global variable.
+ (token::next): Set `have_input' for \f, \H, \R, \s, and \S if not
+ in compatibility mode.
+ (process_input_stack): Use it.
+
2001-10-19 Ruslan Ermilov <ru@FreeBSD.org>
* tmac/doc.tmac (doc-flag-recursion): Protect arguments against
diff --git a/src/roff/troff/input.cc b/src/roff/troff/input.cc
index 1278d776..b557553c 100644
--- a/src/roff/troff/input.cc
+++ b/src/roff/troff/input.cc
@@ -115,6 +115,8 @@ int suppress_output_flag = 0;
int is_html = 0;
int begin_level = 0; // number of nested .begin requests
+int have_input = 0; // whether \f, \H, \R, \s, or \S has
+ // been proceseed in token::next()
int tcommand_flag = 0;
int safer_flag = 1; // safer by default
@@ -1085,6 +1087,7 @@ static unsigned int get_color_element(const char *scheme, const char *color)
}
if (val > color::MAX_COLOR_VAL+1) {
warning(WARN_RANGE, "%1 cannot be greater than 1", color);
+ // we change 0x10000 to 0xffff
return color::MAX_COLOR_VAL;
}
return (unsigned int)val;
@@ -1801,10 +1804,9 @@ void token::next()
curenv->set_font(s);
else
curenv->set_font(atoi(s.contents()));
- if (compatible_flag)
- break;
- type = TOKEN_OPAQUE_ESCAPE;
- return;
+ if (!compatible_flag)
+ have_input = 1;
+ break;
}
case 'g':
{
@@ -1822,10 +1824,9 @@ void token::next()
case 'H':
if (get_delim_number(&x, 'z', curenv->get_requested_point_size()))
curenv->set_char_height(x);
- if (compatible_flag)
- break;
- type = TOKEN_OPAQUE_ESCAPE;
- return;
+ if (!compatible_flag)
+ have_input = 1;
+ break;
case 'k':
nm = read_escape_name();
if (nm.is_null())
@@ -1892,24 +1893,21 @@ void token::next()
return;
case 'R':
do_register();
- if (compatible_flag)
- break;
- type = TOKEN_OPAQUE_ESCAPE;
- return;
+ if (!compatible_flag)
+ have_input = 1;
+ break;
case 's':
if (read_size(&x))
curenv->set_size(x);
- if (compatible_flag)
- break;
- type = TOKEN_OPAQUE_ESCAPE;
- return;
+ if (!compatible_flag)
+ have_input = 1;
+ break;
case 'S':
if (get_delim_number(&x, 0))
curenv->set_char_slant(x);
- if (compatible_flag)
- break;
- type = TOKEN_OPAQUE_ESCAPE;
- return;
+ if (!compatible_flag)
+ have_input = 1;
+ break;
case 't':
type = TOKEN_NODE;
nd = new non_interpreted_char_node('\t');
@@ -2113,8 +2111,6 @@ const char *token::description()
return "a node";
case TOKEN_NUMBERED_CHAR:
return "`\\N'";
- case TOKEN_OPAQUE_ESCAPE:
- return "a transparent escape (`\\f', `\\H', `\\R', `\\s', `\\S')";
case TOKEN_RIGHT_BRACE:
return "`\\}'";
case TOKEN_SPACE:
@@ -2484,9 +2480,9 @@ void process_input_stack()
case token::TOKEN_CHAR:
{
unsigned char ch = tok.c;
- if (bol &&
- (ch == curenv->control_char
- || ch == curenv->no_break_control_char)) {
+ if (bol && !have_input
+ && (ch == curenv->control_char
+ || ch == curenv->no_break_control_char)) {
break_flag = ch == curenv->control_char;
// skip tabs as well as spaces here
do {
@@ -2498,6 +2494,7 @@ void process_input_stack()
else
interpolate_macro(nm);
suppress_next = 1;
+ have_input = 0;
}
else {
if (possibly_handle_first_page_transition())
@@ -2538,16 +2535,15 @@ void process_input_stack()
}
break;
}
- case token::TOKEN_OPAQUE_ESCAPE:
- bol = 0;
- break;
case token::TOKEN_NEWLINE:
{
- if (bol && !curenv->get_prev_line_interrupted())
+ if (bol && !have_input
+ && !curenv->get_prev_line_interrupted())
trapping_blank_line();
else {
curenv->newline();
bol = 1;
+ have_input = 0;
}
break;
}
@@ -2575,6 +2571,7 @@ void process_input_stack()
break;
}
suppress_next = 1;
+ have_input = 0;
break;
}
case token::TOKEN_SPACE:
@@ -2632,6 +2629,7 @@ void process_input_stack()
{
trap_bol_stack.push(bol);
bol = 1;
+ have_input = 0;
break;
}
case token::TOKEN_END_TRAP:
@@ -5827,7 +5825,6 @@ int token::add_to_node_list(node **pp)
*pp = (*pp)->add_char(get_charinfo_by_number(val), curenv, &w, &s);
break;
case TOKEN_RIGHT_BRACE:
- case TOKEN_OPAQUE_ESCAPE:
break;
case TOKEN_SPACE:
n = new hmotion_node(curenv->get_space_width());
@@ -5907,9 +5904,6 @@ void token::process()
case TOKEN_NUMBERED_CHAR:
curenv->add_char(get_charinfo_by_number(val));
break;
- case TOKEN_OPAQUE_ESCAPE:
- // handled in process_input_stack()
- break;
case TOKEN_REQUEST:
// handled in process_input_stack()
break;
diff --git a/src/roff/troff/token.h b/src/roff/troff/token.h
index 2c9cb865..2186d2b0 100644
--- a/src/roff/troff/token.h
+++ b/src/roff/troff/token.h
@@ -47,7 +47,6 @@ class token {
TOKEN_NEWLINE, // newline
TOKEN_NODE,
TOKEN_NUMBERED_CHAR,
- TOKEN_OPAQUE_ESCAPE, // \f, \H, \R, \s, \S
TOKEN_PAGE_EJECTOR,
TOKEN_REQUEST,
TOKEN_RIGHT_BRACE,