1. Re: command()
- Posted by Hawke <mdeland at NWINFO.NET>
Sep 19, 1998
-
Last edited Sep 20, 1998
Matt Z Nunyabidness wrote:
>the first two arguments are always filled with SOMETHING.
>Suppose this is what command() looks like:
> {"ex", "myprog.ex"}
>And you try to read from the third argument where the stuff you supply on
>the command line starts, but nothing is there. You get an error...
---begin slideshw.ex (tested code, don't forget to run trusetup.ex
first)
include truecolr.e
sequence CmdLine,pictures
integer len
procedure sleep(atom seconds)
atom stop
stop = time() + seconds
while time() < stop do --SomeSnoring(TakeANap & GoNiteyNite)
end while
end procedure
--MAIN
CmdLine = command_line()
len = length(CmdLine)
if len > 2 then
CmdLine = CmdLine[3..len]
else CmdLine = {}
end if
--now you can parse CmdLine for your "options" to your hearts
content...
--lets say its a set of filenames... pics to load mebbe?
len = length(CmdLine)
if len > 0 then
pictures = repeat(0,len)
for i=1 to len do
pictures[i] = read_targa(CmdLine[i]) --or whatever...
end for
else puts(1,"Usage: parser <filename1> <filename2> ... <filenameN>
\n")
abort(1)
end if
--slideshow anyone???
InitDisplay()
for i=1 to len do
set_virtual_screen({0,0},{},pictures[i]) --or whatever
sleep(5)
end for
if graphics_mode(-1) then end if
---------end slideshw.ex
>Btw, i'm a former BASIC programmer that's fed up with the way
>Euphoria sometimes just won't do what i tell it to.
ummmmmmmmm.....
no computer language in existence does anything else except
for what you tell it... that's all they do...
it's what you tell it to do that counts... :)
*shrug*