1. comparison stacks

<sigh>
Ok, in the irc client, to handle the numerics from the server, the stack will 
start with one "if", end with an "end if", and have *600* "elsif" in between. 
Isn't that a little incredible? 

Robert, with a "execute var" and a "goto", i could extract the numeric value, 
then goto it. With smart code in the interpreter, or other error recovery, if
that
numeric isn't provided for, it simply returns"". 

Also, the inability to make variable names using data is going to be a 
smallish problem, when the irc client connects to two or more irc nets, has 
an http open, and tries to send an email or three to pops at two different isps 
at the same time. 
Recalling %connection. [ $+ [ %ircnet1 ] $+ . $+ [ %channel ] $+ . $+ [ 
%oplist ] ] 
is easier than looping thru all the possible variables untill the right tags are
found, then reading that data and exiting the loop. Faster too.

Kat

new topic     » topic index » view message » categorize

2. Re: comparison stacks

> <sigh>
> Ok, in the irc client, to handle the numerics from the server, the stack will 
> start with one "if", end with an "end if", and have *600* "elsif" in between. 
> Isn't that a little incredible? 

> Robert, with a "execute var" and a "goto", i could extract the numeric value, 
> then goto it. With smart code in the interpreter, or other error recovery, if
> that
> numeric isn't provided for, it simply returns"". 

> Also, the inability to make variable names using data is going to be a 
> smallish problem, when the irc client connects to two or more irc nets, has 
> an http open, and tries to send an email or three to pops at two different
> isps
> at the same time. 
> Recalling %connection. [ $+ [ %ircnet1 ] $+ . $+ [ %channel ] $+ . $+ [ 
> %oplist ] ] 
> is easier than looping thru all the possible variables untill the right tags
> are
> found, then reading that data and exiting the loop. Faster too.

> Kat

Maybe a whole bunch of elsifs isn't the way to go, how's about having a
sequence of {commmand,routine_id} pairs then looping through to find
the correct routine_id? That's how Hawke's EUServer does it afair....

Thomas Parslow (PatRat) ICQ #:26359483
Rat Software
http://www.rat-software.com/
Please leave quoted text in place when replying

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

3. Re: comparison stacks

----- Original Message -----
From: Kat >

> <sigh>
> Ok, in the irc client, to handle the numerics from the server, the stack
will
> start with one "if", end with an "end if", and have *600* "elsif" in
between.
> Isn't that a little incredible?
>
I can think of several different ways to do this without the 600 elsifs...
1. Create a text file for each different server, containing lines like:
    10,doSomething
    145,SomethingElse
    412,Stuff
    593,MoreStuff

Read in the file line by line, parse on the comma, and store as two arrays,
{10,145,412,593....}
{"doSomething","SomethingElse","Stuff","MoreStuff",...}
then, when you get the numeric, do a find on array 1, and call
routine_id(array2)

This is good because it will be easy to write new tables (files) for
different servers.

2 Create an include file containing:
object v
   v = repeat(Null,600) -- Null should point to a 'do nothing' routine
.  v[10] = "doSomething"
   v[145] = "SomethingElse"
   v[412] = "Stuff"
...
then call routine_id(v[numeric])
This is a little more work to write the files for different servers, and
won't let you
change servers during a run.

3. Look at Jiri's associative arrays.
4. Create a Euphoria database, each table being a server, and each record
within
that table keyed to the numeric code. That record data can contain a routine
name,
plus any parameters that might need to be provided.

Probably the best in the longrun is #4.

Regards,
Irv

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

Search



Quick Links

User menu

Not signed in.

Misc Menu