summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwlemb <wlemb>2001-12-22 23:45:44 +0000
committerwlemb <wlemb>2001-12-22 23:45:44 +0000
commita412bc099a209f461ea3b5e9d6847383da7f9afd (patch)
treea0d6b05f1b0619093008d56cf4f9a9c558d2360b
parentd32ee60d7e7aba695a0ee5adee3ee9f28e5d5866 (diff)
downloadgroff-a412bc099a209f461ea3b5e9d6847383da7f9afd.tar.gz
Adding an `itc' request (input line trap accepting \c).
* src/roff/troff/env.h (environment): New member `continued_input_trap'. Make `do_input_trap' a friend function instead of `input_trap'. * src/roff/troff/env.cc (environment::environment, environment::copy): Updated. (environment::newline): Implement it. (do_input_trap): New function. (input_trap): Call `do_input_trap'. (input_trap_continued): New function. (init_env_requests): Updated. * src/roff/troff/TODO: Updated. * tmac/an-old.tmac (SH, SS, B, I, SM, SB, TP): Use `.itc' instead of `.it'. * src/preproc/grn/hdb.cc (DBRead): Really chop after 127 characters.
-rw-r--r--ChangeLog21
-rw-r--r--NEWS3
-rw-r--r--man/groff.man12
-rw-r--r--man/groff_diff.man8
-rw-r--r--src/preproc/grn/hdb.cc4
-rw-r--r--src/roff/troff/TODO3
-rw-r--r--src/roff/troff/env.cc23
-rw-r--r--src/roff/troff/env.h3
-rw-r--r--tmac/an-old.tmac14
9 files changed, 73 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index 4e8937ac..6abfe804 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2001-12-23 Werner LEMBERG <wl@gnu.org>
+
+ Adding an `itc' request (input line trap accepting \c).
+
+ * src/roff/troff/env.h (environment): New member
+ `continued_input_trap'.
+ Make `do_input_trap' a friend function instead of `input_trap'.
+ * src/roff/troff/env.cc (environment::environment,
+ environment::copy): Updated.
+ (environment::newline): Implement it.
+ (do_input_trap): New function.
+ (input_trap): Call `do_input_trap'.
+ (input_trap_continued): New function.
+ (init_env_requests): Updated.
+ * src/roff/troff/TODO: Updated.
+
+ * tmac/an-old.tmac (SH, SS, B, I, SM, SB, TP): Use `.itc' instead of
+ `.it'.
+
+ * src/preproc/grn/hdb.cc (DBRead): Really chop after 127 characters.
+
2001-12-22 Ruslan Ermilov <ru@FreeBSD.org>
* tmac/doc-common, tmac/doc-syms: Small updates.
diff --git a/NEWS b/NEWS
index ae01a9c6..d2995604 100644
--- a/NEWS
+++ b/NEWS
@@ -49,6 +49,9 @@ o The new request `fchar' can be used to provide fallback characters. Its
the particular glyph isn't found in the current font. This test happens
before checking special fonts.
+o The new request `itc' is a variant of `.it' for which a line interrupted
+ with \c counts as one input line.
+
o A new escape sequence `\O' is available (mainly for internal use with
grohtml). Please see groff_diff.man and groff.texinfo for more details.
diff --git a/man/groff.man b/man/groff.man
index b845985a..1c969999 100644
--- a/man/groff.man
+++ b/man/groff.man
@@ -1313,8 +1313,16 @@ Change indent according to
.scaleindicator m ).
.
.REQ .it N trap
-Set an input-line count trap at position
-.argument N .
+Set an input-line count trap for the next
+.argument N
+lines.
+.
+.REQ .itc N trap
+Same as
+.request .it
+but count lines interrupted with
+.esc c
+as one line.
.
.REQ .kern
Enable pairwise kerning.
diff --git a/man/groff_diff.man b/man/groff_diff.man
index 644639e1..8c7df80c 100644
--- a/man/groff_diff.man
+++ b/man/groff_diff.man
@@ -1264,6 +1264,14 @@ The current hyphenation space is available in the
register.
.
.TP
+.BI .itc\ n\ macro
+Variant of
+.B .it
+for which a line interrupted with
+.B \ec
+counts as one input line.
+.
+.TP
.BI .kern\ n
If
.I n
diff --git a/src/preproc/grn/hdb.cc b/src/preproc/grn/hdb.cc
index 53f967c6..05788ebf 100644
--- a/src/preproc/grn/hdb.cc
+++ b/src/preproc/grn/hdb.cc
@@ -90,7 +90,7 @@ DBRead(register FILE *file)
SUNFILE = FALSE;
elist = DBInit();
- (void) fscanf(file, "%" MAXSTRING_S "s\n", string);
+ (void) fscanf(file, "%" MAXSTRING_S "s%*s\n", string);
if (strcmp(string, "gremlinfile")) {
if (strcmp(string, "sungremlinfile")) {
error("`%1' is not a gremlin file", gremlinfile);
@@ -107,7 +107,7 @@ DBRead(register FILE *file)
/* if (fscanf(file,"%" MAXSTRING_S "s\n", string) == EOF) */
/* I changed the scanf format because the element */
/* can have two words (e.g. CURVE SPLINE) */
- if (fscanf(file, "\n%" MAXSTRING_S "[^\n]\n", string) == EOF) {
+ if (fscanf(file, "\n%" MAXSTRING_S "[^\n]%*s\n", string) == EOF) {
error("`%1', error in file format", gremlinfile);
return (elist);
}
diff --git a/src/roff/troff/TODO b/src/roff/troff/TODO
index 66605973..49aa0eb2 100644
--- a/src/roff/troff/TODO
+++ b/src/roff/troff/TODO
@@ -83,9 +83,6 @@ Then is you ask for R at pointsize 16, groff will first look for
R.display and then R. Probably necessary to be able to specify a
separate unitwidth for each sizesuffix (eg. for X).
-Variant of `.it' for which a line interrupted with \c counts as one
-input line.
-
Make it possible to suppress hyphenation on a word-by-word basis.
(Perhaps store hyphenation flags in tfont.)
diff --git a/src/roff/troff/env.cc b/src/roff/troff/env.cc
index a7330ad1..1bd12cb6 100644
--- a/src/roff/troff/env.cc
+++ b/src/roff/troff/env.cc
@@ -601,6 +601,7 @@ environment::environment(symbol nm)
underline_lines(0),
underline_spaces(0),
input_trap_count(0),
+ continued_input_trap(0),
line(0),
prev_text_length(0),
width_total(0),
@@ -690,6 +691,7 @@ environment::environment(const environment *e)
underline_lines(0),
underline_spaces(0),
input_trap_count(0),
+ continued_input_trap(0),
line(0),
prev_text_length(e->prev_text_length),
width_total(0),
@@ -767,6 +769,7 @@ void environment::copy(const environment *e)
underline_lines = 0;
underline_spaces = 0;
input_trap_count = 0;
+ continued_input_trap = 0;
prev_text_length = e->prev_text_length;
width_total = 0;
space_total = 0;
@@ -1632,8 +1635,9 @@ void environment::newline()
hyphen_line_count = 0;
}
if (input_trap_count > 0) {
- if (--input_trap_count == 0)
- spring_trap(input_trap);
+ if (!(continued_input_trap && prev_line_interrupted))
+ if (--input_trap_count == 0)
+ spring_trap(input_trap);
}
}
@@ -2337,9 +2341,11 @@ void no_adjust()
skip_line();
}
-void input_trap()
+void do_input_trap(int continued)
{
curenv->input_trap_count = 0;
+ if (continued)
+ curenv->continued_input_trap = 1;
int n;
if (has_arg() && get_integer(&n)) {
if (n <= 0)
@@ -2356,6 +2362,16 @@ void input_trap()
skip_line();
}
+void input_trap()
+{
+ do_input_trap(0);
+}
+
+void input_trap_continued()
+{
+ do_input_trap(1);
+}
+
/* tabs */
// must not be R or C or L or a legitimate part of a number expression
@@ -3042,6 +3058,7 @@ const char *environment::get_requested_point_size_string()
void init_env_requests()
{
init_request("it", input_trap);
+ init_request("itc", input_trap_continued);
init_request("ad", adjust);
init_request("na", no_adjust);
init_request("ev", environment_switch);
diff --git a/src/roff/troff/env.h b/src/roff/troff/env.h
index 91513a7d..215c4172 100644
--- a/src/roff/troff/env.h
+++ b/src/roff/troff/env.h
@@ -140,6 +140,7 @@ class environment {
int underline_spaces;
symbol input_trap;
int input_trap_count;
+ int continued_input_trap;
node *line; // in reverse order
hunits prev_text_length;
hunits width_total;
@@ -321,7 +322,7 @@ public:
friend void indent();
friend void temporary_indent();
friend void do_underline(int);
- friend void input_trap();
+ friend void do_input_trap(int);
friend void set_tabs();
friend void margin_character();
friend void no_number();
diff --git a/tmac/an-old.tmac b/tmac/an-old.tmac
index 357d88c3..e662eb51 100644
--- a/tmac/an-old.tmac
+++ b/tmac/an-old.tmac
@@ -250,7 +250,7 @@
. in \\n[an-margin]u
. ti 0
. HTML-TAG ".NH \\n[an-level]"
-. it 1 an-trap
+. itc 1 an-trap
. nr an-no-space-flag 1
. nr an-break-flag 1
. ps \\n[PS-SH]u
@@ -267,7 +267,7 @@
. fi
. in \\n[IN]u
. ti \\n[SN]u
-. it 1 an-trap
+. itc 1 an-trap
. nr an-no-space-flag 1
. nr an-break-flag 1
. ps \\n[PS-SS]u
@@ -277,25 +277,25 @@
..
.
.de1 B
-. it 1 an-trap
+. itc 1 an-trap
. ft B
. if \\n[.$] \&\\$*
..
.
.de1 I
-. it 1 an-trap
+. itc 1 an-trap
. ft I
. if \\n[.$] \&\\$*
..
.
.de1 SM
-. it 1 an-trap
+. itc 1 an-trap
. ps -1
. if \\n[.$] \&\\$*
..
.
.de1 SB
-. it 1 an-trap
+. itc 1 an-trap
. ps -1
. ft B
. if \\n[.$] \&\\$*
@@ -304,7 +304,7 @@
.de1 TP
. sp \\n[PD]u
. if \\n[.$] .nr an-prevailing-indent (n;\\$1)
-. it 1 an-trap
+. itc 1 an-trap
. if !\\n[an-div?] .di an-div
. ie \\n[an-html] .in \\n[an-margin]u
. el \{\