[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

real-time nam animation



Hi,

I've been looking through the newest nam version (the 'snapshot') to try
to understand how to invoke a nam animation which will play **while** a
ns2 simulation runs. (The new version has streams, which allow nam to read
from stdin.  See nam_stream.cc for the code I've been looking at.)
>From the code I've looked at, it appears to me that the correct way to
start nam reading from stdin is as following:

exec nam - | $ns namtrace-all stdout


This doesn't work.  Anybody know what does?  I looked in the 'ex'
directory for an example, but didn't find any.

I expect this to work, if I can find the correct function calls.
This version of nam creates a .nam file which plays a correct animation
for the code, if I put the 'exec nam ' line in the 'finish' function,
which executes after the simulation has ended.  

Thanks for any pointers,
Lori


--------------------------------------------------------------------------
Following is part of a function from file nam_stream.cc, which indicates
that the filename expected is "-.nam" 

NamStream *
NamStream::open(const char *fn)
{
        if (strcmp(fn, "-") == 0 || strcmp(fn, "-.nam") == 0) {  // XXX
#if 1
                return new NamStreamPipe(fn);
#else
                fprintf(stderr, "nam does not currently support reading
from stdin.\n");
                return NULL;
#endif
        };