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,FREEMAIL_FROM, INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3cfb384718eb4f7a X-Google-Attributes: gid103376,public From: "Corey Ashford" Subject: Re: question re Ada equivalent of C function Date: 1998/02/21 Message-ID: <6cnj5d$bjq$1@usenet.rational.com>#1/1 X-Deja-AN: 327358880 References: <34EEFF9C.1D01FA5D@stellar1.com> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Organization: Rational Software Newsgroups: comp.lang.ada Date: 1998-02-21T00:00:00+00:00 List-Id: David Fisher wrote in message <34EEFF9C.1D01FA5D@stellar1.com>... >Sorry if this is a bit basic, but learning Ada on one's own can be, er, >challenging. > >What are the Ada equivalents of the C functions, inp and outp, used to >read a byte from or send one to a memory address? > >Thanks! > >David Fisher >Fisher Research Corporation > There are a number of ways to do this in Ada. Here's one fairly simple one: with unchecked_conversion; with system; type byte is mod 2*8; type byte_access is access byte; function to_byte_access is new unchecked_conversion(system.address, byte_access); function inp(addr: system.address) return byte is begin return to_byte_access(addr).all; end inp; procedure outp(addr: system.address; value: byte) is begin to_byte_access(addr).all := value; end outp;