summaryrefslogtreecommitdiff
path: root/src
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 /src
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.
Diffstat (limited to 'src')
-rw-r--r--src/roff/troff/env.cc22
1 files changed, 17 insertions, 5 deletions
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);
}