[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Sourcecode in the internet?
From: |
Marcus G. Daniels |
Subject: |
Re: Sourcecode in the internet? |
Date: |
29 Jan 2000 11:40:04 -0800 |
User-agent: |
Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.4 |
>>>>> "KR" == Konrad Richter <address@hidden> writes:
KR> Can anyone show me the way to
KR> sourcecode that uses EZBin and is available in the internet?
With 2.0.1 you'd get an OffsetOutOfRange error if you changed
"#if 1" below to "#if 0". That won't happen if you update your
$SWARMHOME/bin/swarm.dll to the one in
ftp://ftp.santafe.edu/pub/swarm/2.0.1-fixes.
#import <simtools.h>
#import <analysis.h>
#import <defobj/Create.h>
#import <simtoolsgui/GUISwarm.h>
@interface Agent: CreateDrop
{
double value;
}
- setAgentValue: (double)value;
- (double)getAgentValue;
@end
@implementation Agent
- setAgentValue: (double)theValue
{
value = theValue;
return self;
}
- (double)getAgentValue
{
return value;
}
@end
@interface ObserverSwarm: GUISwarm
{
id <Schedule> schedule;
id <EZBin> graph;
id <List> list;
}
- createEnd;
- buildActions;
- step;
@end
@implementation ObserverSwarm
#define AGENT(val) [[[Agent createBegin: globalZone] setAgentValue: val]
createEnd]
- createEnd
{
[super createEnd];
list = [List create: globalZone];
#if 1
[list addLast: AGENT (1.0)];
[list addLast: AGENT (2.0)];
[list addLast: AGENT (3.0)];
#endif
graph = [EZBin createBegin: globalZone];
[graph setTitle: "EZBin"];
[graph setAxisLabelsX: "X label" Y: "Y label"];
[graph setBinCount: 10];
[graph setLowerBound: 0];
[graph setUpperBound: 5];
[graph setCollection: list];
[graph setProbedSelector: M(getAgentValue)];
graph = [graph createEnd];
return self;
}
- buildActions
{
schedule = [[[Schedule createBegin: self]
setRepeatInterval: 1]
createEnd];
[schedule at: 0 createActionTo: self message: M(step)];
return self;
}
- step
{
[graph reset];
[graph update];
[graph output];
[actionCache doTkEvents];
return self;
}
- activateIn: swarmContext
{
[super activateIn: swarmContext];
[schedule activateIn: self];
return [self getActivity];
}
@end
int
main (int argc, const char **argv)
{
id observerSwarm;
initSwarm (argc, argv);
observerSwarm = [ObserverSwarm create: globalZone];
[observerSwarm buildObjects];
[observerSwarm buildActions];
[observerSwarm activateIn: nil];
[observerSwarm go];
return 0;
}
/*
Local Variables:
compile-command: "$SWARMHOME/bin/libtool-swarm --mode=link gcc -o ezbin -Wall
-Werror -g -Wno-import -I$SWARMHOME/include -L$SWARMHOME/lib ezbin.m -lswarm
-lobjc"
End:
*/
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.