.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Developer's Farm > General Programming
General Programming Help others and get yourself helped here!

Reply
 
Thread Tools
a small utility to format your messy C/C++ code automatically.
Old
  (#1)
Whistler
Summoner
 
Whistler's Avatar
 
Status: Offline
Posts: 1,499
Join Date: Feb 2004
Location: Mist Village
Default a small utility to format your messy C/C++ code automatically. - 31-12-2004

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

Last edited by Whistler; 31-12-2004 at 04:01..
  
Reply With Quote
Re: a small utility to format your messy C/C++ code automatically.
Old
  (#2)
koraX
Member
 
koraX's Avatar
 
Status: Offline
Posts: 145
Join Date: Jan 2004
Location: Slovak Republic
Default Re: a small utility to format your messy C/C++ code automatically. - 31-12-2004

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



kXBot
koraX's utils
- see my homepage for other projects (OpenGL CSG Editor, FAT16 Sim, NNetwork Sim, ...)
  
Reply With Quote
Re: a small utility to format your messy C/C++ code automatically.
Old
  (#3)
@$3.1415rin
Council Member, Author of JoeBOT
 
@$3.1415rin's Avatar
 
Status: Offline
Posts: 1,381
Join Date: Nov 2003
Location: Germany
Default Re: a small utility to format your messy C/C++ code automatically. - 31-12-2004

"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 ... anyway, usually i'm formatting my code right away as I like it, or sometimes I use the MSVC function to format some lines


  
Reply With Quote
Re: a small utility to format your messy C/C++ code automatically.
Old
  (#4)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: a small utility to format your messy C/C++ code automatically. - 03-01-2005

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 ?



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."

Last edited by Pierre-Marie Baty; 03-01-2005 at 23:38..
  
Reply With Quote
Re: a small utility to format your messy C/C++ code automatically.
Old
  (#5)
Whistler
Summoner
 
Whistler's Avatar
 
Status: Offline
Posts: 1,499
Join Date: Feb 2004
Location: Mist Village
Default Re: a small utility to format your messy C/C++ code automatically. - 04-01-2005

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

Last edited by Whistler; 04-01-2005 at 03:54..
  
Reply With Quote
Re: a small utility to format your messy C/C++ code automatically.
Old
  (#6)
Whistler
Summoner
 
Whistler's Avatar
 
Status: Offline
Posts: 1,499
Join Date: Feb 2004
Location: Mist Village
Default Re: a small utility to format your messy C/C++ code automatically. - 26-02-2005

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
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com