.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   General Programming (http://forums.bots-united.com/forumdisplay.php?f=25)
-   -   a small utility to format your messy C/C++ code automatically. (http://forums.bots-united.com/showthread.php?t=3302)

Whistler 31-12-2004 02:58

a small utility to format your messy C/C++ code automatically.
 
well this is a GNU tool... by default it formats the code as the GNU coding standards, but you can use parameters to specify your favorite style

Precompiled for Windows:
http://prdownloads.sourceforge.net/g...n.zip?download

Source code (for use in GNU/Linux or other UNIXes, but also buildable with MinGW+MSYS, just "./configure;make;make install"):
http://www.gnu.org/software/indent/

A specific warning: it has a bug which just mess up your inline asm... so you need to check all of asms after using it

koraX 31-12-2004 09:42

Re: a small utility to format your messy C/C++ code automatically.
 
I just add that official homepage is http://mysite.wanadoo-members.co.uk/.../beautify.html

and here you can find documentation with examples : http://mysite.wanadoo-members.co.uk/...ndent_toc.html

:)

@$3.1415rin 31-12-2004 10:03

Re: a small utility to format your messy C/C++ code automatically.
 
"While an attempt was made to get indent working for C++, it will not do a good job on any C++ source except the very simplest." ... hm, let's see what it does to joebot xp :P ... anyway, usually i'm formatting my code right away as I like it, or sometimes I use the MSVC function to format some lines

Pierre-Marie Baty 03-01-2005 17:46

Re: a small utility to format your messy C/C++ code automatically.
 
I've made a MSVC-compilable version that doesn't need you to install all the GNU stuff on your PC. You can get it from the filebase here (source, native Win32 binaries and documentation included) :

http://filebase.bots-united.com/inde...on=file&id=245

Please note that indent is not a GNU tool, it was originally a BSD tool, but the GNU folks decided to make it their own but kept the original "indent" name and sticked their GPL on it, leading to confusion. Here I've restored the original BSD indenting options by default.

Also note that there are much better indenting tools available on the market, for different languages (even if most of which are commercial). Look for "pretty printer" on Google to find some. PolyStyle is a good example. I don't use any btw, I format my code while I type ;) but it's very handy to clean out other people's code when you want to look at it.

*edit*
moving this to the proper forum, no objections ?

Whistler 04-01-2005 02:06

Re: a small utility to format your messy C/C++ code automatically.
 
http://download.berlios.de/indent/indent-0.2.tar.gz
this is the one modified from the original BSD one

edit:
I've posted the pre-compiled version of the NetBSD Indent (for both Windows and GNU/Linux) at here:
http://filebase.bots-united.com/inde...on=file&id=247

sorry but I don't use MSVC now so no MSVC projects is included there, I compiled it with MinGW :)

actually there are big differences from GNU and BSD ones (although the GNU one is based on BSD one - but the FSF did give credits to the UC Berkeley in the source code). The BSD code is non-portable which needs some hacks to compile in Windows

Whistler 26-02-2005 02:44

Re: a small utility to format your messy C/C++ code automatically.
 
I've found another such tool which is less buggy and also has better support for C++ and even Java:
http://sourceforge.net/projects/astyle
(this is actually the same one used in KDevelop 3)

the only bad thing for this one:
it doesn't support like using "*.cpp" as parameter :(


All times are GMT +2. The time now is 05:43.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.