Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » How can I setup code formatter in eclipse cdt?
How can I setup code formatter in eclipse cdt? [message #164137] Mon, 20 February 2006 10:36 Go to next message
Eclipse UserFriend
Originally posted by: yinglcs.aim.com

How can I setup code formatter in eclipse cdt?
I am running on Linux Fedora.

Thank you.
Re: How can I setup code formatter in eclipse cdt? [message #164145 is a reply to message #164137] Mon, 20 February 2006 13:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: berend.chalmers.se

Hi,

There are two ways I know of. The most easy is probably installing the
simple intent code:

http://softwitch.net/blog/index.php/simple-indent-code-forma tter-for-cdt/

and having this point to the intent of your preference. I use GNU indent
for C and astyle for C++.

Good luck,
Berend.
Re: How can I setup code formatter in eclipse cdt? [message #164438 is a reply to message #164145] Fri, 24 February 2006 05:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: arne.anka.ginguppin.de

> There are two ways I know of. The most easy is probably installing the
> simple intent code:

and the other one?

regards
Re: How can I setup code formatter in eclipse cdt? [message #164652 is a reply to message #164438] Sat, 25 February 2006 01:52 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: berend.chalmers.se

The other one is using the plugin under indent on the following page:
http://dev.eclipse.org/viewcvs/index.cgi/cdt-home/community. html?cvsroot=Tools_Project&rev=1.10

And it uses gnu indent by default.

Berend.




>> There are two ways I know of. The most easy is probably installing
>> the simple intent code:
>
>
> and the other one?
>
> regards
Re: How can I setup code formatter in eclipse cdt? [message #164659 is a reply to message #164652] Sat, 25 February 2006 02:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: burner.zclipse.org

On Sat, 2006-02-25 at 07:52 +0100, Berend van Wachem wrote:
> The other one is using the plugin under indent on the following page:
> http://dev.eclipse.org/viewcvs/index.cgi/cdt-home/community. html?cvsroot=Tools_Project&rev=1.10
>
> And it uses gnu indent by default.

And there's a newer version (1.0.2) linked from here:
http://dev.eclipse.org/viewcvs/index.cgi/~checkout~/cdt-home /contrib/main.html?cvsroot=Tools_Project

If you do use this one, you'll probably prefer to create a .indent.pro
file in your home directory containing all the GNU indent command line
options you like.

mike

>
> Berend.
>
>
>
>
> >> There are two ways I know of. The most easy is probably installing
> >> the simple intent code:
> >
> >
> > and the other one?
> >
> > regards
Re: How can I setup code formatter in eclipse cdt? [message #164667 is a reply to message #164145] Sat, 25 February 2006 12:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: yinglcs.aim.com

I tried that plugins that you suggest. But after I format the code, it
results in code which can't compile.

i have a funcion like this:

void aFunct const {
// my implmentation.
}

but after I format it, it becomes

void aFunct const const {
// my implmentation.
}
Re: How can I setup code formatter in eclipse cdt? [message #164674 is a reply to message #164667] Sat, 25 February 2006 16:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: berend.chalmers.se

Hi,

I just tried your code and it works fine here. I cannot see why the
indent should create the extra "const".

The GNU indent does not work for C. But again, I don't see wy it should
generate extra text.

Berend.




> I tried that plugins that you suggest. But after I format the code, it
> results in code which can't compile.
>
> i have a funcion like this:
>
> void aFunct const {
> // my implmentation.
> }
>
> but after I format it, it becomes
> void aFunct const const {
> // my implmentation.
> }
>
Re: How can I setup code formatter in eclipse cdt? [message #164680 is a reply to message #164674] Sat, 25 February 2006 20:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: burner.zclipse.org

On Sat, 2006-02-25 at 22:54 +0100, Berend van Wachem wrote:
> Hi,
>
> I just tried your code and it works fine here. I cannot see why the
> indent should create the extra "const".

I've seen indent do weird things from time to time...

>
> The GNU indent does not work for C. But again, I don't see wy it should
> generate extra text.

Eh? GNU indent was made for C, was it not? The info page for GNU indent
tells me that it is made explicitly for indenting and formatting C
program source.

> Berend.
>
>
>
>
> > I tried that plugins that you suggest. But after I format the code, it
> > results in code which can't compile.
> >
> > i have a funcion like this:
> >
> > void aFunct const {
> > // my implmentation.
> > }
> >
> > but after I format it, it becomes
> > void aFunct const const {
> > // my implmentation.
> > }
> >
Re: How can I setup code formatter in eclipse cdt? [message #164688 is a reply to message #164680] Sat, 25 February 2006 22:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: yinglcs.aim.com

I try that. And it happens again:
here is the funciton after indent. See the extra 'const'?


bool
YBlockMap::isVerticalOverlapped () const const
{
return hasOverlapped (y, h);
}

I am running indent on linux fedora
$ indent -version
GNU indent 2.2.9
Re: How can I setup code formatter in eclipse cdt? [message #164696 is a reply to message #164688] Sun, 26 February 2006 01:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: burner.zclipse.org

On Sun, 2006-02-26 at 03:28 +0000, yinglcs wrote:
> I try that. And it happens again:
> here is the funciton after indent. See the extra 'const'?

Well, perhaps what Berend was saying was that indent doesn't work on C++
code.

>From the BUGS section of the indent man page:

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.


The const member function syntax is definitely a C++ construct, so maybe
this is where the problem is stemming from.

> bool
> YBlockMap::isVerticalOverlapped () const const
> {
> return hasOverlapped (y, h);
> }
>
> I am running indent on linux fedora
> $ indent -version
> GNU indent 2.2.9
>
>
Re: How can I setup code formatter in eclipse cdt? [message #164704 is a reply to message #164680] Sun, 26 February 2006 03:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: berend.chalmers.se

Hi,

Yes I am sorry - I meant to say GNU indent does not work for C++. Try
astyle instead then.

But even so, I cannot see why indent generates extra code. Maybe
something strange in an .ident.prr file? My .indent.pro file contains:
-i4 -npsl -di0 -bl -d0 -cli0 -npcs -nprs -nut -sai -saf -nfca -bli0 -ci4
-l140

Berend.

> On Sat, 2006-02-25 at 22:54 +0100, Berend van Wachem wrote:
>
>>Hi,
>>
>>I just tried your code and it works fine here. I cannot see why the
>>indent should create the extra "const".
>
>
> I've seen indent do weird things from time to time...
>
>
>>The GNU indent does not work for C. But again, I don't see wy it should
>>generate extra text.
>
>
> Eh? GNU indent was made for C, was it not? The info page for GNU indent
> tells me that it is made explicitly for indenting and formatting C
> program source.
>
>
>>Berend.
>>
>>
>>
>>
>>
>>>I tried that plugins that you suggest. But after I format the code, it
>>>results in code which can't compile.
>>>
>>>i have a funcion like this:
>>>
>>>void aFunct const {
>>>// my implmentation.
>>>}
>>>
>>>but after I format it, it becomes
>>>void aFunct const const {
>>>// my implmentation.
>>>}
>>>
>
>


--
/\-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-=-\
L_@~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~@
| Berend van Wachem |
| Multiphase Flow Group |
| Chalmers University of Technology |
| |
| Please note that my email address has changed to: |
| Berend@chalmers.se |
| |
| Please make the appropriate changes in your address |
| list. |
| |
__@~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~@
\/______________________________________________________/
Re: How can I setup code formatter in eclipse cdt? [message #168025 is a reply to message #164704] Wed, 12 April 2006 21:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dlwhiteman.alumni.ncsu.edu

Berend van Wachem wrote:
> Hi,
>
> Yes I am sorry - I meant to say GNU indent does not work for C++. Try
> astyle instead then.
>
> But even so, I cannot see why indent generates extra code. Maybe
> something strange in an .ident.prr file? My .indent.pro file contains:
> -i4 -npsl -di0 -bl -d0 -cli0 -npcs -nprs -nut -sai -saf -nfca -bli0 -ci4
> -l140
>
> Berend.

The referenced plugin is for indent. Is there a plugin available to use
astyle?

Thanks,
David
Re: How can I setup code formatter in eclipse cdt? [message #168539 is a reply to message #168025] Thu, 20 April 2006 07:36 Go to previous message
Eclipse UserFriend
Originally posted by: arne.anka.ginguppin.de

> The referenced plugin is for indent. Is there a plugin available to use
> astyle?

no. you have to wrap astyle in a script to convert the parameters, set the
radiobutton to "custom" and add the astyle parameters by hand:

#!/bin/sh
unset arglist
while [ $# -gt 3 ]; do
arglist="$arglist $1"
shift
done

/usr/bin/astyle $arglist < "$1" > "$3"
Previous Topic:How to get stdout to go to console
Next Topic:How to include external API header
Goto Forum:
  


Current Time: Thu Jul 17 19:00:36 EDT 2025

Powered by FUDForum. Page generated in 0.04697 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top