summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwlemb <wlemb>2001-04-06 13:03:13 +0000
committerwlemb <wlemb>2001-04-06 13:03:13 +0000
commitd8d8cd42bf367a56b6c55d06fd94cd096bf9540f (patch)
treed7de980ae5cfa003f56b63a4b875b58f62b0b6fe
parent04387f3d81f90ff69dd1ca79803979ff3a8b205c (diff)
downloadgroff-d8d8cd42bf367a56b6c55d06fd94cd096bf9540f.tar.gz
Implement continuous underlining for nroff mode. To do that, a new
request in the ditroff language has been added: `x u N' (N is 0 or 1). X and Y are now transparent to end-of-sentence recognition. * src/include/printer.h (printer): Add `type' parameter to `special' method. * src/libs/libdriver/printer.cc (printer::special): Updated. * src/libs/libdriver/input.cc (do_file): Handle `x u N'. * src/devices/dvi/dvi.cc (dvi_printer::special): Handle only specials of type `p'. * src/devices/grohtml/post-html.cc (html_printer::special): Ditto. * src/devices/grohtml-old/html.cc (html_printer::special): Ditto. * src/devices/grops/ps.cc (ps_printer::special): Ditto. * src/devices/grotty/tty.cc: Add new enum CU_MODE. (glyph::order): New method. (tty_printer::add_char): Use it. (tty_printer::special): New method. (tty_printer::end_page): Implement it. * src/roff/troff/node.h (special_node): Add `no_init_string' member. * src/roff/troff/node.cc (special_node::special_node): Add parameter to set `no_init_string'. (special_node::tprint_start): Use it. (special_node::same, special_node::copy): Updated. (special_node::ends_sentence): New method. (troff_output_file::start_special): Add parameter to include inititialization of special conditionally. * src/roff/troff/env.h (environment): New member `underline_spaces'. * src/roff/troff/env.cc (do_underline_special): New function. (environment::set_font): Use it. (do_underline): Use it. This was `underline()'. (underline): Call `do_underline()'. (continuous_underline): New function which calls `do_underline()'. (environment::newline): Use `do_underline_special()'. (init_env_requests): Updated. * NEWS, man/troff_out.man: Updated. * font/devutf8/R.proto: Fix code of 'shc'.
-rw-r--r--ChangeLog48
-rw-r--r--NEWS5
-rw-r--r--font/devutf8/R.proto2
-rw-r--r--man/groff_out.man17
-rw-r--r--src/devices/grodvi/dvi.cc9
-rwxr-xr-xsrc/devices/grohtml-old/html.cc8
-rw-r--r--src/devices/grohtml/post-html.cc6
-rw-r--r--src/devices/grops/ps.cc9
-rw-r--r--src/devices/grotty/grotty.man2
-rw-r--r--src/devices/grotty/tty.cc48
-rw-r--r--src/include/printer.h10
-rw-r--r--src/libs/libdriver/input.cc11
-rw-r--r--src/libs/libdriver/printer.cc2
-rw-r--r--src/roff/troff/env.cc45
-rw-r--r--src/roff/troff/env.h3
-rw-r--r--src/roff/troff/node.cc36
-rw-r--r--src/roff/troff/node.h6
17 files changed, 212 insertions, 55 deletions
diff --git a/ChangeLog b/ChangeLog
index e24c999a..0a2e92a4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,51 @@
+2001-04-06 Werner Lemberg <wl@gnu.org>
+
+ Implement continuous underlining for nroff mode. To do that, a new
+ request in the ditroff language has been added: `x u N' (N is 0
+ or 1).
+
+ \X and \Y are now transparent to end-of-sentence recognition.
+
+ * src/include/printer.h (printer): Add `type' parameter to `special'
+ method.
+ * src/libs/libdriver/printer.cc (printer::special): Updated.
+ * src/libs/libdriver/input.cc (do_file): Handle `x u N'.
+
+ * src/devices/dvi/dvi.cc (dvi_printer::special): Handle only
+ specials of type `p'.
+ * src/devices/grohtml/post-html.cc (html_printer::special): Ditto.
+ * src/devices/grohtml-old/html.cc (html_printer::special): Ditto.
+ * src/devices/grops/ps.cc (ps_printer::special): Ditto.
+ * src/devices/grotty/tty.cc: Add new enum CU_MODE.
+ (glyph::order): New method.
+ (tty_printer::add_char): Use it.
+ (tty_printer::special): New method.
+ (tty_printer::end_page): Implement it.
+
+ * src/roff/troff/node.h (special_node): Add `no_init_string' member.
+ * src/roff/troff/node.cc (special_node::special_node): Add parameter
+ to set `no_init_string'.
+ (special_node::tprint_start): Use it.
+ (special_node::same, special_node::copy): Updated.
+ (special_node::ends_sentence): New method.
+ (troff_output_file::start_special): Add parameter to include
+ inititialization of special conditionally.
+
+ * src/roff/troff/env.h (environment): New member `underline_spaces'.
+ * src/roff/troff/env.cc (do_underline_special): New function.
+ (environment::set_font): Use it.
+ (do_underline): Use it. This was `underline()'.
+ (underline): Call `do_underline()'.
+ (continuous_underline): New function which calls `do_underline()'.
+ (environment::newline): Use `do_underline_special()'.
+ (init_env_requests): Updated.
+
+ * NEWS, man/troff_out.man: Updated.
+
+2001-04-06 Bruno Haible <haible@clisp.cons.org>
+
+ * font/devutf8/R.proto: Fix code of 'shc'.
+
2001-04-06 Ruslan Ermilov <ru@freebsd.org>
Many fixes. Diag lists can now be nested also; additionally,
diff --git a/NEWS b/NEWS
index 981046f5..b441fc79 100644
--- a/NEWS
+++ b/NEWS
@@ -174,6 +174,11 @@ o The read/write number register `hp' to get/set the current horizontal
position relative to the input line isn't new but hasn't been documented
properly before.
+o `\X' and `\Y' are no transparent for end-of-sentence recognition.
+
+o The `cu' request in nroff mode now works as documented (i.e., it does
+ underline spaces also).
+
Nroff
-----
diff --git a/font/devutf8/R.proto b/font/devutf8/R.proto
index 9f3eaeb4..7715ed4d 100644
--- a/font/devutf8/R.proto
+++ b/font/devutf8/R.proto
@@ -141,7 +141,7 @@ Fo 24 0 0x00AB
char171 "
no 24 0 0x00AC
char172 "
-shc 24 0 0x00AC
+shc 24 0 0x00AD
char173 "
rg 24 0 0x00AE
char174 "
diff --git a/man/groff_out.man b/man/groff_out.man
index 5e4c9068..ae30f8d4 100644
--- a/man/groff_out.man
+++ b/man/groff_out.man
@@ -1,7 +1,7 @@
'\" e
.\" The above line should force the use of eqn as a preprocessor
.ig
-Copyright (C) 1989-2000 Free Software Foundation, Inc.
+Copyright (C) 1989-2000, 2001 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -87,6 +87,21 @@ Unlike device-independent troff, it is not necessary
for drivers to search special fonts to find a character.
.LP
The
+.B x
+device control command has been extended.
+.TP
+\fBx u \fIn\fR
+If
+.I n
+is\~1, start underlining of spaces.
+If
+.I n
+is\~0, stop underlining of spaces.
+This is needed for the
+.B cu
+request in nroff mode and is ignored otherwise.
+.LP
+The
.B D
drawing command has been extended.
These extensions will not be used by GNU pic if the
diff --git a/src/devices/grodvi/dvi.cc b/src/devices/grodvi/dvi.cc
index 1a8ce8b5..68774de0 100644
--- a/src/devices/grodvi/dvi.cc
+++ b/src/devices/grodvi/dvi.cc
@@ -1,5 +1,6 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001
+ Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -168,7 +169,7 @@ public:
void begin_page(int);
void end_page(int);
void set_char(int, font *, const environment *, int w, const char *name);
- void special(char *arg, const environment *env);
+ void special(char *arg, const environment *env, char type);
void end_of_line();
void draw(int code, int *p, int np, const environment *env);
};
@@ -492,8 +493,10 @@ void dvi_printer::do_special(const char *s)
out1(*s++);
}
-void dvi_printer::special(char *arg, const environment *env)
+void dvi_printer::special(char *arg, const environment *env, char type)
{
+ if (type != 'p')
+ return;
moveto(env->hpos, env->vpos);
do_special(arg);
}
diff --git a/src/devices/grohtml-old/html.cc b/src/devices/grohtml-old/html.cc
index b7acb6b7..89247256 100755
--- a/src/devices/grohtml-old/html.cc
+++ b/src/devices/grohtml-old/html.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2001 Free Software Foundation, Inc.
*
* Gaius Mulley (gaius@glam.ac.uk) wrote grohtml
* but it owes a huge amount of ideas and raw code from
@@ -1201,7 +1201,7 @@ public:
void draw(int code, int *p, int np, const environment *env);
void begin_page(int);
void end_page(int);
- void special(char *arg, const environment *env);
+ void special(char *arg, const environment *env, char type);
font *make_font(const char *);
void end_of_line();
};
@@ -6473,8 +6473,10 @@ int is_graphic_end (char *s)
* also allow tbl, eqn & pic say what commands they have generated.
*/
-void html_printer::special(char *s, const environment *env)
+void html_printer::special(char *s, const environment *env, char type)
{
+ if (type == 'p')
+ return;
if (s != 0) {
if (is_graphic_start(s)) {
graphic_level++;
diff --git a/src/devices/grohtml/post-html.cc b/src/devices/grohtml/post-html.cc
index d66fe94e..63965652 100644
--- a/src/devices/grohtml/post-html.cc
+++ b/src/devices/grohtml/post-html.cc
@@ -1048,7 +1048,7 @@ public:
void draw (int code, int *p, int np, const environment *env);
void begin_page (int);
void end_page (int);
- void special (char *arg, const environment *env);
+ void special (char *arg, const environment *env, char type);
font *make_font (const char *);
void end_of_line ();
};
@@ -2729,8 +2729,10 @@ html_printer::~html_printer()
* also allow troff to emit tags to indicate when a: .br, .sp etc occurs.
*/
-void html_printer::special(char *s, const environment *env)
+void html_printer::special(char *s, const environment *env, char type)
{
+ if (type != 'p')
+ return;
if (s != 0) {
flush_sbuf();
if (env->fontno >= 0) {
diff --git a/src/devices/grops/ps.cc b/src/devices/grops/ps.cc
index 30cd7737..eb3b6cc8 100644
--- a/src/devices/grops/ps.cc
+++ b/src/devices/grops/ps.cc
@@ -1,5 +1,6 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001
+ Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -513,7 +514,7 @@ public:
void draw(int code, int *p, int np, const environment *env);
void begin_page(int);
void end_page(int);
- void special(char *arg, const environment *env);
+ void special(char *arg, const environment *env, char type);
font *make_font(const char *);
void end_of_line();
};
@@ -1210,8 +1211,10 @@ ps_printer::~ps_printer()
fclose(tempfp);
}
-void ps_printer::special(char *arg, const environment *env)
+void ps_printer::special(char *arg, const environment *env, char type)
{
+ if (type != 'p')
+ return;
typedef void (ps_printer::*SPECIAL_PROCP)(char *, const environment *);
static struct {
const char *name;
diff --git a/src/devices/grotty/grotty.man b/src/devices/grotty/grotty.man
index 24462f12..8fdca02b 100644
--- a/src/devices/grotty/grotty.man
+++ b/src/devices/grotty/grotty.man
@@ -39,7 +39,7 @@ translates the output of GNU
into a form suitable for typewriter-like devices.
Normally
.B grotty
-should invoked by using the
+should be invoked by using the
.B groff
command
with a
diff --git a/src/devices/grotty/tty.cc b/src/devices/grotty/tty.cc
index d44c8027..497275ce 100644
--- a/src/devices/grotty/tty.cc
+++ b/src/devices/grotty/tty.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989-2000 Free Software Foundation, Inc.
+/* Copyright (C) 1989-2000, 2001 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -39,10 +39,11 @@ static int overstrike_flag = 1;
static int draw_flag = 1;
enum {
- UNDERLINE_MODE = 01,
- BOLD_MODE = 02,
- VDRAW_MODE = 04,
- HDRAW_MODE = 010
+ UNDERLINE_MODE = 0x01,
+ BOLD_MODE = 0x02,
+ VDRAW_MODE = 0x04,
+ HDRAW_MODE = 0x08,
+ CU_MODE = 0x10
};
// Mode to use for bold-underlining.
@@ -109,6 +110,7 @@ public:
void *operator new(size_t);
void operator delete(void *);
inline int draw_mode() { return mode & (VDRAW_MODE|HDRAW_MODE); }
+ inline int order() { return mode & (VDRAW_MODE|HDRAW_MODE|CU_MODE); }
};
glyph *glyph::free_list = 0;
@@ -148,6 +150,7 @@ public:
~tty_printer();
void set_char(int, font *, const environment *, int, const char *name);
void draw(int code, int *p, int np, const environment *env);
+ void special(char *arg, const environment *env, char type);
void put_char(unsigned int);
void begin_page(int) { }
void end_page(int page_length);
@@ -219,20 +222,25 @@ void tty_printer::add_char(unsigned int c, int h, int v, unsigned char mode)
g->mode = mode;
// The list will be reversed later. After reversal, it must be in
- // increasing order of hpos, with HDRAW characters before VDRAW
- // characters before normal characters at each hpos, and otherwise
- // in order of occurrence.
+ // increasing order of hpos, with CU specials before HDRAW characters
+ // before VDRAW characters before normal characters at each hpos, and
+ // otherwise in order of occurrence.
glyph **pp;
for (pp = lines + (vpos - 1); *pp; pp = &(*pp)->next)
if ((*pp)->hpos < hpos
- || ((*pp)->hpos == hpos && (*pp)->draw_mode() >= g->draw_mode()))
+ || ((*pp)->hpos == hpos && (*pp)->order() >= g->order()))
break;
-
g->next = *pp;
*pp = g;
}
+void tty_printer::special(char *arg, const environment *env, char type)
+{
+ if (type == 'u')
+ add_char(*arg - '0', env->hpos, env->vpos, CU_MODE);
+}
+
void tty_printer::draw(int code, int *p, int np, const environment *env)
{
if (code != 'l' || !draw_flag)
@@ -293,11 +301,14 @@ void tty_printer::put_char(unsigned int wc)
while (count > 0);
*++p = '\0';
fputs(buf, stdout);
- } else {
+ }
+ else {
putchar(wc);
}
}
+int cu_flag = 0;
+
void tty_printer::end_page(int page_length)
{
if (page_length % font::vert != 0)
@@ -334,6 +345,10 @@ void tty_printer::end_page(int page_length)
glyph *nextp;
for (p = g; p; delete p, p = nextp) {
nextp = p->next;
+ if (p->mode & CU_MODE) {
+ cu_flag = p->code;
+ continue;
+ }
if (nextp && p->hpos == nextp->hpos) {
if (p->draw_mode() == HDRAW_MODE &&
nextp->draw_mode() == VDRAW_MODE) {
@@ -359,12 +374,21 @@ void tty_printer::end_page(int page_length)
int next_tab_pos = ((hpos + TAB_WIDTH) / TAB_WIDTH) * TAB_WIDTH;
if (next_tab_pos > p->hpos)
break;
+ if (cu_flag) {
+ putchar('_');
+ putchar('\b');
+ }
putchar('\t');
hpos = next_tab_pos;
}
}
- for (; hpos < p->hpos; hpos++)
+ for (; hpos < p->hpos; hpos++) {
+ if (cu_flag) {
+ putchar('_');
+ putchar('\b');
+ }
putchar(' ');
+ }
}
assert(hpos == p->hpos);
if (p->mode & UNDERLINE_MODE) {
diff --git a/src/include/printer.h b/src/include/printer.h
index d7253d03..beae4d9a 100644
--- a/src/include/printer.h
+++ b/src/include/printer.h
@@ -54,17 +54,17 @@ public:
virtual void end_page(int page_length) = 0;
virtual font *make_font(const char *nm);
virtual void end_of_line();
- virtual void special(char *arg, const environment *env);
+ virtual void special(char *arg, const environment *env, char type = 'p');
static int adjust_arc_center(const int *, double *);
protected:
font_pointer_list *font_list;
// information about named characters
- int is_char_named;
- int is_named_set;
- char named_command;
+ int is_char_named;
+ int is_named_set;
+ char named_command;
const char *named_char_s;
- int named_char_n;
+ int named_char_n;
private:
font **font_table;
diff --git a/src/libs/libdriver/input.cc b/src/libs/libdriver/input.cc
index ba71a5b3..e19841c1 100644
--- a/src/libs/libdriver/input.cc
+++ b/src/libs/libdriver/input.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2001 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -54,7 +54,7 @@ inline int get_char()
* filename eventually.
*/
-void remember_filename (const char *filename)
+void remember_filename(const char *filename)
{
if (current_filename != 0) {
free((char *)current_filename);
@@ -62,7 +62,7 @@ void remember_filename (const char *filename)
if (strcmp(filename, "-") == 0) {
filename = "<standard input>";
}
- current_filename = (const char *)malloc(strlen(filename)+1);
+ current_filename = (const char *)malloc(strlen(filename) + 1);
if (current_filename == 0) {
fatal("can't malloc space for filename");
}
@@ -371,6 +371,10 @@ void do_file(const char *filename)
pr->special(get_string(1), &env);
suppress_skip = 1;
break;
+ case 'u':
+ // .cu
+ pr->special(get_string(), &env, 'u');
+ break;
default:
error("unrecognised x command `%1'", s);
}
@@ -498,4 +502,3 @@ void skip_line()
break;
}
}
-
diff --git a/src/libs/libdriver/printer.cc b/src/libs/libdriver/printer.cc
index f7c20384..4d66f7ba 100644
--- a/src/libs/libdriver/printer.cc
+++ b/src/libs/libdriver/printer.cc
@@ -97,7 +97,7 @@ void printer::end_of_line()
{
}
-void printer::special(char *, const environment *)
+void printer::special(char *, const environment *, char)
{
}
diff --git a/src/roff/troff/env.cc b/src/roff/troff/env.cc
index 10994daa..060850d1 100644
--- a/src/roff/troff/env.cc
+++ b/src/roff/troff/env.cc
@@ -431,6 +431,8 @@ void environment::space(hunits space_width, hunits sentence_space_width)
spread_flag = 0;
}
+node *do_underline_special(int);
+
void environment::set_font(symbol nm)
{
if (interrupted)
@@ -454,6 +456,12 @@ void environment::set_font(symbol nm)
return;
fontno = n;
}
+ if (underline_spaces && fontno != prev_fontno) {
+ if (fontno == get_underline_fontno())
+ add_node(do_underline_special(1));
+ if (prev_fontno == get_underline_fontno())
+ add_node(do_underline_special(0));
+ }
}
void environment::set_font(int n)
@@ -554,6 +562,7 @@ environment::environment(symbol nm)
temporary_indent(0),
have_temporary_indent(0),
underline_lines(0),
+ underline_spaces(0),
input_trap_count(0),
line(0),
prev_text_length(0),
@@ -638,6 +647,7 @@ environment::environment(const environment *e)
temporary_indent(0),
have_temporary_indent(0),
underline_lines(0),
+ underline_spaces(0),
input_trap_count(0),
line(0),
prev_text_length(e->prev_text_length),
@@ -711,6 +721,7 @@ void environment::copy(const environment *e)
have_temporary_indent = 0;
temporary_indent = 0;
underline_lines = 0;
+ underline_spaces = 0;
input_trap_count = 0;
prev_text_length = e->prev_text_length;
width_total = 0;
@@ -1299,7 +1310,15 @@ void temporary_indent()
tok.next();
}
-void underline()
+node *do_underline_special(int underline_spaces)
+{
+ macro m;
+ m.append_str("x u ");
+ m.append(underline_spaces + '0');
+ return new special_node(m, 1);
+}
+
+void do_underline(int underline_spaces)
{
int n;
if (!has_arg() || !get_integer(&n))
@@ -1308,6 +1327,10 @@ void underline()
if (curenv->underline_lines > 0) {
curenv->prev_fontno = curenv->fontno;
curenv->fontno = curenv->pre_underline_fontno;
+ if (underline_spaces) {
+ curenv->underline_spaces = 0;
+ curenv->add_node(do_underline_special(0));
+ }
}
curenv->underline_lines = 0;
}
@@ -1315,10 +1338,24 @@ void underline()
curenv->underline_lines = n;
curenv->pre_underline_fontno = curenv->fontno;
curenv->fontno = get_underline_fontno();
+ if (underline_spaces) {
+ curenv->underline_spaces = 1;
+ curenv->add_node(do_underline_special(1));
+ }
}
skip_line();
}
+void continuous_underline()
+{
+ do_underline(1);
+}
+
+void underline()
+{
+ do_underline(0);
+}
+
void control_char()
{
curenv->control_char = '.';
@@ -1489,6 +1526,10 @@ void environment::newline()
if (--underline_lines == 0) {
prev_fontno = fontno;
fontno = pre_underline_fontno;
+ if (underline_spaces) {
+ underline_spaces = 0;
+ add_node(do_underline_special(0));
+ }
}
}
if (current_field)
@@ -2966,7 +3007,7 @@ void init_env_requests()
init_request("in", indent);
init_request("ti", temporary_indent);
init_request("ul", underline);
- init_request("cu", underline);
+ init_request("cu", continuous_underline);
init_request("cc", control_char);
init_request("c2", no_break_control_char);
init_request("br", break_request);
diff --git a/src/roff/troff/env.h b/src/roff/troff/env.h
index a6060d56..dd5273a0 100644
--- a/src/roff/troff/env.h
+++ b/src/roff/troff/env.h
@@ -137,6 +137,7 @@ class environment {
hunits target_text_length;
int pre_underline_fontno;
int underline_lines;
+ int underline_spaces;
symbol input_trap;
int input_trap_count;
node *line; // in reverse order
@@ -308,7 +309,7 @@ public:
friend void line_length();
friend void indent();
friend void temporary_indent();
- friend void underline();
+ friend void do_underline(int);
friend void input_trap();
friend void set_tabs();
friend void margin_character();
diff --git a/src/roff/troff/node.cc b/src/roff/troff/node.cc
index 458ed484..4e9706fa 100644
--- a/src/roff/troff/node.cc
+++ b/src/roff/troff/node.cc
@@ -750,8 +750,8 @@ public:
void right(hunits);
void down(vunits);
void moveto(hunits, vunits);
- void start_special(tfont *tf);
- void start_special();
+ void start_special(tfont *tf, int no_init_string = 0);
+ void start_special(int no_init_string = 0);
void special_char(unsigned char c);
void end_special();
void word_marker();
@@ -794,7 +794,7 @@ inline void troff_output_file::put(int i)
put_string(i_to_a(i), fp);
}
-void troff_output_file::start_special(tfont *tf)
+void troff_output_file::start_special(tfont *tf, int no_init_string)
{
flush_tbuf();
@@ -807,14 +807,16 @@ void troff_output_file::start_special(tfont *tf)
set_font(tf);
}
do_motion();
- put("x X ");
+ if (!no_init_string)
+ put("x X ");
}
-void troff_output_file::start_special()
+void troff_output_file::start_special(int no_init_string)
{
flush_tbuf();
do_motion();
- put("x X ");
+ if (!no_init_string)
+ put("x X ");
}
void troff_output_file::special_char(unsigned char c)
@@ -3305,8 +3307,8 @@ int node::interpret(macro *)
return 0;
}
-special_node::special_node(const macro &m)
-: mac(m)
+special_node::special_node(const macro &m, int n)
+: mac(m), no_init_string(n)
{
font_size fs = curenv->get_font_size();
int char_height = curenv->get_char_height();
@@ -3318,15 +3320,16 @@ special_node::special_node(const macro &m)
tf = tf->get_plain();
}
-special_node::special_node(const macro &m, tfont *t)
-: mac(m), tf(t)
+special_node::special_node(const macro &m, tfont *t, int n)
+: mac(m), tf(t), no_init_string(n)
{
}
int special_node::same(node *n)
{
- return ((mac == ((special_node *)n)->mac) &&
- (tf == ((special_node *)n)->tf));
+ return ((mac == ((special_node *)n)->mac)
+ && (tf == ((special_node *)n)->tf)
+ && (no_init_string == ((special_node *)n)->no_init_string));
}
const char *special_node::type()
@@ -3334,6 +3337,11 @@ const char *special_node::type()
return "special_node";
}
+int special_node::ends_sentence()
+{
+ return 2;
+}
+
int special_node::force_tprint()
{
return 0;
@@ -3341,12 +3349,12 @@ int special_node::force_tprint()
node *special_node::copy()
{
- return new special_node(mac, tf);
+ return new special_node(mac, tf, no_init_string);
}
void special_node::tprint_start(troff_output_file *out)
{
- out->start_special(get_tfont());
+ out->start_special(get_tfont(), no_init_string);
}
void special_node::tprint_char(troff_output_file *out, unsigned char c)
diff --git a/src/roff/troff/node.h b/src/roff/troff/node.h
index 96fad20f..3e5f6159 100644
--- a/src/roff/troff/node.h
+++ b/src/roff/troff/node.h
@@ -458,17 +458,19 @@ public:
class special_node : public node {
macro mac;
tfont *tf;
+ int no_init_string;
void tprint_start(troff_output_file *);
void tprint_char(troff_output_file *, unsigned char);
void tprint_end(troff_output_file *);
public:
- special_node(const macro &);
- special_node(const macro &, tfont *t);
+ special_node(const macro &, int = 0);
+ special_node(const macro &, tfont *, int = 0);
node *copy();
void tprint(troff_output_file *);
int same(node *);
const char *type();
int force_tprint();
+ int ends_sentence();
tfont *get_tfont();
};