Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » Code reformatter added to TheIDE
Code reformatter added to TheIDE [message #13794] Sun, 27 January 2008 15:56 Go to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
Well, after some effort, I got astyle code reformatter bound to Theide.
Here a screenshot of the setup dialog:

index.php?t=getfile&id=957&private=0

On next post, the changed files and some technical details.

Ciao

Max
  • Attachment: astyle.png
    (Size: 183.68KB, Downloaded 694 times)
Re: Code reformatter added to TheIDE [message #13795 is a reply to message #13794] Sun, 27 January 2008 16:15 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
Here the patched/added files to get astyle working in TheIDE.
Patches consist of :

1 - Added modified astyle code. Changes are related to :
- use Upp:: containers/types instead of std:: ones
- fixed some memory leaks
- ported sources to unicode (using Upp::WString instead std::string)


2 - Additions to ide menu, dialog, keys and serialization, so astyle settings are saved with the Ide configuration.

To use, just get the 2401 UVS2 release (corresponding to latest 104 SVN release) and unpack the file here in uppsrc folder, overwriting files when needed.

Enjoy!

Ciao

Max

p.s. : I forgot to mention, code reformatting command is in edit menu; it reformats current editor window.
No support to reformat selections as IMHO it makes few sense...
Undo is supported, so don't worry about testing !

Ciao

Max

[Updated on: Sun, 27 January 2008 17:19]

Report message to a moderator

Re: Code reformatter added to TheIDE [message #13810 is a reply to message #13795] Mon, 28 January 2008 19:46 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
It works unchanged also on today SVN Release 105, corresponding to latest UVS2 2402 Release.

Ciao

Max
Re: Code reformatter added to TheIDE [message #13850 is a reply to message #13794] Tue, 29 January 2008 23:42 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
It works unchanged also on today SVN Release 106, corresponding to latest UVS2 2407 Release.

Ciao

Max
Re: Code reformatter added to TheIDE [message #13857 is a reply to message #13794] Wed, 30 January 2008 11:04 Go to previous messageGo to next message
zsolt is currently offline  zsolt
Messages: 698
Registered: December 2005
Location: Budapest, Hungary
Contributor
seems to be promising. My only problem is license of astyle. It's LGPL, so it should be compiled as a dll or so.
Re: Code reformatter added to TheIDE [message #13859 is a reply to message #13857] Wed, 30 January 2008 11:24 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
zsolt wrote on Wed, 30 January 2008 11:04

seems to be promising. My only problem is license of astyle. It's LGPL, so it should be compiled as a dll or so.


Well, that's not for sure.... In LGPL license is stated that :
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.


We're modifying the source code and publishing it on terms of LGPL, we're distributing a work containing portions of the library with a license that allow access to source code of the derivative product, so I think that Theide falls in such a case.... But we'd need a lawer to be sure about that Smile

BTW, it would be no problem to make a shared library of astyle, but imo it makes few sense.

Ciao

Max
Re: Code reformatter added to TheIDE [message #13863 is a reply to message #13857] Wed, 30 January 2008 12:51 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
IMO, license is not a problem. We are redistributing all the code with it. And it is not needed for U++ applications, only for TheIDE.

BTW, even worse issue there is ndisasm, which is GPL.

Speaking about it, I am more worried about the coding style. Astyle code is exactly what U++ approach tries to argue with Wink

Mirek
Re: Code reformatter added to TheIDE [message #13864 is a reply to message #13863] Wed, 30 January 2008 13:13 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
luzr wrote on Wed, 30 January 2008 12:51



Speaking about it, I am more worried about the coding style. Astyle code is exactly what U++ approach tries to argue with Wink



Well, I'd agree with you if astyle would be made as a part of Upp, but it's only an helper for theide, not upp Smile
IMHO loosing a week or two to make something like astyle from scrath would not be a valuable choice.
Besides of that, astyle patched to use upp containers doesn't look awful, even if it uses pointers to manage stuffs quite a bit.
I had to change just 5(or 6 ?) container variables to use the DeepCopy option, among the lot more used there, so it's not so bad.
(BTW, nice stuff the 'pick semantics broken' error, it saved me a lot of debugging).
Just think as astyle like a black box that does (well, indeed) it's job.
Speaking about coding style, jpeg, tif and so C plugins are not the most elegant pieces of code ever seen !

IMHO, reinventing the wheel makes sense if with that wheel you travel for many km at high speed. Having a ferrari to go shopping at the supermarket near home is not whorth the money !

Ciao

Max
Re: Code reformatter added to TheIDE [message #14066 is a reply to message #13864] Fri, 08 February 2008 12:08 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Well, I have added it...

Anyway, after a while of experimenting, it feels hardly usable... E.g. I was completely unsuccesful trying to use it to format anything in a way I am used to (and most U++ sources are formatted).

Actually, the only effect I have noticed is that it inserted a line after each source line Wink

Also, I think, if such set of flags is possible (I mean, U++ 'default' style), it should be preset...

Mirek
Re: Code reformatter added to TheIDE [message #14078 is a reply to message #14066] Fri, 08 February 2008 21:53 Go to previous message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
luzr wrote on Fri, 08 February 2008 12:08

Well, I have added it...

Anyway, after a while of experimenting, it feels hardly usable... E.g. I was completely unsuccesful trying to use it to format anything in a way I am used to (and most U++ sources are formatted).

Actually, the only effect I have noticed is that it inserted a line after each source line Wink

Also, I think, if such set of flags is possible (I mean, U++ 'default' style), it should be preset...

Mirek


Hmmmm... I hope that one was before our chat in ICQ Smile
BTW, besides XP problems (I hope you found why it behaves so in XP and good on Linux...), I think that "default U++ style" can easily be added with a button more. Better, I guess it would not be a bad idea to add some 'defaults', like K&R, Linux, Upp, My ( Smile ) and maybe the ability to store user settings by name.

Ciao

Max
Previous Topic: MSC 9 Compilation Warnings -- Fix
Next Topic: The very strange xterm issue
Goto Forum:
  


Current Time: Sat May 04 14:47:15 CEST 2024

Total time taken to generate the page: 0.02876 seconds