[ns] Scripts and command function

Julien Cartigny Julien.Cartigny@lifl.fr
Mon Apr 22 08:30:04 2002


Hello,

My question is : "how to use tcl command when i use script launched with
command line ???"

I want to have more tcl commands in my Agent. I have added in my command
function:

int FuzzyAgent::command(int argc, const char*const* argv)
{

[...]

  if (argc == 2) {

    if (strcmp (argv[1], "fuzzy-go") == 0) {
      cout << "HIT!" << endl;
      return (TCL_OK);
    }
   
   }

[...]

}

If I call fuzzy-go into ns-lib.tcl or ns-agent.tcl, the TCL fuzzy-go
command is understand (the C++ command function into my agent is called).

But if I call the TCL fuzzy-go from a script launch with command line:
"ns fuzzy.tcl" with "$node_(16) fuzzy-go", ns stops with the error message:

    (_o303 cmd line 1)
    invoked from within
"_o303 cmd fuzzy-go"
    invoked from within
"catch "$self cmd $args" ret"
    (procedure "_o303" line 2)
    (SplitObject unknown line 2)
    invoked from within
"$node_(16) fuzzy-go"
    (file "fuzzy.tcl" line 117)

(because the C++ command function in my agent is never called !!!!)

-- 
CARTIGNY Julien 
These d'informatique dans l'equipe RD2P  a l'universite de Lille 1 
(Phd student of Computer Science at the University of Lille 1 / France)