gbranden pushed a commit to branch master
in repository groff.
commit bedd4ca476bcb9da7fff1b7fad9e0aeb9ad3cca5
Author: G. Branden Robinson <[email protected]>
AuthorDate: Wed May 1 22:07:15 2024 -0500
Revert "[troff]: Diagnose bogus composite char escapes."
This reverts commit 6008b6b7aa2920035e09d1dea44d262d30391195.
Fixes <https://savannah.gnu.org/bugs/?65601>. Thanks to Deri James for
the report.
---
ChangeLog | 27 ---------------------------
src/roff/troff/input.cpp | 32 --------------------------------
src/roff/troff/input.h | 1 -
src/roff/troff/node.cpp | 22 ----------------------
4 files changed, 82 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d4d2143bc..571441318 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2428,33 +2428,6 @@
* doc/doc.am (doc/webpage.ms): Register dependency on
"tmac/pspic.tmac".
-2024-01-18 G. Branden Robinson <[email protected]>
-
- [troff]: Diagnose bogus composite character escape sequences.
- That is, when a composite character escape sequence like \[a ~]
- has a bogus modifier (as opposed to base) character, meaning one
- that has not been defined as the source _or_ destination of a
- `composite` request, warn about it. For instance, \[a $] is
- nonsense, barring a request like `.composite $ \[uFF00]`, which
- would map `$`, when used as a modifier character in a composite
- special character escape sequence, to U+FF00, which would be a
- modifier form of the dollar sign in an alternate universe.
-
- * src/roff/troff/input.cpp (is_codepoint_composite): New
- function searches `composite_dictionary` for the presence of the
- given four-digit hexadecimal string as a key _or_ value.
-
- * src/roff/troff/input.h: Expose foregoing function to other
- translation units.
-
- * src/roff/troff/node.cpp (make_glyph_node): Check input
- `charinfo` for a Unicode code point sequence, and if it contains
- one, call `valid_unicode_code_sequence()` to check it for
- validity. Then, iterate through each code point after the first
- {the base character}, and call `is_codepoint_composite()` on it.
- Diagnose invalid composite character and return null pointer if
- validation fails.
-
2024-01-17 G. Branden Robinson <[email protected]>
* src/roff/troff/input.cpp (map_composite_character): Stop
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 09b25f7cd..a10bc2112 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -4188,38 +4188,6 @@ static symbol composite_glyph_name(symbol nm)
return symbol(gl.contents());
}
-// Does the hexadecimal four-character sequence `n` represent a code
-// point with a composite mapping? Either the key or value component
-// of an entry in the composite dictionary qualifies.
-//
-// This is an O(n) search, but by default groff defines only 22
-// composite character mappings ("tmac/composite.tmac"). If this
-// becomes a performance problem, we will need another dictionary
-// mapping the unique values of `composite_dictionary` (which is not
-// one-to-one) to a Boolean.
-bool is_codepoint_composite(const char *n)
-{
- bool result = false;
- dictionary_iterator iter(composite_dictionary);
- symbol key;
- char *value;
- while (iter.get(&key, reinterpret_cast<void **>(&value))) {
- assert(!key.is_null());
- assert(value != 0 /* nullptr */);
- const char *k = key.contents();
- if (strcmp(k, n) == 0) {
- result = true;
- break;
- }
- const char *v = reinterpret_cast<char *>(value);
- if (strcmp(v, n) == 0) {
- result = true;
- break;
- }
- }
- return result;
-}
-
static void report_composite_characters()
{
dictionary_iterator iter(composite_dictionary);
diff --git a/src/roff/troff/input.h b/src/roff/troff/input.h
index b328ca387..10b337f1e 100644
--- a/src/roff/troff/input.h
+++ b/src/roff/troff/input.h
@@ -112,7 +112,6 @@ const int INPUT_SOFT_HYPHEN= 0312;
extern void do_glyph_color(symbol);
extern void do_fill_color(symbol);
-extern bool is_codepoint_composite(const char *n);
extern bool suppress_push;
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 15875b690..72ac67494 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -36,7 +36,6 @@ along with this program. If not, see
<http://www.gnu.org/licenses/>. */
#include "charinfo.h"
#include "input.h"
#include "geometry.h"
-#include "unicode.h" // valid_unicode_code_sequence()
#include "nonposix.h"
@@ -4928,27 +4927,6 @@ static node *make_glyph_node(charinfo *s, environment
*env,
error("cannot format glyph: no current font");
return 0 /* nullptr */;
}
- const char *seq = valid_unicode_code_sequence(s->nm.contents());
- if (seq != 0 /* nullptr */) {
- // If it is a multi-character sequence like u1234_5678, every code
- // point after the first must have (or be) a composite mapping.
- char codepoint[5] = { 0, 0, 0, 0, 0 };
- bool is_composite_glyph_valid = true;
- while ((seq = strchr(seq, '_')) != 0 /* nullptr */) {
- seq++;
- (void) strncpy(codepoint, seq, 4);
- if (!is_codepoint_composite(codepoint)) {
- is_composite_glyph_valid = false;
- break;
- }
- seq += 4;
- }
- if (!is_composite_glyph_valid) {
- error("cannot format glyph: '%1' is not a valid composite"
- " character", s->nm.contents());
- return 0 /* nullptr */;
- }
- }
assert(fontno < font_table_size && font_table[fontno] != 0);
int fn = fontno;
bool found = font_table[fontno]->contains(s);
_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit