Ummm.. since I have time today, I'm just wondering how you folks thing that a 
commmand interpreter should work.

I have an idea that I'd like everyone to pick apart and tell me EVERY flaw 
with it, please.
All command functions have the prototype:
void funp(CH_DATA *ch, char ** input);
Ok.. you have a interp(CH_DATA * ch, char * input)...
your command interpreter reads what the command EXPECTS...
It expects no arguments.
funp(ch, 0); //0 is null, remember.
it expects one argument... (such as "shout")
Your interpreter parses it out more so that...
char ** cmd = *input
while (*input != ' ' && *input != 0)
 ++input;
*(cmd+1)=input;
funp(ch, cmd);
it expects two arguments (such as "tell")
char ** cmd=*input
while (*input != ' ' && *input != 0)
 ++input;
*(cmd+1)=input;
while (*input != ' ' && *input != 0)
 ++input;
*(cmd+2)=input;
funp(ch, cmd);
infinite number of arguments... (such as a spell cast on these six people...)
up above, but longer....
*(cmd+num)=0; // null terminated
funp(ch, cmd);
....

If this doesn't make sense, I'll post some actual code... (I'm presently 
working on this idea of a command interpreter...)

I don't know if it'll be useful... and I'm positive that nobody wants to 
actually rewrite ROM's command interpreter... (ick!) :)

But still. :)

Mark

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Reply via email to