comp.lang.ada
 help / color / mirror / Atom feed
* Where is my ASIS mistake?
@ 2003-11-28 11:12 Xela
  2003-11-29 12:10 ` Alex Xela
  2003-12-01 13:48 ` Marc A. Criley
  0 siblings, 2 replies; 3+ messages in thread
From: Xela @ 2003-11-28 11:12 UTC (permalink / raw)



With a basic ASIS program I am attempting to list all units in my current 
library.
In order, I wrote the following code:
------------
with Asis;
with Asis.Implementation;
with Asis.Ada_Environments;
with Asis.Compilation_Units;
with Asis.Ada_Environments.Containers;
with Ada.Text_Io;
with Ada.Wide_Text_Io;
procedure List_Units is
    My_Context  : Asis.Context;
    Sep : constant String := "------------------------------------------";
begin
    Asis.Implementation.Initialize;
    Asis.Ada_Environments.Associate(My_Context, "My Context");
    Asis.Ada_Environments.Open (My_Context);
    declare
        Libraries_List : Asis.Ada_Environments.Containers.Container_List
            := Asis.Ada_Environments.Containers.Defining_Containers(My_Context);
        Units_List :  Asis.Compilation_Unit_List
            := Asis.Ada_Environments.Containers.Compilation_Units(
            Libraries_List(1));
    begin
        for U in  Units_List'range loop
            Ada.Text_Io.Put_Line(Sep);
            Ada.Wide_Text_Io.Put_Line("Full Name = "&Asis.Compilation_Units.
Unit_Full_Name(Units_List(U)));
            Ada.Wide_Text_Io.Put_Line("Texte Name= "&Asis.Compilation_Units.
Text_Name(Units_List(U)));
            Ada.Text_Io.Put_Line("Unit Kind = "&Asis.Unit_Kinds'Image(Asis.
Compilation_Units.Unit_Kind(Units_List(U))));
        end loop;
    end;
    Ada.Text_Io.Put_Line(Sep);
    Asis.Ada_Environments.Close( My_Context );
    Asis.Ada_Environments.Dissociate( My_Context );
    Asis.Implementation.Finalize;
end List_Units;
--------

If now I compile with gnat3.15p  the following code (gnatmake hello), and also 
my List_units one :

with Ada.Text_Io;
procedure Hello is
begin
   Ada.Text_Io.Put_Line("hello!");
end Hello;

Executing list_units.exe give me:

--------------------------------------
Full Name = Standard
Texte Name= 
Unit Kind = A_PACKAGE
-------------------------------------- :-(

Now with the same code, If I recompile my list_units program and I execute it 
under an ObjectAda library registered with the hello unit the result is the 
expecting one:

------------------------------------------
Full Name = Hello
Texte Name= d:\Cholay\Tmp\Exercices\hello.adb
Unit Kind = A_PROCEDURE_BODY
------------------------------------------ :-)

I am convincing with the fact that I am making a huge error but which one?
Thanks for the help!




-- 
Ce message a ete poste via la plateforme Web club-Internet.fr
This message has been posted by the Web platform club-Internet.fr

http://forums.club-internet.fr/



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

* Re: Where is my ASIS mistake?
  2003-11-28 11:12 Where is my ASIS mistake? Xela
@ 2003-11-29 12:10 ` Alex Xela
  2003-12-01 13:48 ` Marc A. Criley
  1 sibling, 0 replies; 3+ messages in thread
From: Alex Xela @ 2003-11-29 12:10 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3106 bytes --]

--------------------------
I am not very familiar with the Gnat implementation of Asis.
In order I had a quick glance to the documentation. I suppose that my
problem is coming from the way I am handling the procedure
Asis.Ada_Environments.Associate.
I am thinking that my ""problem/question"" is solved!
---------------------------
"Xela" <xela2@free.fr> a �crit dans le message de
news:20031128-121211-658150@foorum.com...
>
> With a basic ASIS program I am attempting to list all units in my current
> library.
> In order, I wrote the following code:
> ------------
> with Asis;
> with Asis.Implementation;
> with Asis.Ada_Environments;
> with Asis.Compilation_Units;
> with Asis.Ada_Environments.Containers;
> with Ada.Text_Io;
> with Ada.Wide_Text_Io;
> procedure List_Units is
>     My_Context  : Asis.Context;
>     Sep : constant String := "------------------------------------------";
> begin
>     Asis.Implementation.Initialize;
>     Asis.Ada_Environments.Associate(My_Context, "My Context");
>     Asis.Ada_Environments.Open (My_Context);
>     declare
>         Libraries_List : Asis.Ada_Environments.Containers.Container_List
>             :=
Asis.Ada_Environments.Containers.Defining_Containers(My_Context);
>         Units_List :  Asis.Compilation_Unit_List
>             := Asis.Ada_Environments.Containers.Compilation_Units(
>             Libraries_List(1));
>     begin
>         for U in  Units_List'range loop
>             Ada.Text_Io.Put_Line(Sep);
>             Ada.Wide_Text_Io.Put_Line("Full Name =
"&Asis.Compilation_Units.
> Unit_Full_Name(Units_List(U)));
>             Ada.Wide_Text_Io.Put_Line("Texte Name=
"&Asis.Compilation_Units.
> Text_Name(Units_List(U)));
>             Ada.Text_Io.Put_Line("Unit Kind =
"&Asis.Unit_Kinds'Image(Asis.
> Compilation_Units.Unit_Kind(Units_List(U))));
>         end loop;
>     end;
>     Ada.Text_Io.Put_Line(Sep);
>     Asis.Ada_Environments.Close( My_Context );
>     Asis.Ada_Environments.Dissociate( My_Context );
>     Asis.Implementation.Finalize;
> end List_Units;
> --------
>
> If now I compile with gnat3.15p  the following code (gnatmake hello), and
also
> my List_units one :
>
> with Ada.Text_Io;
> procedure Hello is
> begin
>    Ada.Text_Io.Put_Line("hello!");
> end Hello;
>
> Executing list_units.exe give me:
>
> --------------------------------------
> Full Name = Standard
> Texte Name=
> Unit Kind = A_PACKAGE
> -------------------------------------- :-(
>
> Now with the same code, If I recompile my list_units program and I execute
it
> under an ObjectAda library registered with the hello unit the result is
the
> expecting one:
>
> ------------------------------------------
> Full Name = Hello
> Texte Name= d:\Cholay\Tmp\Exercices\hello.adb
> Unit Kind = A_PROCEDURE_BODY
> ------------------------------------------ :-)
>
> I am convincing with the fact that I am making a huge error but which one?
> Thanks for the help!
>
>
>
>
> -- 
> Ce message a ete poste via la plateforme Web club-Internet.fr
> This message has been posted by the Web platform club-Internet.fr
>
> http://forums.club-internet.fr/





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

* Re: Where is my ASIS mistake?
  2003-11-28 11:12 Where is my ASIS mistake? Xela
  2003-11-29 12:10 ` Alex Xela
@ 2003-12-01 13:48 ` Marc A. Criley
  1 sibling, 0 replies; 3+ messages in thread
From: Marc A. Criley @ 2003-12-01 13:48 UTC (permalink / raw)


Xela <xela2@free.fr> wrote in message news:<20031128-121211-658150@foorum.com>...
> With a basic ASIS program I am attempting to list all units in my current 
> library.

Another good place to ask questions like this is on the ASIS mailing
list.  More info on signing up at
http://www.acm.org/sigada/wg/asiswg/asiswg.html.

Marc A. Criley
McKae Technologies  "The Efficient Production of Reliable Software"
www.mckae.com



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

end of thread, other threads:[~2003-12-01 13:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-28 11:12 Where is my ASIS mistake? Xela
2003-11-29 12:10 ` Alex Xela
2003-12-01 13:48 ` Marc A. Criley

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