[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 569
  • Last Modified:

Source Code Reformatting Tool

Does anyone know where to find a shareware source code reformatting tool for C/C++?

So far I found the following for a fee:

  C-Clearly at
  http://www.mixsoftware.com/product/ccl.htm 

  Visual Source Format at
  http://www.SourceFormat.com 
0
lhgarrett
Asked:
lhgarrett
  • 6
  • 3
  • 2
  • +5
1 Solution
 
ozoCommented:
cb
0
 
mliberiCommented:
Did you ever try GNU indent?

http://www.gnu.org/software/indent/indent.html
0
 
lhgarrettAuthor Commented:
To ozo and mliberi:

I should have mentioned that I am doing my development on a PC. Both cb and indent look like they are Unix-based utilities. Do you folks know any formatter tools for DOS or Win98?
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
ozoCommented:
You can get the indent sources at
ftp://ftp.gnu.org/gnu/indent/
or from one of the mirrors listed at
http://www.gnu.org/order/ftp.html
and port it to your PC
0
 
nil_dibCommented:
if you are on VC there are some macros at codeguru.com

nil_dib
0
 
lhgarrettAuthor Commented:
To ozo:

I found the source code for indent, and extracted the tar file to my PC. I unarchived the source code and shell scripts. I created a project in MS Visual C++, and tried to compile and link. I got 19 errors associated with the indent.exe executable.

I think I'm doing this the hard way! Is there a pre-compiled executable that I can download instead?

Thanks :-)
0
 
lhgarrettAuthor Commented:
To nil dib:

Can you tell me where to find some specific macros at codeguru.com, or their names so I can do a search for them?

Thanks
0
 
alexoCommented:
Is there a C++ reformatting tool as customizable as indent (preferrably free)?
0
 
yonatCommented:
If you are using MSDev, just select the code and do Alt+F8.
0
 
mliberiCommented:
I own a 'indent' DOS executable. I don't remember if I produced it by compiling the sources or I found it already compiled.

If you like I could send or POST it (uuencoded)
0
 
alexoCommented:
>> If you are using MSDev, just select the code and do Alt+F8.
Hardly "customizable"
0
 
kloperCommented:
Just in case you are using emacs -
do
M-x c-set-style
then type C programming style, there are a number available,e.g. I am using "ellemtel".
Then in any file mark a region and do
M-x indent-region

You can create your own customized style
read doc of c-style-alist variable (C-h v c-style-alist)

Hope that helps.
0
 
GylesCommented:

A simple but flexible one:

astyle

http://gene.md.huji.ac.il/~tald/astyle/

0
 
lhgarrettAuthor Commented:
> http://www.codeguru.com/devstudio_macros/MakeCodeNicer.shtml 

This works to a point, but it is very slow since it is a macro that works in visual mode. Ideally, the code would be reformatted in a subprocess, and then redisplayed when the job is done.

Also, there are some inconsistencies and issues that the macro seems to overlook (lining up enumerated types, #ifdefs outside of the main() function, breaking-up onto multiple lines function signatures over 80 characters).
0
 
lhgarrettAuthor Commented:
> Just in case you are using emacs
Actually, I'm using a combination of "improved vi" (www.vim.org) and MSDEV.

If there is a Vim function I'm unaware of, that would be slick!!!
0
 
lhgarrettAuthor Commented:
> I own a 'indent' DOS executable...
I would like to try this out if possible (lhgarrett@hotmail.com).

> A simple but flexible one:
Gyles' suggestion seems to work pretty well, so I'm going to award points at this time.
0
 
mliberiCommented:
I uploaded 'INDENT.EXE' to my home page.
Please download from http://www.geocities.com/mliberi/INDENT.ZIP
0

Featured Post

Live webcast with Pinal Dave

Pinal Dave will teach you tricks to help identify the real root cause of database problems rather than red herrings. Attendees will learn scripts that they can use in their environment to immediately figure out their performance Blame Shifters and fix them quickly.

  • 6
  • 3
  • 2
  • +5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now