1. Euphoria CGI, SVGA, and Pixel perfect collision dectection
- Posted by Pete Eberlein <xseal at HARBORSIDE.COM>
Jun 01, 1998
-
Last edited Jun 02, 1998
Buddy Hyllberg writes:
> 1. is there a way to redirect STDIN & STDOUT globally?
I'm not sure what you mean by globally, but the files STDIN and STDOUT
relate to the predefined Euphoria file numbers 0 and 1, respectively.
Irv's cgi files use temporary input and output files declared by the HTTP
program ( the filenames are passed via environment variables). I've got
some CGI programs around here somewhere... one took a euphoria program off
my hard drive, applied syntax coloring in html and returned it to the
browser.
-----------------------
Charn writes regarding svga.e:
> ...and there are other things so I don't think i missed anything obvious
> When I run it I get an error that says bytes_per_line has no value in
> Pete's svga.e I'm inclined to think that my program is at fault. Anyway, this
> is part
> of ex.err:
bytes_per_line gets its value when you call svga_mode with the vesa mode
number to set. Make sure to use svga_mode and not graphics_mode...
I looked again at the your code, and you are peeking data from memory
into a sequence... which my redefined pixel then pokes back into video
memory. It would be much faster to use a mem_copy instead.
Michael Bolin has added SVGA block move routines to his ememcopy.e
package. His routines look exactly like what you are trying to do.
---------------------
And to Michael Bolin regarding pixel perfect collision testing:
I say go for it! If you need any assistance, I would be glad to help. I
already have an idea for how to code it, but not much time...
Later,
_______ ______ _______ ______
[ _ \[ _ ][ _ _ ][ _ ]
[/| [_] |[/| [_\][/ | | \][/| [_\]
| ___/ | _] | | | _]
[\| [/] [\| [_/] [\| |/] [\| [_/]
[_____] [______] [_____] [______]
xseal at harborside.com
2. Re: Euphoria CGI, SVGA, and Pixel perfect collision dectection
At 10:46 PM 6/1/98 -0700, you wrote:
>Buddy Hyllberg writes:
>> 1. is there a way to redirect STDIN & STDOUT globally?
>
>I'm not sure what you mean by globally, but the files STDIN and STDOUT
>relate to the predefined Euphoria file numbers 0 and 1, respectively.
>Irv's cgi files use temporary input and output files declared by the HTTP
>program ( the filenames are passed via environment variables). I've got
>some CGI programs around here somewhere... one took a euphoria program off
>my hard drive, applied syntax coloring in html and returned it to the
>browser.
You can copy any of my CGI test programs, and change the
puts(fn.... to puts(1.... which is STDOUT. See if it works.
Note: you cannot just puts(1,"HELLO WORLD") and expect the
server to return it to the browser. There absolutely MUST
be a proper content header on the file: either text or html.
Here's a test file that implements a counter:
-- Euphoria CGI Webcounter Program
include file.e
include get.e
object outfile, fn, ok, count
count = 0 -- get and update visitor count
fn = open("C:\\httpd\\cgi-dos\\WEBCOUNT.DAT","u")
if fn > 0 then
count = get(fn)
count = count[2]
ok = seek(fn,0)
printf(fn,"%d",count+1) -- increment the count
close(fn)
end if
outfile = getenv("OUTPUT_FILE") -- open file and write header
fn = open(outfile,"w") -- you could try changing
if fn > 0 then -- fn to 1 and see if it will work
puts(1,"Writing to file:"&outfile&"\n") -- debug message
puts(fn,"Content-type: text/html\n") -- these two lines are
puts(fn,"\n") -- required!
-- note: the content-type line must
-- be there and have a blank line after
-- or you'll get a server error.
else puts(1,"Error opening "&outfile)
abort(0)
end if
-- create the html code:
puts(fn,"<HTML><HEAD><TITLE>")
puts(fn,"Euphoria Web Server")
puts(fn,"</TITLE></HEAD>\n")
-- create the body code:
puts(fn,"<BODY>")
puts(fn,"<H2>Euphoria HTML CGI Webcount</H2>")
puts(fn,"<hr>")
printf(fn,"You are visitor #%d",count)
puts(fn,"<hr>")
puts(fn,"<a href=mailto:irv at ellijay.com>irv at ellijay.com</a>")
close(fn)
Regards,
Irv