* Re: Aritmetics on numeric types
[not found] <vhi3dzx601l.fsf@sigrlinn.ifi.uio.no>
@ 1999-06-12 0:00 ` David C. Hoos, Sr.
1999-06-12 0:00 ` Robert Dewar
0 siblings, 1 reply; 2+ messages in thread
From: David C. Hoos, Sr. @ 1999-06-12 0:00 UTC (permalink / raw)
Jan Kroken <jankr@nntp.ifi.uio.no> wrote in message
news:vhi3dzx601l.fsf@sigrlinn.ifi.uio.no...
>
> I have this code:
>
> package Types is
> type Score is range 0 .. 99999999999; for Score'Size use 64;
> end Types;
>
> Points : Types.Score; pragma import(C,Score,"score");
> function C_Bind_Compute_Score(level,humans,moves:Interfaces.C.Int)
> return Types.Score;
> pragma import(C,C_Bind_Compute_Score,"c_bind_compute_score");
> ....
> Points := C_Bind_Compute_Score(Level,Humans,Moves);
>
>
> in C:
> score c_bind_compute_score(int level, int humans, int moves){
> return points +
> ((Score)sqrt(((level+1)*humans*10000)/(moves+1)))*(level+1);
> }
>
>
>
> Now I want to eliminate the C function. But I don't know how to
> do aritmetic operations on Types.Score.
> Points := Points + ... resultet in
>
> game.adb:208:27: operator for type "Score" defined at types.ads:6 is not
directly visible
> game.adb:208:27: use clause would make operation legal
>
> I tried to add "use Types.Score", but that did not change anything.
>
> Help!
You need to say
use type Types.Score;
This makes the primitive operations of Types.scope visible
anywhere in the scope where the use clause appears, following
its appearance.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Aritmetics on numeric types
1999-06-12 0:00 ` Aritmetics on numeric types David C. Hoos, Sr.
@ 1999-06-12 0:00 ` Robert Dewar
0 siblings, 0 replies; 2+ messages in thread
From: Robert Dewar @ 1999-06-12 0:00 UTC (permalink / raw)
In article <bJ3mcLNt#GA.203@newstoo.hiwaay.net>,
"David C. Hoos, Sr." <david.c.hoos.sr@ada95.com> wrote:
> You need to say
>
> use type Types.Score;
>
> This makes the primitive operations of Types.scope visible
> anywhere in the scope where the use clause appears, following
> its appearance.
or simply
use Types;
but what you tried was some peculiar mixture of the two clearly
not allowed by the language.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1999-06-12 0:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <vhi3dzx601l.fsf@sigrlinn.ifi.uio.no>
1999-06-12 0:00 ` Aritmetics on numeric types David C. Hoos, Sr.
1999-06-12 0:00 ` Robert Dewar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox