[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problems with createActionTo and arg types...
From: |
Pietro Terna |
Subject: |
Re: Problems with createActionTo and arg types... |
Date: |
Wed, 27 Aug 1997 11:46:06 +0200 |
At 00.39 27/08/97 -0400, you wrote:
>Alex Lancaster wrote:
>>
>> Dear Swarm folks,
>>
>> I am trying to create a dynamic schedule using a createActionTo message.
>>
>> The Swarm interface guide says that when creating an action to with one or
>> more arguments, the argument needs to be cast to the Objective C id type,
>> to whit:
>>
>> [createActionTo: neurone message: M(receivePulse:) : (id) pulseAmplitude]
>>
>> This seems fine if the type of the argument (i.e. pulseAmplitude in the
>> above e.g.) is an integer. But gcc won't allow compilation if the argument
>> is a float, with an error message to the effect "can't cast that arg to a
>> pointer". (I can send the exact code and error message if necessary).
>>
>> Is this a known problem? If so, are there any workarounds? I really need my
>> arguments to be floats, as integers are far too coarse to represent the
>> variables in my model.
>>
>> Any ideas?
>
>This might be a stupid suggestion, but what if you divided up the float
>into the mantissa and the exponent, and store both of these as integers
>(or long integers) and then pass them into the method as integers cast
>to ids, and then inside the method "reconvert" them back to floats?
>I know theres got to be a simplier way....
>
>Brad.
An other solution (the previous is not a stupid suggestion; my attempt, may
be ...):
to have pulseAmplitude in an object; to transfer to neurone the address of
that object, which have to reply to a method like givePulseAmplitude when
is accessed by neurone;
i.e. to replace
[createActionTo: neurone message: M(receivePulse:) : (id) pulseAmplitude];
with something like
[createActionTo: neurone message: M(keepPulseFrom:) :
anObjectContainingPulseAmplitude];
Yours, Pietro
==================================
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.
==================================