1. my bitmap problem again
It's me again. I have cut down all the non relevant code to the part
that gives me a problem.
Here is the code, which should be copied into a subdirectory. The code
(on my machine) runs
once ok, but with an erroneous error message at the return to the
editor; or sometimes after
the second run. Please see if this happens to you, or is peculiar to my
machine. You can use
any small 256 color bitmap file that you may have and it will do the
same thing. The code
looks fine to me, so I think the error is in the interpreter. The
included files are standard,
so no need to send them. Could be in the editor? I'm using The CyrekSoft
EE Editor v2.2:CS1.
JOHN
------------------------------------------------------------------------
-------------
include graphics.e
include image.e
include get.e
include file.e
object key --usually user key stroke, sometimes junk
procedure intro_window()
sequence ss
if graphics_mode(259) then end if
ss=read_bitmap("a.bmp")
printf(1,"size of ss %d ",length(ss))
key=wait_key()
all_palette(ss[1]/4)
display_image({0,0},ss[2])
key=wait_key()
key=chdir("..") --something very strange happens here
end procedure
intro_window()
------------------------------------------------------------------------
-------------
2. Re: my bitmap problem again
John McAdam wrote:
> It's me again. I have cut down all the non relevant code to the part
> that gives me a problem.
> Here is the code, which should be copied into a subdirectory. The code
> (on my machine) runs once ok, but with an erroneous error message at
> the return to the editor; or sometimes after the second run. Please see
> if this happens to you, or is peculiar to my machine. You can use any
> small 256 color bitmap file that you may have and it will do the same
> thing. The code looks fine to me, so I think the error is in the
> interpreter.
I think it could help, when you tell what operating system and what
Euphoria version you are using.
On my system, under Win 98, using the ex.exe interpreter version 2.4,
your code works fine.
> The included files are standard, so no need to send them. Could be in
> the editor? I'm using The CyrekSoft EE Editor v2.2:CS1.
Are there any errors, when you run the code from the command-line,
whithout involving the editor?
> JOHN
[code snipped]
Regards,
Juergen
--
/"\ ASCII ribbon campain | This message has been ROT-13 encrypted
\ / against HTML in | twice for higher security.
X e-mail and news, |
/ \ and unneeded MIME | http://home.arcor.de/luethje/prog/
3. Re: my bitmap problem again
John McAdam wrote:
> It's me again. I have cut down all the non relevant code to the part
> that gives me a problem.
> Here is the code, which should be copied into a subdirectory. The code
> (on my machine) runs
> once ok, but with an erroneous error message at the return to the
> editor; or sometimes after
> the second run. Please see if this happens to you, or is peculiar to my
> machine. You can use
> any small 256 color bitmap file that you may have and it will do the
> same thing. The code
> looks fine to me, so I think the error is in the interpreter. The
> included files are standard,
> so no need to send them. Could be in the editor? I'm using The CyrekSoft
> EE Editor v2.2:CS1.
> JOHN
> ------------------------------------------------------------------------
> -------------
> include graphics.e
> include image.e
> include get.e
> include file.e
>
> object key --usually user key stroke, sometimes junk
>
> procedure intro_window()
> sequence ss
> if graphics_mode(259) then end if
> ss=read_bitmap("a.bmp")
> printf(1,"size of ss %d ",length(ss))
> key=wait_key()
> all_palette(ss[1]/4)
> display_image({0,0},ss[2])
> key=wait_key()
> key=chdir("..") --something very strange happens here
> end procedure
>
> intro_window()
I don't know exactly what's wrong, but a few things worry me:
1. You declare ss as a sequence, but if read_bitmap() fails
it will return an atom, such as 1 (open failed). That
will give you a type_check error.
2. If this type_check error occurs, you will be in SVGA mode
259, so I'm not sure if you'll see the error on your screen.
3. You have a chdir() call in your program, so after running
once, I'm not sure that a.bmp will still be in the
current directory. I'm also not sure where ex.err
will be written.
4. SVGA modes are not well supported in DOS. I can imagine
that there might be trouble if you switch into SVGA
from a DOS editor system() call.
Regards,
Rob Craig
Rapid Deployment Software
http://www.RapidEuphoria.com
4. Re: my bitmap problem again
On Sun, 16 May 2004 20:55:15 +0100, John McAdam <johnmcadam at clix.pt>
wrote:
>Shouldn't euphoria reset the subdirectory information after the program
>runs?
No! You might want a program to have that effect.
>I don't want to hard-code the directory info, because the end-user could
>put my program anywhere she wants.
Understood, but your program should terminate leaving current_dir()
what it was when it started (unless you want it otherwise).
I don't know anything about that editor you are using, but if you use
a desktop icon or start menu entry you can set a working/start in
directory for the program to be run, if that helps. (Ignore that if
you are indeed working in a pure DOS environment, of course).
Alternatively, you may be able to set the current directory off
information from command_line(), though I'm a little rusty on that.
Regards,
Pete
5. Re: my bitmap problem again
Pete Lomax wrote:
<snip>
>Alternatively, you may be able to set the current directory off
>information from command_line(), though I'm a little rusty on that.
>
>
This one is easy, and doesn't even require you to change your current
directory. (Which I hate to the biggest degree)
--- Globalize this if you put it in a include
function progDir(sequence ext)
sequence t
t = command_line()
t = reverse(t[2])
return reverse(t[find('\\',t)..length(t)]) & ext
end function
constant whereIsABitmap = progDir("..\\aBitmap.bmp") -- Note that this
will still work! :P
--
Enchanted Blade (Mario)
Brain: Come Pinky, let's return to the cage, to plan for tommorrow night.
Pinky: Why Brain, what are we gonna do tommorrow night?
Brain: Same thing we do every night Pinky, try to take over the world!