bug-groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #64104] [troff] you can set the escape, control, and no-break contr


From: G. Branden Robinson
Subject: [bug #64104] [troff] you can set the escape, control, and no-break control characters to the same thing
Date: Mon, 10 Jul 2023 04:38:51 -0400 (EDT)

Update of bug #64104 (project groff):

                  Status:         Ready for Merge => Fixed                  
             Open/Closed:                    Open => Closed                 
         Planned Release:                    None => 1.24.0                 

    _______________________________________________________

Follow-up Comment #6:


commit 1e8e7608414ec18e94afaebd74c4897ed7f866bd
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Sun May 7 00:32:32 2023 -0500

    [troff]: Fix Savannah #64104 (1/2).
    
    * src/roff/troff/input.cpp (set_escape_char): Rename this...
      (assign_escape_character): ...to this.  Don't permit the escape
      character to be set to the same thing as the control or no-break
      control characters.
    
    * doc/groff.texi (Using Escape Sequences): Document restrictions.
    
    Tested with:
    
    $ cat ec.roff
    .ec .
    .ec '
    .ec \-
    $ ./build/test-groff ec.roff
    troff:ec.roff:1: error: ignoring escape character change request; the
control character is already '.'
    troff:ec.roff:2: error: ignoring escape character change request; the
no-break control character is already "'"
    troff:ec.roff:3: error: cannot select invalid escape character; using '\'

commit e09bc6c083657af9b503313376a759e674ecfbaf
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Sun May 7 12:33:20 2023 -0500

    [troff]: Fix Savannah #64104 (2/2).
    
    * src/roff/troff/env.h (class environment): Slightly refactor.  Rename
      fields `control_char` and `no_break_control_char` to
      `control_character` and `no_break_control_character`, respectively,
      and make them private.  Add public getters and setters for them.
    
      (get_control_character): New public member function returns `unsigned
      char`.
    
      (set_control_character): New public member function takes an `unsigned
      char` and returns a `bool`.
    
      (get_no_break_control_character):
      (set_no_break_control_character): Similar.
    
    * src/roff/troff/env.cpp (environment::environment): Update constructors
      to use new field names and initialize them in their new order of
      declaration.
    
      (environment::copy): Similar.  (Not to be confused with a copy
      constructor, this member function implements the operation of a valid
      `evc` GNU troff request.)
    
      (environment::get_control_character):
      (environment::set_control_character):
      (environment::get_no_break_control_character):
      (environment::set_no_break_control_character): Implement.
    
    * src/roff/troff/env.cpp: Drop handling of `cc` and `c2` requests.
    
      (control_char, no_break_control_char): Drop implementations.
    
      (init_env_requests): Drop `init_request` calls for them.
    
    * src/roff/troff/input.cpp: Resurrect handling of `cc` and `c2` requests
      here, with more error handling.
    
      (assign_escape_character, process_input_stack): Use the new getters
      defined above in environment object since the relevant fields are now
      private.
    
      (assign_control_character): New function assumes the former
      responsibilities of env.cpp:control_char and rejects the request if
      the desired character is already the escape or no-break control
      character.
    
      (assign_no_break_control_character): New function assumes the former
      responsibilities of env.cpp:no_break_control_char and rejects the
      request if the desired character is already the escape or control
      character.
    
      (process_input_stack): Reorder comparisons to avoid inadvertent lvalue
      assignment.  Add parentheses to assignment with complex RHS.
    
      (init_input_requests): Attach `cc` and `c2` requests to new functions
      above.
    
    * doc/groff.texi (Control Characters): Document restrictions.
    
    Fixes <https://savannah.gnu.org/bugs/?64104>.
    
    Tested with:
    
    $ cat cc.roff
    .cc \\
    .cc '
    .cc \-
    $ ./build/test-groff cc.roff
    troff:cc.roff:1: error: ignoring control character change request; the
escape character is already '\'
    troff:cc.roff:2: error: ignoring control character change request; the
no-break control character is already "'"
    troff:cc.roff:3: error: cannot select invalid control character; using
'.'
    $ cat c2.roff
    .c2 \\
    .c2 .
    .c2 \-
    $ ./build/test-groff c2.roff
    troff:c2.roff:1: error: ignoring no-break control character change
request; the escape character is already '\'
    troff:c2.roff:2: error: ignoring no-break control character change
request; the (breaking) control character is already '.'
    troff:c2.roff:3: error: cannot select invalid no-break control character;
using "'"




    _______________________________________________________

Reply to this item at:

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

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]