HP OpenVMS Systems

Content starts here

DEC Ada
Technical Overview and Comparison on DIGITAL Platforms


Previous Contents Index

E.4.5 The Task Stack

In DEC Ada, a task stack is allocated each time a nonpassive task is activated. As soon as the task is terminated, the storage for the task stack is deallocated.

If you specify a size of zero (bytes) with T'STORAGE_SIZE, a default stack size is used. Also, regardless of the size specified, some additional space is allocated for task management purposes. On OpenVMS VAX systems, at least 21 pages are allocated. On OpenVMS Alpha systems, at least one page is allocated.

GNAT handles task stacks in a similar manner. According to the Ada 95 rules, it provides the pragma STORAGE_SIZE as an alternative method for controlling the task stack size. The specification of the attribute T'STORAGE_SIZE is also supported in a manner compatible with DEC Ada.

E.4.6 External Interrupts

On DEC Ada, external interrupts can be associated with task entries. GNAT is compatible.

E.5 Pragmas and Pragma-Related Features

Both DEC Ada and GNAT supply all language-defined pragmas as specified by the Ada 83 standard. These pragmas are as follows:

  • CONTROLLED
  • ELABORATE
  • INLINE (restricted by DEC Ada; see Section E.5.1)
  • INTERFACE (restricted by DEC Ada; see Section E.5.1)
  • LIST
  • MEMORY_SIZE
  • OPTIMIZE
  • PACK
  • PAGE
  • PRIORITY
  • SHARED
  • STORAGE_UNIT
  • SUBTITLE
  • SUPPRESS
  • SYSTEM_NAME

GNAT supplies all the DIGITAL implementation-defined pragmas in the following lists, although these three are ignored:

  • TITLE
  • PASSIVE
    In GNAT, the effect of PASSIVE can be obtained by the use of Ada 95 protected objects.
  • SHARE_GENERIC
    In GNAT, all generics are inlined.

See the GNAT Reference Manual for details on pragmas.

GNAT supplies all the additional Ada 95 pragmas as follows:

  • ALL_CALLS_REMOTE
  • ASYNCHRONOUS
  • ATOMIC
  • ATOMIC_COMPONENTS
  • ATTACH_HANDLER
  • CONVENTION
  • DISCARD_NAMES
  • ELABORATE_ALL
  • ELABORATE_BODY
  • EXPORT
  • IMPORT
  • INSPECTION_POINT
  • INTERRUPT_HANDLER
  • INTERRUPT_PRIORITY
  • LINKER_OPTIONS
  • LOCKING_POLICY
  • NORMALIZE_SCALARS
  • PREEABORATE
  • PURE
  • QUEUEING_POLICY
  • REMOTE_CALL
  • REMOTE_TYPES
  • RESTRICTIONS
  • REVIEWABLE
  • SHARED_PASSIVE
  • STORAGE_SIZE
  • TASK_DISPATCHING_POLICY
  • VOLATILE
  • VOLATILE_COMPONENTS

GNAT processes these pragmas in a manner consistent with the definitions in the Ada 95 Reference Manual.

DEC Ada also supplies the following implementation-defined pragmas:

  • AST_ENTRY
  • COMMON_OBJECT
  • COMPONENT_ALIGNMENT
  • EXPORT_EXCEPTION
  • EXPORT_FUNCTION
  • EXPORT_OBJECT
  • EXPORT_PROCEDURE
  • EXPORT_VALUED_PROCEDURE
  • FLOAT_REPRESENTATION
  • IDENT
  • IMPORT_EXCEPTION
  • IMPORT_FUNCTION
  • IMPORT_OBJECT
  • IMPORT_PROCEDURE
  • IMPORT_VALUED_PROCEDURE
  • INLINE_GENERIC
  • INTERFACE_NAME
  • LONG_FLOAT
  • MAIN_STORAGE
  • PASSIVE
  • PSET_OBJECT
  • SHARE_GENERIC
  • SUPPRESS_ALL
  • TASK_STORAGE
  • TIME_SLICE
  • TITLE
  • VOLATILE

In addition, GNAT supplies the following implementation-defined pragmas:

  • ABORT_DEFER
  • ADA_83
  • ADA_95
  • ANNOTATE
  • ASSERT
  • C_PASS_BY_COPY
  • CPP_CLASS
  • CPP_CONSTRUCTOR
  • CPP_DESTRUCTOR
  • CPP_VIRTUAL
  • CP_VTABLE
  • DEBUG
  • EXTEND_SYSTEM
  • LINKER_ALIAS
  • LINKER_SECTION
  • MACHINE_ATTRIBUTE
  • NO_RETURN
  • PURE_FUNCTION
  • SOURCE_FILE_NAME
  • SOURCE_REFERENCE
  • TASK_INFO
  • UNCHECKED_UNION
  • UNIMPLEMENTED_UNIT
  • UNSUPPRESS
  • WARNINGS
  • WEAK_EXTERNAL

The Ada language specifies that unrecognized pragmas are accepted but ignored. Therefore, programs using a GNAT-only pragma on a DIGITAL implementation compile but do not necessarily run as expected.

E.5.1 Pragma-Related Restrictions

Restrictions on the Pragma INLINE

DEC Ada applies the following restrictions to the pragma INLINE:

  • Parameters cannot be a task type.
  • Function results cannot be task types, unconstrained array types, or unconstrained types with discriminants.
  • Bodies cannot declare the following:
    • Subprogram body or stub (imported subprogram is allowed)
    • Tasks
    • Generic declarations
    • Instantiations
    • Exceptions
    • Access types (types derived from access types allowed)
    • Array or record types
    • Dependent tasks
    • Direct recursive calls of subprogram or containing subprogram, directly or via a renaming

In GNAT, the only restriction on pragma INLINE is that the body must occur before the call if both are in the same unit and the size must be appropriately small. There are no other specific restrictions which cause subprograms to be incapable of being inlined.

Restrictions on the Pragma INTERFACE

Following are the restrictions on the pragma INTERFACE on DEC Ada and GNAT:

  • Languages accepted: Ada, Bliss, C, Fortran, DEFAULT.
  • Parameter passing: Language specifies default mechanisms but can be overridden with an EXPORT pragma.
    • Ada: Use internal Ada rules.
    • Bliss, C: Parameters must be mode 'in'; cannot be record or task type. Result cannot be a string, an array, or a record.
    • Fortran: Parameters cannot be a task. Result cannot be a string, an array, or a record.

GNAT is compatible with DEC Ada. In addition, GNAT allows record parameters for all languages.

Restrictions on the Pragma SYSTEM_NAME

The values for the enumeration type NAME vary by system and are not interchangeable.

Restrictions on the Pragma EXPORT_VALUED_PROCEDURE

In DEC Ada and GNAT when a main function or a main procedure declared with the pragma EXPORT_VALUED_PROCEDURE returns a discrete value whose size is less than 64 bits (32 on OpenVMS VAX systems), the value is zero- or sign-extended as appropriate.

Restrictions on the Pragma IMPORT_EXCEPTION

On OpenVMS systems, pragma IMPORT_EXCEPTION allows a specific condition value to be associated with an Ada exception. This pragma is used for implementing exceptions in the OpenVMS operating system.

This restriction is identical in GNAT.

E.6 Library of Predefined Units

A library of predefined units is provided as part of the DEC Ada and GNAT implementations. DEC Ada does not provide the package MACHINE_CODE but instead recommends importing assembler code.

GNAT does not provide the following DEC Ada packages:

  • LONG_LONG_FLOAT_MATH_LIB
  • LONG_LONG_FLOAT_TEXT_IO
  • VAXELN

Both DEC Ada and GNAT provide packages beyond the minimum required by the Ada language standard.

The GNAT versions of the DEC Ada Run-Time Library (ADA$PREDEFINED:) units are taken from the OpenVMS Alpha version, not the OpenVMS VAX version. During GNAT installation, the DEC Ada Predefined Library units are copied into the DECLIB directory GNU:[LIB.OPENVMS7_x.2_8_x.DECLIB] and patched to remove Ada 95 incompatibilities and to make them interoperable with GNAT. These changes are minor and transparent to users. They include:

  • Adjusting the location of pragmas and record representation clauses to obey Ada 95 rules
  • Adding the proper notation to generic formal parameters that take unconstrained types in instantiation
  • Adding pragma ELABORATE_BODY to package specifications that have package bodies not otherwise allowed
  • Renaming objects whose names are Ada 95 keywords (for example, in STARLET.ADS, PROTECTED becomes PROTECTD)

The GNAT RTL is contained in the ADALIB directory GNU:[LIB.OPENVMS7_x.2_8_x.ADALIB].

The default search path is set up to find DEC Ada DECLIB units in preference to GNAT ADALIB units with the same name (TEXT_IO, SEQUENTIAL_IO, and DIRECT_IO, for example). However, it is possible to change the default so that the reverse is true, or even to mix them using child package notation. The DEC Ada 83 units are available as DEC.xxx where xxx is the package name, and the Ada units are available as Ada.xxx (the standard manner defined for Ada 95). To change the default, set ADA_INCLUDE_PATH and ADA_OBJECTS_PATH appropriately. For example, to change the default to use the Ada 95 versions specify the following:


$ DEFINE ADA_INCLUDE_PATH "GNU:[LIB.OPENVMS7_1.2_8_0.ADAINCLUDE],-
                           GNU:[LIB.OPENVMS7_1.2_8_0.DECLIB]"
$ DEFINE ADA_OBJECTS_PATH "GNU:[LIB.OPENVMS7_1.2_8_0.ADALIB],-
                           GNU:[LIB.OPENVMS7_1.2_8_0.DECLIB]"

E.7 Bindings

GNAT and DEC Ada on OpenVMS Alpha have compatible bindings. They provide the following strongly typed bindings:

  • Command Language Interpreter (CLI interface)
  • DECtalk Run-Time Library (DTK interface)
  • Librarian utility routines (LBR interface)
  • General Purpose Run-Time Library (LIB interface)
  • Math Run-Time Library (MTH interface)
  • National Character Set Run-Time Library (NCS interface)
  • Compiled Code Support Run-Time Library (OTS interface)
  • Parallel Processing Run-Time Library (PPL interface)
  • Screen Management Run-Time Library (SMG interface)
  • Sort Run-Time Library (SOR interface)
  • String Run-Time Library (STR interface)
  • STARLET System Library
  • X Window System Version 11R4, 11R5, and (for UNIX) 11R6 (X, XLIB interface)
  • X Windows Toolkit (XT interface)
  • X/Motif Version 1.1.3 and 1.2 (XM interface)

GNAT provides implementations of the OpenVMS DEC bindings in the DECLIB directory.

The X/Motif bindings used to build DECLIB are the versions in the DEC Ada ADA$PREDEFINED directory with extension .ADC. The build script automatically adds a pragma Linker_Options to packages Xm, Xt, and X_Lib causing the default X/Motif shareable image libraries to be linked. This is done via options files named XM.OPT, XT.OPT, and X_LIB.OPT (also located in the DECLIB directory).

It may be necessary to edit these options files to update or correct the library names if, for example, the newer X/Motif bindings from ADA$EXAMPLES were (previous to installing GNAT) copied and renamed to supersede the default ADA$PREDEFINED versions.

E.7.1 Shared Libraries and OPT files

When you use the DEC Ada predefined X and Motif bindings, the linking with their shareable images is done automatically by GNAT LINK. When using other X and Motif bindings, you must add the corresponding shareable images to the command line for GNAT LINK. When linking with shared libraries, or with .OPT files, you must also add them to the command line for GNAT LINK.

A shared library to be used with GNAT is built in the same way as other libraries under OpenVMS. The OpenVMS LINK command can be used in the standard way.

E.7.2 Interfaces to C

DEC Ada recognizes the importance of interfacing to C and provides Ada types and operations, as shown in Table E-4.

Table E-4 Interfaces to C
Type or Operation Name of Type or Operation
C types package C_TYPES
   
C strings C_TYPES.NULL_TERMINATED
   
Other types SHORT_INT

Interfacing to C with GNAT, one can use the approach described in this section for DEC Ada or the facilities of Annex B of the Ada 95 Reference Manual (packages INTERFACES.C, INTERFACES.C.STRINGS, and INTERFACES.C.POINTERS). For more information, see the section "Interfacing to C" in the GNAT Reference Manual.

E.7.3 Main Program Definition

The following section discusses differences in the definition of main programs on DEC Ada and GNAT.

On DEC Ada, main programs are defined to meet the following conditions:

  • Procedure with no formal parameters (returns 0 upon normal completion)
  • Procedure with no formal parameters (returns 42 when unhandled exceptions are raised)
  • Function with no formal parameters whose returned value is of a discrete type
  • Procedure with one OUT formal of a discrete type for which a pragma EXPORT_VALUED_PROCEDURE is specified
    When a main function or main procedure declared with the pragma EXPORT_VALUED_PROCEDURE returns a discrete value whose size is less than 64 bits (32 on VAX systems), the value is zero- or sign-extended as appropriate.

On GNAT, a main program must be a nongeneric, parameter-less subprogram that is either a procedure or function returning an Ada STANDARD.INTEGER (the predefined type). It cannot be a generic subprogram or an instantiation of a generic subprogram.

E.8 Implementation-Defined Attributes

GNAT provides all DEC Ada implementation-defined attributes.

E.9 Compiler and Run-Time Interfacing

DEC Ada provides many qualifiers for passing options to the linker (ACS LINK).

GNAT provides the following qualifiers for passing options to the linker (GNAT LINK):

  • /EXECUTABLE=EXEC-NAME
    EXEC-NAME specifies an alternative name for the generated executable program. If this qualifier is omitted, the executable has the same name as the main unit.
  • /VERBOSE
    Causes additional information to be output, including a full list of the included object files.
  • /DEBUG
    Causes the C bind file (b_MAINPROG.C) to be compiled with /DEBUG. The binder does not delete the b_MAINPROG.C and b_MAINPROG.OBJ files. Without /DEBUG, the binder deletes these files.
  • /DEBUG=TRACEBACK
    Causes sufficient information to be included in the executable file to allow a traceback, but does not include the full symbol information needed by the debugger.
  • /NOINHIBIT-EXEC
    Generates the executable file even if there are linker warnings.

E.10 Optimization

In DEC Ada, optimization is turned on by default. In GNAT, it is turned off by default.

In both GNAT and DEC Ada, the command-line qualifier /OPTIMIZE is available to control optimization. The qualifier options, which specify the level of optimization, are different.

In DEC Ada, the /OPTIMIZE options are as follows:

  • Primary options
    • TIME (the default)
    • SPACE
    • DEVELOPMENT
    • NONE
  • Secondary options
    • INLINE
    • SHARE

See the online help or Developing Ada on OpenVMS Systems for more information on /OPTIMIZE and its options.

In GNAT, the /OPTIMIZE qualifier has the following options:

  • NONE (the default)
  • SOME
  • ALL
  • INLINING

See the GNAT User's Guide for more information on the /OPTIMIZE options.

DEC Ada also supplies the following pragmas:

  • OPTIMIZE (ignored by GNAT)
  • INLINE (also in GNAT; see Section E.5.1 for the differences in restrictions on this pragma)
  • INLINE_GENERIC (ignored by GNAT, which inlines all generics)
  • SUPPRESS_ALL (also in GNAT)
  • PASSIVE (ignored by GNAT, which instead uses the Ada 95 protected objects)

E.11 Program Compilation and Management

Table E-5 summarizes the DEC Ada commands for building programs and the equivalent GNAT commands. DEC Ada instructions do not necessarily translate easily into GNAT instructions. This table is a summary only, with some translations simplified and generalized.

DEC Ada, unlike GNAT, provides a program library and a compilation system (ACS). GNAT provides directories of sources that are compiled as needed. GNAT's collections of source and object files are used in a manner consistent with other languages like C and Fortran. In Table E-5, each GNAT equivalent indicates the closest approximation to the DEC Ada command and does not take into account the effects of qualifiers. The GNAT equivalents marked with a footnote reflect the fact that GNAT does not use the concept of program library.

Table E-5 Comparison of DEC Ada Commands and GNAT Equivalents
DEC Ada Command GNAT Equivalent Description
ADA GNAT CHOP
GNAT COMPILE
Invokes the compiler to compile one or more Ada source files.
ACS ATTACH No equivalent Switches control of terminal from current process running the program library manager.
ACS CHECK GNAT MAKE
/DEPENDENCY_LIST
Checks completeness and currency.
ACS COMPILE GNAT MAKE /NOLINK Forms the execution closure of one or more specified units, checks completeness and currency, identifies units that have revised source files, compiles same, and recompiles units that are or will become obsolete. Also completes incomplete generic instantiations.
ACS COPY FOREIGN COPY 1 Copies a foreign object file into the program library as a library unit body.
ACS COPY UNIT COPY 1 Copies a compiled unit from one program library to another.
ACS CREATE LIBRARY CREATE /DIRECTORY 1 Creates a program library.
ACS CREATE SUBLIBRARY No equivalent Creates a program sublibrary.
ACS DELETE LIBRARY DELETE 1 Deletes a program library and its contents.
ACS DELETE SUBLIBRARY No equivalent Deletes a program sublibrary and its contents.
ACS DELETE UNIT DELETE <file> 1 On OpenVMS systems, deletes one or more compiled units from the current program library.
ACS DIRECTORY DIRECTORY 1 On OpenVMS systems, lists units contained in the current program library.
ACS ENTER FOREIGN COPY 1 Allows the import of a foreign body as an Ada library specification and enters a reference to a pointer.
ACS ENTER UNIT COPY 1 Enters a reference (pointer) from the current program library to a unit compiled into another program library.
ACS EXIT No equivalent Exits from the program library manager.
ACS EXPORT COPY 1 Creates an object file that contains system-specific object code for one or more units. In GNAT, object files simply can be copied into the desired directory.
ACS EXTRACT SOURCE COPY 1 Allows access to the copied source file for each Ada compilation unit.
ACS HELP HELP GNAT Provides online help.
ACS LINK GNAT LINK Links an object file containing Ada units into an executable file.
ACS LOAD GNAT CHOP Loads (partially compiles) Ada units into the program library. Allows loading a program from a collection of files into a library without knowing the relationship among units.
ACS MERGE RENAME 1 Merges into the current program library, one or more units from another library where they were modified.
ACS RECOMPILE GNAT MAKE /NOLINK Recompiles from external or copied source files any obsolete unit in the closure. Also, completes any incomplete generic instantiations.
ACS REENTER GNAT MAKE Reenters current references to units compiled after last entered with the ACS ENTER UNIT command.
ACS SET LIBRARY SET DEFAULT 1 Defines a program library to be the compilation context as well as the target library for compiler output and commands in general.
ACS SET PRAGMA Edit GNAT.adc 1 Redefines specified values of the library characteristics
LONG_FLOAT,
MEMORY_SIZE,
SYSTEM_NAME, and
FLOAT_REPRESENTATION.
ACS SET SOURCE DEFINE ADA_INCLUDE_PATH <path> 1 Defines the source file search list for the ACS COMPILE command.
ACS SHOW LIBRARY DIRECTORY 1 Lists information about one or more program libraries.
ACS SHOW PROGRAM No equivalent Lists information about the execution closure of one or more units in the program library.
ACS SHOW SOURCE Show logical ADA_INCLUDE_PATH Shows the source file search used when compiling units.
ACS SHOW VERSION Compile with /VERBOSE Displays the version number of the compiler and program library manager used.
ACS SPAWN No equivalent Creates a subprocess of the current process (same as DCL SPAWN command).
ACS VERIFY No equivalent Performs a series of consistency checks on a program library to determine whether the library structure and library files are in valid form.

1Reflects that GNAT does not use the concept of a program library. Standard system commands are used instead.

A complete set of the following commands provides an interface to GNAT using familiar OpenVMS-style qualifiers with standard OpenVMS conventions regarding abbreviations and so on. See the GNAT User's Guide for full details or consult the online help system:

  • GNAT COMPILE
  • GNAT CHOP
  • GNAT COMPILE
  • GNAT LIBRARY
  • GNAT LINK
  • GNAT MAKE
  • GNAT PREPROCESS
  • GNAT XREF

E.12 Input-Output

On OpenVMS systems, DEC Ada uses OpenVMS Record Management Services (RMS) to perform operations on external files.

DEC Ada and GNAT predefine an identical set of input-output packages ( Section E.6). To make the use of the generic TEXT_IO operations more convenient, DEC Ada provides predefined library packages that instantiate the integer and floating-point operations for the predefined integer and floating-point types as shown in Table E-6.

Table E-6 Predefined Instantiations of TEXT_IO Packages
Package Name Instantiation
INTEGER_TEXT_IO INTEGER_IO(INTEGER)
SHORT_INTEGER_TEXT_IO INTEGER_IO(SHORT_INTEGER)
SHORT_SHORT_INTEGER_TEXT_IO INTEGER_IO(SHORT_SHORT_INTEGER)
FLOAT_TEXT_IO FLOAT_IO(FLOAT)
LONG_FLOAT_TEXT_IO FLOAT_IO(LONG_FLOAT)

The DEC Ada predefined packages and their operations are implemented with OpenVMS files and input-output facilities. DEC Ada supports asynchronous input-output on OpenVMS systems. Familiarity with the following is recommended:

  • RMS file organizations and access methods
  • OpenVMS file specifications and directories
  • OpenVMS File Definition Language (FDL)

Note that GNAT does not support shared generics, which are a feature on DEC Ada on OpenVMS VAX systems. All generic instantiations result in the creation of a specialized copy of the code that uses the supplied formal generic parameters.

GNAT provides I/O facilities that are completely compatible with DEC Ada. The distribution includes the standard DEC Ada versions of all I/O packages, operating in a manner compatible with DEC Ada. In particular, the following packages are by default the DEC Ada (Ada 83) versions of these packages rather than the renamings suggested in annex J of the Ada 95 Reference Manual:

  • TEXT_IO
  • SEQUENTIAL_IO
  • DIRECT_IO

The use of the standard Ada 95 forms for packages (for example, ADA.TEXT_IO) obtains the Ada 95 versions of these packages as defined in the Ada 95 Reference Manual.

GNAT provides DIGITAL-compatible predefined instantiations of the TEXT_IO packages as listed in Table E-6 and also provides the standard predefined instantiations required by the Ada 95 Reference Manual.

For further information on how GNAT interfaces to the file system or how I/O is implemented in programs written in mixed languages, see the chapter "Implementation of the Standard I/O" in the GNAT Reference Manual. In addition to other topics, this chapter covers the following:

  • Standard I/O packages
  • FORM strings
  • DIRECT_IO
  • SEQUENTIAL_IO
  • TEXT_IO
  • Stream pointer positioning
  • Reading and writing non-regular files
  • GET_IMMEDIATE
  • Treating TEXT_IO files as streams
  • Shared files
  • Open modes

E.13 Implementation Limits

The following table lists implementation limits for DEC Ada and GNAT systems.

Limit DEC Ada GNAT
In a subprogram or entry declaration, maximum number of formal parameters that are of an unconstrained record type 32 No set limit
Maximum identifier length (number of characters) 255 255
Maximum number of characters in a source line 255 255
Maximum collection size (number of bytes) 2 31--1 2 31--1
Maximum number of discriminants for a record type 245 No set limit
Maximum number of formal parameters in an entry or subprogram declaration 246 No set limit
Maximum number of dimensions in an array type 255 No set limit
Maximum number of library units and subunits in a compilation closure 1 4095 No set limit
Maximum number of library units and subunits in an execution closure 2 16383 No set limit
Maximum number of objects declared with the pragma COMMON_OBJECT or PSECT_OBJECT 32757 No set limit
Maximum number of enumeration literals in an enumeration type definition 65535 No set limit
Maximum number of lines in a source file 65534 No set limit
Maximum number of bits in any object 2 31 --1 2 31 --1
Maximum size of the static portion of a stack frame (approximate) 2 30 2 30

1The compilation closure of a given unit is the total set of units that the given unit depends on, directly and indirectly.
2The execution closure of a given unit is the compilation closure plus all associated secondary units (library bodies and subunits).


Previous Next Contents Index