[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Argument passing in Schedule
From: |
Ho-Sheng Hsiao |
Subject: |
Re: Argument passing in Schedule |
Date: |
Sun, 9 Feb 1997 18:01:34 -0500 (EST) |
On Sun, 9 Feb 1997, glen e. p. ropella wrote:
> > The way I coded my model, I have a two schedules under one ModelSwarm. One
> > is the regular repeating schedule, and the other holds a discrete event
> > "scratch schedule" a la mousetraps.
> How and where did you activate the scratch schedule? Did you activateIn
> on the modelSwarm (self) or the modelSwarm's activity?
-activateIn: (id) swarmContext {
[super activateIn: swarmContext];
[modelSchedule activateIn: self];
[modelScratchSchedule activateIn: self];
return getActivity;
}
> > The definition for eventReceiveMessage is
> >
> > -(int) eventReceiveMessage: (RouterMessage *) msg;
> It looks to me like your selector is fine, at least in argument terms.
> If it's the problem, I would suspect the (int) return value before I
> would suspect the argument.
Actually, I did. I tried it with (void) and (id) -- same results. The NeXT
ObjC manual isn't clear if the return value affects the return value. In
any case, gcc warns of messages returning different return values (as
defined in @interface or @implementation).
> I would concentrate on checking the time at which you intend to send
> the message and what time getCurrentTime() + 1 is returning. BTW, in
I did that -- it looks fine. Of course, my only way of knowing that is
approximating the time on the graphs... any way to check for the exact time?
> your code fragment above, your parentheses are not closed around
> getCurrentTime() +1.
Oops. It's there in the original code, though.
> Anyway, you might also put something on the schedule before it's
> activated (so that it is non-zero to begin with) and see if it
> does that at least once.
Good idea... let's see: immediatly right after building the actions, I tried
sending the message. It works -- the schedule, the (debug) message).
However, I used a constant time (1) instead of (getCurrentTime() + 1)
since the app aborts... still, *during* the execution, the debug
message won't print out.
> > 1) I added a nil check for both target and modelScratchSchedule. The
> > modelScratchSchedule wasn't nil, but the target was. So I said to
> > myself, "maybe this will work". When I fixed that bug, the debug message
> > still doesn't print out.
>
> Are you saying that the target is no longer "nil?" I.e. that a
> message is, in fact, being sent to a valid object?
That's right: I fixed the bug that caused target to be nil, but the result
is still the same.
---hhh