comp.lang.ada
 help / color / mirror / Atom feed
* question about functions
@ 2000-01-20  0:00 Pascal LEJEUNE
  2000-01-20  0:00 ` Tucker Taft
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Pascal LEJEUNE @ 2000-01-20  0:00 UTC (permalink / raw)


Hello,

I would like to know if there is a "clean" (i.e. not compiler dependant)
solution to this problem :


- i have a function, for example : f(A, B : in T) return T
- how can i find the return address in f ?


I explain :
if C := f(A, B);

how can i know, in f, C's addres ?
function f(A, B : in T) return T is
   ...
begin
   ...
   address of the result of f ?
   ...
end f;


Thank you for your help



        Pascal LEJEUNE






^ permalink raw reply	[flat|nested] 17+ messages in thread
* question about functions
@ 2000-01-21  0:00 Pascal LEJEUNE
  2000-01-21  0:00 ` tmoran
  0 siblings, 1 reply; 17+ messages in thread
From: Pascal LEJEUNE @ 2000-01-21  0:00 UTC (permalink / raw)


Hello everybody,

Thank you for your replies !!!!
What I want to do, is to give my user the possibility of operators
to a type (for example C := A + B, C := A - B, C := A < B ...). This
type is not very complex (a record of 4 bytes).
Then, my operator is a rename of a function, for example :
function "+" (A, B : in T) return T renames ADD;

Finaly, my function ADD use a hardware component which do
the operation with the addresses (it's an asic which needs
to know on which variable the operation is done) :

function ADD (A, B : in T) return T is
   tmp : system.address;
begin
   << find the address of the result (that's my problem !!) >> and
   put it in a local variable (tmp)

   call a procedure which use directly the hardware :
   proc (a'address, b'address, tmp);
end ADD;

So, the problem is quite simple : the type T is a "numerical" type
on which it is normal to have operators ... but the hardware need
to have the address of the arguments and the address of the result !!!

I hope i'll find a "nice" solution (ie in Ada or C), but if it is
impossible,
i'll use ASM !


Thank you !!!


 Pascal LEJEUNE






^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2000-01-27  0:00 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-01-20  0:00 question about functions Pascal LEJEUNE
2000-01-20  0:00 ` Tucker Taft
2000-01-20  0:00 ` Stephen Leake
2000-01-22  0:00   ` Andy
2000-01-22  0:00     ` Matthew Heaney
2000-01-24  0:00     ` Stephen Leake
2000-01-22  0:00   ` Matthew Heaney
2000-01-24  0:00     ` Mats Weber
2000-01-24  0:00     ` Stephen Leake
2000-01-25  0:00       ` Matthew Heaney
2000-01-27  0:00         ` Stephen Leake
2000-01-20  0:00 ` Hyman Rosen
2000-01-20  0:00 ` David Starner
  -- strict thread matches above, loose matches on Subject: below --
2000-01-21  0:00 Pascal LEJEUNE
2000-01-21  0:00 ` tmoran
2000-01-21  0:00   ` Samuel T. Harris
2000-01-21  0:00     ` Stephen Leake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox