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

📄 swarm.overview.mag4.main-func.sect1.html

📁 set for Swarm2.1是圣菲研究院的开发人员对Swarm的特性及其使用描述的最为完备的指南性文档。从这里可以获得最细致的平台说明。
💻 HTML
字号:
<HTML><HEAD><TITLE>The main() function</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="Mag 4x:Sketch of Code "HREF="swarm.overview.mag4.chapter.html"><LINKREL="PREVIOUS"TITLE="Building a Data Graph"HREF="swarm.overview.mag4.build-graph.sect1.html"><LINKREL="NEXT"TITLE="Conclusion"HREF="swarm.overview.chap5.html"></HEAD><BODYCLASS="SECT1"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.overview.mag4.build-graph.sect1.html">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom">Chapter 4. Mag 4x:Sketch of Code</TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="swarm.overview.chap5.html">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="SWARM.OVERVIEW.MAG4.MAIN-FUNC.SECT1">4.8. The main() function</A></H1><P>The last main type of code needed for an application is the      function <TTCLASS="LITERAL">main()</TT> the first function called in      your program. All the real work has been done already - all      that's left is to create the objects at the right time.</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">int main(int argc, const char** argv) {  id theTopLevelSwarm ; // Swarm initialization: all Swarm apps must call this first. initSwarm(argc, argv); // swarmGUIMode is set in initSwarm(). It's set to be 0 if you  // typed `heatbugs --batchmode' or `heatbugs -b', Otherwise, it's set to // 1. if (swarmGUIMode == 1) // We've got graphics, so make a full ObserverSwarm to get GUI objects   theTopLevelSwarm = [HeatbugObserverSwarm create: globalZone]; else // No graphics - make a batchmode swarm and run it.   theTopLevelSwarm = [HeatbugBatchSwarm create: globalZone]; [theTopLevelSwarm buildObjects]; [theTopLevelSwarm buildActions]; [theTopLevelSwarm activateIn: nil]; [theTopLevelSwarm go]; // theTopLevelSwarm has finished processing, so it's time to quit. return 0;}</PRE></TD></TR></TABLE><P><TTCLASS="LITERAL">main()</TT> calls <TTCLASS="LITERAL">initSwarm</TT>      (required in all Swarm applications). It then detects if it      should do graphics or not, creates the appropriate top level      Swarm to contain the model, and sets it to running. Simple as      that!</P></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLEWIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="swarm.overview.mag4.build-graph.sect1.html">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="set.html">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="swarm.overview.chap5.html">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Building a Data Graph</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="swarm.overview.mag4.chapter.html">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Conclusion</TD></TR></TABLE></DIV></BODY></HTML>

⌨️ 快捷键说明

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