Update of bug #68512 (group groff):

                 Summary: [troff] `pchar` reports information about deleted
special characters => [PATCH] [troff] `pchar` reports information about
deleted special characters

    _______________________________________________________

Follow-up Comment #1:

I'm dying to land this...


$ git stash show -p 0
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 80d359269..b616b7122 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -102,6 +102,8 @@ extern "C" const char *Version_string;
 // initial size for input buffers that need to grow arbitrarily
 static const size_t default_buffer_size = 16;
 
+dictionary charinfo_dictionary(501);
+
 // If we ever support this feature, these declarations should move into
 // a new "column.h" file.
 #ifdef COLUMN
@@ -5409,6 +5411,13 @@ static void remove_character_request() // .rchar
       macro *m = ci->set_macro(0 /* nullptr */);
       if (m != 0 /* nullptr */)
        delete m;
+      // Ordinary and indexed characters always "exist", but special
+      // characters are deletable.
+      if (tok.is_special_character()) {
+       //debug("GBR: would remove %1", tok.description());
+       //ci->dump();
+       charinfo_dictionary.remove(tok.get_name());
+      }
     }
     tok.next();
   }
@@ -11036,8 +11045,6 @@ void debug_with_file_and_line(const char *filename,
   fflush(stderr);
 }
 
-dictionary charinfo_dictionary(501);
-
 charinfo *lookup_charinfo(symbol nm, bool suppress_creation)
 {
   void *p = charinfo_dictionary.lookup(nm);


...but something funny happens during the build.  All tests pass but I get
some surprising warnings.


troff: backtrace: '../contrib/mom/examples/mon_premier_doc.mom':13: string
'$AUTHOR_1'
troff: backtrace: '../contrib/mom/om.tmac':6772: macro 'DO_AUTHORS'
troff: backtrace: '../contrib/mom/om.tmac':7750: macro 'DO_DOC_COVER'
troff: backtrace: '../contrib/mom/om.tmac':8094: macro 'START'
troff: backtrace: file '../contrib/mom/examples/mon_premier_doc.mom':28
troff:../contrib/mom/examples/mon_premier_doc.mom:28: warning: special
character "'e" not defined [-w char]
troff: backtrace: '../contrib/mom/examples/mon_premier_doc.mom':13: string
'$AUTHOR_1'
troff: backtrace: '../contrib/mom/om.tmac':6930: macro 'DEFAULT_DOCHEADER'
troff: backtrace: '../contrib/mom/om.tmac':8205: macro 'START'
troff: backtrace: file '../contrib/mom/examples/mon_premier_doc.mom':28
troff:../contrib/mom/examples/mon_premier_doc.mom:28: warning: special
character "'e" not defined [-w char]
troff: backtrace: '../contrib/mom/examples/mon_premier_doc.mom':30
troff: backtrace: '../contrib/mom/om.tmac':11069: while loop
troff: backtrace: '../contrib/mom/om.tmac':11075: macro 'HEADING'
troff: backtrace: file '../contrib/mom/examples/mon_premier_doc.mom':30
troff:../contrib/mom/examples/mon_premier_doc.mom:30: warning: special
character "'e" not defined [-w char]
troff: backtrace: '../contrib/mom/om.tmac':16416
troff: backtrace: '../contrib/mom/om.tmac':9513: macro 'HEADER_CENTER'
troff: backtrace: '../contrib/mom/om.tmac':16416: macro 'TOC'
troff: backtrace: file '../contrib/mom/examples/mon_premier_doc.mom':136
troff:../contrib/mom/examples/mon_premier_doc.mom:136: warning: special
character '`e' not defined [-w char]


This seems to have something to do with _mom_'s `SMALLCAPS` macro, which uses
`rchar` to delete characters.  When the `rchar` deleted only the "macro"
attached to a character's `charinfo` this was fine, but now that it deletes a
special character's _name_ as well, we get the foregoing warnings.

This _might_ suggest a bug in _mom_...why is she interpolating a special
character that she has removed.

Also, what if the user, via a custom _troffrc_ for example, has already
created user-defined characters for `\['e]` and/or `\[`e]`?  A _mom_ document
will see those definitions destroyed without recovery if `SMALLCAPS` gets
used.

Alternatively, the bug could be mine, which is more probable judging by
history...

So I think I'm going to gate this change pending some insight from Peter
Schaffter.




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?68512>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature

Reply via email to