* Re: Problem with packages [not found] <01bd706a$6007a540$db41a6c3@grat.softnet.co.uk> @ 1998-04-25 0:00 ` Tucker Taft 1998-04-27 0:00 ` Stephen Leake 1998-04-27 0:00 ` Samuel Mize 2 siblings, 0 replies; 3+ messages in thread From: Tucker Taft @ 1998-04-25 0:00 UTC (permalink / raw) Sean kenny (skenny@gifford.co.uk) wrote: : can anyone tell us why this the following code won't compile : we keep the following error message : invalid prefix in selected component "working_hold" : on the indicated lines : hold_id is defined in the following package which compiles : ok. The problem is that hold_id is a private type. You haven't exported any operations on hold_id, other than "request_work." If you want next_container and complete to be performed on hold_id, you will need to declare them in the visible part of "foreman." You could declare them as "regular" procedures in the visible part, with an extra "hold_id" formal parameter, and then implement them in the body of package "foreman" by calling the corresponding entry of the task type "hold." You could use a pragma Inline on these "wrapper" procedures if the extra procedure call overhead is a serious problem (seems unlikely in this case). : WITH foreman; : use foreman; : PACKAGE BODY gangs IS : TASK body gang is : hold_state : work := more; : working_hold: hold_id; : begin : foreman.request_work(working_hold); : WHILE hold_state = more loop : working_hold.next_container(hold_state); <---- : END loop; : : working_hold.complete; <------ : end gang; : END gangs; : package foreman is : type work is (more, finished); : type hold_id is limited private; : procedure request_work(this_hold : in out hold_id); : private : type hold; : type hold_id is access hold; : task type hold is : entry next_container(state : out work); : entry complete; : end hold; : end foreman;-- : ---------------------------------------------------------------------------- : ------------------- : You've received this mail from one of the Kenny : -Irvine clan, it could have been Sean, Hilary, : Eileen(10),Joe(9) or Neave (6mths). : If you want to mail us its skenny@gifford.co.uk : or : skenny@csm.uwe.ac.uk -- -Tucker Taft stt@inmet.com http://www.inmet.com/~stt/ Intermetrics, Inc. Burlington, MA USA ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Problem with packages [not found] <01bd706a$6007a540$db41a6c3@grat.softnet.co.uk> 1998-04-25 0:00 ` Problem with packages Tucker Taft @ 1998-04-27 0:00 ` Stephen Leake 1998-04-27 0:00 ` Samuel Mize 2 siblings, 0 replies; 3+ messages in thread From: Stephen Leake @ 1998-04-27 0:00 UTC (permalink / raw) Sean kenny wrote: > > can anyone tell us why this the following code won't compile > we keep the following error message > > invalid prefix in selected component "working_hold" > > on the indicated lines > > hold_id is defined in the following package which compiles > ok. You've defined Hold_ID as a "limited private" type. This means client packages (like gang) cannot access any elements of the type directly. Either make the type not limited, or provide a function in package foreman that gives you the access you need. -- Stephe > > WITH foreman; > use foreman; > > PACKAGE BODY gangs IS > TASK body gang is > hold_state : work := more; > working_hold: hold_id; > begin > foreman.request_work(working_hold); > WHILE hold_state = more loop > working_hold.next_container(hold_state); <---- > END loop; > > working_hold.complete; <------ > end gang; > > END gangs; > > package foreman is > > type work is (more, finished); > type hold_id is limited private; > > procedure request_work(this_hold : in out hold_id); > private > type hold; > type hold_id is access hold; > task type hold is > entry next_container(state : out work); > entry complete; > end hold; > end foreman;-- > ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Problem with packages [not found] <01bd706a$6007a540$db41a6c3@grat.softnet.co.uk> 1998-04-25 0:00 ` Problem with packages Tucker Taft 1998-04-27 0:00 ` Stephen Leake @ 1998-04-27 0:00 ` Samuel Mize 2 siblings, 0 replies; 3+ messages in thread From: Samuel Mize @ 1998-04-27 0:00 UTC (permalink / raw) Sean kenny <skenny@gifford.co.uk> wrote: >can anyone tell us why this the following code won't compile The variable working_hold is of type hold_id, which is limited private. Nobody outside the package Foreman can see that it's an access to a task. Best, Sam Mize >WITH foreman; >use foreman; ... > working_hold: hold_id; >begin ... > working_hold.next_container(hold_state); <---- ... > working_hold.complete; <------ ... >package foreman is ... >type hold_id is limited private; -- Samuel Mize -- smize@imagin.net (home email) -- Team Ada Multi-part MIME message: " ", " ", " " (hands waving) Fight Spam - see http://www.cauce.org/ ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1998-04-27 0:00 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <01bd706a$6007a540$db41a6c3@grat.softnet.co.uk> 1998-04-25 0:00 ` Problem with packages Tucker Taft 1998-04-27 0:00 ` Stephen Leake 1998-04-27 0:00 ` Samuel Mize
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox