swarm-support
[Top][All Lists]
Advanced

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

initSwarm() and command line arguments


From: Theodore C. Belding
Subject: initSwarm() and command line arguments
Date: Tue, 17 Sep 1996 06:32:43 -0400

Hi-
Are there any plans for what command-line arguments initSwarm will use, if
any?

Rick and I are working on a set of tools for doing batch runs of Swarm
programs.  To do this, we give the program several command-line arguments
(for instance: random seed, output file path, etc.).  So our main()
function pulls off these arguments  and then calls initSwarm(), which also
expects to be passed the command line arguments in argc and argv.
Currently, I just set argc = 0 before calling initSwarm(), which is
obviously an ugly hack.  It would be nice to have some sort of convention
about which command line arguments will be passed to initSwarm(), and which
ones will be interpreted within main() and not passed on.

Would something like this be a good convention?

<swarmprogram> <arg1> <arg2> ... <argn> -- <argn+1> ... <argm>

Everything before "--" would be interpreted within main().  main() would
then be responsible for resetting argv and argc so that initSwarm gets all
of the arguments after the "--".  If there is no "--" in the command line,
all arguments get pulled interpreted in main().  I think this is similar to
the conventions followed by the Unix getopt() function, and by makedepend.
So, in the above example, <arg1> through <argn> would be interpreted by
main(), and initSwarm() would get <argn+1> through <argm>.

Or should initSwarm get passed everything and just be expected to ignore
options it doesn't understand?

Or should main() pull off any command-line arguments it understands, and
pass the rest to initSwarm()?

Or should there be a fixed list of command-line arguments that initSwarm()
takes?

Comments?

This is the only documentation I've found for initSwarm(), in the SimTools
docs:
void initSwarm(int argc, char ** argv)
        initialize the Swarm libraries to be ready to be used.
        This should be the first line of code
        you call in any Swarm application. argc and argv are
        the input parameters to main().

-Ted

--
Ted Belding                        <mailto:address@hidden>
University of Michigan Program for the Study of Complex Systems
<http://www-personal.engin.umich.edu/~streak/>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]