comp.lang.ada
 help / color / mirror / Atom feed
* how to i get the type of a parameter specification is ASIS
@ 2010-10-25 11:55 stuart clark
  2010-10-25 13:07 ` Julian Leyh
  0 siblings, 1 reply; 6+ messages in thread
From: stuart clark @ 2010-10-25 11:55 UTC (permalink / raw)


1) i am getting the parameter_specification using

 params : Asis.Parameter_Specification_List :=
                 asis.Declarations.Parameter_Profile
                   (element);

2) from params i am getting the parameter name using

 names: asis.Defining_Name_list :=
                       asis.declarations.Names(params(i));

3) i am also getting the parameter mode_kind using

mode_kind : Asis.Mode_Kinds :=
                       asis.elements.mode_kind
                         (params(i));

it looks like this

param  =  b : in out float
name  =   b
mode kind  = AN_IN_OUT_MODE

but i also want the type of the parameter, eg float.

anybody know how ???



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: how to i get the type of a parameter specification is ASIS
  2010-10-25 11:55 how to i get the type of a parameter specification is ASIS stuart clark
@ 2010-10-25 13:07 ` Julian Leyh
  2010-10-25 13:12   ` stuart clark
  0 siblings, 1 reply; 6+ messages in thread
From: Julian Leyh @ 2010-10-25 13:07 UTC (permalink / raw)


On 25 Okt., 13:55, stuart clark <clark.stuart...@gmail.com> wrote:
> 1) i am getting the parameter_specification using
>
>  params : Asis.Parameter_Specification_List :=
>                  asis.Declarations.Parameter_Profile
>                    (element);
>
> 2) from params i am getting the parameter name using
>
>  names: asis.Defining_Name_list :=
>                        asis.declarations.Names(params(i));
>
> 3) i am also getting the parameter mode_kind using
>
> mode_kind : Asis.Mode_Kinds :=
>                        asis.elements.mode_kind
>                          (params(i));
>
> it looks like this
>
> param  =  b : in out float
> name  =   b
> mode kind  = AN_IN_OUT_MODE
>
> but i also want the type of the parameter, eg float.
>
> anybody know how ???

from AdaBrowse source:

      declare
         Params : constant Parameter_Specification_List :=
           Parameter_Profile (Decl);
      begin
         for I in Params'Range loop
            declare
               T : constant Type_Descriptor :=
                 Type_Of (Declaration_Subtype_Mark (Params (I)));
            begin
               if T.Attrs = No_Attributes and then
                  Is_Equal (T.Decl, The_Type)
               then
                  return True;
               end if;
            end;
         end loop;
      end;



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: how to i get the type of a parameter specification is ASIS
  2010-10-25 13:07 ` Julian Leyh
@ 2010-10-25 13:12   ` stuart clark
  2010-10-25 13:24     ` Julian Leyh
  0 siblings, 1 reply; 6+ messages in thread
From: stuart clark @ 2010-10-25 13:12 UTC (permalink / raw)


On Oct 25, 10:07 pm, Julian Leyh <jul...@vgai.de> wrote:
> On 25 Okt., 13:55, stuart clark <clark.stuart...@gmail.com> wrote:
>
>
>
> > 1) i am getting the parameter_specification using
>
> >  params : Asis.Parameter_Specification_List :=
> >                  asis.Declarations.Parameter_Profile
> >                    (element);
>
> > 2) from params i am getting the parameter name using
>
> >  names: asis.Defining_Name_list :=
> >                        asis.declarations.Names(params(i));
>
> > 3) i am also getting the parameter mode_kind using
>
> > mode_kind : Asis.Mode_Kinds :=
> >                        asis.elements.mode_kind
> >                          (params(i));
>
> > it looks like this
>
> > param  =  b : in out float
> > name  =   b
> > mode kind  = AN_IN_OUT_MODE
>
> > but i also want the type of the parameter, eg float.
>
> > anybody know how ???
>
> from AdaBrowse source:
>
>       declare
>          Params : constant Parameter_Specification_List :=
>            Parameter_Profile (Decl);
>       begin
>          for I in Params'Range loop
>             declare
>                T : constant Type_Descriptor :=
>                  Type_Of (Declaration_Subtype_Mark (Params (I)));
>             begin
>                if T.Attrs = No_Attributes and then
>                   Is_Equal (T.Decl, The_Type)
>                then
>                   return True;
>                end if;
>             end;
>          end loop;
>       end;

thanks but which package is type_descriptor from ???



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: how to i get the type of a parameter specification is ASIS
  2010-10-25 13:12   ` stuart clark
@ 2010-10-25 13:24     ` Julian Leyh
  2010-10-25 13:26       ` stuart clark
  2010-10-25 13:32       ` stuart clark
  0 siblings, 2 replies; 6+ messages in thread
From: Julian Leyh @ 2010-10-25 13:24 UTC (permalink / raw)


On 25 Okt., 15:12, stuart clark <clark.stuart...@gmail.com> wrote:
> On Oct 25, 10:07 pm, Julian Leyh <jul...@vgai.de> wrote:
>
>
>
> > On 25 Okt., 13:55, stuart clark <clark.stuart...@gmail.com> wrote:
>
> > > 1) i am getting the parameter_specification using
>
> > >  params : Asis.Parameter_Specification_List :=
> > >                  asis.Declarations.Parameter_Profile
> > >                    (element);
>
> > > 2) from params i am getting the parameter name using
>
> > >  names: asis.Defining_Name_list :=
> > >                        asis.declarations.Names(params(i));
>
> > > 3) i am also getting the parameter mode_kind using
>
> > > mode_kind : Asis.Mode_Kinds :=
> > >                        asis.elements.mode_kind
> > >                          (params(i));
>
> > > it looks like this
>
> > > param  =  b : in out float
> > > name  =   b
> > > mode kind  = AN_IN_OUT_MODE
>
> > > but i also want the type of the parameter, eg float.
>
> > > anybody know how ???
>
> > from AdaBrowse source:
>
> >       declare
> >          Params : constant Parameter_Specification_List :=
> >            Parameter_Profile (Decl);
> >       begin
> >          for I in Params'Range loop
> >             declare
> >                T : constant Type_Descriptor :=
> >                  Type_Of (Declaration_Subtype_Mark (Params (I)));
> >             begin
> >                if T.Attrs = No_Attributes and then
> >                   Is_Equal (T.Decl, The_Type)
> >                then
> >                   return True;
> >                end if;
> >             end;
> >          end loop;
> >       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/



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: how to i get the type of a parameter specification is ASIS
  2010-10-25 13:24     ` Julian Leyh
@ 2010-10-25 13:26       ` stuart clark
  2010-10-25 13:32       ` stuart clark
  1 sibling, 0 replies; 6+ messages in thread
From: stuart clark @ 2010-10-25 13:26 UTC (permalink / raw)


On Oct 25, 10:24 pm, Julian Leyh <jul...@vgai.de> wrote:
> On 25 Okt., 15:12, stuart clark <clark.stuart...@gmail.com> wrote:
>
>
>
> > On Oct 25, 10:07 pm, Julian Leyh <jul...@vgai.de> wrote:
>
> > > On 25 Okt., 13:55, stuart clark <clark.stuart...@gmail.com> wrote:
>
> > > > 1) i am getting the parameter_specification using
>
> > > >  params : Asis.Parameter_Specification_List :=
> > > >                  asis.Declarations.Parameter_Profile
> > > >                    (element);
>
> > > > 2) from params i am getting the parameter name using
>
> > > >  names: asis.Defining_Name_list :=
> > > >                        asis.declarations.Names(params(i));
>
> > > > 3) i am also getting the parameter mode_kind using
>
> > > > mode_kind : Asis.Mode_Kinds :=
> > > >                        asis.elements.mode_kind
> > > >                          (params(i));
>
> > > > it looks like this
>
> > > > param  =  b : in out float
> > > > name  =   b
> > > > mode kind  = AN_IN_OUT_MODE
>
> > > > but i also want the type of the parameter, eg float.
>
> > > > anybody know how ???
>
> > > from AdaBrowse source:
>
> > >       declare
> > >          Params : constant Parameter_Specification_List :=
> > >            Parameter_Profile (Decl);
> > >       begin
> > >          for I in Params'Range loop
> > >             declare
> > >                T : constant Type_Descriptor :=
> > >                  Type_Of (Declaration_Subtype_Mark (Params (I)));
> > >             begin
> > >                if T.Attrs = No_Attributes and then
> > >                   Is_Equal (T.Decl, The_Type)
> > >                then
> > >                   return True;
> > >                end if;
> > >             end;
> > >          end loop;
> > >       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/

cheers



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: how to i get the type of a parameter specification is ASIS
  2010-10-25 13:24     ` Julian Leyh
  2010-10-25 13:26       ` stuart clark
@ 2010-10-25 13:32       ` stuart clark
  1 sibling, 0 replies; 6+ messages in thread
From: stuart clark @ 2010-10-25 13:32 UTC (permalink / raw)


On Oct 25, 10:24 pm, Julian Leyh <jul...@vgai.de> wrote:
> On 25 Okt., 15:12, stuart clark <clark.stuart...@gmail.com> wrote:
>
>
>
> > On Oct 25, 10:07 pm, Julian Leyh <jul...@vgai.de> wrote:
>
> > > On 25 Okt., 13:55, stuart clark <clark.stuart...@gmail.com> wrote:
>
> > > > 1) i am getting the parameter_specification using
>
> > > >  params : Asis.Parameter_Specification_List :=
> > > >                  asis.Declarations.Parameter_Profile
> > > >                    (element);
>
> > > > 2) from params i am getting the parameter name using
>
> > > >  names: asis.Defining_Name_list :=
> > > >                        asis.declarations.Names(params(i));
>
> > > > 3) i am also getting the parameter mode_kind using
>
> > > > mode_kind : Asis.Mode_Kinds :=
> > > >                        asis.elements.mode_kind
> > > >                          (params(i));
>
> > > > it looks like this
>
> > > > param  =  b : in out float
> > > > name  =   b
> > > > mode kind  = AN_IN_OUT_MODE
>
> > > > but i also want the type of the parameter, eg float.
>
> > > > anybody know how ???
>
> > > from AdaBrowse source:
>
> > >       declare
> > >          Params : constant Parameter_Specification_List :=
> > >            Parameter_Profile (Decl);
> > >       begin
> > >          for I in Params'Range loop
> > >             declare
> > >                T : constant Type_Descriptor :=
> > >                  Type_Of (Declaration_Subtype_Mark (Params (I)));
> > >             begin
> > >                if T.Attrs = No_Attributes and then
> > >                   Is_Equal (T.Decl, The_Type)
> > >                then
> > >                   return True;
> > >                end if;
> > >             end;
> > >          end loop;
> > >       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 :=
                       asis.declarations.Declaration_Subtype_Mark
(Params (I));
                  begin
                     ada.Text_IO.Put_Line("type  = " &
 
ada.characters.Handling.To_String
 
(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.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-10-25 13:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-25 11:55 how to i get the type of a parameter specification is ASIS stuart clark
2010-10-25 13:07 ` Julian Leyh
2010-10-25 13:12   ` stuart clark
2010-10-25 13:24     ` Julian Leyh
2010-10-25 13:26       ` stuart clark
2010-10-25 13:32       ` stuart clark

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