comp.lang.ada
 help / color / mirror / Atom feed
From: Bill Pritchett <bpritchett@std.caci.com>
Subject: Protected Type Question
Date: 1996/03/20
Date: 1996-03-20T00:00:00+00:00	[thread overview]
Message-ID: <31502A7B.2885@std.caci.com> (raw)

I have a question regarding protected types.  Specifically, I've been trying to figure out
how to pin a protected object to a specific memory location.  The two ways I have tried are as 
follows:

  procedure Test is

    protected type Sensor (Sensor_Address : System.Address) is
      function Get_Value return Integer;
    private
      The_Sensor : Integer;
      for The_Sensor'Address use Sensor_Address;
    end Sensor;
    ...
    Sensor1 : Sensor(..);
  begin
    ...
  end Test;

GNAT bombs on this incorrectly stating 'missing "end Sensor"' which throws the rest of the 
compilation out of whack.  I'm pretty sure this is NOT legal anyway.

The second alternative is this

  procedure Test is

     protected type Sensor is
       function Get_Value return Integer;
     private
       The_Sensor : Integer;
     end Sensor;
     ...
     Sensor1 : Sensor;
     for Sensor1'Address use ...;

  begin
   ...
  end Test;

This compiles.  When I execute this it bombs (partly because I have no clue of what's at the 
address I give it).  My question is what does the address (Sensor1'Address) represent?  Is it the 
address to the object as a whole or to The_Sensor (what I want)?  If it is to the object as a 
whole, then how does one specify a particular address for a protected object?  Is it possible 
directly?

Thanks,
Bill Pritchett
CACI, Inc.




             reply	other threads:[~1996-03-20  0:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-03-20  0:00 Bill Pritchett [this message]
1996-03-20  0:00 ` Protected Type Question Robert Dewar
  -- strict thread matches above, loose matches on Subject: below --
2000-12-12  1:45 Beard, Frank
2000-12-12  2:51 ` Robert Dewar
     [not found] <B6A1A9B09E52D31183ED00A0C9E0888C46992F@nctswashxchg.nctswash.navy.mil>
2000-12-12  3:39 ` tmoran
2000-12-12  5:49 Beard, Frank
2000-12-12 10:54 ` Robert Dewar
2000-12-12  6:43 Beard, Frank
2000-12-13 23:23 Beard, Frank
2004-01-03 20:58 protected type question shoko
2004-01-04  0:50 ` James Rogers
2004-01-04  1:04 ` Robert I. Eachus
replies disabled

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