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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,263d6079ff6f1361 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews1.google.com!not-for-mail From: jpwoodruff@irisinternet.net (John Woodruff) Newsgroups: comp.lang.ada Subject: Re: generic and visibility Date: 4 Nov 2004 19:39:37 -0800 Organization: http://groups.google.com Message-ID: <34defe4d.0411041939.2969990@posting.google.com> References: <1099581795.057353.199160@c13g2000cwb.googlegroups.com> NNTP-Posting-Host: 66.81.68.189 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1099625978 31973 127.0.0.1 (5 Nov 2004 03:39:38 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 5 Nov 2004 03:39:38 +0000 (UTC) Xref: g2news1.google.com comp.lang.ada:5997 Date: 2004-11-04T19:39:37-08:00 List-Id: "mferracini" wrote in message news:<1099581795.057353.199160@c13g2000cwb.googlegroups.com>... > i'm new on ADA, and i hav some problem > with generic. > > this is an exemple > > > > ------------------------------------ > package Manage is > generic > Id : integer; > with procedure Init; > with procedure Job; > package Det is > > procedure Start( > Status : out Integer ); > end Det; > end Manage; > > ---------------------------------------- > > with Ada.Text_Io; > with Ada.Task_Identification; > > package body Applicazione is > I : Integer := 0; > > procedure Init is > begin > I:=1; > end Init; > > procedure Job is > begin > Ada.Text_Io.Put(Item => "> mi sbatto! "); > I:=I+1; > Ada.Text_Io.Put(Item => Integer'Image (I)); > Ada.Text_Io.New_Line; > end Job; > > end Applicazione; > ----------------------------------------- > > with Manage; > with Applicazione; > > > package Fake_App is new Manage_Task.Det_Task_M_Pack > ( > Id_task => 1, > Init_Job => Applicazione.Init, > Job => Applicazione.Job); > > --------------- > > > with Fake_App; > > procedure Test is > begin > Fake_app.job; > end Test; > > --------------------------------------------------------------------------------- > job in not a visible entry of fake_app > > how i can do? > thanks I'm guessing "homework" here, so I'll give (I hope) constructive hints, but not solve the problem completely ---- You have omitted a couple items that are needed before I can answer your direct question. You need to give a specification for the package Applicazione. You gave only a body, and every package needs a spec (most need a body as well). It probably looks like this: package Applicazione is procedure Init ; procedure Job ; end Applicazione; ----- Next, your package that you call "Fake_App" is not correct. Manage contains an internal package called Det. So you need to "instantiate" that internal package by naming it properly when you say something like package Fake_App is new <> with its parameters. ----- Then finally, why are you unable to find an entry "job" in the instance called Fake_App? When you make a new instance (the thing you're calling Fake_App), it has the subprograms that were visible in its spec. Start is the ONLY visible subprogram declared. Consider the difference between the generic formal procedure "Job" and the procedure Start. HTH John