⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 swarm.defobj.arguments.protocol.html

📁 set for Swarm2.1是圣菲研究院的开发人员对Swarm的特性及其使用描述的最为完备的指南性文档。从这里可以获得最细致的平台说明。
💻 HTML
字号:
<HTML><HEAD><TITLE>Arguments</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.53"><LINKREL="HOME"TITLE="Documentation Set for Swarm 2.1.1"HREF="set.html"><LINKREL="UP"TITLE="Defobj Library"HREF="swarm.defobj.sgml.reference.html"><LINKREL="PREVIOUS"TITLE="Archiver"HREF="swarm.defobj.archiver.protocol.html"><LINKREL="NEXT"TITLE="BehaviorPhase"HREF="swarm.defobj.behaviorphase.protocol.html"></HEAD><BODYCLASS="REFENTRY"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLEWIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">Documentation Set for Swarm 2.1.1</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="swarm.defobj.archiver.protocol.html">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom">Reference I. Defobj Library</TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="swarm.defobj.behaviorphase.protocol.html">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><H1><ANAME="SWARM.DEFOBJ.ARGUMENTS.PROTOCOL">Arguments</A></H1><DIVCLASS="REFNAMEDIV"><ANAME="AEN2462"></A><H2>Name</H2>Arguments&nbsp;--&nbsp; A class that provides customizable command line argument parsing support</DIV><DIVCLASS="REFSECT1"><ANAME="AEN2465"></A><H2>Description</H2><P> A class that provides customizable command line argument parsing support</P></DIV><DIVCLASS="REFSECT1"><ANAME="AEN2468"></A><H2>Protocols adopted by Arguments</H2><P> <AHREF="swarm.defobj.create.protocol.html">Create</A> <AHREF="swarm.defobj.drop.protocol.html">Drop</A> <AHREF="swarm.defobj.creatable.protocol.html">CREATABLE</A></P></DIV><DIVCLASS="REFSECT1"><ANAME="AEN2474"></A><H2>Methods</H2><DIVCLASS="REFSECT2"><ANAME="AEN2476"></A><H3>Phase: Creating</H3><P></P><UL><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.DEFOBJ.ARGUMENTS.METHOD.PC.M51"></A><P></P>+ <BCLASS="FUNCPROTOTYPE">createBegin:</B> (id &lt;Zone&gt;)<VARCLASS="PDPARAM">aZone</VAR> <BR><P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.DEFOBJ.ARGUMENTS.METHOD.PC.M228"></A><P></P>- <BCLASS="FUNCPROTOTYPE">createEnd</B><BR><P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.DEFOBJ.ARGUMENTS.METHOD.PC.M673"></A><P></P>- <BCLASS="FUNCPROTOTYPE">setArgc:</B> (int)<VARCLASS="PDPARAM">theArgc</VAR> <BCLASS="FUNCPROTOTYPE">Argv:</B> (const char **)<VARCLASS="PDPARAM">theArgv</VAR> <BR><P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.DEFOBJ.ARGUMENTS.METHOD.PC.M667"></A><P></P>- <BCLASS="FUNCPROTOTYPE">setAppName:</B> (const char *)<VARCLASS="PDPARAM">appName</VAR> <BR><P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.DEFOBJ.ARGUMENTS.METHOD.PC.M666"></A><P></P>- <BCLASS="FUNCPROTOTYPE">setAppModeString:</B> (const char *)<VARCLASS="PDPARAM">appModeString</VAR> <BR><P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.DEFOBJ.ARGUMENTS.METHOD.PC.M816"></A><P></P>- <BCLASS="FUNCPROTOTYPE">setOptionFunc:</B> (int (*) (int, const char *))<VARCLASS="PDPARAM">optionFunc</VAR> <BR><P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.DEFOBJ.ARGUMENTS.METHOD.PC.M691"></A><P></P>- <BCLASS="FUNCPROTOTYPE">setBugAddress:</B> (const char *)<VARCLASS="PDPARAM">bugAddress</VAR> <BR><P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.DEFOBJ.ARGUMENTS.METHOD.PC.M893"></A><P></P>- <BCLASS="FUNCPROTOTYPE">setVersion:</B> (const char *)<VARCLASS="PDPARAM">version</VAR> <BR><P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.DEFOBJ.ARGUMENTS.METHOD.PC.M99"></A><P></P>- <BCLASS="FUNCPROTOTYPE">addOptions:</B> (struct argp_option *)<VARCLASS="PDPARAM">options</VAR> <BR><P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.DEFOBJ.ARGUMENTS.METHOD.PC.M50"></A><P></P>+ <BCLASS="FUNCPROTOTYPE">createArgc:</B> (int)<VARCLASS="PDPARAM">argc</VAR> <BCLASS="FUNCPROTOTYPE">Argv:</B> (const char **)<VARCLASS="PDPARAM">argv</VAR> <BCLASS="FUNCPROTOTYPE">appName:</B> (const char *)<VARCLASS="PDPARAM">appName</VAR> <BCLASS="FUNCPROTOTYPE">version:</B> (const char *)<VARCLASS="PDPARAM">version</VAR> <BCLASS="FUNCPROTOTYPE">bugAddress:</B> (const char *)<VARCLASS="PDPARAM">bugAddress</VAR> <BCLASS="FUNCPROTOTYPE">options:</B> (struct argp_option *)<VARCLASS="PDPARAM">options</VAR> <BCLASS="FUNCPROTOTYPE">optionFunc:</B> (int (*) (int, const char *))<VARCLASS="PDPARAM">optionFunc</VAR> <BCLASS="FUNCPROTOTYPE">inhibitExecutableSearchFlag:</B> (BOOL)<VARCLASS="PDPARAM">inhibitExecutableSearchFlag</VAR> <BR><P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.DEFOBJ.ARGUMENTS.METHOD.PC.M598"></A><P></P>- (int)<BCLASS="FUNCPROTOTYPE">parseKey:</B> (int)<VARCLASS="PDPARAM">key</VAR> <BCLASS="FUNCPROTOTYPE">arg:</B> (const char *)<VARCLASS="PDPARAM">arg</VAR> <BR> Takes an option specification that includes the following information:<BR> - The name of the option specification<BR> - The key of the option.  This an integer that, if printiable, is   the single-character use of the option.  For example, `-p'    vs. `--protocol' are the different versions of the same thing.   One is intended to be mnemonic, the other convenient.<BR> - If non-NULL, an argument label that says that the option   requires an argument (in this case, the protocol name).<BR> - Flags that change the visibility and parsing of the option <BR> - Documentation for the option<BR> - A sorting integer; relative placement of the option in the help   screen.<BR> This method is called for each option that occurs.<P></P></DIV></LI></UL></DIV><DIVCLASS="REFSECT2"><ANAME="AEN2595"></A><H3>Phase: Setting</H3><P></P><UL><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.DEFOBJ.ARGUMENTS.METHOD.PS.M773"></A><P></P>- <BCLASS="FUNCPROTOTYPE">setInhibitArchiverLoadFlag:</B> (BOOL)<VARCLASS="PDPARAM">inhibitArchiverLoadFlag</VAR> <BR><P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.DEFOBJ.ARGUMENTS.METHOD.PS.M774"></A><P></P>- <BCLASS="FUNCPROTOTYPE">setInhibitExecutableSearch:</B> (BOOL)<VARCLASS="PDPARAM">theInhibitExecutableSearchFlag</VAR> <BR><P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.DEFOBJ.ARGUMENTS.METHOD.PS.M684"></A><P></P>- <BCLASS="FUNCPROTOTYPE">setBatchModeFlag:</B> (BOOL)<VARCLASS="PDPARAM">batchModeFlag</VAR> <BR><P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.DEFOBJ.ARGUMENTS.METHOD.PS.M892"></A><P></P>- <BCLASS="FUNCPROTOTYPE">setVarySeedFlag:</B> (BOOL)<VARCLASS="PDPARAM">varySeedFlag</VAR> <BR><P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.DEFOBJ.ARGUMENTS.METHOD.PS.M727"></A><P></P>- <BCLASS="FUNCPROTOTYPE">setDefaultAppConfigPath:</B> (const char *)<VARCLASS="PDPARAM">path</VAR> <BR> Specify a default path to use for configuration files when installed location of Swarm cannot be determined.  Defaults to current directory.<P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.DEFOBJ.ARGUMENTS.METHOD.PS.M728"></A><P></P>- <BCLASS="FUNCPROTOTYPE">setDefaultAppDataPath:</B> (const char *)<VARCLASS="PDPARAM">path</VAR> <BR> Specify a default path to use for data files when installed location of Swarm cannot be determined.  Defaults to current directory.<P></P></DIV></LI></UL></DIV><DIVCLASS="REFSECT2"><ANAME="AEN2652"></A><H3>Phase: Using</H3><P></P><UL><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.DEFOBJ.ARGUMENTS.METHOD.PU.M320"></A><P></P>- (BOOL)<BCLASS="FUNCPROTOTYPE">getBatchModeFlag</B><BR><P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.DEFOBJ.ARGUMENTS.METHOD.PU.M525"></A><P></P>- (BOOL)<BCLASS="FUNCPROTOTYPE">getVarySeedFlag</B><BR><P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.DEFOBJ.ARGUMENTS.METHOD.PU.M305"></A><P></P>- (const char *)<BCLASS="FUNCPROTOTYPE">getAppName</B><BR><P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.DEFOBJ.ARGUMENTS.METHOD.PU.M304"></A><P></P>- (const char *)<BCLASS="FUNCPROTOTYPE">getAppModeString</B><BR><P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.DEFOBJ.ARGUMENTS.METHOD.PU.M312"></A><P></P>- (int)<BCLASS="FUNCPROTOTYPE">getArgc</B><BR><P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.DEFOBJ.ARGUMENTS.METHOD.PU.M314"></A><P></P>- (const char **)<BCLASS="FUNCPROTOTYPE">getArgv</B><BR><P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.DEFOBJ.ARGUMENTS.METHOD.PU.M379"></A><P></P>- (const char *)<BCLASS="FUNCPROTOTYPE">getExecutablePath</B><BR><P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.DEFOBJ.ARGUMENTS.METHOD.PU.M500"></A><P></P>- (const char *)<BCLASS="FUNCPROTOTYPE">getSwarmHome</B><BR><P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.DEFOBJ.ARGUMENTS.METHOD.PU.M344"></A><P></P>- (const char *)<BCLASS="FUNCPROTOTYPE">getConfigPath</B><BR><P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.DEFOBJ.ARGUMENTS.METHOD.PU.M356"></A><P></P>- (const char *)<BCLASS="FUNCPROTOTYPE">getDataPath</B><BR><P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.DEFOBJ.ARGUMENTS.METHOD.PU.M303"></A><P></P>- (const char *)<BCLASS="FUNCPROTOTYPE">getAppDataPath</B><BR> A path where application-specific data files can be expected to be found.<P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.DEFOBJ.ARGUMENTS.METHOD.PU.M302"></A><P></P>- (const char *)<BCLASS="FUNCPROTOTYPE">getAppConfigPath</B><BR> A path where application-specific configuration files can be expected to be found.<P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.DEFOBJ.ARGUMENTS.METHOD.PU.M486"></A><P></P>- (BOOL)<BCLASS="FUNCPROTOTYPE">getShowCurrentTimeFlag</B><BR><P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.DEFOBJ.ARGUMENTS.METHOD.PU.M395"></A><P></P>- (BOOL)<BCLASS="FUNCPROTOTYPE">getInhibitArchiverLoadFlag</B><BR><P></P></DIV></LI></UL></DIV></DIV><DIVCLASS="REFSECT1"><ANAME="AEN2767"></A><H2>Examples</H2><DIVCLASS="EXAMPLE"><ANAME="SWARM.DEFOBJ.ARGUMENTS.GENERIC.2.EXAMPLE"></A><P><B>Example defobj/Arguments/1. </B></P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING"> Let's say you want to add a new argument, say `protocol' to your standard  list of command.  In other words you want the following to happen at the command line when you type --help. ------------------------ mgd@wijiji[/opt/src/mgd/src/mySwarmApp] $ ./mySwarmApp --help Usage: mySwarmApp [OPTION...]    -s, --varyseed             Run with a random seed   -b, --batch                Run in batch mode   -m, --mode=MODE            Specify mode of use (for archiving)   -p, --protocol=PROTOCOL    Set protocol   -?, --help                 Give this help list       --usage                Give a short usage message   -V, --version              Print program version  Mandatory or optional arguments to long options are also mandatory or  optional for any corresponding short options.  Report bugs to bug-swarm@swarm.org.  -----------------------  To implement this you need to make your own subclass of Arguments like the following:  #import &#60;defobj/Arguments.h&#62;  @interface MySwarmAppArguments: Arguments_c {   const char *protocolArg; } - (const char *)getProtocolArg; @end  @implementation MySwarmAppArguments  + createBegin: (id &#60;Zone&#62;)aZone {   static struct argp_option options[] = {     {"protocol", 'p', "PROTOCOL", 0, "Set protocol", 3},     { 0 }   };      MySwarmAppArguments *obj = [super createBegin: aZone];    [obj addOptions: options];   return obj; }  - (int)parseKey: (int)key arg: (const char *)arg {   if (key == 'p')     {       protocolArg = arg;       return 0;     }   else     return [super parseKey: key arg: arg]; }  - (const char *)getProtocolArg {   return protocolArg; }  @end To actually invoke this in the main.m program, you do the following: int  main (int argc, const char ** argv)  {   initSwarmArguments (argc, argv, [MySwarmAppArguments class]);      // the usual - buildObjects:, - buildActions:, - activateIn: calls      return 0;					   }</PRE></TD></TR></TABLE></DIV></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLEWIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="swarm.defobj.archiver.protocol.html">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="set.html">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="swarm.defobj.behaviorphase.protocol.html">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Archiver</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="swarm.defobj.sgml.reference.html">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">BehaviorPhase</TD></TR></TABLE></DIV></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -