Topic: Request For C++ Beautify Program


Author: roadifer@teal.csn.org (Jim Roadifer)
Date: Thu, 13 May 1993 22:16:44 GMT
Raw View
I'm looking for a beautify program for C++ source code. The ultimate would
be a program which I could feed a template that defined how I wanted the
source code to be formatted; four space indentation, braces on the same
line as the looping construct, brace on the same line as an "else", etc.
Does anyone know of such aprogram?







Author: allen@golem.ssc.gov (Michael Allen)
Date: Fri, 14 May 1993 17:08:53 GMT
Raw View
get "indent" from the FSF (y'know, the Gnu people).  From the manual:

The "indent" program changes the appearance of a C program by
inserting or deleting whitespace.  It can be used to make code easier
to read.  It can also convert from one style of writing C to another.

"indent" understands a substantial amount about the syntax of C,
but it also attempts to cope with incomplete and misformed syntax.


(It seems to work just fine with C++ programs as well.)
-Michael
--
--------------------------------------------------
But those who toiled knew nothing of the dreams of
        Those Who Planned;
And the minds who planned the Tower of Babel
        Cared nothing for the workers who built it.

 -Metropolis




Author: marcus@x4u.desy.de (Marcus Speh)
Date: Sun, 16 May 1993 21:29:37 GMT
Raw View
>>>>> On Thu, 13 May 1993 22:16:44 GMT, roadifer@teal.csn.org (Jim Roadifer) said:

|> I'm looking for a beautify program for C++ source code. The ultimate would
|> be a program which I could feed a template that defined how I wanted the
|> source code to be formatted; four space indentation, braces on the same
|> line as the looping construct, brace on the same line as an "else", etc.
|> Does anyone know of such aprogram?

A trivial Emacs-Lisp function (acting on a full source file, a buffer
or a line only) employing C++ Mode (advertised below) produces
beautified C++ code which is more satisfying than what GNU indent(1)
does, IMHO.

  Marcus Speh

[Obtain more information from the World Wide Web info page on C++ --
 link to http://info.desy.de:80/gnu/ftp/pub/www/projects/hepC++.html
 or go yo WWW-SUBJECTS -> COMPUTING -> LANGUAGES. The following is
 part of the info page on C++ mode.]


GNU Emacs C++ Mode
******************

The C++ mode for the GNU Emacs editor is a customizable
environment to format C++ (and C) code in a consistent way. It
is suggested to use this code to ensure homogeneity of the
format while leaving details (how to comment, where to put
braces etc.) to the author (via customization in the Emacs
initialization file .emacs).

This Emacs mode has recently been improved very much by
Barry Warsaw. It is still under active development and
discussion.

An older copy of c++-mode.el is part of the GNU libg++
package.

Where To Get C++ Mode
=====================

The latest version of GNU Emacs C++ mode is available via
anonymous FTP to archive.cis.ohio-state.edu in directory
/pub/gnu/emacs/elisp-archive/modes in file c++-mode.el.Z. See
the header of the file for introduction and installation