Exported Data in Server Libraries

Language Restrictions

The only languages that can export data are ALGOL, NEWP, and FORTRAN77.

Currently, NEWP exports a more limited range of data types than ALGOL. For information about the types of data that can be exported in ALGOL and NEWP, refer to Matching Data Types later in this section.

This section does not discuss the exporting of data in FORTRAN77. Instead, refer to the FORTRAN77 Programming Reference Manual.

Comparison with Global Objects

ALGOL and NEWP server libraries can export certain types of data objects in much the same way as procedures. By exporting data, you provide client processes with direct access to the data, rather than the indirect type of access described under Global Objects in Server Libraries in this section. The capabilities provided by these methods are compared in the following table:

Capability

Exporting Data

Exporting Procedures That Access Global Data

Ease of Implementation

The importing program is given direct access to the data.

You have to implement library procedures that provide an interface to the data.

Maintainability

Changes to data structures, semantics, and access rules can make it necessary to revise all client programs.

Changes to data structures, semantics, and access rules can often be hidden from client programs.

Processor Overhead

Low.

Somewhat higher, due to the cost of invoking a procedure.

Sharing

In the case of a SHAREDBYALL or SHAREDBYRUNUNIT library, all clients of the same library instance receive the same instance of the exported variable.

In the case of a SHAREDBYALL or SHAREDBYRUNUNIT library, all clients of the same library instance receive indirect access to the same instance of the global variable.

Writeability

The library can specify whether clients have read-write or read-only access to the variable.

The exported procedures can each contain logic to provide read-write or read-only access.

Mutual Exclusion

The library can export an event that client processes are expected to procure before updating some particular object. The library cannot enforce the use of this event.

The exported procedures can be coded to always procure a global event before updating the global variable. In this way, the library can ensure that the event is used.

Client Identity

The library provides the same access rights to all clients.

However, individual clients can reduce their own access rights by requesting read-only access to data that was exported with read-write access.

The exported procedures can include code to interrogate the client's identity, and allow different actions for different clients.

Use by Client Programs or Connection Libraries

The importing of data by client programs is supported only in ALGOL. Therefore, if a server library exports data, that data can be imported only by a connection library or an ALGOL client program.

Specifying the Access Mode

The server library can specify an access mode of READONLY or READWRITE for most exported data objects. If the server library does not specify an access mode, the default is READONLY.

In ALGOL, if all of the objects exported in an EXPORT declaration have the same access mode, you can specify the access mode within square brackets just after the EXPORT keyword. If the objects in the export list have different access modes, the access modes can be specified individually after each export object in the list.

You cannot specify an access mode for events or event arrays. However, access to events is automatically restricted in some ways, as described in the following paragraphs.

Limitations on Events

A server library program can use exported events in the same ways as any other event. However, a number of restrictions apply to the use of imported events by the importing program. The usage of imported events is restricted in the following ways:

Usage

Restriction

WAIT and WAITANDRESET Statements

An imported event cannot be used in WAIT or WAITANDRESET statements.

However, imported events can be used in other event-related statements and functions, such as AVAILABLE, CAUSE, CAUSEANDRESET, FIX, FREE, HAPPENED, LIBERATE, PROCURE, RESET, and SET.

Furthermore, a server library and client program could communicate by having the server library apply WAIT or WAITANDRESET statements to the exported event, and having the client library apply CAUSE or CAUSEANDRESET statements to the imported event.

Interrupts

An imported event cannot be attached to an interrupt.

LOCK Statements

An imported event cannot be used in statements of the form LOCK (<interlock>, <event>).

Direct I/O

An imported event cannot be used in direct I/O.

Parameters

An imported event cannot be passed as a parameter to a procedure.

If a program violates one of these restrictions, a syntax error results.

Syntax Examples for Exporting Data

The following ALGOL statements export several data objects. Real array A receives the default access mode of read-only, and integer I is assigned an access mode of read-write.

REAL ARRAY A [0:10];
INTERGER I;
EVENT E1;
EXPORT A (LINKCLASS = PROTECTED),
		I AS “I2” (READWRITE),
		E1;

Alternatively, the EXPORT statement can include a single access mode assignment that affects all the items in the export list, as in the following example:

EXPORT [READWRITE] A, I;

Direct, Indirect, and Dynamic Data Provision

Server libraries must use direct provision when exporting data objects; indirect and dynamic provision are not permitted. For definitions of these various types of provision, refer to Methods of Providing Objects later in this section.