[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-indent] indent patches
From: |
anton . peters |
Subject: |
[Bug-indent] indent patches |
Date: |
Wed, 19 Jun 2002 15:43:16 +0200 |
To: David Ingamells <address@hidden>
Like I reported earlier this month (as "A.R. (Tom) Peters"
<address@hidden>), `indent` can not handle trigraphs. I need to use
these in portable C code that needs to work for Unix as well as for native
OS/390 . See:
http://www-3.ibm.com/software/data/db2/udb/ad/v7/adg/db2a0/frame3.htm
I do not have a solution, but I do have a work-around.
Treat trigraphs as identifiers. Although this screws up code formatting
(esp. with braces {}), indent then leaves the trigraphs alone and the code
remains fit for compilation.
See the attached diff file and a sample text to try it on (with the
result). I used v2.2.8 .
Tip: OS/390 only needs to have trigraphs for '[', ']', '|', '^', '~' ; so '
{', '}', '\', '#' can safely be used in the C code, which should avoid most
of the formatting problems.
Alternatives:
* Piggy-back on the existing tokens codes by catching the trigraphs in
lexi.c and jump to the corresponding cases: I tried that (hence the labels
in my diff'ed code), but did not get it to work; probably due to further
processing later, as follows:
* Define new token codes: this will not properly work because at many
places in indent.c the ordinary chars are hard-coded, so would replace the
trigraphs.
* Define new keywords using addkey() to the user_specials list: this will
not work because user keywords must be alphanumeric and the trigraphs are
not.
(See attached file: lexi.diff)(See attached file: indentst_tri.c.orig)(See
attached file: indentst_tri.c.out)
BTW:
Your mailto: address at http://www.gnu.org/directory/indent.html is
erroneous: TLD ".ml" instead of ".nl".
---------------------------------------------------------------------------
This message (including any attachments) is confidential and may be
privileged. If you have received it by mistake please notify the sender by
return e-mail and delete this message from your system. Any unauthorised
use or dissemination of this message in whole or in part is strictly
prohibited. Please note that e-mails are susceptible to change. ABN AMRO
Bank N.V. (including its group companies) shall not be liable for the
improper or incomplete transmission of the information contained in this
communication nor for any delay in its receipt or damage to your system.
ABN AMRO Bank N.V. (or its group companies) does not guarantee that the
integrity of this communication has been maintained nor that this
communication is free of viruses, interceptions or interference.
---------------------------------------------------------------------------
lexi.diff
Description: Binary data
indentst_tri.c.orig
Description: Binary data
indentst_tri.c.out
Description: Binary data
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug-indent] indent patches,
anton . peters <=