Re: Multithreaded and forking version of former email-fmt.py
Brought to you by:
set
From: Salvador E. T. <sal...@in...> - 2005-09-12 16:25:40
|
On 10/09/05 19:05, Grzegorz Adam Hankiewicz wrote: >Hello there! Long time no see. > >After spending a lot of time doing nothing at all, my parents have >prodded me to find a job again. Earlier this week I had an interview >where they wanted to ask me about being able to write multithreaded >programs or communicate with other processes. > >So I thought I would rewrite the email-fmt.py script I contributed >two years ago. I still don't know the results of the interview, >but it was quite fun writting this version and it is much better: >it no longer uses temporary files, and since it is in C, it doesn't >waste time loading the huge python interpreter. > >I was wondering if those of you using the format script could give >this a try again. In fact, Tim, are you still around here? Tim >wanted the email-fmt program to reformat the lines of text to the >size of the currently opened window. SET, I think this could be >passed as a parameter to the program, but how would you get the >current window size? > > I'm adding: GetWindowCols (GetWindowCols [window_number]) Returns the number of visible columns in the specified window. If you don't specify a window number then the current window number is used. If the specified value is invalid this function returns 0. -------------------------------------------------------------- GetWindowRows (GetWindowRows [window_number]) Returns the number of visible columns in the specified window. If you don't specify a window number then the current window number is used. If the specified value is invalid this function returns 0. I'm also adding a third command to get the "Wrap column" setting. So we can write a couple of sLisp macros to format using the window width and using the wrap column setting. We could even create one set to format the selection and another to format the whole file. >And, the previous python version did fit ok as help >documentation. But a C project is much more complex than >copy&paste. Would you like it to as something in a "contrib" >directory? > > Good! Please add the command line option to select the columns. >As a final note, profiling the C version agains the python one shows >on the command line that python is about four times slower. However, >no matter which version I run from inside setedit, it is much slower >than the command line version. Why does this happen? > > How did you meassure the time? May be the problem is the communication with the editor. >Here's the C version of email-fmt. Enjoy! > > http://gradha.sdf-eu.org/email-fmt.tar.gz > > I tried it in my Debian GNU/Linux Sarge box and it worked flawlessly. SET -- Salvador Eduardo Tropea (SET). (Electronics Engineer) Visit my home page: http://welcome.to/SetSoft or http://www.geocities.com/SiliconValley/Vista/6552/ Alternative e-mail: se...@co... se...@ie... Address: Curapaligue 2124, Caseros, 3 de Febrero Buenos Aires, (1678), ARGENTINA Phone: +(5411) 4759 0013 |