📄 x23625.html
字号:
<HTML><HEAD><TITLE>Global Object Symbols</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="Library Interface Conventions"HREF="swarm.library.sgml.appendix.html"><LINKREL="PREVIOUS"TITLE="GridTurtle example"HREF="x23614.html"><LINKREL="NEXT"TITLE="Interface Design Convention"HREF="x23632.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="x23614.html">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom">Appendix B. Library Interface Conventions</TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="x23632.html">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="AEN23625">B.5. Global Object Symbols</A></H1><P>The <TTCLASS="FILENAME">grid.h</TT> header file above also containsthe declaration:<TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING"> id <Symbol> North, East, South, West;</PRE></TD></TR></TABLE></P><P>Lines that declare global id variables of type Symbol,EventType, Warning, or Error (using the angle bracket syntax of idvariables conforming to a protocol) are processed somewhat likedeftype declarations in that they also produce global id variablesinitialized to support particular messages defined by defobj. Theseglobal variables, however, are not used to define or implement othermessage interfaces, but only to define certain fixed capabilitiesreferenced through their global object names.</P><P>If declared as a Symbol, as in the case here, the generatedobjects have no particular behavior of their own (other than thecharacter string of their name), but only serve to define uniqueglobal id constants which may be used as distinct named values inmessages. In this example, the current direction of a GridTurtleobject is represented by one of the symbol names North, East, South,or West. These values are like the enum constants of the C language,except that they are defined as full Objective C objects, and may beused with further restrictions. An EventType, or a Warning or Error,defines a further subtype of a Symbol constant with furtherspecialized messages documented in defobj.</P></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLEWIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="x23614.html">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="set.html">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="x23632.html">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">GridTurtle example</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="swarm.library.sgml.appendix.html">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Interface Design Convention</TD></TR></TABLE></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -