TOC PREV NEXT INDEX DOC LIST MASTER INDEX



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.

This chapter includes:


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 Standard

Although 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 ASIS

The 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:

Each package is listed with both its preferred name and its alternate name, if any.

Table 1 Portable ASIS Packages
Package Name
(alternate name, if any)


Description

Asis
The root package of the ASIS interface; supplies convenient (short) names for most ASIS types and packages. All other packages are logically subunits of this package; whether they are implemented, physically, as subunits of this package is a vendor-specific decision.
Asis.Compilation_Units
(Asis_Compilation_Units)

Queries dealing with compilation units and the crossover between compilation units, elements, and libraries.
Asis.Declarations
(Asis_Declarations)

Queries dealing with Ada declarations.
Asis.Elements
(Asis_Elements)

Basic element queries.
Asis.Environment
(Asis_Environment)

ASIS initialization and finalization and queries about implementation options.
Asis.Exceptions
Exceptions used by the ASIS interface, except for Ada predefined I/O exceptions that may be raised by the various I/O packages exported by Asis.Ids.
Asis.Expressions
(Asis_Expressions)

Queries dealing with Ada expressions.
Asis.Ids
(Asis_Ids)

Queries dealing with ASIS element-ids and conversions between elements and element-ids.
Asis.Libraries
(Asis_Libraries)

Operations for creating, opening, closing, and destroying libraries.
Asis.Lines
Definitions of all of the types and type operations dealing with ASIS textual images.
Asis.Numerics
Definitions of all of the numeric types and type operations required for use of the ASIS interface.
Asis.Representation_Clauses
(Asis_Representation_Clauses)

Queries dealing with LRM Chapter 13 representation clauses.
Asis.Statements
(Asis_Statements)

Queries dealing with Ada statements.
Asis.Strings
Definitions of all character and string types and type operations required for use of the ASIS interface.
Asis.Text
(Asis_Text)

Operations for obtaining textual strings that correspond to specific elements.
Asis.Times
Definitions of all time and duration types and type operations required for use of the ASIS interface.
Asis.Type_Definitions
(Asis_Type_Definitions)

Queries dealing with the type definition portion of Ada type and subtype declarations.

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:

Table 2 Nonportable ASIS Packages
Package Name
Description
Asis_Type_Primitives
Declares all of the most basic ASIS data types and operators. These include numerics, characters, strings, exceptions, and various enumeration literals.
Asis_Vendor_Primitives
Declares all of the more complex composite ASIS data types. These are types that, by definition, must be based on vendor-supplied types.

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 Program

An ASIS application must follow these steps (possibly in a loop):

1 . Initialize the ASIS interface. This needs to be done only once. Use:

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:

3 . Locate the library named in the previous step; this is the step that actually provides you with access to the library. Use:

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:

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:

9 . When you are completely finished with a library, you can (optionally) drop all information about the library with:

10 . Before exiting the application, you can release all ASIS resources with:


Using Rational ASIS in Your Program

Package 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.
TOC PREV NEXT INDEX DOC LIST MASTER INDEX TECHNOTES APEX TIPS