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 autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,daf3a0910fbd55c X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!l14g2000yqb.googlegroups.com!not-for-mail From: stuart clark Newsgroups: comp.lang.ada Subject: Re: how to i get the type of a parameter specification is ASIS Date: Mon, 25 Oct 2010 06:32:47 -0700 (PDT) Organization: http://groups.google.com Message-ID: <421b3b56-b784-48e3-a0fc-38b1dbd81052@l14g2000yqb.googlegroups.com> References: <7a87e044-ad32-47bd-90cf-060d8c5b3a20@v20g2000yqb.googlegroups.com> <7413fd4e-7cf6-494b-a73b-be0833372dac@g13g2000yqj.googlegroups.com> <59c38ed3-2a17-4db7-841f-75b4d050c780@v20g2000yqb.googlegroups.com> NNTP-Posting-Host: 115.64.246.86 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1288013567 19379 127.0.0.1 (25 Oct 2010 13:32:47 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 25 Oct 2010 13:32:47 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: l14g2000yqb.googlegroups.com; posting-host=115.64.246.86; posting-account=MZK52AoAAABSzwZnz7ceKVzE2LKWwfyu User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10,gzip(gfe) Xref: g2news1.google.com comp.lang.ada:14751 Date: 2010-10-25T06:32:47-07:00 List-Id: On Oct 25, 10:24=A0pm, Julian Leyh wrote: > On 25 Okt., 15:12, stuart clark wrote: > > > > > On Oct 25, 10:07=A0pm, Julian Leyh wrote: > > > > On 25 Okt., 13:55, stuart clark wrote: > > > > > 1) i am getting the parameter_specification using > > > > > =A0params : Asis.Parameter_Specification_List :=3D > > > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0asis.Declarations.Parameter_Prof= ile > > > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(element); > > > > > 2) from params i am getting the parameter name using > > > > > =A0names: asis.Defining_Name_list :=3D > > > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0asis.declarations.Na= mes(params(i)); > > > > > 3) i am also getting the parameter mode_kind using > > > > > mode_kind : Asis.Mode_Kinds :=3D > > > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0asis.elements.mode_k= ind > > > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(params(i)); > > > > > it looks like this > > > > > param =A0=3D =A0b : in out float > > > > name =A0=3D =A0 b > > > > mode kind =A0=3D AN_IN_OUT_MODE > > > > > but i also want the type of the parameter, eg float. > > > > > anybody know how ??? > > > > from AdaBrowse source: > > > > =A0 =A0 =A0 declare > > > =A0 =A0 =A0 =A0 =A0Params : constant Parameter_Specification_List := =3D > > > =A0 =A0 =A0 =A0 =A0 =A0Parameter_Profile (Decl); > > > =A0 =A0 =A0 begin > > > =A0 =A0 =A0 =A0 =A0for I in Params'Range loop > > > =A0 =A0 =A0 =A0 =A0 =A0 declare > > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0T : constant Type_Descriptor :=3D > > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Type_Of (Declaration_Subtype_Mark = (Params (I))); > > > =A0 =A0 =A0 =A0 =A0 =A0 begin > > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if T.Attrs =3D No_Attributes and then > > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Is_Equal (T.Decl, The_Type) > > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0then > > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return True; > > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0end if; > > > =A0 =A0 =A0 =A0 =A0 =A0 end; > > > =A0 =A0 =A0 =A0 =A0end loop; > > > =A0 =A0 =A0 end; > > > thanks but which package is type_descriptor from ??? > > Oh, sorry... Type_Descriptor and Type_Of are from AdaBrowse... You > could have a look at the body of Type_Of to find out how they did it. > > AdaBrowse:http://home.tiscalinet.ch/t_wolf/tw/ada95/adabrowse/ this works... declare x: Asis.Expression :=3D asis.declarations.Declaration_Subtype_Mark (Params (I)); begin ada.Text_IO.Put_Line("type =3D " & =20 ada.characters.Handling.To_String =20 (asis.Text.Element_Image(x))); end; thanks heaps, i've been doing it the dumb way, ie parsing strings searching/deleting/using :in out etc.