1. LW for Windows - very good news!

Hi Rob and Junko!

I hate wars but I "won" this one on "expert" level!!!  

Just to see your faces and hear your voices, our dear
friends!

Happy New Year to All!

Good Luck!

Regards,
Igor Kachan
kinz at peterlink.ru

new topic     » topic index » view message » categorize

2. Re: LW for Windows - very good news!

Rob/Junko,

I decided to cheat.  I figured out how you displayed the image and just did it
manually.  How was the food?  :)

Jonas Temple
http://www.innovativesys.net

new topic     » goto parent     » topic index » view message » categorize

3. Re: LW for Windows - very good news!

Rob,

dos_rescue.ew is interesting, however, I think you have a memory leak in
the call to DrawText, where you call allocate_string() instead of using
the already allocated pointer stored in 's':
global procedure putsxy(sequence pos, sequence string,
			integer fcolor, integer bcolor)
    atom s
    
    poke4(charRect, pos[1])
    poke4(charRect+CHAR_TOP, pos[2])
    poke4(charRect+CHAR_RIGHT, pos[1]+length(string)*8)
    poke4(charRect+CHAR_BOTTOM, pos[2]+18)
    s = allocate_string(string)  -- could reserve large space instead
    c_proc(SetTextColor, {hdc, color_map[1+fcolor]})
    
    c_proc(SetBkColor, {hdc, color_map[1+bcolor]})
    
    c_proc(SetBkMode, {hdc, OPAQUE})
    
c_proc(DrawText, {hdc, allocate_string(string), -1, charRect,
    DT_SINGLE_LINE})
    free(s)
end procedure


new topic     » goto parent     » topic index » view message » categorize

4. Re: LW for Windows - very good news!

Matt Lewis wrote:
> Rob,
> 
> dos_rescue.ew is interesting, however, I think you have a memory leak in
> the call to DrawText, where you call allocate_string() instead of using
> the already allocated pointer stored in 's':
> }}}
<eucode>
> global procedure putsxy(sequence pos, sequence string, 
> 			integer fcolor, integer bcolor)
>     atom s
>     
>     poke4(charRect, pos[1])
>     poke4(charRect+CHAR_TOP, pos[2])
>     poke4(charRect+CHAR_RIGHT, pos[1]+length(string)*8)
>     poke4(charRect+CHAR_BOTTOM, pos[2]+18)
>     s = allocate_string(string)  -- could reserve large space instead
>     c_proc(SetTextColor, {hdc, color_map[1+fcolor]})
>     
>     c_proc(SetBkColor, {hdc, color_map[1+bcolor]})
>     
>     c_proc(SetBkMode, {hdc, OPAQUE})
>     
>     c_proc(DrawText, {hdc, allocate_string(string), -1, charRect,
>     DT_SINGLE_LINE})
>     free(s)
> end procedure
> </eucode>
{{{


Thanks for spotting that.
I must have intended to use s, but forgot.
Here's my new code:

global procedure putsxy(sequence pos, sequence string,
                        integer fcolor, integer bcolor)
    atom s

    poke4(charRect, pos[1])
    poke4(charRect+CHAR_TOP, pos[2])
    poke4(charRect+CHAR_RIGHT, pos[1]+length(string)*8)
    poke4(charRect+CHAR_BOTTOM, pos[2]+18)

    c_proc(SetTextColor, {hdc, color_map[1+fcolor]})
    c_proc(SetBkColor, {hdc, color_map[1+bcolor]})
    c_proc(SetBkMode, {hdc, OPAQUE})

    s = allocate_string(string)
    c_proc(DrawText, {hdc, s, -1, charRect, DT_SINGLE_LINE})
    free(s)
end procedure


I recompiled and uploaded the new version.

I don't think allocating a fixed, large space for the string
will have any significant effect on speed. On my machine,
lw, even when interpreted, only uses about 1% of the available CPU.
It was using almost 100%, until I inserted a 1 ms sleep
inside the only time-share task, task_video_save(), when the program 
finds that it has no video data to write out, and no real-time
tasks ready to run at the moment.

Thanks,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu