comp.lang.ada
 help / color / mirror / Atom feed
From: Jean-Pierre Rosen <rosen@adalog.fr>
Subject: Re: ASIS Question: Looking up procedure names.
Date: Wed, 18 May 2005 18:41:52 +0200
Date: 2005-05-18T18:41:52+02:00	[thread overview]
Message-ID: <f8rf6d.6tm.ln@hunter.axlog.fr> (raw)
In-Reply-To: <428b5c41$1_2@newsfeed.slurp.net>

James Alan Farrell a �crit :
> Here is how to get the full name:
> 
> First, from call get the entity called
> 
> procedure get_called_entity(ProcCall : asis.element)
>    CalledEntity : asis.element;
> begin
>    CalledEntity :=
>       asis.statements.corresponding_called_entity(ProcCall);
> end;
But use Corresponding_Called_Function if it is a function
> 
> CalledEntity is a declaration.  To get it's name, use 
> asis.declarations.names, which returns a list.  To turn that into a wide 
> string, use asis.declarations.defining_name_image(name_list[0]).
You meant name_list(1), which language are you using :-)

> Now to get the package name, you can use asis.elements.enclosing_element 
> to get the declaration of the package in which the entity is declared. 
> This also returns a decl (the package decl) and you can use the same 
> method to get it's name.  
That's much too simplistic. The SP can be declared in a block statement, 
or another procedure. If it comes from an instantiation, you'll get 
extra levels (the SP declaration is in a (pseudo) package, which is 
itself inside the instantiation, etc.

Believe me: use Full_Name_Image (or rewrite it at your convenience), it 
is GMGPL. It took me a *lot* of time to get it working in all contexts.
-- 
---------------------------------------------------------
            J-P. Rosen (rosen@adalog.fr)
Visit Adalog's web site at http://www.adalog.fr



  reply	other threads:[~2005-05-18 16:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-07 20:10 ASIS Question: Looking up procedure names Peter C. Chapin
2005-05-09  8:49 ` Jean-Pierre Rosen
2005-05-09 11:25   ` Peter C. Chapin
2005-05-09 15:18 ` James Alan Farrell
2005-05-18 15:14   ` James Alan Farrell
2005-05-18 16:41     ` Jean-Pierre Rosen [this message]
2005-05-18 18:08       ` James Alan Farrell
replies disabled

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