Chatter Box
Volume Number: | | 5
|
Issue Number: | | 2
|
Column Tag: | | Intermediate Mac'ing
|
Related Info: AppleTalk Mgr
AppleTalk Chatter Box
By Rob Hafernik, Austin, TX
Note: Source code files accompanying article are located on MacTech CD-ROM or source code disks.
A Chat Program for AppleTalk
(Rob Hafernik has been programming at one job or another for 10 years. Over the years, hes been involved in a wide variety of programming projects; working with banks, hospitals, the Space Shuttle, robotics, graphics, and so on. Hes finally lucked out and now actually gets paid to program the Macintosh for Technology Works in Austin, Texas. He can be reached via e-mail on BIX or MacNet as user ID rob42 )
From the first time I sat down to a Mac connected to AppleTalk, I wanted to write a program to let users on AppleTalk-connected Macs chat back and forth. The idea languished in the back of my mind for years until I recently found myself with a need to learn AppleTalk and a whole day free of other programming responsibilities. Thus Chatterbox was begun.
I had already spent a couple of hours studying Inside AppleTalk to get a feel for the various AppleTalk protocols and more time pouring over the various Inside Macintosh chapters that cover AppleTalk. From the start, Id decided that the program would not be restricted to just two users talking back and forth. The program had to be able to let any user send a message to any subset of the rest of the users on the internet (or all of them). I also wanted to keep the program as simple and fool-proof as possible. From all of this I came to the decision that Chatterbox would use the Name Binding Protocol (NBP) to see who was available to talk to and the Datagram Delivery Protocol (DDP) to send and receive the actual messages.
AppleTalk Basics
First a few AppleTalk terms. Each device (such as your Mac or LaserWriter) on an AppleTalk network is called a node. Up to 32 devices can be connected together to form an AppleTalk network (up to 255 devices are allowed with Apples new release of AppleTalk). Several networks may be connected together (via special nodes called internet routers) to form a zone. The sum of all of the networks connected together are referred to as an internet. As each device boots up, it establishes contact with its network and comes up with a unique node id. Since more than one program may be running on a given node that wants to use the network, an addressing mechanism called sockets allows each node to have up to 254 separate addressable entities running at any one time. The low numbered sockets are reserved by Apple for the low-level protocols (such as the Name Binding Protocol well discuss below), but sockets 128-254 are open for use by any Mac program. Each socket must have a socket listener. This is a piece of code that the DDP calls to handle incoming messages. Apple supplies a default socket listener that does the minimum - it copies incoming messages to the buffer you supply and sets a result field.
The Datagram Delivery Protocol is the simplest data transfer protocol of them all and the one that all of the higher-level protocols are based on: it doesnt guarantee delivery and it doesnt guarantee that packets will arrive intact. What does it do? Well, it provides for the best effort delivery of a packet of up to 586 bytes to a given network, node and socket on the internet. What more could a chat program ask for? One note: throughout this program I have used the alternate interface, as opposed to the preferred interface. The preferred interface (described in Inside Macintosh Volume V) is based on the same type of parameter-block calls as the low-level file system interface. Unfortunately, since the preferred interface provides no equivalent of the DDPRead function, a socket listener and read function must be provided by the programmer. For this simple application, the alternate interface proved best and easiest to understand.
The Name Binding Protocol provides a way for programs that will use AppleTalk (client programs) to register on the network. Each client program opens a socket, then registers a name and type with the NBP. A client program can also ask NBP for the names, types, and addresses of other clients in its zone. NBP provides a wild-card match scheme that allows, for example, a client to scan the zone for all other names of a given type. This is the mechanism that Chatterbox uses to find other users to talk to.
The Chatterbox Program
Now lets look at the program. When Chatterbox first starts up, it asks the user for the name they wish to use during the session (figure 1). The name defaults to the Chooser name, but the user may override this and provide any name less than 32 characters long (the limit allowed by the NBP). After that, the program displays a window with several parts (figure 2). There is a scrollable area where the names of other Chatterbox users are displayed; an area for status messages (I like programs that let me know what theyre doing, especially ones like this whose actions are mostly invisible); a TextEdit field for messages you wish to send; and a read-only TextEdit field where incoming messages are displayed.
Figure 1.
To use the program, the user selects recipients from the list. Multiple selections are allowed, both continuous selections made with a shift-click and discontinuous selections made with a command-click. Messages entered in the edit-text field are transmitted by hitting the <return> key at the end of the message. As others send messages, theyre displayed in the area at the bottom. As more messages come in, the old ones scroll up and are eventually deleted as they scroll off the top.
Figure 2.
The flow of the program is pretty simple. Once the usual Mac stuff is initialized, the program opens a socket that will be used to receive messages. To keep things easy, I used the default, Apple-supplied, socket listener. Then the RegisterName routine allocates a parameter block, fills in the users name, type, zone, socket and a few other parameters and calls NBPRegister to do the work. The zone string is set to *, meaning this zone and the type string to Chatterbox. By using the * zone name, Chatterbox is limiting communications to a single zone (the one its in), but this simplifies the program considerably. Note that when the program quits, it must call NBPRemove to take this name out of the list - see the UnRegisterName routine.
After registering on the internet, the next thing the program does is send out a special greeting to all other Chatterboxes. Why? Well, its a long story. When I first wrote the program, I thought that it would periodically scan the zone for new users and add them to its display. This proved to be very cumbersome (it takes a second or two to do the lookup for one thing, a pretty big interruption if youre doing anything) and I went through several schemes before I came up with another method: as Chatterbox gets incoming messages, it looks to see if they begin with the non-breaking space (option-space from the keyboard). If so, its a signal that the list of users in the zone has changed and its time to call CheckForUsers (discussed below). This means that the user is only interrupted when a new user comes along (or goes away, well get to that later). So this special message that is sent out by a new Chatterbox coming along triggers all the other Chatterboxes to look around the zone for their fellows. Why go to all the trouble of a CheckForUsers and not just add the new user to the list? In a word, redundancy. This may take a little extra processor time, but it guarantees that the list of users is up-to-date, regardless of the whims and crashes of the network.
The CheckForUsers routine is a bit complicated. The current list of other Chatterboxes in the zone is displayed using the list manager. Whenever CheckForUsers scans the network for other users, it must add new Chatterboxes to the list and delete Chatterboxes no longer active from the list - all without disturbing the users selections in the list. It first calls NBPLookUp to get the names of all Chatterboxes, then it extracts one name at a time using NBPExtract. Each name is compared to those in the list; if theres a match, that entry is marked as found and the next name is processed. If the name is not found in the list, its added. After all of the names have been extracted, any names not marked as found are deleted from the list. This would all be better handled by a custom LDEF, but Ill save that for another day.
To receive messages with DDP, a program must first ask for them and provide a buffer to store them in. The AskForMessages routine takes care of this. Its very simple, just a single call to DDPRead. In this case, DDPRead is called with the async parameter set to true, meaning that the program will go on with its business while it waits for a message to come in. Once DDPRead has been called, its the programs responsibility to watch the abResult field of the InABRecord parameter block to go to zero or a negative value. DDPRead sets this field to a positive number - the socket listener will set it to zero (if everything is OK) or negative (the error code) when a message comes in. In Chatterbox, the abResult field is examined once each time a null event is received.
When a message has been detected, the ReadMessage routine is called to pull the message out of the buffer and display it in the incoming messages field. As soon as the message is dealt with, ReadMessage calls AskForMessage to get ready for the next message.
Sending messages is simple too. When the user hits <return> to send a message, its pulled out of the TextEdit field and put into a message buffer. The program then runs through the user list, building a parameter block for each user selected and calling DDPWrite to send the message. Sometimes the SendMessage routine must be called upon to send a message to everyone in the list, even if they arent selected (this happens during the start-up greeting, for example). In this case, the calling routine sets the toAll parameter true.
When the user quits the program, it again sends out a special message that starts with a non-breaking space. This time its an adios message. This message, like the greeting message, is used to tell all of the other Chatterbox programs in the zone to re-build their lists of users, since one has just quit.
Extras and Options
Thats the bulk of the program, but there are a few extras. There are two buttons in the window for frequently-used tasks. The Scan button just looks for Chatterboxes on the network. The user can press it if things seem a little screwy or out of sync - its really just a security blanket, its rarely needed. The Select All button selects all of the users in the list, something I found most users do often. There are also three optional behaviors that can be set or unset in the Options menu. The first sets a flag that tells the program to beep with each incoming message. This is in case a message comes in when the user isnt watching or the window is in the background under MultiFinder. The second option allows the user to see the messages transmitted echoed in the incoming message field. The last option allows the user to have all new users that come along be automatically selected as recipients.
What next?
So how could this program be improved? Well, it would be nice if the program let you pick the zone you wanted to chat in, instead of just letting you chat in your own. The AppleTalk Zone Information Protocol could be used to get a list of zones on the internet. It would also be nice if the incoming messages that were deleted from the TextEdit field as they scrolled off the top could instead be scrolled back down with a scroll bar. A file transfer facility would be nice. No doubt all of you out there can come up with more improvements.
As you see, AppleTalk is easy to use. This simple, low-level approach, using DDP and NBP, could be used to implement games, e-mail, network copy protection schemes and so on. As more and more Macs are networked out there, network awareness becomes more and more a must for any application.
Listing: Chatter.c
/* ======== Chatterbox ======= */
#include<AppleTalk.h>
/*** defines */
#define NULL0L
#define MAXUSERS 64
#define BUFSIZE 600
#define NONE0
#define REGISTER 1
#define WAITING 2
#define SCANNING 3
#define SENDING 4
#define RECEIVING5
#define MAXTEXT 32000L
#define MAXMSG 50
#define DISPLINES8
#define RETURNKEY\015
#define ENTERKEY \003
/*** data about a single user */
typedef struct UserRecord {
AddrBlockaddr;
int found;
} UserRecord;
/*** Globals */
intDoneFlag;
WindowPtr TheWindow;
ControlHandle ScanButton;
ControlHandle SelectAllButton;
ListHandleUserList;
TEHandleMyMessage;
TEHandleInMessages;
MenuHandleAppleMenu;
MenuHandleFileMenu;
MenuHandleEditMenu;
MenuHandleOptionMenu;
DDPProto**InABRecord;
UserRecordOtherUsers[MAXUSERS];
EntityNameMyEntityName;
PtrMyNameBuf;
Str255 MyName;
intMySocketID;
intNumOtherUsers;
intTheError;
intEchoFlag;
intBeepFlag;
intSelectFlag;
char RecBuffer[BUFSIZE];
Rect StatusR;
Rect DragRect;
/*====================*/
main()
{
EventRecordevent;
WindowPtrwhichWindow;
char key;
Initialize ();
while ( !DoneFlag ) {
GetNextEvent ( everyEvent, &event );
switch ( event.what ) {
case activateEvt:
whichWindow = (WindowPtr)event.message;
if ( whichWindow == TheWindow ) {
if ( event.modifiers & activeFlag ) {
TEActivate ( MyMessage );
LActivate ( true, UserList );
ShowControl ( ScanButton );
ShowControl( SelectAllButton);
}
else {
TEDeactivate ( MyMessage );
LActivate ( false, UserList );
HideControl ( ScanButton );
HideControl ( SelectAllButton );
}
}
break;
case updateEvt:
whichWindow = (WindowPtr)event.message;
if ( whichWindow == TheWindow ) {
BeginUpdate ( TheWindow );
DoUpdate ( );
EndUpdate ( TheWindow );
}
break;
case mouseDown:
switch ( FindWindow ( event.where,
&whichWindow ) ) {
case inMenuBar:
DoMenu (MenuSelect(event.where));
break;
case inSysWindow:
SystemClick (&event,whichWindow);
break;
case inDrag:
if ( whichWindow == TheWindow )
DragWindow ( TheWindow,
event.where, &DragRect );
break;
case inContent:
if ( whichWindow == TheWindow ) {
if (TheWindow != FrontWindow())
SelectWindow ( TheWindow );
else DoMouseDown ( event.where,
event.modifiers );
}
break;
}
break;
case autoKey:
case keyDown:
key = (char) (event.message & charCodeMask);
if ( event.modifiers & cmdKey )
DoMenu ( MenuKey ( key ) );
else if ( key == RETURNKEY || key == ENTERKEY )
SendMessage ( false );
else {
ForeColor ( greenColor );
TEKey ( key, MyMessage );
if ((*MyMessage)->teLength > MAXMSG){
TESetSelect ( (long) MAXMSG,
MAXTEXT, MyMessage );
TEDelete ( MyMessage );
}
ForeColor ( blackColor );
}
break;
case nullEvent:
if ( MySocketID == 0 ) StartAT ( );
else {
ShowStatus ( WAITING );
if ( (*InABRecord)->abResult <= 0 )
ReadMessage ( );
TEIdle ( MyMessage );
}
break;
}
}
ByeBye ( );
}
/*===== initialize the Mac and my globals */
Initialize ()
{
EventRecordevent;
Handle h;
/*** init the mac rom stuff */
InitGraf ( &thePort );
InitFonts ();
InitWindows ();
InitMenus ();
TEInit ();
InitDialogs ( 0L );
InitCursor ();
FlushEvents ( everyEvent, 0 );
/*** set up a few globals ... */
EchoFlag = BeepFlag = SelectFlag = true;
DoneFlag = false;
MyNameBuf = 0L;
InABRecord = (DDPProto **)
NewHandle ( sizeof ( DDPProto ) );
MoveHHi ( InABRecord );
HLock ( InABRecord );
DragRect = screenBits.bounds;
MySocketID = 0;
NumOtherUsers = 0;
/*** read in the menus */
AppleMenu = GetMenu ( 1000 );
InsertMenu ( AppleMenu, 0 );
AddResMenu ( AppleMenu, DRVR );
FileMenu = GetMenu ( 1001 );
InsertMenu ( FileMenu, 0 );
EditMenu = GetMenu ( 1002 );
InsertMenu ( EditMenu, 0 );
OptionMenu = GetMenu ( 1003 );
InsertMenu ( OptionMenu, 0 );
DrawMenuBar ();
/*** make sure appletalk is available */
if ( (TheError = MPPOpen ()) != noErr )
ErrorAlert (\PCant start AppleTalk, error:, TheError);
/*** get users name */
h = (Handle) GetString ( -16096 );
if ( h != NULL )
BlockMove ( *h, MyName, ((long) **h) + 1L );
else MyName[0] = 0;
ReleaseResource ( h );
NameDlog ( );
/*** open our window & init */
InitTheWindow ( );
}
/*===== process menu picks */
DoMenu ( mResult )
long mResult;
{
int theMenu, theItem, i;
Str255 daname;
DialogPtraboutdlog;
GrafPtrcurport;
TEHandle te;
theItem = LoWord ( mResult );
theMenu = HiWord ( mResult );
switch ( theMenu ) {
case 1000:
if ( theItem == 1 ) {
aboutdlog = GetNewDialog ( 2000, NULL, -1L );
i = 0;
while ( !i ) ModalDialog ( NULL, &i );
DisposDialog ( aboutdlog );
}
else {
GetItem ( AppleMenu, theItem, daname );
GetPort ( &curport );
OpenDeskAcc ( daname );
SetPort ( curport );
}
break;
case 1001:
if ( theItem == 1 ) DoneFlag = true;
break;
case 1002:
ForeColor ( greenColor );
switch ( theItem ) {
case 3:
TECut ( MyMessage );
break;
case 4:
TECopy ( MyMessage );
break;
case 5:
TEPaste ( MyMessage );
if ((*MyMessage)->teLength > MAXMSG){
TESetSelect ( (long) MAXMSG,
MAXTEXT, MyMessage );
TEDelete ( MyMessage );
}
break;
}
ForeColor ( blackColor );
break;
case 1003:
switch ( theItem ) {
case 1:
if ( BeepFlag ) {
BeepFlag = false;
CheckItem (OptionMenu, 1, false );
}
else {
BeepFlag = true;
CheckItem (OptionMenu, 1, true );
}
break;
case 2:
if ( EchoFlag ) {
EchoFlag = false;
CheckItem (OptionMenu, 2, false );
}
else {
EchoFlag = true;
CheckItem (OptionMenu, 2, true );
}
break;
case 3:
if ( SelectFlag ) {
SelectFlag = false;
CheckItem (OptionMenu, 3, false );
}
else {
SelectFlag = true;
CheckItem (OptionMenu, 3, true );
}
break;
}
break;
}
HiliteMenu(0);
}
/*===== get the name the user wants to go by */
NameDlog ( )
{
DialogPtrdlog;
int itype, item;
Handle h, namefield;
Rect r;
Str255 astr;
/*** do the dialog */
dlog = GetNewDialog ( 1000, 0L, -1L );
GetDItem ( dlog, 4, &itype, &namefield, &r );
SetIText ( namefield, MyName );
SelIText ( dlog, 4, 0, 255 );
item = 0;
while ( item != 1 ) ModalDialog ( 0L, &item );
/*** save off the name, 32 chars max */
GetIText ( namefield, &MyName );
if ( ((int) *MyName) > 31 ) *MyName =(char) 31;
CloseDialog ( dlog );
}
/*===== initialize AppleTalk stuff */
StartAT ( )
{
/*** open a socket, use defalut listener */
if (
(TheError = DDPOpenSocket (&MySocketID,NULL)) != noErr )
ErrorAlert ( \PDDPOpenSocket ( ) returned:, TheError );
RegisterName ( );
CheckForUsers ( );
SendGreeting ( );
/*** listen for messages */
AskForMessage ( );
}
/*=== Register MyName as a Chatterbox via AppleTalk NBP */
RegisterName ( )
{
int len;
NBPProto **myABRecNBP;
/*** show some feedback */
ShowStatus ( REGISTER );
/*** make up a handle for registering */
myABRecNBP = (NBPProto **)
NewHandle ( sizeof ( NBPProto ) );
HLock ( myABRecNBP );
/*** set up our entity name */
BlockMove ( MyName, MyEntityName.objStr,
((long) *MyName) + 1L );
BlockMove ( \PChatterbox,
MyEntityName.typeStr, 11L );
BlockMove ( \P*, MyEntityName.zoneStr, 2L );
/*** set up a buffer for NBPs internal use */
len = ((int) *MyName) + 26;
MyNameBuf = NewPtr ( (long) len );
/*** fill in the record & register */
(*myABRecNBP)->abOpcode = tNBPRegister;
(*myABRecNBP)->abUserReference = 0L;
(*myABRecNBP)->nbpEntityPtr = &MyEntityName;
(*myABRecNBP)->nbpBufPtr = MyNameBuf;
(*myABRecNBP)->nbpBufSize = len;
(*myABRecNBP)->nbpAddress.aSocket = (Byte)
MySocketID;
(*myABRecNBP)->nbpRetransmitInfo.
retransInterval = 8;
(*myABRecNBP)->nbpRetransmitInfo.retransCount = 2;
if ( (TheError = NBPRegister(myABRecNBP, false)) != noErr )
ErrorAlert ( \PNBPRegister ( ) returned:, TheError );
HUnlock ( myABRecNBP );
DisposHandle ( myABRecNBP );
}
/*===== remove the name from NBP */
UnRegisterName ( )
{
if ( (TheError = NBPRemove(&MyEntityName )) != noErr )
ErrorAlert ( \PNBPRemove ( ) returned:, TheError );
DisposPtr ( MyNameBuf );
}
/*===== check for other users on the net. */
CheckForUsers ( )
{
int j, r, i, numFound, found, removed;
Point c;
EntityName otherEntity;
NBPProto **otherABRecNBP;
AddrBlockaddblock;
/*** show some feedback */
ShowStatus ( SCANNING );
/*** mark them all as not found */
for ( i = 0; i < NumOtherUsers; ++i )
OtherUsers[i].found = false;
/*** now scan for other users */
BlockMove ( \P=, otherEntity.objStr, 2L );
BlockMove ( \PChatterbox, otherEntity.typeStr, 11L );
BlockMove ( \P*, otherEntity.zoneStr, 2L );
otherABRecNBP = (NBPProto **)
NewHandle ( sizeof ( NBPProto ) );
HLock ( otherABRecNBP );
(*otherABRecNBP)->abOpcode = tNBPLookup;
(*otherABRecNBP)->abUserReference = 0L;
(*otherABRecNBP)->nbpEntityPtr = &otherEntity;
(*otherABRecNBP)->nbpBufPtr = NewPtr ( 4096 );
(*otherABRecNBP)->nbpBufSize = 4096;
(*otherABRecNBP)->nbpDataField = 40;
(*otherABRecNBP)->nbpRetransmitInfo.
retransInterval = 8;
(*otherABRecNBP)->nbpRetransmitInfo.
retransCount = 1;
if ((TheError = NBPLookup(otherABRecNBP, false)) != noErr)
ErrorAlert ( \PNBPLookup ( ) returned:, TheError );
/*** if we found any, check for them in the
list, else empty the list */
numFound = (*otherABRecNBP)->nbpDataField;
if ( numFound <= 0 ) {
j = (*UserList)->dataBounds.bottom;
if ( j > 0 ) LDelRow ( j, 0, UserList );
NumOtherUsers = 0;
}
else {
for ( i = 0; i < numFound; ++i ) {
/*** extract it */
if ( (TheError = NBPExtract (
(*otherABRecNBP)->nbpBufPtr,
numFound, i+1, &otherEntity,
&addblock )) == noErr ) {
/*** see if its in the list */
found = false;
for ( j = 0; j < NumOtherUsers; ++j ) {
if ( OtherUsers[j].addr.aSocket ==
addblock.aSocket &&
OtherUsers[j].addr.aNode ==
addblock.aNode &&
OtherUsers[j].addr.aNet ==
addblock.aNet ) {
found = true;
break;
}
}
/*** if it is, mark it */
if ( found ) OtherUsers[j].found=true;
/***else add it, select it if auto-select is on */
else {
c.h = 0;
c.v = NumOtherUsers;
OtherUsers[NumOtherUsers].addr =
addblock;
OtherUsers[NumOtherUsers].found =
true;
LAddRow ( 1,NumOtherUsers,UserList );
LSetCell ( &otherEntity.objStr[1],
(int) otherEntity.objStr[0], c, UserList );
if ( SelectFlag )
LSetSelect ( true, c, UserList );
++NumOtherUsers;
}
/*** dont overflow */
if ( NumOtherUsers >= MAXUSERS ) break;
}
}
/**delete any that were not found (theyve logged off) */
for ( j = NumOtherUsers-1; j >= 0; --j ) {
if ( !OtherUsers[j].found ) {
--NumOtherUsers;
BlockMove ( &OtherUsers[j+1],
&OtherUsers[j],
(long) ((NumOtherUsers-j)
*sizeof(UserRecord)) );
LDelRow ( 1, j, UserList );
}
}
}
DisposPtr ( (*otherABRecNBP)->nbpBufPtr );
HUnlock ( otherABRecNBP );
DisposHandle ( otherABRecNBP );
}
/*===== tell DDP were waiting for a msg */
AskForMessage ( )
{
(*InABRecord)->abOpcode = tDDPRead;
(*InABRecord)->abResult = 0;
(*InABRecord)->abUserReference = 0L;
(*InABRecord)->ddpType = 5;
(*InABRecord)->ddpSocket = MySocketID;
(*InABRecord)->ddpReqCount = BUFSIZE;
(*InABRecord)->ddpDataPtr = RecBuffer;
if ( (TheError = DDPRead ( InABRecord, true,
true)) != noErr )
ErrorAlert ( \PDDPRead ( ) returned:, TheError );
}
/*===== read a message from the socket */
ReadMessage ( )
{
Rect r;
Cell c;
Str255 othername;
int i, namelen, nlines, fromnode;
/*** make sure theres really a message */
if ( (*InABRecord)->ddpActCount > 0 ) {
/*** show some feedback */
ShowStatus ( RECEIVING );
/*** check for users if its a special
message (ie, has option-space) */
if ( RecBuffer[0] == ) CheckForUsers ();
/*** see who its from */
namelen = 0;
fromnode = (*InABRecord)->ddpAddress.aNode;
for ( i = 0; i < NumOtherUsers; ++i )
if ( fromnode ==
OtherUsers[i].addr.aNode ) break;
if ( i < NumOtherUsers ) {
c.h = 0;
c.v = i;
namelen = 32;
LGetCell ( othername, &namelen, c, UserList );
}
/*** put the message in the display */
ForeColor ( blueColor );
TESetSelect ( MAXTEXT, MAXTEXT, InMessages );
TEInsert ( RecBuffer, (long) (*InABRecord)->ddpActCount,
InMessages );
TEInsert ( (, 2L, InMessages );
TEInsert ( othername, (long) namelen, InMessages );
TEInsert ( )\015, 2L, InMessages );
nlines = (*InMessages)->nLines;
for ( i = DISPLINES; i < nlines; ++i )
DeleteFirstLine ( InMessages );
ForeColor ( blackColor );
if ( BeepFlag ) SysBeep ( 1 );
}
else ErrorAlert ( \PError in recieved packet., 0 );
AskForMessage ( );
}
/*===== send the message out. If toAll is true,
send to all, else send to selected. */
SendMessage ( toAll )
int toAll;
{
DDPProto **outABRecord;
Handle thetext;
int i, nlines, textlen, msgSent;
Cell c;
char xmitBuffer[BUFSIZE];
/*** only if there is something to say */
if ( (*MyMessage)->teLength <= 0 ) return;
/*** get a record */
outABRecord = (DDPProto **)
NewHandle ( sizeof ( DDPProto ) );
HLock ( outABRecord );
/*** copy the text to the out buffer, empty
TextEdit record */
thetext = (Handle) TEGetText ( MyMessage );
HLock ( thetext );
textlen = (*MyMessage)->teLength;
BlockMove ( *thetext, xmitBuffer, textlen );
HUnlock ( thetext );
/*** send the message to appropriate users */
for(msgSent=false,i=0; i<NumOtherUsers; ++i) {
c.h = 0;
c.v = i;
if ( toAll ||
LGetSelect ( false, &c, UserList ) ) {
ShowStatus ( SENDING );
(*outABRecord)->abOpcode = tDDPWrite;
(*outABRecord)->abUserReference = 0L;
(*outABRecord)->ddpType = 5;
(*outABRecord)->ddpSocket = MySocketID;
(*outABRecord)->ddpAddress =
OtherUsers[i].addr;
(*outABRecord)->ddpDataPtr = xmitBuffer;
(*outABRecord)->ddpReqCount = textlen;
if ( (TheError = DDPWrite ( outABRecord,
false, false )) != noErr )
ErrorAlert ( \PDDPWrite ( ) returned:, TheError );
msgSent = true;
}
}
if ( msgSent ) {
TESetSelect ( 0L, MAXTEXT, MyMessage );
TEDelete ( MyMessage );
TESetSelect ( 0L, 0L, MyMessage );
if ( EchoFlag ) {
ForeColor ( blueColor );
TESetSelect (MAXTEXT,MAXTEXT,InMessages);
TEInsert ( «, 1L, InMessages );
TEInsert ( xmitBuffer, (long) textlen, InMessages );
TEInsert ( »\015, 2L, InMessages );
nlines = (*InMessages)->nLines;
for ( i = DISPLINES; i < nlines; ++i )
DeleteFirstLine ( InMessages );
ForeColor ( blackColor );
}
}
HUnlock ( outABRecord );
DisposHandle ( outABRecord );
}
/*===== say hello to existing users */
SendGreeting ( )
{
Str255 greeting;
/*** send log-on messge (has option-space) */
greeting[0] = \0;
Pstrcat ( greeting, \P Hello Everyone! );
TESetSelect ( 0L, 0L, MyMessage );
TEInsert ( &greeting[1], (long) greeting[0], MyMessage );
SendMessage ( true );
TESetSelect ( 0L, MAXTEXT, MyMessage );
TEDelete ( MyMessage );
}
/*===== pick up our toys and go home */
ByeBye ( )
{
Str255 adios;
/*** send logoff message (has option-space) */
adios[0] = \0;
Pstrcat ( adios, \P );
Pstrcat ( adios, MyName );
Pstrcat ( adios, \P is off! );
TESetSelect ( 0L, 0L, MyMessage );
TEInsert ( &adios[1], (long) adios[0], MyMessage );
SendMessage ( true );
/*** close everything */
UnRegisterName ( );
DDPCloseSocket ( (Byte) MySocketID );
CloseWindow ( TheWindow );
}
/*===== delete the first line from the given TEhandle */
DeleteFirstLine ( te )
TEHandle te;
{
Handle h;
int charsinline = 0;
char *cp;
h = TEGetText ( te );
HLock ( h );
cp = *h;
while ( *cp != \015 ) {
++cp;
++charsinline;
}
++charsinline;
TESetSelect ( 0L, (long) charsinline, te );
TEDelete ( te );
}
/*===== open and initialize the window */
InitTheWindow ( )
{
Rect r, dbr, view, dest;
Point csize;
char title[80];
TheWindow = GetNewWindow ( 1000, 0L, -1L );
title[0] = \0;
Pstrcat ( title, \PChatterbox - );
Pstrcat ( title, MyName );
SetWTitle ( TheWindow, title );
SetPort ( TheWindow );
TextFont ( 4 );
TextSize ( 9 );
TextFace ( 0 );
/*** add in the controls */
ScanButton = GetNewControl ( 1000, TheWindow );
SelectAllButton =
GetNewControl ( 2000, TheWindow );
/*** add in the user list */
SetRect ( &r, 20, 22, 164, 94 );
SetRect ( &dbr, 0, 0, 1, 0 );
csize.v = 12;
csize.h = 300;
UserList = LNew ( &r, &dbr, csize, 0,
TheWindow, true, false, false, true );
/*** add in the outgoing message field */
SetRect ( &view, 21, 114, 339, 128 );
SetRect ( &dest, 22, 115, 338, 270 );
MyMessage = TENew ( &dest, &view );
TESetSelect ( 0L, 0L, MyMessage );
/*** set up the incomming message area */
SetRect ( &view, 21, 148, 339, 238 );
SetRect ( &dest, 22, 149, 338, 270 );
InMessages = TENew ( &dest, &view );
TESetSelect ( 0L, 0L, InMessages );
/*** set up the status area */
SetRect ( &StatusR, 196, 21, 340, 65 );
}
/*===== handle update events for our main (and only) window */
DoUpdate ( )
{
Rect r;
RgnHandlevis;
/*** do the controls */
SetPort ( TheWindow );
DrawControls ( TheWindow );
/*** show the user list */
r = (*UserList)->rView;
InsetRect ( &r, -1, -1 );
FrameRect ( &r );
MoveTo ( r.left, r.top-4 );
DrawString ( \PSelect Recipients: );
vis = TheWindow->visRgn;
HandToHand ( &vis );
LUpdate ( vis, UserList );
DisposHandle ( vis );
/*** show the MyMessage field */
r = (*MyMessage)->viewRect;
MoveTo ( r.left-1, r.top-6 );
DrawString ( \PType a message, <return> to send: );
EraseRect ( &r );
InsetRect ( &r, -2, -2 );
FrameRect ( &r );
ForeColor ( greenColor );
TEUpdate ( &r, MyMessage );
ForeColor ( blackColor );
/*** show the incomming message field */
r = (*InMessages)->viewRect;
MoveTo ( r.left-1, r.top-6 );
DrawString ( \PReceived Messages: );
EraseRect ( &r );
InsetRect ( &r, -2, -2 );
FrameRect ( &r );
ForeColor ( blueColor );
TEUpdate ( &r, InMessages );
ForeColor ( blackColor );
/*** show the status area */
MoveTo ( StatusR.left, StatusR.top-4 );
DrawString ( \PStatus: );
FrameRect ( &StatusR );
ShowStatus ( NONE );
}
/*===== display the status notice */
ShowStatus ( status )
int status;
{
Rect r;
char *cp;
static int oldstatus;
if ( status != oldstatus ) {
InsetRect ( &StatusR, 2, 2 );
EraseRect ( &StatusR );
ForeColor ( redColor );
cp = NULL;
switch ( status ) {
case NONE:
break;
case REGISTER:
cp = \PRegistering on the network.;
break;
case WAITING:
cp = \PListening ;
break;
case SCANNING:
cp = \PScanning for other users.;
break;
case SENDING:
cp = \PSending message.;
break;
case RECEIVING:
cp = \PReceiving message.;
break;
}
if ( cp != NULL )
TextBox ( (cp + 1), (long) *cp, &StatusR, teJustLeft );
ForeColor ( blackColor );
InsetRect ( &StatusR, -2, -2 );
oldstatus = status;
}
}
/*===== handle mouse-downs in our window */
DoMouseDown ( thePt, mods )
Point thePt;
int mods;
{
Rect r;
Point localPt, c;
ControlHandle chan;
/*** get the local point */
localPt = thePt;
GlobalToLocal ( &localPt );
/*** in UserList or its scroll bars? */
r = (*UserList)->rView;
r.right += 16;
if ( PtInRect ( localPt, &r ) &&
( NumOtherUsers > 0 ) ) {
LClick ( localPt, mods, UserList );
return;
}
/*** in MyMessage ? */
r = (*MyMessage)->viewRect;
if ( PtInRect ( localPt, &r ) ) {
TEClick ( localPt,
((mods & shiftKey) == shiftKey),
MyMessage );
return;
}
/*** in the controls */
if (FindControl(localPt, TheWindow, &chan)) {
if ( TrackControl ( chan, localPt, NULL ) ) {
if ( chan == ScanButton ) CheckForUsers();
if ( chan == SelectAllButton ) {
for ( c.h = 0, c.v = (*UserList)->dataBounds.top;
c.v < (*UserList)->dataBounds.bottom; ++c.v )
LSetSelect ( true, c, UserList );
}
}
}
}
/*===== catenate the second pascal string to the first */
Pstrcat ( str1, str2 )
char *str1, *str2;
{
char *str1len, *str1end;
str1len = str1;
str1end = str1 + (int) *str1len + 1;
BlockMove ((str2 + 1), str1end, (long) *str2);
*str1len += (int) *str2;
}
/*=== alert the user to an error, optionally exit to shell */
ErrorAlert ( where, errorNum )
char *where;
int errorNum;
{
Str255 idstr;
/*** give the alert */
NumToString ( (long) errorNum, idstr );
ParamText ( where, idstr, \P, \P );
if ( Alert ( 666, 0L ) == 1 ) {
UnRegisterName ( );
DDPCloseSocket ( (Byte) MySocketID );
ExitToShell ();
}
}
Listing: Chatter.r
resource BNDL (128) {
chat,
0,
{ /* array TypeArray: 2 elements */
/* [1] */
ICN#,
{ /* array IDArray: 2 elements */
/* [1] */
0, 128,
/* [2] */
1, 129
},
/* [2] */
FREF,
{ /* array IDArray: 2 elements */
/* [1] */
0, 128,
/* [2] */
1, 129
}
}
};
data chat (0) {
$15 43 68 61 74 74 65 72 62 6F 78 20 31 2E 30 20"
$62 79 20 52 6F 62 0D};
resource ICN# (128) {
{ /* array: 2 elements */
/* [1] */
$1F FF FF F8 21 FF FF FC 41 FF FF FE 81 FF FF FF
$81 FF FF FF 81 FF C0 FF 89 FF 00 3F 99 FE 00 1F
$89 FC 00 0F 81 F8 00 07 81 F8 00 07 81 F0 00 03"
$80 F1 9D C3 80 F0 00 03 80 70 00 03 80 71 DD 43"
$80 70 00 03 80 70 00 03 80 F1 D7 03 87 F0 00 03"
$81 F0 00 03 81 F1 EE C3 81 F0 00 07 81 F0 00 07"
$81 F0 00 0F 87 E0 00 1F 8F 80 00 7F 87 FF FF FF
$81 FF FF FF 41 FF FF FE 21 FF FF FC 1F FF FF F8",
/* [2] */
$1F FF FF F8 3F FF FF FC 7F FF FF FE FF FF FF FF
$FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
$FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
$FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
$FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
$FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
$FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
$FF FF FF FF 7F FF FF FE 3F FF FF FC 1F FF FF F8"
}
};
resource WIND (1000, Chatterbox) {
{46, 16, 300, 376},
documentProc,
visible,
noGoAway,
0x0,
Chatterbox
};
resource MENU (1000, Apple) {
1000,
textMenuProc,
0x7FFFFFFD,
enabled,
apple,
{ /* array: 2 elements */
/* [1] */
About Chatterbox , noIcon, noKey, noMark, plain,
/* [2] */
-, noIcon, noKey, noMark, plain
}
};
resource MENU (1001, File) {
1001,
textMenuProc,
allEnabled,
enabled,
File,
{ /* array: 1 elements */
/* [1] */
Quit, noIcon, Q, noMark, plain
}
};
resource MENU (1002, Edit) {
1002,
textMenuProc,
0x7FFFFFFC,
enabled,
Edit,
{ /* array: 5 elements */
/* [1] */
Undo, noIcon, Z, noMark, plain,
/* [2] */
-, noIcon, noKey, noMark, plain,
/* [3] */
Cut, noIcon, X, noMark, plain,
/* [4] */
Copy, noIcon, C, noMark, plain,
/* [5] */
Paste, noIcon, V, noMark, plain
}
};
resource MENU (1003, Options) {
1003,
textMenuProc,
allEnabled,
enabled,
Options,
{ /* array: 3 elements */
/* [1] */
Beep On Receipt, noIcon, noKey, check, plain,
/* [2] */
Echo My Transmissions,noIcon,noKey,check,plain,
/* [3] */
Auto-select New Users,noIcon,noKey,check,plain
}
};
resource ALRT (666, Error Alert) {
{162, 90, 330, 398},
666,
{ /* array: 4 elements */
/* [1] */
OK, visible, sound1,
/* [2] */
OK, visible, sound1,
/* [3] */
OK, visible, sound1,
/* [4] */
OK, visible, sound1
}
};
resource cicn (1000) {
16,
{0, 0, 32, 32},
0,
unpacked,
0,
0x480000,
0x480000,
chunky,
4,
1,
4,
0,
0,
4,
{0, 0, 32, 32},
4,
{0, 0, 32, 32},
$1F FF FF F8 3F FF FF FC 7F FF FF FE FF FF FF FF
$FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
$FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
$FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
$FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
$FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
$FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
$FF FF FF FF 7F FF FF FE 3F FF FF FC 1F FF FF 8F,
$1F FF FF F8 21 FF FF FC 41 FF FF FE 81 FF FF FF
$81 FF FF FF 81 FF C0 FF 89 FF 00 3F 99 FE 00 1F
$89 FC 00 0F 81 F8 00 07 81 F8 00 07 81 F0 00 03"
$80 F1 DD C3 80 F0 00 03 80 70 00 03 80 71 DD 43"
$80 70 00 03 80 70 00 03 80 F1 D7 03 87 F0 00 03"
$81 F0 00 03 81 F1 EE C3 81 F0 00 07 81 F0 00 07"
$81 F0 00 0F 87 E0 00 1F 8F 80 00 7F 87 FF FF FF
$81 FF FF FF 41 FF FF FE 21 FF FF FC 1F FF FF F8"
,0x0, 0,
{ /* array ColorSpec: 5 elements */
/* [1] */
0, 65535, 65535, 65535,
/* [2] */
1, 0, 0, 0,
/* [3] */
2, 8856, 65535, 6900,
/* [4] */
3, 7652, 8260, 65535,
/* [5] */
4, 65535, 9758, 8505
},
$00 01 11 11 11 11 11 11 11 11 11 11 11 11 10 00"
$00 10 00 01 33 33 33 33 33 33 33 33 33 33 31 00"
$01 00 00 01 33 33 33 33 33 33 33 33 33 33 33 10"
$10 00 00 01 33 33 33 33 33 33 33 33 33 33 33 31"
$10 00 00 01 33 33 33 33 33 33 33 33 33 33 33 31"
$10 00 00 01 33 33 33 33 33 00 00 00 33 33 33 31"
$10 00 10 01 33 33 33 33 00 00 00 00 00 33 33 31"
$10 01 10 01 33 33 33 30 00 00 00 00 00 03 33 31"
$10 00 10 01 33 33 33 00 00 00 00 00 00 00 33 31"
$10 00 00 01 33 33 30 00 00 00 00 00 00 00 03 31"
$10 00 00 01 33 33 30 00 00 00 00 00 00 00 03 31"
$10 00 00 01 33 33 00 00 00 00 00 00 00 00 00 31"
$10 00 00 00 13 33 00 04 44 04 44 04 44 00 00 31"
$10 00 00 00 13 33 00 00 00 00 00 00 00 00 00 31"
$10 00 00 00 01 33 00 00 00 00 00 00 00 00 00 31"
$10 00 00 00 01 33 00 04 44 40 44 04 04 00 00 31"
$10 00 00 00 01 33 00 00 00 00 00 00 00 00 00 31"
$10 00 00 00 01 33 00 00 00 00 00 00 00 00 00 31"
$10 00 00 00 13 33 00 04 44 04 04 44 00 00 00 31
$10 00 01 11 33 33 00 00 00 00 00 00 00 00 00 31"
$10 00 00 01 33 33 00 00 00 00 00 00 00 00 00 31"
$10 00 00 01 33 33 00 04 44 40 44 40 44 00 00 31"
$10 00 00 01 33 33 00 00 00 00 00 00 00 00 03 31"
$10 00 00 01 33 33 00 00 00 00 00 00 00 00 03 31"
$10 00 00 01 33 33 00 00 00 00 00 00 00 00 33 31"
$10 00 01 13 33 30 00 00 00 00 00 00 00 03 33 31"
$10 00 13 33 30 00 00 00 00 00 00 00 03 33 33 31"
$10 00 01 13 33 33 33 33 33 33 33 33 33 33 33 31"
$10 00 00 01 33 33 33 33 33 33 33 33 33 33 33 31"
$01 00 00 01 33 33 33 33 33 33 33 33 33 33 33 10"
$00 10 00 01 33 33 33 33 33 33 33 33 33 33 31 00"
$00 01 11 11 11 11 11 11 11 11 11 11 11 11 10 00"
};
resource DITL (1000) {
{ /* array DITLarray: 4 elements */
/* [1] */
{80, 52, 100, 112},
Button {
enabled,
OK
},
/* [2] */
{8, 8, 40, 40},
Icon {
disabled,
1000
},
/* [3] */
{16, 52, 36, 288},
StaticText {
enabled,
Enter the name you want to go by:
},
/* [4] */
{48, 56, 64, 256},
EditText {
enabled,
}
}
};
resource DITL (666) {
{ /* array DITLarray: 6 elements */
/* [1] */
{128, 16, 152, 128},
Button {
enabled,
Exit To Shell
},
/* [2] */
{128, 168, 152, 296},
Button {
enabled,
OK, Keep Going
},
/* [3] */
{8, 8, 40, 40},
Icon {
disabled,
1000
},
/* [4] */
{16, 48, 40, 296},
StaticText {
disabled,
Oops! Something bad has happened:
},
/* [5] */
{48, 48, 80, 296},
StaticText {
disabled,
^0
},
/* [6] */
{88, 48, 112, 296},
StaticText {
disabled,
^1
}
}
};
resource DITL (2000) {
{ /* array DITLarray: 1 elements */
/* [1] */
{2, 8, 98, 313},
Picture {
enabled,
2000
}
}
};
resource ICON (1000, purgeable) {
$1F FF FF F8 21 FF FF FC 41 FF FF FE 81 FF FF FF
$81 FF FF FF 81 FF C0 FF 89 FF 00 3F 99 FE 00 1F
$89 FC 00 0F 81 F8 00 07 81 F8 00 07 81 F0 00 03"
$80 F1 DD C3 80 F0 00 03 80 70 00 03 80 71 DD 43"
$80 70 00 03 80 70 00 03 80 F1 D7 03 87 F0 00 03"
$81 F0 00 03 81 F1 EE C3 81 F0 00 07 81 F0 00 07"
$81 F0 00 0F 87 E0 00 1F 8F 80 00 7F 87 FF FF FF
$81 FF FF FF 41 FF FF FE 21 FF FF FC 1F FF FF F8"
};
resource DLOG (1000, Get Name) {
{66, 40, 178, 360},
altDBoxProc,
visible,
goAway,
0x0,
1000,
Whats your name?
};
resource DLOG (2000, About...) {
{40, 40, 140, 360},
dBoxProc,
visible,
goAway,
0x0,
2000,
New Dialog
};
resource FREF (128) {
APPL,
0,
};
resource CNTL (1000, Scan) {
{75, 274, 95, 340},
0,
visible,
1,
0,
pushButProc,
0,
Scan
};
resource CNTL (2000, Select All) {
{75, 196, 95, 264},
0,
visible,
1,
0,
pushButProc,
0,
Select All
};
resource vers (2) {
0x1,
0x0,
0x0,
0x0,
verUs,
1.0,
by Rob Hafernik
};
resource vers (1) {
0x1,
0x0,
0x0,
0x0,
verUs,
1.0,
1.0
};
resource PICT (2000) {
{191, 81, 287, 386},
VersionOne {
{ /* array OpCodes: 4 elements */
/* [1] */
shortComment {
130
},
/* [2] */
clipRgn {
{0, 0, 720, 576},
$
},
/* [3] */
packBitsRect {
40,
{191, 80, 287, 392},
{191, 81, 287, 386},
{191, 81, 287, 386},
srcCopy,
$02 D9 00 02 D9 00 02 D9 00 08 00 01 F1 FF 00 80"
$EB 00 09 01 02 1F F2 FF 00 C0 EB 00 09 01 04 1F
$F2 FF 00 E0 EB 00 09 01 08 1F F2 FF 00 F0 EB 00"
$09 01 08 1F F2 FF 00 F0 EB 00 0B 02 08 1F FC F4"
$00 01 0F F0 EB 00 0B 02 08 9F F0 F4 00 01 03 F0"
$EB 00 0B 02 09 9F E0 F4 00 01 01 F0 EB 00 0A 02"
$08 9F C0 F3 00 00 F0 EB 00 0A 02 08 1F 80 F3 00"
$00 70 EB 00 0A 02 08 1F 80 F3 00 00 70 EB 00 26"
$08 08 1F 00 7F C6 00 00 0C 0C FE 00 00 C0 FD 00"
$0E 30 1F F8 00 00 1F F8 00 18 00 03 01 80 00 78"
$FD 00 00 C6 FE 00 26 08 08 0F 00 C0 66 00 00 0C
$0C FE 00 00 C0 FD 00 0E 30 18 0C 00 00 18 0C 00"
$18 00 03 01 80 00 C0 FD 00 00 06 FE 00 29 25 08"
$0F 00 C0 07 F8 7F 1F 9F 8F E3 FE FF 0F E3 06 00"
$30 18 0C C1 80 18 0C 7F 1F E0 03 01 8F E3 F8 FE
$3F EF F1 C6 18 FF 00 29 25 08 07 00 C0 06 0C C1"
$8C 0C 18 33 80 C1 98 31 8C 00 30 18 0C C1 80 18"
$0C C1 98 30 03 01 98 30 C1 83 38 0E 18 C6 30 FF
$00 29 25 08 07 00 C0 06 0C 01 8C 0C 18 33 00 C1"
$98 30 D8 00 30 1F F8 C1 80 1F F8 C1 98 30 03 FF
$80 30 C1 83 30 0C 18 C6 60 FF 00 29 25 08 07 00"
$C0 06 0C 7F 8C 0C 1F F3 00 C1 98 30 70 00 30 18"
$0C C1 80 18 C0 C1 98 30 03 01 8F F0 C1 FF 30 0C
$18 C7 C0 FF 00 29 25 08 07 00 C0 06 0C C1 8C 0C
$18 03 00 C1 98 30 70 00 30 18 0C C1 80 18 60 C1"
$98 30 03 01 98 30 C1 80 30 0C 18 C6 60 FF 00 29"
$25 08 0F 00 C0 06 0C C1 8C 0C 18 03 00 C1 98 30"
$D8 00 30 18 0C C1 80 18 30 C1 98 30 03 01 98 30"
$C1 80 30 0C 18 C6 30 FF 00 29 25 08 7F 00 C0 66"
$0C C1 8C 0C 18 33 00 C1 98 31 8C 00 30 18 0C C1"
$80 18 18 C1 98 30 03 01 98 30 C1 83 30 0C 18 C6"
$18 FF 00 29 25 08 1F 00 7F C6 0C 7F 87 87 8F E3"
$00 FF 0F E3 06 00 30 1F F8 7F 80 18 0C 7F 1F E0"
$03 01 8F F0 C0 FE 30 0C 18 C6 0C FF 00 0D 01 08"
$1F F2 00 04 30 00 00 01 80 EF 00 0D 01 08 1F F2"
$00 04 70 00 00 C1 80 EF 00 0C 01 08 1F F2 00 03"
$70 00 00 7F EE 00 09 01 08 1F F2 00 00 F0 EB 00"
$0A 01 08 7E F3 00 01 01 F0 EB 00 0A 01 08 F8 F3"
$00 01 07 F0 EB 00 09 01 08 7F F2 FF 00 F0 EB 00"
$09 01 08 1F F2 FF 00 F0 EB 00 09 01 04 1F F2 FF
$00 E0 EB 00 09 01 02 1F F2 FF 00 C0 EB 00 08 00"
$01 F1 FF 00 80 EB 00 02 D9 00 02 D9 00 02 D9 00"
$02 D9 00 02 D9 00 02 D9 00 02 D9 00 02 D9 00 02"
$D9 00 02 D9 00 02 D9 00 02 D9 00 02 D9 00 02 D9"
$00 0D 09 04 04 88 80 02 00 03 00 00 18 E3 00 0D
$09 04 04 08 80 02 00 01 00 00 20 E3 00 10 0C 04"
$05 9E FC 03 F1 F1 3F 00 FA F3 E7 B9 E6 00 10 0C
$04 04 88 82 02 0A 09 20 80 23 04 14 44 E6 00 10"
$0C 04 44 88 82 02 0A 09 20 80 22 04 14 44 E6 00"
$10 0C 04 A4 88 82 02 0B F9 20 80 22 04 14 44 E6"
$00 10 0C 05 14 88 82 02 0A 01 20 80 22 04 14 44"
$E6 00 10 0C 06 0C 88 82 02 0A 09 20 80 22 04 14"
$44 E6 00 10 0C 04 04 86 82 02 09 F1 3F 00 22 03"
$E4 45 E6 00 06 FA 00 00 20 E1 00 06 FA 00 00 20"
$E1 00 02 D9 00 02 D9 00 02 D9 00 02 D9 00 02 D9"
$00 25 06 04 04 00 02 00 01 02 FE 00 0C 20 40 04"
$40 00 00 20 20 00 10 00 0F E0 FC 00 03 01 FC 20"
$08 FD 00 00 80 FE 00 25 06 06 0C 00 02 00 01 04"
$FE 00 0C 20 80 04 40 00 00 30 60 00 10 00 08 10"
$FC 00 03 01 02 00 08 FD 00 00 80 FE 00 28 24 05"
$14 F9 7A 10 01 08 3E 5E 00 21 07 CF 7E 41 00 28"
$A7 CB D0 80 08 0A 09 F2 F2 F1 F0 01 01 65 E8 40"
$1F 2F 1F 80 FE 00 28 24 04 A5 05 82 20 01 10 41"
$61 00 22 08 24 41 41 00 25 28 2C 11 00 08 0A 0A
$0B 0B 0A 08 01 01 26 08 80 20 B0 A0 80 FE 00 28"
$17 04 44 05 02 40 01 F0 41 41 00 3E 00 24 41 41"
$00 22 20 28 12 00 08 0A 08 FE 0A 09 08 01 01 24"
$09 00 00 A0 A0 80 FE 00 28 24 04 04 FD 03 C0 01"
$08 7F 41 00 21 07 E4 41 41 00 20 27 E8 1E 00 08"
$0A 09 FA 0A 0B F8 01 01 24 0F 00 1F A0 A0 80 FE
$00 26 15 04 05 05 02 20 01 04 40 41 00 20 88 24"
$41 41 00 20 28 28 11 00 08 FC 0A 09 00 01 01 24"
$08 80 20 A0 A0 80 FE 00 28 17 04 05 05 02 10 01"
$02 41 41 00 20 48 24 41 41 00 20 28 28 10 80 08"
$12 1A FE 0A 09 08 01 02 24 08 40 20 A0 A0 80 FE
$00 28 24 04 04 FD 02 09 01 01 3E 41 20 20 27 E3"
$41 3F 20 20 27 E8 10 48 0F E1 E9 FA 0A 09 F1 01"
$FC 24 08 20 1F A0 9F 80 FE 00 17 FD 00 00 01 FD
$00 00 20 FD 00 01 01 20 FD 00 00 08 FB 00 00 01"
$F5 00 17 FD 00 00 02 FD 00 00 40 FD 00 01 41 40"
$FD 00 00 10 FB 00 00 02 F5 00 06 F3 00 00 3E E8"
$00 02 D9 00 02 D9 00 02 D9 00 02 D9 00 1D 12 07"
$FD 00 00 07 F8 00 00 80 00 10 1F F8 00 00 C0 00"
$00 1C FD 00 03 30 30 00 03 F4 00 1D 12 00 41 00"
$00 04 04 00 00 80 00 10 01 80 00 00 C0 00 00 0C
$FD 00 03 30 30 00 03 F4 00 20 1C 00 41 F8 F8 04"
$04 F8 F9 E0 1F 3C 01 81 F8 FC FE 7F 1F 8C 7E 3F
$B0 C0 30 33 F3 FB 18 FC F6 00 20 1C 00 41 05 04"
$04 05 05 04 80 20 90 01 83 0D 86 C3 71 B0 CC C3"
$61 B0 C0 30 36 1B 83 31 86 F6 00 20 1C 00 41 05"
$04 07 F9 05 00 80 00 90 01 83 0D 80 C3 61 B0 CC
$C3 61 B0 C0 33 36 1B 03 61 80 F6 00 20 1C 00 41"
$05 FC 04 21 FC FC 80 1F 90 01 83 FD 80 C3 61 B0"
$CC C3 61 B0 C0 37 B6 1B 03 E0 FE F6 00 20 1C 00"
$41 05 00 04 11 00 04 80 20 90 01 83 01 80 C3 61"
$B0 CC C3 61 B0 C0 3C F6 1B 03 30 06 F6 00 20 1C
$00 41 05 04 04 09 05 04 80 20 90 01 83 0D 86 C3"
$61 B0 CC C3 61 B0 C0 38 76 1B 03 19 86 F6 00 20"
$1C 00 41 04 F8 04 04 F8 F8 60 1F 8C 01 81 F8 FC
$C3 61 9F 8C 7E 3F 9F C0 30 33 F3 03 0C FC F6 00"
$08 ED 00 02 01 80 C0 F0 00 08 ED 00 02 61 B0 C0"
$F0 00 08 ED 00 02 3F 1F 80 F0 00 02 D9 00 02 D9"
$00 02 D9 00"
},
/* [4] */
shortComment {
131
}
}
}
};