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

📄 x1613.html

📁 set for Swarm2.1是圣菲研究院的开发人员对Swarm的特性及其使用描述的最为完备的指南性文档。从这里可以获得最细致的平台说明。
💻 HTML
字号:
<HTML><HEAD><TITLE>Porting from 1.0.5 to 1.1</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="Swarm Changes and Compatibility"HREF="swarm.compatibility.sgml.preface.html"><LINKREL="PREVIOUS"TITLE="Porting from 1.1 to 1.2"HREF="x1520.html"><LINKREL="NEXT"TITLE="Porting from 1.0.4 to 1.0.5"HREF="x1797.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="x1520.html">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom">Swarm Changes and Compatibility</TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="x1797.html">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="AEN1613">6. Porting from 1.0.5 to 1.1</A></H1><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="AEN1615">6.1. Major changes</A></H2><P> The major changes which are likely to affect existing      users are the following:</P><P></P><UL><LI><P>Addition of a new library class "gui" which replaces          the existing "tkobjc" library.</P></LI><LI><P>All direct references to any Tcl/Tk code such as the          "globalTkInterp" variable have been completely removed from          any library code and should not be used in any          application.</P></LI><LI><P> Splitting of simtools into two separate libraries:          simtools and simtoolsgui.  Classes that intrinsically depend          on a GUI toolkit being present (either Tcl/Tk or Java AWT)          were put into simtoolsgui.  This allows a user who never          intends to use a GUI toolkit, to be able to compile, link          and run Swarm applications <ICLASS="EMPHASIS">without any</I>          GUI toolkit installed at all.  This was not previously          possible.</P></LI><LI><P> The above change has been made possible by the fact          that the dependency of Tcl/Tk in the Probing mechanism has          been completely removed. It has been replaced by the          libffi/ffcall libraries.  Other than the fact that the user          will need to install this new library if they are not using          a binary distribution, this new dependence should          <ICLASS="EMPHASIS">not</I> break any user code.</P></LI><LI><P> The header file to the random library is no longer          included in simtools.h you need to explicitly import          random.h when you use a default random number          generator.</P></LI><LI><P>The XColormap class is now just Colormap to divorce          it from its association with X-Windows.  Similarly, BLTGraph          is now just Graph.</P></LI><LI><P>The class named Histo is now named            Histogram.</P></LI><LI><P>Certain classes now enforce their defining by the            protocol method.  For example an instance of the Raster            class must be defined as <TTCLASS="LITERAL">(id &lt;Raster&gt;              r)</TT> rather than <TTCLASS="LITERAL">(Raster *              r)</TT>.</P></LI><LI><P> Backwardly-compatible references to the old            swarmobject library are no longer supported.  You should            always use objectbase.</P></LI></UL></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="AEN1641">6.2. Porting guide</A></H2><P></P><UL><LI><P> Always use the "gui" protocol when calling            doing any GUI events:                        <P></P><UL><LI><P>Replace all occurences of tkobjc.h with                  gui.h</P></LI><LI><P><ICLASS="EMPHASIS">never</I> explicitly                reference any Tcl/Tk-specific code, in particular                  module with a call to globalTkInterp will no longer                  compile.</P></LI></UL>          </P></LI><LI><P> Using simtools/simtoolsgui:                         <P></P><UL><LI><P>Add the header file simtoolsgui.h to                  your list of imports whenever you are referencing                  any of the following classes:                                <TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="90%"><TR><TD><PRECLASS="PROGRAMLISTING">ActionCache, ControlPanel, SimpleProbeDisplay, ActionHolder,GUIComposite, VarProbeWidget, ActiveGraph, GUISwarm,ClassDisplayWidget, MessageProbeWidget, CommonProbeDisplay,ProbeDisplay, CompleteProbeDisplay,ProbeDisplayManager</PRE></TD></TR></TABLE>                </P></LI></UL>          </P></LI><LI><P> Explictly import the header when you are            subclassing from a given class:                        <P></P><UL><LI><P>You also need to import the header                  file for any class for which you are                subclassing.  In particular, when you are                  creating a GUISwarm you are subclassing from                  GUISwarm so you need to explicitly import both                &lt;simtoolsgui.h&gt; AND                  &lt;simtoolsgui/GUISwarm.h&gt;. The same is true                  for &lt;objectbase/SwarmObject.h&gt; and                  &lt;objectbase/Swarm.h&gt;</P></LI></UL></P></LI><LI><P> Colormap class name change:                      <P></P><UL><LI><P>Change all references of                  XColormap to Colormap as it is no longer                  specific to X11.</P></LI><LI><P> Change all method references to set the                  Colormap for the Value2dDisplay class ([Value2dDisplay                  -Colormap]) to lowercase ([Value2dDisplay -colormap])                  to avoid namespace conflicts with Colormap class.  For                  example, in <SPANCLASS="APPLICATION">heatbugs</SPAN>:                                    <TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="90%"><TR><TD><PRECLASS="PROGRAMLISTING">[heatDisplay setDisplayWidget: worldRaster Colormap: colormap];                                         should now be:                  [heatDisplay setDisplayWidget: worldRaster colormap: colormap];                        </PRE></TD></TR></TABLE>                </P></LI></UL>                      </P></LI><LI><P> Ensure that all required classes            conform to their protocol:                        <P></P><UL><LI><P>Make all occurences of                  (Raster *) to the protocol i.e. (id                  &lt;Raster&gt;)</P></LI><LI><P>Similarly change any                  references to Colormap, ZoomRaster,                  InFile and OutFile.</P></LI></UL>                    </P></LI><LI><P> Import random.h explicitly:                        <P></P><UL><LI><P>The header file                  &lt;random.h&gt; is no longer                  included by &lt;simtools.h&gt;                  should always <ICLASS="EMPHASIS">explicitly</I>                  reference the random library if you                  use it in a given module (.m) file.                  This again reduces the inter-library                  dependence, if you don't need to use                  the random library in your                  application, you shouldn't be                  including it.  </P></LI></UL></P></LI><LI><P> ActionCache and ControlPanel:            <P></P><UL><LI><P>Make all references to -doTkEvents and                  -waitForControlEvent be to actionCache NOT                  controlPanel.</P></LI></UL>          </P></LI></UL></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="AEN1690">6.3. Porting example: <SPANCLASS="APPLICATION">heatbugs</SPAN></A></H2><P>To help users port their applications to 1.1, I have        included a checklist of changes that were required to update        <SPANCLASS="APPLICATION">heatbugs</SPAN> from 1.0.5 to 1.1.  This        may help some users as a kind of "template" for changes they        may require for their applications.  The        <TTCLASS="FILENAME">ChangeLog</TT> entries in in the<SPANCLASS="APPLICATION">        heatbug-1.1</SPAN> distribution also provide further        specific information.</P><P><TTCLASS="FILENAME">Heatbug.h</TT></P><P></P><UL><LI><P>          Replace &lt;tkobjc/Raster.h&#62; with &lt;gui.h&#62;          <ICLASS="EMPHASIS">(*)</I></P></LI><LI><P>            Make all occurences of (Raster *) to the protocol (id            &lt;Raster&#62;) <ICLASS="EMPHASIS">(*)</I></P></LI></UL><P><TTCLASS="FILENAME">Heatbug.m</TT></P><P></P><UL><LI><P>Make all occurences of (Raster *) to the protocol          (id &lt;Raster&#62;) <ICLASS="EMPHASIS">(*)</I></P></LI><LI><P>Removed &lt;simtools.h&#62; altogether - not        used. <ICLASS="EMPHASIS">(*)</I></P></LI><LI><P>Added &lt;random.h&#62; - no longer included by          &lt;simtools.h&#62; - should always <ICLASS="EMPHASIS">explicitly</I>          reference the random library if you use it in your          code. <ICLASS="EMPHASIS">(*)</I></P></LI></UL><P><TTCLASS="FILENAME">HeatbugBatchSwarm.h</TT></P><P></P><UL><LI><P>          Changed &lt;swarmobject.h&#62; to &lt;objectbase.h&#62;          <ICLASS="EMPHASIS">(*)</I></P></LI></UL><P><TTCLASS="FILENAME">HeatbugBatchSwarm.m</TT></P><P></P><UL><LI><P>          Removed redundant &lt;collections.h&#62; <ICLASS="EMPHASIS">(x)</I></P></LI></UL><P><TTCLASS="FILENAME">HeatbugModelSwarm.h</TT></P><P></P><UL><LI><P>Removed &lt;tkobjc.h&#62; irrelevant in this context - tkobjc should          never be included directly in any case, if required use &lt;gui.h&#62;          <ICLASS="EMPHASIS">(*)</I></P></LI><LI><P>          Changed &lt;swarmobject.h&#62; to &lt;objectbase.h&#62;. <ICLASS="EMPHASIS">(*)</I></P></LI><LI><P>          Note we need to <ICLASS="EMPHASIS">separately</I> include &lt;objectbase/Swarm.h&#62;          since you always need to the header file for a class if you need to          subclass from it. <ICLASS="EMPHASIS">(*)</I></P></LI></UL><P><TTCLASS="FILENAME">HeatbugModelSwarm.m</TT></P><P></P><UL><LI><P>          Include &lt;random.h&#62; explicitly since we use the default          random number generators. <ICLASS="EMPHASIS">(*)</I></P></LI></UL><P><TTCLASS="FILENAME">HeatbugObserverSwarm.h</TT></P><P></P><UL><LI><P>          Change &lt;simtools.h&#62; to &lt;simtoolsgui.h&#62; since we are using GUI          widgets <ICLASS="EMPHASIS">(*)</I></P></LI><LI><P>          Explicitly import &lt;simtoolsgui/GUISwarm.h&#62; since we subclass from          it <ICLASS="EMPHASIS">(*)</I></P></LI><LI><P>          Remove: &lt;swarmobject.h&#62; &lt;space.h&#62; &lt;activity.h&#62;          &lt;collections.h&#62; all are irrelevant in the header          file. <ICLASS="EMPHASIS">(x)</I></P></LI><LI><P>&lt;tkobjc.h&#62; has been relocated to the (.m) file as          no gui classes are referenced directly in the header (.h)          file.  It is now changed to          &lt;gui.h&gt;. <ICLASS="EMPHASIS">(*)</I></P></LI><LI><P>            Change all references of XColormap to Colormap and use            protocol form: <ICLASS="EMPHASIS">(*)</I><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="90%"><TR><TD><PRECLASS="PROGRAMLISTING"> XColormap * colormap TO id &lt;Colormap&#62; colormap</PRE></TD></TR></TABLE>          </P></LI><LI><P>Make ZoomRaster conform to protocol, ie:          <ICLASS="EMPHASIS">(*)</I>      <TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="90%"><TR><TD><PRECLASS="PROGRAMLISTING"> ZoomRaster * worldRaster TO id &lt;ZoomRaster&#62; worldRaster</PRE></TD></TR></TABLE>&#13;</P></LI></UL><P><TTCLASS="FILENAME">HeatbugObserverSwarm.m</TT></P><P></P><UL><LI><P>Change swarmobject to objectbase          <ICLASS="EMPHASIS">(*)</I></P></LI><LI><P>Import the &lt;gui.h&#62; in the implementation file -          since it is not referenced in the header file          <ICLASS="EMPHASIS">(*)</I></P></LI><LI><P>Change XColormap to Colormap - no longer specific          to X11 - so name should not suggest          so. <ICLASS="EMPHASIS">(*)</I></P></LI><LI><P>Message to set colormap for worldRaster changed          name from (uppercase) Colormap to (lowercase)          colormap.<ICLASS="EMPHASIS">(*)</I></P></LI><LI><P>Call -enableDestroyNotification method on          worldRaster after createEnd.          <ICLASS="EMPHASIS">(x)</I></P></LI></UL><P><TTCLASS="FILENAME">main.m</TT></P><P></P><UL><LI><P>Need to import &lt;simtoolsgui.h&gt; in          addition to &lt;simtools.h&gt; since we reference GUISwarm          methods. <ICLASS="EMPHASIS">(*)</I></P></LI></UL></DIV></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLEWIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="x1520.html">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="set.html">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="x1797.html">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Porting from 1.1 to 1.2</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="swarm.compatibility.sgml.preface.html">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Porting from 1.0.4 to 1.0.5</TD></TR></TABLE></DIV></BODY></HTML>

⌨️ 快捷键说明

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