[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: reprise: interface declaration
From: |
Marcus G. Daniels |
Subject: |
Re: reprise: interface declaration |
Date: |
11 Oct 2000 09:41:44 -0700 |
User-agent: |
Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.4 |
>>>>> "DC" == Daniel Calhoun <address@hidden> writes:
[Daniel sent me the model]
DC> In file included from ModelSwarm.h:6, from Band.h:10, from
DC> Band.m:3: Post.h:14: Cannot find interface declaration for `Band',
DC> superclass of `Post'
So here are the changes I'd suggest. The problem was that you had
ModelSwarm.h included in the files below, which made the includes happen
in a different order than you probably anticipated. The only time you
really ought to include a ModelSwarm in an agent type file is when
you need the agent to seem some global state or do behind-the-scenes
global bookkeeping, etc.
Note the last chunk was a workaround fix to get the thing to run.
It can happen modelSwarm isn't initialized at that point in Post.m.
The other printf thing is just a picky typing thing you'll see on some
systems.
Also I changed "food" to not conform to the Discrete2d protocol because
you use it with some additional methods from FoodSpace. So I statically
typed it.
To apply the patches run:
$ cd bandarch
$ patch -p1 < the-file-below
diff -c -r band-orig/Band.h band/Band.h
*** band-orig/Band.h Wed Oct 11 06:57:12 2000
--- band/Band.h Wed Oct 11 10:31:27 2000
***************
*** 9,15 ****
// NB: Large sections commented out below are those not yet reinstated during
rebuild.
- #import "ModelSwarm.h"
//#import "Council.h"
#import "Herd.h"
#import "FoodSpace.h"
--- 9,14 ----
diff -c -r band-orig/FoodSpace.h band/FoodSpace.h
*** band-orig/FoodSpace.h Sat Oct 7 07:47:40 2000
--- band/FoodSpace.h Wed Oct 11 10:32:24 2000
***************
*** 1,6 ****
// FoodSpace.h
- #import "ModelSwarm.h"
#import "Band.h"
#import <space/Discrete2d.h>
--- 1,5 ----
diff -c -r band-orig/Herd.h band/Herd.h
*** band-orig/Herd.h Wed Oct 11 07:32:08 2000
--- band/Herd.h Wed Oct 11 10:31:35 2000
***************
*** 1,6 ****
// Herd.h gtplains
- #import "ModelSwarm.h"
#import <objectbase/SwarmObject.h>
#import <space.h>
#import <gui.h>
--- 1,5 ----
diff -c -r band-orig/ModelSwarm.h band/ModelSwarm.h
*** band-orig/ModelSwarm.h Wed Oct 11 07:09:56 2000
--- band/ModelSwarm.h Wed Oct 11 10:28:48 2000
***************
*** 20,26 ****
// float avgMember;
// float avgPaired;
! id <Discrete2d> food;
id <Grid2d> world;
id <Grid2d> momWorld;
id <Discrete2d> specs;
--- 20,26 ----
// float avgMember;
// float avgPaired;
! FoodSpace *food;
id <Grid2d> world;
id <Grid2d> momWorld;
id <Discrete2d> specs;
diff -c -r band-orig/ModelSwarm.m band/ModelSwarm.m
*** band-orig/ModelSwarm.m Wed Oct 11 07:20:26 2000
--- band/ModelSwarm.m Wed Oct 11 10:30:29 2000
***************
*** 863,870 ****
[specs putValue: 2 atX: worldXSize*i/4 Y: (worldYSize -
worldYSize*i/4)];
[postList addLast: aPost];
! printf ("postList %d %d \n", [postList getCount],
! [specs getValueAtX: (int) worldXSize*i/4 Y: (int)(worldYSize -
worldYSize*i/4)]);
}
--- 863,870 ----
[specs putValue: 2 atX: worldXSize*i/4 Y: (worldYSize -
worldYSize*i/4)];
[postList addLast: aPost];
! printf ("postList %u %ld\n", [postList getCount],
! [specs getValueAtX: (unsigned) worldXSize*i/4 Y: (unsigned)(worldYSize
- worldYSize*i/4)]);
}
diff -c -r band-orig/Post.m band/Post.m
*** band-orig/Post.m Wed Oct 11 07:48:14 2000
--- band/Post.m Wed Oct 11 10:33:17 2000
***************
*** 149,155 ****
{
int week, year;
! week= [[modelSwarm getActivity] getCurrentTime];
year=week/60;
week=week%60;
--- 149,158 ----
{
int week, year;
! if (modelSwarm)
! week= [[modelSwarm getActivity] getCurrentTime];
! else
! week = 0;
year=week/60;
week=week%60;
==================================
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.