1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
|
<HTML>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- Created on May, 22 2008 by texi2html 1.64-gnat-1 -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
Karl Berry <karl@freefriends.org>
Olaf Bachmann <obachman@mathematik.uni-kl.de>
and many others.
Maintained by: Olaf Bachmann <obachman@mathematik.uni-kl.de>
Send bugs and suggestions to <texi2html@mathematik.uni-kl.de>
-->
<HEAD>
<TITLE>ASIS-for-GNAT User's Guide: Processing an Ada Library by an ASIS-Based Tool</TITLE>
<META NAME="description" CONTENT="ASIS-for-GNAT User's Guide: Processing an Ada Library by an ASIS-Based Tool">
<META NAME="keywords" CONTENT="ASIS-for-GNAT User's Guide: Processing an Ada Library by an ASIS-Based Tool">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META NAME="Generator" CONTENT="texi2html 1.64-gnat-1">
</HEAD>
<BODY LANG="" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">
<A NAME="SEC51"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_9.html#SEC50"> < </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_11.html#SEC52"> > </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[ << ]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug.html#SEC_Top"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_11.html#SEC52"> >> </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_15.html#SEC56">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1> 9. Processing an Ada Library by an ASIS-Based Tool </H1>
<!--docid::SEC51::-->
<P>
When an Ada unit to be processed by some ASIS-based tool makes
use of an Ada library, you need to be aware of the following features
of using Ada libraries with GNAT:
</P><P>
<UL>
<LI>
An Ada library is a collection of precompiled Ada components. The sources
of the Ada components belonging to the library are present,
but if your program uses some components from a
library, these components are not recompiled by <CODE>gnatmake</CODE>
(except in circumstances described below).
For example, <CODE>Ada.Text_IO</CODE> is not recompiled
when you invoke <CODE>gnatmake</CODE> on a unit that <CODE>with</CODE>s
<CODE>Ada.Text_IO</CODE>.
<P>
<LI>
According to the GNAT source-based compilation model, the spec of a library
component is processed when an application unit depending on such a component is
compiled, but the body of the library component is not processed. As a result,
if you invoke <CODE>gnatmake</CODE> to create a set of tree files covering a given
program, and if this program references an entity from an Ada library, then the
set of tree files created by such a call will contain only specs, but not
bodies for library components.
<P>
<LI>
Any GNAT installation contains the GNAT Run-Time Library (RTL) as a
precompiled Ada library. In some cases, a GNAT installation may contain some
other libraries (such as Win32Ada Binding on a Windows GNAT
platform).
<P>
<LI>
In ASIS-for-GNAT, there is no standard way to define whether a given
<CODE>Compilation_Unit</CODE> belongs to some precompiled Ada library other than
the GNAT Run-Time Library (some heuristics may be added to <CODE>Asis.Extensions</CODE>).
<A NAME="IDX154"></A>
ASIS-for-GNAT classifies (by means of the
<CODE>Asis.Compilation_Units.Unit_Origin</CODE> query)
<A NAME="IDX155"></A>
a unit as
<CODE>A_Predefined_Unit</CODE>, if it is from the Run-Time Library
and if it is mentioned in the <CITE>Ada Reference Manual</CITE>, Annex A, Paragraph 2
as an Ada 95 predefined unit;
a unit is classified as
<CODE>An_Implementation_Unit</CODE> if is belongs to Run-Time Library but is not mentioned in
the paragraph just cited.
Components of Ada libraries other than the Run-Time Library are always classified
as <CODE>An_Application_Unit</CODE>;
<P>
<LI>
It is possible to recompile the components of the Ada libraries used
by a given program. To do this, you have to invoke <CODE>gnatmake</CODE> for this
program with the <SAMP>`-a'</SAMP> option. If you create a set of
tree files for your program by invoking <CODE>gnatmake</CODE> with the <SAMP>`-a'</SAMP> option, the
resulting set of tree files will contain all the units needed by this
program to make up a complete partition.
</UL>
<P>
Therefore, there are two possibilities for an ASIS-based tool if processing
(or avoiding processing) of Ada libraries is important for
the functionality of the tool:
</P><P>
<UL>
<LI>
If the tool is not to process components of Ada libraries, then
a set of tree files for this tool may be created by invoking <CODE>gnatmake</CODE>
without the <SAMP>`-a'</SAMP> option (this is the usual way of using <CODE>gnatmake</CODE>).
When the tool encounters a <CODE>Compilation_Unit</CODE> which represents a spec of some
library unit, and for which <CODE>Asis.Compilation_Units.Is_Body_Required</CODE>
<A NAME="IDX156"></A>
returns <CODE>True</CODE>, but <CODE>Asis.Compilation_Units.Corresponding_Body</CODE>
<A NAME="IDX157"></A>
yields a
result of <CODE>A_Nonexistent_Body</CODE> kind, then the tool may conclude that
this library unit belongs to some precompiled Ada library.
<P>
<LI>
If a tool needs to process all the Ada compilation units making up a
program, then a set of tree files for this program should be created by
invoking <CODE>gnatmake</CODE> with the <SAMP>`-a'</SAMP> option.
</UL>
<P>
You can use <CODE>Asis.Compilation_units.Unit_Origin</CODE>
<A NAME="IDX158"></A>
to filter out Run-Time Library components.
</P><P>
<A NAME="Compiling Binding and Linking Applications with ASIS-for-GNAT"></A>
<HR SIZE="6">
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[ << ]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_11.html#SEC52"> >> </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_15.html#SEC56">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<BR>
<FONT SIZE="-1">
This document was generated
by <I>Mail Server</I> on <I>May, 22 2008</I>
using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html/"><I>texi2html</I></A>
</BODY>
</HTML>
|