Apple (programming language)

Apple is a PL/I dialect programming language created by General Motors Research Laboratories for their Control Data Corporation STAR-100 supercomputer.

Apple is a subset of full PL/I, but has been extended to integrate with the Associative Programming Language (APL - not to be confused with APL (programming language) )

Associative programming features
clause is executed if no entities are found. For Each Heads a group of statements to be executed for all entities or sets matching a specified condition. Insert Insert an entity into a specified set. Optionally, the placement of the new entity relative to other elements of the set may be specified. Let Set a locator variable to reference a specified set. Remove Remove an entity from a set.

if the set is a file-set. APLINDX APLNUMB APLOWNI APLOWRS APLSNAM APLTYPE

Other features
An  variable identifies the relative location of a based variable in the containing file. A  variable resembles a pointer variable, but also contains the length of the associated based variable in addition to its address.

The  statement puts a program into "locked status", where all asynchronous events will be queued. A corresponding  statement puts the program in "unlocked status", capable of processing asynchronous events. All queued events will be processed.

Asynchronous processing
Apple uses the PL/I  data type to implement asynchronous processing.

An event variable can be associated with an external action, such as a keypress at the user's terminal, by a system call. Each event has a "delay state" and a "completion state" associated with it. When the event associated with the action occurs, the event becomes complete, and remains complete until the program accesses the information associated with the event. Events can also be marked complete with a  statement, rather than the PL/I standard assignment to the  pseudovariable. An event can be put into a delay state by the  pseudovariable, and recognition will remain deferred until the program resets the delay state.

Events can be associated with "ON-Units", by the  statement, similar to PL/I standard for conditions. The  statement removes the association. When the event is recognized (complete and not delayed) the On-Unit is executed. This ON-Unit can access system information about the event using the  builtin function, which returns the address of an "Event Completion Block", and sets the event to complete.

Hardware access
The  storage class and the   builtin subroutine allow access to STAR hardware features.

A scalar arithmetic variable can be declared. can be an unsigned integer constant 0..255 to specify one of the computer's hardware registers. If it is omitted the compiler will assign a register.

The  builtin subroutine inserts an arbitrary machine-language instruction into the compiled code. Except for the function code (operation code) and subcode of the instructions all operands can be numeric constants, variables, or arithmetic constants.

Example: CALL INLINE("F8", 5, 0, SOURCE, 0, "20", 0, TARGET);

Text replacement
The  specification allows the programmer to specify replacement text to be substituted at compile time. The syntax is: %DECLARE &lt;identifier&gt; LITERALLY [ (&lt;parameter-list&gt; ) ] &lt;character-constant&gt; ;

If &lt;parameter-list&gt; is not specified the compiler replaces all occurrences of &lt;identifier&gt; throughout the program with &lt;character-constant&gt;.If &lt;paramter-list&gt; is specified, the replacement character string is formed by replacing all occurrences of the parameter name with the corresponding argument.

Example: %DECLARE BITS LITERALLY(A1,A2) 'A1*A2*64'; I = BITS(J,B); will generate the statement: I=J*8*64;

Omitted PL/I features
Some features of standard PL/I are not included in Apple. The most significant are:
 * The  and   storage attributes are not supported.   and   have many of the characteristics of.
 * List-directed and data-directed input and output are not supported.
 * Record input-output statements, including,  ,  ,  , and  .   is used as a synonym for   when deleting   variables.