From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,688b25ba856f42d7 X-Google-Attributes: gid103376,public From: "David C. Hoos, Sr." Subject: Re: question about functions (bis) Date: 2000/01/21 Message-ID: #1/1 X-Deja-AN: 575664056 Content-Transfer-Encoding: 7bit References: <8690s0$8tq$1@news.mgn.net> Content-Type: text/plain; charset="iso-8859-1" X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 X-ELN-Date: Fri Jan 21 01:58:55 2000 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 948448735 158.252.123.210 (Fri, 21 Jan 2000 01:58:55 PST) Organization: Ada95 Press, Inc. MIME-Version: 1.0 NNTP-Posting-Date: Fri, 21 Jan 2000 01:58:55 PST Newsgroups: comp.lang.ada Date: 2000-01-21T00:00:00+00:00 List-Id: Pascal LEJEUNE wrote in message news:8690s0$8tq$1@news.mgn.net... > 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 ! Why don't you declare a local variable for the result, then after the hardware has done its job, return the value of the result to the caller, say, as follows: function ADD (A, B : in T) return T is tmp : T; begin call a procedure which use directly the hardware : proc (a'address, b'address, tmp'address); return tmp; end ADD;