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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM,T_HK_NAME_FM_MR_MRS autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,d253eb7042ff641 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!k19g2000yqc.googlegroups.com!not-for-mail From: "Mr.Spark" Newsgroups: comp.lang.ada Subject: Re: a slight problem need some help. Simulation Control System Date: Sat, 14 Nov 2009 01:06:46 -0800 (PST) Organization: http://groups.google.com Message-ID: <49caecd5-f0ec-497b-88db-e2ec58f2afdf@k19g2000yqc.googlegroups.com> References: <1ca4f848-7e5e-4524-8df3-43ea76caafbc@s15g2000yqs.googlegroups.com> <0e354dda-8ba6-498e-a7d9-a577edcc22e3@a21g2000yqc.googlegroups.com> NNTP-Posting-Host: 91.105.115.59 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1258189606 2335 127.0.0.1 (14 Nov 2009 09:06:46 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 14 Nov 2009 09:06:46 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: k19g2000yqc.googlegroups.com; posting-host=91.105.115.59; posting-account=9cnuMgoAAACVm1EM80Y3k6mYMNXtvlB3 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; ar; rv:1.9.0.14) Gecko/2009082707 Firefox/3.0.14 (.NET CLR 3.5.30729),gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:8101 Date: 2009-11-14T01:06:46-08:00 List-Id: On Nov 13, 4:54=A0pm, Phil Thornley wrote: > On 13 Nov, 16:09, "Mr.Spark" wrote: > > > > > I had a problem when I run examiner to check if the body package is > > working fine but the problem it gives me: > > > Specification Part: > > > with Sensor, Pump; > > > --# inherit Sensor, Pump; > > > package Tank > > > --# own Tank_Level; > > --# initializes Tank_Level; > > > is > > =A0 =A0procedure Control; > > > =A0 =A0--# global out Tank_Level; > > =A0 =A0--# =A0 =A0 =A0 =A0in Sensor.Level; > > =A0 =A0--# =A0 =A0 =A0 =A0in out Pump.Pump_Open; > > =A0 =A0--# derives Tank_Level from Sensor.Level & > > =A0 =A0--# =A0 =A0 =A0 =A0 Pump.Pump_Open from Sensor.Level, Pump.Pump_= Open; > > > end Tank; > > > Body Package Is : > > > with Sensor, Pump; > > > package body Tank > > > is > > > =A0 =A0Empty: constant Sensor.Level_Type :=3D 10; > > =A0 =A0Full: constant Sensor.Level_Type :=3D 60; > > > =A0 =A0-- this procedure controls the operation of pumps when they shou= ld > > be opened > > =A0 =A0-- or closed for the safety of the system. The pump will be clos= ed > > if the > > =A0 =A0-- Water Level Tank is <=3D 10 and it will be Opened if the Wate= r > > Level > > =A0 =A0-- in Tank >=3D 60. > > > =A0 =A0procedure Control > > =A0 =A0is > > =A0 =A0 =A0 Tank_Level: Sensor.Level_Type; > > =A0 =A0begin > > > =A0 =A0 =A0 Tank_Level:=3D Sensor.Get_Level; > > =A0 =A0 =A0 if Tank_Level <=3D Empty then > > =A0 =A0 =A0 =A0 =A0Pump.Close; > > =A0 =A0 =A0 elsif Tank_Level >=3D Full then > > =A0 =A0 =A0 =A0 =A0Pump.Open; > > =A0 =A0 =A0 end if; > > =A0 =A0end Control; > > > end Tank; > > > The errors that it shows are : > > > 1.Semantic Error : Ilegal redeclaration of identifier Tank_Level; > > 2.Semantic Error : The Identifier is either undeclared or not visible > > at his point > > 3.Semantic Error : The Identifier is either undeclared or not visible > > at his point1. > > 4.Semantic Error : The Identifier is either undeclared or not visible > > at his point > > 5.Semantic Error : The own variable Tank_Level does not have a > > definition > > > If you could give me a hint how to solve this problem it would be > > great. > > The main problem is that the 'own' annotation on the spec states that > the variable Tank_Level will be declared in the package body - as > permanent data. =A0But the code only creates it as local data within the > Control procedure. =A0So Tank_Level is created as uninitialised data > each time that the Control procedure is invoked. > > If you move the declaration of Tank_Level to the package body then you > will remove some of the errors. =A0Alterntively if the data should be > local to the Control procedure then it should not be declared as 'own' > data in the package specification. > > For more accurate error diagnosis, include at least the specs of all > the other referenced packages (ie Sensor and Pump in this case) so > that we can do a complete SPARK run. > > Cheers, > > Phil Hi Phil, Thanks a lot for replying in a short time. I Appreciate your help. that solved the problem. :)