Personal style -vs- Standards

Brad Brown bradb at ai.toronto.edu
Thu Dec 22 12:38:46 AEST 1988


In article <519 at midgard.Midgard.MN.ORG> dal at midgard.Midgard.MN.ORG (Dale Schumacher) writes:
...
>Proposed, what is needed is a program
>which understands C syntax and can use a template to reformat C source
>into a form described by that template.  I know, this is DEFINATELY a
>non-trivial task.  Comments are one of the biggest problems, for example.
>However, with all of the resources touched by this newsgroup, it would
>seem that this could be accomplished.  It's value is, at least to me,
>obvious.  I would suggest looking into things like the processing that
>'tbl' or 'eqn' use to treat this as a page formatting problem with the
>comments (hanging comments, that is) being column align text.  Even if
>the comments AREN'T handled nicely, just getting the format of the code
>itself into reasonable shape is a big head start.  So far, the 'cb' type
>programs I've seen have the major disadvantage that the formatting rules
>are hard coded and even at that, don't seem to do a very good job of
>fully converting to a consistent style.  I'd be glad to work on something
>like this, but I don't think I want to do it alone.


I've seen two commercial programs that go part of the way toward what
you are looking for.  Both run on PCs but the vendors may have Unix
implementations as well.  

cb from Polytron can be given flags that tell it when to break lines.
This handles many (though not all) of the stylistic differences that
pertain to placement of braces and when a newline is inserted during
a function declaration.

The C-DOC package from Software Blacksmith's Inc. is a complete documentation
package that handles reformatting and cross references and a whole bunch of
things.  They have flexible control over what reformatted programs look
like, and they have options for handling reformatting of comments. I
don't have much experience with comment reformatting because I do it
in my editor and the C-DOC package doesn't do *everything* right, but it
is nice.

If you'd like addresses for Polytron or C-DOC, send me mail and I'll look
them up.  However, I think more work needs to be done in this area...

					(-:  Brad Brown  :-)
					bradb at ai.toronto.edu
					bradb at ai.utoronto.ca




More information about the Comp.lang.c mailing list