![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
ASIS Overview This chapter introduces ASIS, outlines the class of tasks that ASIS is designed to address, and discusses the basic theory involved in designing tools to deal with those tasks.
What Is ASIS?ASIS is a portable interface to the Ada semantic information that is buried in any Ada program library.
ASIS consists of about 380 functions and private types.
ASIS —— The StandardAlthough ASIS is a standard, it is not a limited standard like Ada (which allows no supersets or subsets). Rather, vendors can add specifications and can implement each of the specifications in the standard somewhat differently, including implementing them as a no-op (usually for cases where the function or procedure deals with a construct that has no meaning on a particular platform).
Packages in ASISThe software is best described as a series of software layers. The top layer is package Asis and the bottom layer is package Asis.Type_Primitives, as shown in the following figure:
Figure 1 ASIS Implementation Layers
![]()
These packages are described in more detail in the following subsections.
Portable Packages
The packages that form the portable ASIS interface are listed in Table 1 .
Packages fall into two general categories, and the ASIS standard provides naming conventions for each:
- Packages that declare the basic types and type operations defined by ASIS are available through naming expressions of the form Asis.Name.
- Packages that serve to group similar query subprograms are available both as Asis.Name and as Asis_Name. The Asis.Name form is the preferred usage.
Each package is listed with both its preferred name and its alternate name, if any.
Nonportable Packages
The ASIS standard includes three sample package specifications that describe information designed to be hidden from an ASIS user. These packages are delivered as part of Rational ASIS but might not ultimately be part of a conforming ASIS implementation. These packages are:
Note: Portable applications should not call these packages directly.
The functionality in these packages is visible from package Asis and hence is available, if needed, without directly referencing these packages.
Using Standard ASIS in Your ProgramAn ASIS application must follow these steps (possibly in a loop):
- 1 . Initialize the ASIS interface. This needs to be done only once. Use:
Asis.Environment.Initialize;
- 2 . Name the Ada library from which compilation units will be analyzed by your application. This creates a logical library reference in your application that describes how the library should be opened but does not yet open or read the actual library. Use:
Asis.Libraries.Associate(..);
- 3 . Locate the library named in the previous step; this is the step that actually provides you with access to the library. Use:
Asis.Libraries.Open(..);
- 4 . Repeat Step 2 and Step 3 for each library to be used.
- 5 . Open the specific compilation unit that you want to analyze. Use:
Asis.Compilation_Units.Library_Unit(..);
- 6 . Use the various Asis.Elements interfaces, including Asis-
.Declarations, Asis.Statements, and Asis.Expressions, as needed.- 7 . Repeat Step 5 and Step 6 for each compilation unit.
- 8 . When you are finished with a particular library or are between uses of the library, you can (optionally) drop access to the actual library without losing the naming information about the library. Use:
Asis.Libraries.Close(..);
- 9 . When you are completely finished with a library, you can (optionally) drop all information about the library with:
Asis.Libraries.Dissociate(..);
- 10 . Before exiting the application, you can release all ASIS resources with:
Using Rational ASIS in Your ProgramPackage Asis in Rational ASIS provides renames of all of the other packages in such a way that you need only include package Asis in your program's context clause to have access to all other packages.
Rational ASIS provides the packages shown in Table 1 and Table 2.
Note: A vendor implementation might provide other packages; these should not be referenced by portable applications.
Detailed descriptions of the Rational ASIS packages and functions and how to use them are provided in the Rational ASIS online reference.
Rational Software Corporation http://www.rational.com support@rational.com techpubs@rational.com Copyright © 1993-2002, Rational Software Corporation. All rights reserved. |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |