Code::Blocks Forums

User forums => Help => Topic started by: m00 on December 28, 2005, 07:08:09 pm

Title: Is astyle supposed to touch comment (/* */)?
Post by: m00 on December 28, 2005, 07:08:09 pm
Current, I have comment looks like this.
Code
/*
 * comments....
 * comments....
 * comments....
 */

If I touch astyle and it always will ending up like this by remove the first space.
Code
/*
* comments....
* comments....
* comments....
*/
Is there any option to disable it, or is it bug, or is it normal?


Uh oh, looks like forum has removed the first space too in the first example above. I had to add tab in the third example to workaround for this forum to show the * is supposed to be straight in the first example.
Code
	/*
* comments....
* comments....
* comments....
*/
Title: Re: Is astyle supposed to touch comment (/* */)?
Post by: jimp on December 28, 2005, 10:18:44 pm
The problem is probably one of the options you are using,  like pad-parens or pad-operators.  Try it without either of these options.
Title: Re: Is astyle supposed to touch comment (/* */)?
Post by: m00 on December 28, 2005, 10:47:28 pm
The problem is probably one of the options you are using,  like pad-parens or pad-operators.  Try it without either of these options.


Good call, it was pad-operators that I had it enable. It sounds like a bug? Should I report in sourceforge? I am not sure if it's a bug or feature.
Title: Re: Is astyle supposed to touch comment (/* */)?
Post by: Ceniza on December 29, 2005, 02:44:37 am
I'd say that's a bug, an AStyle bug, but since AStyle development has stopped, it'd be kinda useless to add a bug report, or it could be reported already.

I hope AStyle's replacement be developed and released soon...
Title: Re: Is astyle supposed to touch comment (/* */)?
Post by: m00 on December 29, 2005, 05:07:39 am
Okay, thanks, I shall report in AStyle and leave there for anyone that willing to pick up in future.
Title: Re: Is astyle supposed to touch comment (/* */)?
Post by: takeshimiya on December 29, 2005, 05:55:11 am
Quote from: devsolar link=http://sourceforge.net/forum/forum.php?forum_id=507269
Looking for new maintainer

I decided that the legacies involved in AStyle were too much of a hindrance for me to make any significant progress towards the 1.17.0 release I have been battling for whenever I picked up the thread again.
 
If anyone is willing to continue this project, please contact devsolar@users.sourceforge.net.
 
I will soon start work on a source reformatter specialized on C++ instead. I don't know much about C#, and AFAIK there are good Java reformatters readily available, so compatibility to those languages was one of the main roadblocks for me in AStyle. Perhaps I can make better progress that way.
 
Sorry for taking so long to realize I'm not the person to bring AStyle forward.
Title: Re: Is astyle supposed to touch comment (/* */)?
Post by: 280Z28 on December 29, 2005, 10:27:09 pm
I'd say that's a bug, an AStyle bug, but since AStyle development has stopped, it'd be kinda useless to add a bug report, or it could be reported already.

I hope AStyle's replacement be developed and released soon...

I'm working on a plugin that does format-as-you-type, and can reformat code when you paste it (just the code you pasted, say copy and paste from one program to another), similar to what Visual Studio 2005 can do with C# code, if you are familiar with that.
Title: Re: Is astyle supposed to touch comment (/* */)?
Post by: yop on December 29, 2005, 10:39:00 pm
I'm working on a plugin that does format-as-you-type, and can reformat code when you paste it (just the code you pasted, say copy and paste from one program to another), similar to what Visual Studio 2005 can do with C# code, if you are familiar with that.
This is a very handy feature, kdevelop has this one also (haven't used visual studio for ages to know what happens there). You'll use existing astyle handling implemented in codeblocks? (cause it'll need consistency with the style the user has selected for the astyle plugin).
Title: Re: Is astyle supposed to touch comment (/* */)?
Post by: royalbox on January 03, 2006, 04:18:42 pm
Quote
I'm working on a plugin that does format-as-you-type

I look forward to seeing that. There seems to be a few bugs or annoyances in Astyle.
One is this:

Code
THING thing{0};
becomes:
Code
THING thing {
    0
};
no matter what options I try.

Also, comments added after code (on the same line) seem to drift to the right each time Astyle is used.
Title: Re: Is astyle supposed to touch comment (/* */)?
Post by: Michael on January 03, 2006, 08:20:16 pm
Code
THING thing{0};
becomes:
Code
THING thing {
    0
};
no matter what options I try.

Hmm. And what you would like to have? Anyway, did you try with custom (and define what you would like by yourself)?

Michael
Title: Re: Is astyle supposed to touch comment (/* */)?
Post by: rickg22 on January 03, 2006, 08:23:27 pm
I think this is the way of initializing C Arrays.

char[25] mychars = {1,2,3,4,5, (etc) }; And that's very different from functions.
Title: Re: Is astyle supposed to touch comment (/* */)?
Post by: Michael on January 03, 2006, 08:33:39 pm
I think this is the way of initializing C Arrays.

char[25] mychars = {1,2,3,4,5, (etc) }; And that's very different from functions.

Yes, you are right :). I have tried your array with ANSI style and got:

Code
char[25] mychars =
    {
        1,2,3,4,5
    };

I suppose that this is not what you would like to have.

Michael
Title: Re: Is astyle supposed to touch comment (/* */)?
Post by: royalbox on January 08, 2006, 02:11:49 pm
There are two options in the aStyle plugin configuration:

Quote
Don't break complex statements and multiple statements residing in a single line
and
Quote
Don't break one line blocks

which don't seem to do anything.

Let's say you have a class with several methods like this:

Code
        int GetHeight() const {return cy;}
        int GetWidth() const {return cx;}
        int GetX() const {return x;}
        int GetY() const {return y;}
Even with both the above options checked, when you run aStyle you get this:
Code
        int GetHeight() const
        {
            return cy;
        }
        int GetWidth() const
        {
            return cx;
        }
        int GetX() const
        {
            return x;
        }
        int GetY() const
        {
            return y;
        }

What are these options for if not for this?

Many thanks.