Home » Developing U++ » U++ Developers corner » Code reformatter added to TheIDE
|
Re: Code reformatter added to TheIDE [message #13795 is a reply to message #13794] |
Sun, 27 January 2008 16:15 |
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 #13859 is a reply to message #13857] |
Wed, 30 January 2008 11:24 |
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
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 #13864 is a reply to message #13863] |
Wed, 30 January 2008 13:13 |
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
|
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
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 #14078 is a reply to message #14066] |
Fri, 08 February 2008 21:53 |
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
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
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 ( ) and maybe the ability to store user settings by name.
Ciao
Max
|
|
|
Goto Forum:
Current Time: Sat May 04 14:47:15 CEST 2024
Total time taken to generate the page: 0.02876 seconds
|