← Back to team overview

kicad-developers team mailing list archive

Re: indentation and code style was Re: Infinite look

 

Raúl Sánchez Siles wrote:
El Jueves, 24 de Abril de 2008, Dick Hollenbeck escribió:

Raúl Sánchez Siles wrote:

El Jueves, 24 de Abril de 2008, Raúl Sánchez Siles escribió:

Hello Dick and thanks for you much clarifying anwer:

I'm thinking of a solution which would involve using a wxProcess
variable to redirect pipes into it or something like that. I'm doing
some tests and preparing a patch for this, so I get this working you'll
have news about it.

If I'm right I think this isn't a problem only covering debug builds,
but also general builds as long as the child process output enough
information, so it's something where care should be taken.

Thanks for the help, regards,

Find attached a first try. Tested and works. I don't know yet the
possible drawbacks of this.

What do you think about it?

It does not fix the so called problem. So you go back to the drawing
board, if it still bothers you.

I just tried it and PCBNEW hung up when run from kicad.


I frankly think its a waste of time, but just to provide a better
playground for you, I am submitting a patch which consolidates the
solution into one place in common.cpp


Dick


Thanks a lot for the patch. That was the correct implementation for the patch I sent as proof of concept. In my case, pcbnew worked, but since you patch is more comprehensive I've tested it as well and looks working.


Raúl,


Are you sure you ran the program long enough? Remember you have to fill up the pipe, and the pipe is probably several hundred bytes or even a few kbytes. My test board was large. There is that initial output from Show() on the whole board, which if used against a very large board would help fill the pipe faster. Then even after that I have to do 20 to 40 object selections with the mouse before the output pipe gets full and pcbnew stops responding.


So unless we have run into a wxWidgets version difference, I am suspicious that your fix is no solution, at least not a general one. On the other hand, according to the documentation for wxProcess, one would get the idea that unless ::Redirect() is called, there should be no stdout redirection. So we have to allow for the possibility that a bug exists in my wxWidgets 2.8.4 that is fixed in your version? Are you on linux and using newer than 2.8.4 wxWidgets?


What I've noticed is the patch is somewhat noisy because changes in indentation style. Where tabs were used, you changed it for white spaces. I'm not sure guidelines are established for code style.


Hopefully this thread will clarify the subject for you and for any future developers who also have the same question. Hopefully they will know how to use the search feature of this list.


Over the course of the last year most of the files have been run through "uncrustify", the C++ beautifier which we have adopted as the official Kicad beautifier. I built the configuration file for the project, called uncrustify.cfg. Giving up a full day of my time to develop this file, I set that up for spaces, which is a strong preference I have over tabs.


("He who does the work gets to decide." After 40 hours per week of C/C++ programming for 25 years, a person tends to develop preferences.)


Although the output of uncrustify is not perfect, it is usually better than the inconsistencies that existed in the code from 15 years ago. But given that the output of uncrustify is not perfect, I chose against making a script to beautify all the source files in a batch. Instead I have been doing this one by one as I have discovered these older files, so I can review the results individually.


Uncrustify is the best free C++ beautifier that there is in my opinion and this was also a result of another full day of investigation. (So if you are paying attention, you know I have 2 full days of time expenditure in this already.) The uncrustify developer is responsive to bug requests, and it is a well written piece of code. You should install it from SVN and use it freely as you find crusty C++ code.


Having said this, in a volunteer world, it is impossible to establish too many hard and fast rules about the way things are done, and old programmers are stubborn and some of them have tabs setup in their editors. But not me, I am using spaces.



As you may have noticed, I don't have a deep knowledge of kicad code, but I think commits could be clearer if there would be a code style.

I don't know what this means. We are hoping for perfection, and we expect it to happen for free. The expectations should not exceed the organizational capacity of an open source project. If we had a few corporate sponsors with real lines of authority, then more could be done. Having contributed about as much as anyone to this project in the last year, I am not convinced that we should expect too much of an open source model without any sponsorship. The ultimate problem is that those qualified to do the work *in a quality manor* generally cannot afford to give away their time. Most contributions come from folks who are bothered by something, and think they know how to fix it. So this ends up being, "he who does the work, gets to decide."


If it is, I volunteer to send patches in order to comply with that style and maybe do some other minor changes like code documentation/comments translations.



Thank you Raúl, your help is appreciated.









Follow ups

References