Follow-up Comment #20, bug #68511 (group groff): Hi Dave,
At 2026-07-12T14:50:33-0400, Dave wrote:
> Follow-up Comment #19, bug #68511 (group groff):
> [comment #17 comment #17:]
>> Care to rewrite the test script mentioned in comment #9 to work
>> better?
>
> I won't have time to look at it for probably another week, so depends
> on how much of a hurry you're in.
I'm not in a hurry. An extra test script, one out of (now) 360, that
produces false negatives (passes when it shouldn't) doesn't break
anything for users--it potentially upsets only groff's own developers.
Another reason is that that test script may not _need_ to be fixed--we
might just delete it.
> Comment #11 alluded to opening a separate ticket for it, so I went
> ahead and did that, 'cause that's quick and easy. Bug #68515.
Observe that the implementation of the `hcode` request handler no longer
has any logic that cares whether a character argument is "ordinary",
"special", or "indexed". All it cares about is the character's
`charinfo`. So I'm thinking the new "hcode-request-works.sh" test
should be adequate to cover the special case that prompted the test
script I've asked you look at it.
// Because `hcode` doesn't require spaces separating its "arguments",
// we don't use `has_arg()` except initially to determine whether we
// have any arguments at all.
static void set_hyphenation_codes() // .hcode
{
if (!has_arg()) {
warning(WARN_MISSING, "hyphenation code assignment request expects"
" arguments");
skip_line();
return;
}
while (read_any_character()) {
unsigned char cdst = tok.ch();
if (!tok.is_any_character()) {
error("cannot apply a hyphenation code to %1", tok.description());
break;
}
if (csdigit(cdst)) {
error("cannot apply a hyphenation code to a numeral");
break;
}
charinfo *cidst = tok.get_charinfo();
if ('\0' == cdst) {
if (0 /* nullptr */ == cidst) {
error("expected ordinary, special, or indexed character,"
" got %1", tok.description());
break;
}
}
tok.next();
if (!read_any_character()) {
if (tok.is_newline())
error("hyphenation codes must be specified in pairs");
else
error("cannot copy the hyphenation code of %1",
tok.description());
break;
}
unsigned char csrc = tok.ch();
if (csdigit(csrc)) {
error("cannot use the hyphenation code of a numeral");
break;
}
unsigned char new_code = 0U;
charinfo *cisrc = tok.get_charinfo();
if (cisrc != 0 /* nullptr */)
// Common case: assign destination character the hyphenation code
// of the source character.
new_code = cisrc->get_hyphenation_code();
if ('\0' == csrc) {
if (0 /* nullptr */ == cisrc) {
error("expected ordinary, special, or indexed character,"
" got %1", tok.description());
break;
}
new_code = cisrc->get_hyphenation_code();
}
else if (csrc == cdst)
// If assigning a ordinary character's hyphenation code to itself,
// use its character code point as the value.
new_code = tok.ch();
cidst->set_hyphenation_code(new_code);
if (cidst->get_translation()
&& cidst->get_translation()->is_translatable_as_input())
cidst->get_translation()->set_hyphenation_code(new_code);
tok.next();
}
skip_line();
}
Maybe I should make this comment in bug #68515 as well.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?68511>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
Description: PGP signature
