Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development
New AStyle plugin
Ceniza:
I'm pretty sure it'sn't the most popular plugin of Code::Blocks, but when it comes handy it's good to have it working :)
The original plugin uses AStyle 1.15.3, the new plugin uses AStyle 1.17.0-dev CVS.
There was a big change that makes it easier to use: std::istream instead of the AStyle stream iterator.
The current implementation had a few problems when applying the settings, that's now fixed.
I added the Bracket type combobox so now you can decide if you want Break, Attach, Linux or None when you customize.
I hope it be accepted to replace the current CVS version.
Well, the link, of course: http://gda.utp.edu.co/~ceniza/CodeBlocks/astyle.zip
Urxae:
Wouldn't it be better to create a patch against Code::Blocks CVS and submit it?
mandrav:
--- Quote from: fvbommel ---Wouldn't it be better to create a patch against Code::Blocks CVS and submit it?
--- End quote ---
Yes that is better for patches. But, I think, we have an exception here since he updated to the newest astyle code too (which we keep in our CVS)...
Anyway, thanks Ceniza. Your changes have been applied to CVS :)
Yiannis.
tiwag:
With the new astyle plugin,
the indentation of if(){} blocks is wrong,
when using K&R style (at least there i found it happen),
it's indented one size too much.
this sample, reference "K&R" style
--- Code: ---void Notify() {
if(!m_frame->IsRunning()) {
m_gauge->SetValue(0);
}
else {
if(!m_bInit) {
if(m_thread->GetRSSLength()) {
m_bInit = true;
}
}
else {
m_gauge->SetValue(m_thread->GetRSSPos());
m_frame->SetStatusText(
wxString::Format(wxT("Converting Data... %i of %i"),
m_thread->GetRSSPos(),
m_thread->GetRSSLength()
)
);
}
}
}
--- End code ---
astyled with "K&R"
--- Code: ---void Notify() {
if ( !m_frame->IsRunning() ) {
m_gauge->SetValue( 0 );
}
else {
if ( !m_bInit ) {
if ( m_thread->GetRSSLength() ) {
m_bInit = true;
}
}
else {
m_gauge->SetValue( m_thread->GetRSSPos() );
m_frame->SetStatusText(
wxString::Format( wxT( "Converting Data... %i of %i" ),
m_thread->GetRSSPos(),
m_thread->GetRSSLength()
)
);
}
}
}
--- End code ---
is indented one size too much !
btw, the K&R preview-sample misses a bracket '}'
--- Code: ---namespace foospace {
int Foo() {
if (isBar) {
bar();
return 1;
} <<<<<<<<<<<<<<<<<<<<<missing
else
return 0;
}
}
--- End code ---
Ceniza:
Thanks for your feedback.
When I updated and "fixed" the plugin I focused in the Custom style and considered the predefined ones were right, but it seems I was wrong.
I had to enable and disable even more options to get the right results in the predifined styles. Hadn't noticed the sample was wrong for almost all of them.
I tested all the styles this time and they seem to be working as they should now.
I'd really need to make a file to test all the cases, pass it through AStyle, AStyle plugin and compare the results.
By now I'll upload the new files (just 2) which I had to modify. I'll try to make the test file later (I really need to sleep first).
I'll also include a 3rd file (the resource file) where I made a little change.
New files: http://gda.utp.edu.co/~ceniza/CodeBlocks/astyle-020705.zip
Navigation
[0] Message Index
[#] Next page
Go to full version