summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwlemb <wlemb>2002-03-17 22:05:27 +0000
committerwlemb <wlemb>2002-03-17 22:05:27 +0000
commitc63595ace2eee61bccccda797616b724a6c37a9a (patch)
tree1403bec49bb47034593846fc62e09705ddfb4ecf
parent0a1633afcc34945e7af0f441fc4dbc7a63e33319 (diff)
downloadgroff-c63595ace2eee61bccccda797616b724a6c37a9a.tar.gz
Added request `hpfa' to append hyphenation patterns.
* src/roff/troff/env.cc (hyphen_trie::read_patterns_file): Add parameter `append'. (hyphenation_patterns_file): Renamed to... (do_hyphenation_patterns_file): This. (hyphenation_patterns_file, hyphenation_patterns_file_append): New functions. (init_hyphen_requests): Updated. * NEWS, man/groff.man, man/groff_diff.man: Document it.
-rw-r--r--ChangeLog13
-rw-r--r--NEWS3
-rw-r--r--man/groff.man4
-rw-r--r--man/groff_diff.man10
-rw-r--r--src/roff/troff/env.cc22
5 files changed, 46 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index d8b3bf03..da8c6013 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2002-03-17 Werner LEMBERG <wl@gnu.org>
+
+ Added request `hpfa' to append hyphenation patterns.
+
+ * src/roff/troff/env.cc (hyphen_trie::read_patterns_file): Add
+ parameter `append'.
+ (hyphenation_patterns_file): Renamed to...
+ (do_hyphenation_patterns_file): This.
+ (hyphenation_patterns_file, hyphenation_patterns_file_append): New
+ functions.
+ (init_hyphen_requests): Updated.
+ * NEWS, man/groff.man, man/groff_diff.man: Document it.
+
2002-03-16 Werner LEMBERG <wl@gnu.org>
Added request `writec' in analogy to `tmc'.
diff --git a/NEWS b/NEWS
index 6e4e7a64..72b7ee5c 100644
--- a/NEWS
+++ b/NEWS
@@ -81,6 +81,9 @@ o Two new requests `ds1' and `as1' which are similar to `ds' and `as' but
with compatibility mode disabled during expansion of strings defined by
them.
+o The new request `hpfa' appends hyphenation patterns (`hpf' replaces
+ already existing patterns).
+
o A new request `ami' (append macro indirect) has been added. The first and
second parameter of `ami' are taken from string registers rather than
directly; this very special request is needed to make `trace.tmac'
diff --git a/man/groff.man b/man/groff.man
index 56f1e75c..cc23a86b 100644
--- a/man/groff.man
+++ b/man/groff.man
@@ -1588,6 +1588,10 @@ Set the maximum number of consecutive hyphenated lines to
Read hyphenation patterns from
.IR file .
.
+.REQ .hpfa file
+Append hyphenation patterns from
+.IR file .
+.
.REQ .hw words
List of
.I words
diff --git a/man/groff_diff.man b/man/groff_diff.man
index d636a764..5d1b1475 100644
--- a/man/groff_diff.man
+++ b/man/groff_diff.man
@@ -1447,7 +1447,15 @@ The
.B hpf
request is usually invoked by the
.B troffrc
-file.
+file; a second call replaces the old patterns with the new ones.
+.
+.TP
+.BI hpfa\ file
+The same as
+.B hpf
+except that the hyphenation patterns from
+.I file
+are appended to the patterns already loaded in current language.
.
.TP
.BI .hym\ n
diff --git a/src/roff/troff/env.cc b/src/roff/troff/env.cc
index eea8ad2e..05244767 100644
--- a/src/roff/troff/env.cc
+++ b/src/roff/troff/env.cc
@@ -3223,7 +3223,7 @@ public:
hyphen_trie() {}
~hyphen_trie() {}
void hyphenate(const char *word, int len, int *hyphens);
- void read_patterns_file(const char *name);
+ void read_patterns_file(const char *name, int append);
};
@@ -3426,9 +3426,10 @@ void hyphen_trie::do_delete(void *v)
}
}
-void hyphen_trie::read_patterns_file(const char *name)
+void hyphen_trie::read_patterns_file(const char *name, int append)
{
- clear();
+ if (!append)
+ clear();
char buf[WORD_MAX];
int num[WORD_MAX+1];
errno = 0;
@@ -3520,18 +3521,28 @@ void hyphenate(hyphen_list *h, unsigned flags)
}
}
-static void hyphenation_patterns_file()
+static void do_hyphenation_patterns_file(int append)
{
symbol name = get_long_name(1);
if (!name.is_null()) {
if (!current_language)
error("no current hyphenation language");
else
- current_language->patterns.read_patterns_file(name.contents());
+ current_language->patterns.read_patterns_file(name.contents(), append);
}
skip_line();
}
+static void hyphenation_patterns_file()
+{
+ do_hyphenation_patterns_file(0);
+}
+
+static void hyphenation_patterns_file_append()
+{
+ do_hyphenation_patterns_file(1);
+}
+
class hyphenation_language_reg : public reg {
public:
const char *get_string();
@@ -3547,5 +3558,6 @@ void init_hyphen_requests()
init_request("hw", hyphen_word);
init_request("hla", set_hyphenation_language);
init_request("hpf", hyphenation_patterns_file);
+ init_request("hpfa", hyphenation_patterns_file_append);
number_reg_dictionary.define(".hla", new hyphenation_language_reg);
}