• C

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 
lhgarrettAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
Redefining Cyber Security w/ AI & Machine Learning

The implications of AI and machine learning in cyber security are massive and constantly growing, creating both efficiencies and new challenges across the board. Join our webinar on Sept. 21st to learn more about leveraging AI and machine learning to protect your business.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C

From novice to tech pro — start learning today.