C/C++ code beautifier

Discussion in 'C Programming' started by Diego Andres Alvarez Marin, Nov 16, 2004.

  1. Hi all!

    Is there a linux tool that uses as input my ugly C/C++ code and
    outputs a pretty and nice formated source code?

    Regards,

    Diego
     
    Diego Andres Alvarez Marin, Nov 16, 2004
    #1
    1. Advertising

  2. Diego Andres Alvarez Marin wrote:
    >
    >
    > Is there a linux tool that uses as input my ugly C/C++ code and
    > outputs a pretty and nice formated source code?



    Artistic Style

    http://astyle.sourceforge.net/
     
    E. Robert Tisdale, Nov 16, 2004
    #2
    1. Advertising

  3. Diego Andres Alvarez Marin wrote:
    > Is there a linux tool that uses as input my ugly C/C++ code and
    > outputs a pretty and nice formated source code?


    Have you tried www.google.com?
     
    Victor Bazarov, Nov 16, 2004
    #3
  4. On Tue, 16 Nov 2004 15:17:45 -0800, Diego Andres Alvarez Marin wrote:

    > Hi all!
    >
    > Is there a linux tool that uses as input my ugly C/C++ code and
    > outputs a pretty and nice formated source code?
    >
    > Regards,
    >
    > Diego


    Assuming you mean C and/or C++, yes, there are many. This is not on-topic
    here though, you should ask in comp.unix.programmer or a linux group. You
    could alternatively learn how to use a search engine and find all the
    information you seek in a few seconds.

    Rob Gamble
     
    Robert Gamble, Nov 16, 2004
    #4
  5. On Tue, 16 Nov 2004 15:21:38 -0800, E. Robert Tisdale wrote:

    > Diego Andres Alvarez Marin wrote:
    >>
    >>
    >> Is there a linux tool that uses as input my ugly C/C++ code and
    >> outputs a pretty and nice formated source code?

    >
    >
    > Artistic Style
    >
    > http://astyle.sourceforge.net/


    To the OP: If you have any questions or comments about this program,
    please feel free to email Tisdale directly as opposed to asking here.

    Rob Gamble
     
    Robert Gamble, Nov 17, 2004
    #5
  6. Diego Andres Alvarez Marin

    Steve Kobes Guest

    Robert Gamble wrote:
    > Assuming you mean C and/or C++, yes, there are many.


    Out of curiosity, when would C/C++ ever mean anything *other* than "C and/or C++"?
     
    Steve Kobes, Nov 17, 2004
    #6
  7. In article <>,
    Steve Kobes <> wrote:
    >Robert Gamble wrote:
    >> Assuming you mean C and/or C++, yes, there are many.

    >
    >Out of curiosity, when would C/C++ ever mean anything *other* than "C
    >and/or C++"?


    http://groups.google.com/groups?selm=

    Unfortunately the link seems to be dead.


    dave

    --
    Dave Vandervies

    Silly, yes. But have we shown that it is unhelpful?
    --Daniel Fox in comp.lang.c
     
    Dave Vandervies, Nov 17, 2004
    #7
  8. Diego Andres Alvarez Marin

    Trent Buck Guest

    Trent Buck, Nov 17, 2004
    #8
  9. Victor Bazarov <> wrote in message news:<L6wmd.11028$09.us.to.verio.net>...
    > Diego Andres Alvarez Marin wrote:
    > > Is there a linux tool that uses as input my ugly C/C++ code and
    > > outputs a pretty and nice formated source code?

    >
    > Have you tried www.google.com?


    Believe me that I spend 15 minutes before asking here and I did not
    find anything... maybe I did not put the right words...
     
    Diego Andres Alvarez Marin, Nov 17, 2004
    #9
  10. Diego Andres Alvarez Marin

    Ben Pfaff Guest

    (Diego Andres Alvarez Marin) writes:

    > Victor Bazarov <> wrote in message news:<L6wmd.11028$09.us.to.verio.net>...
    >> Diego Andres Alvarez Marin wrote:
    >> > Is there a linux tool that uses as input my ugly C/C++ code and
    >> > outputs a pretty and nice formated source code?

    >>
    >> Have you tried www.google.com?

    >
    > Believe me that I spend 15 minutes before asking here and I did not
    > find anything... maybe I did not put the right words...


    "c beautifier" hits lots of useful programs and links.
    --
    "I hope, some day, to learn to read.
    It seems to be even harder than writing."
    --Richard Heathfield
     
    Ben Pfaff, Nov 17, 2004
    #10
  11. Diego Andres Alvarez Marin

    Richard Bos Guest

    (Steve Kobes) wrote:

    > Robert Gamble wrote:
    > > Assuming you mean C and/or C++, yes, there are many.

    >
    > Out of curiosity, when would C/C++ ever mean anything *other* than "C and/or C++"?


    All too often, when someone uses the term "C/C++", it appears that they
    mean "C and C++-with-objects-ignored, which is exactly the same thing,
    isn't it?". Of course, it isn't the same thing at all, and such people
    tend to run into problems trying to compile C code with a C++ compiler,
    or vice versa.

    Richard
     
    Richard Bos, Nov 17, 2004
    #11
  12. Diego Andres Alvarez Marin

    Villy Kruse Guest

    On Wed, 17 Nov 2004 00:07:23 -0800,
    Ben Pfaff <> wrote:


    > (Diego Andres Alvarez Marin) writes:
    >
    >> Victor Bazarov <> wrote in message news:<L6wmd.11028$09.us.to.verio.net>...
    >>> Diego Andres Alvarez Marin wrote:
    >>> > Is there a linux tool that uses as input my ugly C/C++ code and
    >>> > outputs a pretty and nice formated source code?
    >>>
    >>> Have you tried www.google.com?

    >>
    >> Believe me that I spend 15 minutes before asking here and I did not
    >> find anything... maybe I did not put the right words...

    >
    > "c beautifier" hits lots of useful programs and links.


    Not to mention that normally linux comes with a butifier, as did most unix
    systems for decades.

    Villy
     
    Villy Kruse, Nov 17, 2004
    #12
  13. Diego Andres Alvarez Marin wrote:

    > Victor Bazarov wrote:
    >
    >>Diego Andres Alvarez Marin wrote:
    >>
    >>>Is there a linux tool that uses as input my ugly C/C++ code and
    >>>outputs a pretty and nice formated source code?

    >>
    >>Have you tried www.google.com?

    >
    > Believe me that I spend 15 minutes before asking here
    > and I did not find anything...


    You should have told us that in your original post.

    > Maybe I did not put the right words...


    I used Google

    http://www.google.com/

    to search for

    +"reformat C++"

    and I found lots of stuff including:

    http://www.vijayawadasite.com/home/cfaq/misc-environmental-issues.html

    [30.2] Are there any pretty-printers that reformat C++ source code?

    [snip]

    In alphabetical order:

    * Artistic Style is a reindenter and reformatter of C++, C and Java
    source code. It is available from http://gene.md.huji.ac.il/~tald/astyle/
    * C++2LaTeX is a LaTeX pretty printer. It is available from
    http://mirriwinni.cse.rmit.edu.au/ftp/pub/languages/C 2LaTeX-4.0.tar.gz
    * C-Clearly by V Communications, Inc. is a Windows program that
    comes with standard formatting templates and also allows you to
    customize your own. http://www.mixsoftware.com/product/ccl.htm
    * GNU indent program may help. It's available at
    http://www.arceneaux.com/indent.html. You can also find an "official"
    GNU mirror site by looking at http://www.gnu.org/order/ftp.html or
    perhaps the original GNU site, ftp://prep.ai.mit.edu/pub/gnu/ (e.g., if
    the current version is 1.9.1 you could use
    ftp://prep.ai.mit.edu/pub/gnu/indent-1.9.1.tar.gz).
    * tgrind is a Unix based pretty printer. It usually comes with the
    public distribution of TeX and LaTeX in the directory
    "...tex82/contrib/van/tgrind". A more up-to-date version of tgrind by
    Jerry Leichter can be found on: ftp://venus.ycc.yale.edu/pub in
    [.TGRIND]. [Note: If anyone has an updated URL for tgrind, please let me
    know ().]

    Finally, you might consider lgrind which is another C++ to LaTeX
    translator (check for the closest mirror site of the ctan archive). The
    following is a grind definition for C++ (but this one doesn't recognize
    some new keywords such as bool or wchar_t, and it doesn't recognize a
    file ending with .cpp as C++):

    C++|c++|CC:\
    :pb=\p\d?\:)cf:np=\)\d?;:bb={:be=}:\
    :cb=/*:ce=*/:ab=//:ae=$:sb=":se=\e":lb=':\
    :zb=@:ze=@:tb=%%:te=%%:mb=%\$:me=\$%:vb=%\|:ve=\|%:\
    :le=\e':tl:id=_~\::\
    :kw=asm auto break case cdecl char continue default do double else\
    enum extern far float for fortran goto huge if int interrupt long\
    near pascal register return short signed sizeof static struct\
    switch typedef union unsigned while void\
    #define #else #endif #if #ifdef #ifndef #include #undef # define\
    endif ifdef ifndef include undef defined #pragma\
    class const delete friend inline new operator overload private\
    protected public template this virtual:
     
    E. Robert Tisdale, Nov 17, 2004
    #13
  14. On 16 Nov 2004 21:26:22 -0800, in comp.lang.c ,
    (Steve Kobes) wrote:

    >Robert Gamble wrote:
    >> Assuming you mean C and/or C++, yes, there are many.

    >
    >Out of curiosity, when would C/C++ ever mean anything *other* than "C and/or C++"?


    Quite frequently, people that use "C/C++" have the idea that the two
    languages are so similar that they're interchangable, or that C is a subset
    of C++, or that C++ is a superset of C. None of these is true, hence the
    mere sight of C/C++ tends to send shivers up the regular's spines.
    --
    Mark McIntyre
    CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
    CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>

    ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
    http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
    ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
     
    Mark McIntyre, Nov 17, 2004
    #14
  15. Steve Kobes wrote:

    > Robert Gamble wrote:
    >
    >>Assuming you mean C and/or C++, yes, there are many.

    >
    >
    > Out of curiosity, when would C/C++ ever mean anything *other* than "C and/or C++"?


    C++ was designed by the same people at Bell Labs.
    C++ was designed to replace C and not compete with it.
    C++ *subsumes* C.
    Most popular implementations compile both C or C++.
     
    E. Robert Tisdale, Nov 17, 2004
    #15
  16. In article <cngm90$7ig$>, "E. Robert Tisdale" <> writes:
    >
    > C++ was designed by the same people at Bell Labs.


    Recently shown here to be false.

    > C++ was designed to replace C and not compete with it.


    Replacement constitutes competition.

    > C++ *subsumes* C.


    If this is taken in any strict sense, it is false. If it is taken
    loosely, it is inconsequential.

    > Most popular implementations compile both C or C++.


    A meaningless statistic.

    Zero for four.

    --
    Michael Wojcik

    Push up the bottom with your finger, it will puffy and makes stand up.
    -- instructions for "swan" from an origami kit
     
    Michael Wojcik, Nov 18, 2004
    #16
  17. In article <>, (Steve Kobes) writes:
    > Robert Gamble wrote:
    > > Assuming you mean C and/or C++, yes, there are many.

    >
    > Out of curiosity, when would C/C++ ever mean anything *other* than "C and/or C++"?


    It can mean anything, if it's used in an expression.

    --
    Michael Wojcik
     
    Michael Wojcik, Nov 18, 2004
    #17
  18. Diego Andres Alvarez Marin

    Kevin Handy Guest

    Steve Kobes wrote:
    > Robert Gamble wrote:
    >
    >>Assuming you mean C and/or C++, yes, there are many.

    >
    >
    > Out of curiosity, when would C/C++ ever mean anything *other* than "C and/or C++"?


    Roman numerals mixed with C operators? 100/100++ = 100/101 ~= 0.99
     
    Kevin Handy, Nov 18, 2004
    #18
  19. In message <cngm90$7ig$>, E. Robert Tisdale
    <> trolled
    >
    >C++ was designed by the same people at Bell Labs.


    bool same(std::string a, std::string b);

    assert(same("Stroustrup", "Ritchie"));

    Yeah, right.

    --
    Richard Herring
     
    Richard Herring, Nov 19, 2004
    #19
  20. Diego Andres Alvarez Marin

    Chris Hills Guest

    I always though that a C/C++ beautifier was ADA....

    Runs off to find asbestos suit and a ticket off the planet :)

    /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/\
    /\/\/ www.phaedsys.org \/\/
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
     
    Chris Hills, Nov 19, 2004
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Diego Andres Alvarez Marin

    C/C++ code beautifier

    Diego Andres Alvarez Marin, Nov 16, 2004, in forum: C++
    Replies:
    20
    Views:
    6,933
    Jason Taylor
    Nov 28, 2004
  2. Sparhawk
    Replies:
    1
    Views:
    415
    Ira Baxter
    Nov 23, 2004
  3. Replies:
    4
    Views:
    4,707
    Bharat Karia
    Mar 22, 2005
  4. Franz Steinhaeusler

    Python Source Code Beautifier

    Franz Steinhaeusler, Feb 27, 2007, in forum: Python
    Replies:
    18
    Views:
    1,176
    Gabriel Genellina
    Mar 9, 2007
  5. Delaney, Timothy (Tim)

    RE: Python Source Code Beautifier

    Delaney, Timothy (Tim), Feb 27, 2007, in forum: Python
    Replies:
    2
    Views:
    394
    Duncan Booth
    Feb 28, 2007
Loading...

Share This Page