1. [dos] trouble with image.e

Am I overlooking something really obvious or is my computer
somehow different?

I was working on a little program and wanted to change a letter without
changing the screen colors. This trivial program snatch shows the
problem. This code always gives me the error "slice ends past end".
In this example it would be easy to manually reset the colors, but in
my program there are too many colors to keep track of. I should be
able to just get the colors off the screen.

include graphics.e
include image.e
global sequence s s={0,0}
if graphics_mode(3) then abort(1) end if
--put a letter using text and background colors
position(10,10) text_color(12) bk_color(2)  puts(1,'A')
--now put another letter but without changing the existing colors
s=get_screen_char(10,10)
s[1]='B'       --s[2] should still have the colors
put_screen_char(10,10,s)
--why does slice end past end of sequence?

new topic     » topic index » view message » categorize

2. Re: [dos] trouble with image.e

Try this:

s = get_screen_char(10,10)
s[1]='B'       --s[2] should still have the colors
put_screen_char(10,10, {s})

Note the use of {s} instead of s. I don't know if this works, but this is
how Rob does it in Library.doc.

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

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

3. Re: [dos] trouble with image.e

Your example appeared correct, so I tested it on my computer.  It worked
fine.  Rob's example for get_screen_char() in Library.doc (which uses {s})
appears incorrect.

- Colin Taylor


----- Original Message -----
From: John McAdam <johnmcadam at CLIX.PT>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Friday, January 19, 2001 6:42 AM
Subject: [dos] trouble with image.e


> Am I overlooking something really obvious or is my computer
> somehow different?
>
> I was working on a little program and wanted to change a letter without
> changing the screen colors. This trivial program snatch shows the
> problem. This code always gives me the error "slice ends past end".
> In this example it would be easy to manually reset the colors, but in
> my program there are too many colors to keep track of. I should be
> able to just get the colors off the screen.
>
> include graphics.e
> include image.e
> global sequence s s={0,0}
> if graphics_mode(3) then abort(1) end if
> --put a letter using text and background colors
> position(10,10) text_color(12) bk_color(2)  puts(1,'A')
> --now put another letter but without changing the existing colors
> s=get_screen_char(10,10)
> s[1]='B'       --s[2] should still have the colors
> put_screen_char(10,10,s)
> --why does slice end past end of sequence?
>

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

4. Re: [dos] trouble with image.e

john

it didn't work fine on mine. i'm wondering whether there are different
versions of image.e floating around.

in my image.e, lines 335-337 read:-

>>
overflow = length(char_attr) - 2 * (vc[VC_COLUMNS] - column + 1)
     if overflow then
  poke(scr_addr, char_attr[1..length(char_attr) - overflow])
     else
<<

as i read it, the 'if' line overlooks that when overflow is negative, it
will test true. in that case, the poke line will always be beyond bounds.

on my version, 'if overflow > 0 then' works, and i think that's what was
intended.

also, i presume that your second put was suppose to be in a different place
from the first.

cheers tacitus

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

5. Re: [dos] trouble with image.e

Colin Taylor writes:
> Your example appeared correct, so I tested it
> on my computer.  It worked fine.  Rob's example for
> get_screen_char() in Library.doc (which uses {s})
> appears incorrect.

Thanks. I'll fix the documentation.

Tacitus writes:
> overflow = length(char_attr) - 2 * (vc[VC_COLUMNS] - column + 1)
>     if overflow then
>  poke(scr_addr, char_attr[1..length(char_attr) - overflow])
>     else

> as i read it, the 'if' line overlooks that when overflow
> is negative, it will test true. in that case, the poke line
> will always be beyond bounds.

> on my version, 'if overflow > 0 then' works, and
> i think that's what was intended.

You are correct.
This bug was reported several months ago.
put_screen_char() in image.e should be modified
to have:
          if overflow > 0 then ...   -- correct
rather than:
          if overflow then ... -- wrong

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

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

6. Re: [dos] trouble with image.e

My image.e lines 335-338 read:

<snip>
     overflow = length(char_attr) - 2 * (vc[VC_COLUMNS] - column + 1)
     if overflow > 0 then
            poke(scr_addr, char_attr[1..length(char_attr) - overflow])
     else
</snip>

This is different from yours.  There must be 2 versions of image.e in
circulation, or maybe you have image.e from an earlier version of Euphoria.

Anyone who has this problem with put_screen_char(row, col, s) could use
display_text_image({row, col}, {s}) as a work-around.

- Colin Taylor

----- Original Message -----
From: tacitus <indor at PRIMUS.COM.AU>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Friday, January 19, 2001 9:00 AM
Subject: Re: [dos] trouble with image.e


>
> in my image.e, lines 335-337 read:-
>
> >>
> overflow = length(char_attr) - 2 * (vc[VC_COLUMNS] - column + 1)
>      if overflow then
>   poke(scr_addr, char_attr[1..length(char_attr) - overflow])
>      else
> <<
>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu