Hal-S Language Specification
Hal-S Language Specification
Hal-S Language Specification
32.0/17.0
November 2005
DRD - 1.4.3.8-a
Contract NAS9-20000
USA003088
32.0/17.0
Approved by
DRD - 1.4.3.8-a
Contract NAS9-20000
HAL/S Language Specification USA003088
32.0/17.0
Revision Log
The HAL/S Language Specification has been revised and issued on the following
dates(s):1
Issue Revision Date Change Sections Changed
Authority
29.0/14.0 03/05/99 CR13043 - pp. Ix, x, xi, xii, iii
- p. 1-2
- pp. 2-1, 2-3, 2-4, 2-6, 2-7, 2-8
- pp. 3-1, 3-2, 3-3, 3-6, 3-8, 3-9, 3-10,
3-11, 3-12, 3-13
- pp. 4-1, 4-3, 4-4, 4-5, 4-7, 4-8, 4-9,
4-10, 4-11, 4-13, 4-14, 4-15, 4-
16, 4-17, 4-18, 4-19, 4-20
- pp. 5-1, 5-2, 5-3, 5-4, 5-6, 5-7, 5-8,
5-9, 5-10, 5-11, 5-12, 5-14
- pp. 6-1, 6-2, 6-4, 6-6, 6-8, 6-12, 6-
13, 6-14, 6-15, 6-16, 6-18, 6-19,
6-20, 6-21, 6-22, 6-24, 6-25, 6-
26, 6-27, 6-28
- pp. 7-1, 7-2, 7-3, 7-4, 7-5, 7-6, 7-7,
7-8, 7-9, 7-11, 7-12, 7-13, 7-14,
7-15
- pp. 8-3, 8-5, 8-8, 8-9, 8-10
- pp. 9-1, 9-2, 9-4
- pp. 10-3, 10-4, 10-7, 10-8, 10-9, 10-
11, 10-13, 10-14, 10-15, 10-16,
10-18
- pp. 11-2, 11-4, 11-6, 11-10, 11-12,
11-13, 11-14, 11-16, 11-17, 11-
18, 11-19, 11-20, 11-21, 11-23,
11-24, 11-25, 11-26, 11-27, 11-
28, 11-29, 11-30
- pp. A-3, A-4, A-5, A-6, A-7, A-8, A-9
- pp. C-1, C-2, C-4, C-5
- p. D-1
- p. E-1
- p. F-1
- p. H-2, H-3
1. A table containing the Revision History of this document prior to the USA contract can be found in
Appendix J.
November 2005
USA003088 HAL/S Language Specification
32.0/17.0
November 2005
USA003088 HAL/S Language Specification
32.0/17.0
November 2005
HAL/S Language Specification USA003088
32.0/17.0
November 2005
USA003088 HAL/S Language Specification
32.0/17.0
Preface
The HAL/S Language Specification was developed by Intermetrics, Inc., and is currently
maintained by the HAL/S project of United Space Alliance.
The HAL/S programming language accomplishes three significant objectives:
• increased readability, through the use of a natural two-dimensional mathematical
format;
• increased reliability, by providing for selective recognition of common data and
subroutines, and by incorporating specific data-protect features;
• real-time control facility, by including a comprehensive set of real-time control
commands and signal conditions.
Although HAL/S is designed primarily for programming on-board computers, it is general
enough to meet nearly all the needs in the production, verification, and support of aero-
space and other real-time applications.
The design of HAL/S exhibits a number of influences, the greatest being the syntax of
PL/1 and ALGOL, and the two-dimensional format of MAC/360, a language developed at
the Charles Stark Draper Laboratory. With respect to the latter, fundamental contribu-
tions to the concept and implementation of MAC were made by Dr. J. Halcombe Laning
of the Draper Laboratory.
The primary responsibility is with USA, Department, 01635A7.
Questions concerning the tecnical content of this document should be directed to Danny
Strauss (281-282-2647), MC USH-635L.
November 2005
USA003088 HAL/S Language Specification
32.0/17.0
November 2005
HAL/S Language Specification USA003088
32.0/17.0
Table of Contents
i November 2005
USA003088 HAL/S Language Specification
32.0/17.0
5.3 Subscripting ..................................................................................................... 5-2
5.3.1 Classes of Subscripting .......................................................................... 5-3
5.3.2 The General Form of Subscripting. ........................................................ 5-6
5.3.3 Structure Subscripting. ........................................................................... 5-7
5.3.4 Array Subscripting. ................................................................................. 5-8
5.3.5 Component Subscripting. ....................................................................... 5-9
5.4 The Property of Arrayness. ............................................................................ 5-10
5.4.1 Arrayness of Subscript Expressions .................................................... 5-11
5.5 The Natural Sequence of Data Elements ...................................................... 5-13
6.0 DATA MANIPULATION AND EXPRESSIONS ..................................................... 6-1
6.1 Regular Expressions. ...................................................................................... 6-1
6.1.1 Arithmetic Expressions. .......................................................................... 6-1
6.1.2 Bit Expressions. ..................................................................................... 6-6
6.1.3 Character Expressions. .......................................................................... 6-8
6.1.4 Structure Expressions. ........................................................................... 6-9
6.1.5 Array Properties of Expressions. ............................................................ 6-9
6.2 Conditional Expressions. ............................................................................... 6-10
6.2.1 Arithmetic Comparisons. ...................................................................... 6-12
6.2.2 Bit Comparisons. .................................................................................. 6-13
6.2.3 Character Comparisons. ...................................................................... 6-14
6.2.4 Structure Comparisons. ....................................................................... 6-15
6.2.5 Comparisons Between Arrayed Operands. .......................................... 6-15
6.3 Event Expressions. ........................................................................................ 6-16
6.4 Normal Functions. ......................................................................................... 6-17
6.5 Explicit Type Conversions. ............................................................................ 6-20
6.5.1 Arithmetic Conversion Functions. ........................................................ 6-20
6.5.2 The Bit Conversion Function. ............................................................... 6-23
6.5.3 The Character Conversion Function. ................................................... 6-25
6.5.4 The SUBBIT pseudo-variable. ............................................................. 6-26
6.5.5 Summary of Argument Types. ............................................................. 6-27
6.6 Explicit Precision Conversion. ....................................................................... 6-28
7.0 EXECUTABLE STATEMENTS ............................................................................ 7-1
7.1 Basic Statements. ............................................................................................ 7-1
7.2 The IF Statement. ............................................................................................ 7-1
7.3 The Assignment Statement. ............................................................................ 7-2
7.4 The CALL Statement. ...................................................................................... 7-4
7.5 The RETURN Statement. ................................................................................ 7-7
7.6 The DO…END Statement Group. ................................................................... 7-8
7.6.1 The Simple DO Statement. .................................................................... 7-9
7.6.2 The DO CASEStatement. ...................................................................... 7-9
7.6.3 The DO WHILE and UNTIL Statements. .............................................. 7-10
7.6.4 The Discrete DO FOR Statement. ....................................................... 7-11
7.6.5 The Iterative DO FOR Statement. ........................................................ 7-12
7.6.6 The END Statement. ............................................................................ 7-13
7.7 Other Basic Statements. ................................................................................ 7-14
8.0 REAL TIME CONTROL ........................................................................................ 8-1
November 2005 ii
HAL/S Language Specification USA003088
32.0/17.0
November 2005 iv
HAL/S Language Specification USA003088
32.0/17.0
LIST OF FIGURES
v November 2005
HAL/S Language Specification USA003088
32.0/17.0
vi November 2005
HAL/S Language Specification USA003088
32.0/17.0
Figure 10-4 FORMAT lists - #82 ................................................................................ 10-7
Figure 10-5 format character expression - #83.......................................................... 10-8
Figure 10-6 FORMAT item - #84 ............................................................................. 10-10
Figure 10-7 I FORMAT Item - #85 ........................................................................... 10-11
Figure 10-8 F and E FORMAT items - #86 ............................................................. 10-12
Figure 10-9 A format item - #87 ............................................................................... 10-14
Figure 10-10 U format item - #88............................................................................. 10-15
Figure 10-11 X format item - #89 ............................................................................. 10-15
Figure 10-12 FORMAT quote string - #90 ............................................................... 10-16
Figure 10-13 P format item - #91 ............................................................................. 10-17
Figure 10-14 FILE statements - #68 ........................................................................ 10-19
Figure 11-1 Inline Function Block - #69 .................................................................... 11-2
Figure 11-2 %Macro Statement - #70....................................................................... 11-3
Figure 11-3 arithmetic operand - #25s....................................................................... 11-4
Figure 11-4 bit operand - #27s................................................................................... 11-5
Figure 11-5 character operand - #29s ....................................................................... 11-6
Figure 11-6 structure expression - #29.1s ................................................................. 11-6
Figure 11-7 %MACRO - #71...................................................................................... 11-7
Figure 11-8 DO…END Statement Group - #49s....................................................... 11-8
Figure 11-9 temporary statement - #72 ..................................................................... 11-8
Figure 11-10 discrete DO FOR with loop TEMPORARY variable index - #53.......... 11-9
Figure 11-11 iterative DO FOR with loop TEMPORARY variable index - #54s...... 11-10
Figure 11-12 declaration statement - #14s ............................................................. 11-11
Figure 11-13 NAME Examples ................................................................................ 11-12
Figure 11-14 NAME Array Examples....................................................................... 11-12
Figure 11-15 label declarative attribute - #16s........................................................ 11-13
Figure 11-16 structure template statement - #13s ................................................... 11-14
Figure 11-17 Structure NAME Examples................................................................. 11-15
Figure 11-18 NAME Variable Dereferencing Examples........................................... 11-16
Figure 11-19 NAME reference - #73........................................................................ 11-16
Figure 11-20 NAME Variable Subscripting Example .............................................. 11-17
Figure 11-21 NAME Variable Referencing Examples.............................................. 11-18
Figure 11-22 NAME assign #74.............................................................................. 11-18
Figure 11-23 NAME Assignment Example .............................................................. 11-18
Figure 11-24 NAME assignment statement #75 ...................................................... 11-19
Figure 11-25 NAME conditional expression- #76 ................................................... 11-19
Figure 11-26 NAME Conditional Example ............................................................... 11-20
Figure 11-27 normal FUNCTION reference - #77.................................................... 11-20
Figure 11-28 CALL STATEMENT with NAME - #47s .............................................. 11-21
Figure 11-29 NAME Variables as Parameters Example......................................... 11-22
Figure 11-30 NAME initialization attribute #79........................................................ 11-22
Figure 11-31 Structure NAME Dereference............................................................. 11-23
Figure 11-32 Structure NAME Dereference Chain .................................................. 11-24
Figure 11-33 Structure NAME Dereference Loop.................................................... 11-24
Figure 11-34 Structure NAME Dereference with Subscripting................................. 11-25
Figure 11-35 Structure NAME Manipulation ............................................................ 11-26
ix November 2005
USA003088 HAL/S Language Specification
32.0/17.0
This page is intentionally left blank.
November 2005 x
HAL/S Language Specification USA003088
32.0/17.0
1.0 INTRODUCTION
HAL/S is a programming language developed by Intermetrics, Inc., for the flight software
of NASA programs. HAL/S is intended to satisfy virtually all of the flight software
requirements of NASA programs. To achieve this, HAL/S incorporates a wide range of
features, including applications-oriented data types and organizations, real-time control
mechanisms, and constructs for systems programming tasks.
As the name indicates, HAL/S is a dialect of the original HAL language previously
developed by Intermetrics. Changes have been incorporated to simplify syntax, curb
excessive generality, or facilitate flight code emission.
SYSTEM LANGUAGE
HAL/S contains a number of features especially designed to facilitate its applications to
systems programming. Thus it substantially eliminates the necessity of using an
assembler language.
PROGRAM RELIABILITY
Program reliability is enhanced when software can, by its design, create effective
isolation between various sections of code, while maintaining ease of access to
commonly used data. HAL/S is a block oriented language in that blocks of code may be
established with locally defined variables that are not visible from outside the block.
Separately compiled program blocks can be executed together and communicate
through one or more centrally managed and highly visible data pools. In a real time
environment, HAL/S couples these precautions with locking mechanisms preventing the
uncontrolled usage of sensitive data or areas of code.
WAIT 2
1 statement 8
basic
statement
arith exp
3 4
WAIT FOR DEPENDENT ;
5 6
4 1
0
: label
7 event exp
11
12
example: UNTIL arith exp
RULES:
1. Every diagram defines a syntactical term. The name of the term being defined
appears in the hexagonal box 1 . The title of the syntax diagram is usually a
discursive description of the syntactical term. In the case illustrated, the language
construct depicted is a particularization of the syntactical term defined (a “WAIT
statement” is an example of 1 ).
2. To generate examples of the construct, the flow path is to be followed from left to
right, from box to box, starting at the point of juncture of the definition box 3 , and
ending when the end of the path 6 is reached.
3. The path is moved along until it arrives at a black dot 4 . No “backing up” along points
of convergence such as 5 is allowed. A black dot denotes that a choice of paths is to
be made. The possible number of divergent paths is arbitrary.
4. Potentially infinite loops such as 7 may sometimes be encountered. Sometimes
there are semantic restrictions upon how many times such loops may be traversed.
5. Every time a box is encountered, the syntactical term it represents is added to the
right of the sequence of terms generated by moving along the flow path. For
example, moving along the path paralleling dotted line 8 generates the sequence
“WAIT <arith exp>;” (see Rule 7).
6. Boxes with squared corners, such as 9 , represent syntactical terms defined in other
diagrams. Boxes with circular ends, such as 11 , represent HAL/S primitives. Circular
boxes, such as 10 , contain special characters (see Section 2.2).
7. The text accompanying the syntax diagrams, boxes containing lower case names are
represented by enclosing the names in the delimiters <>. Thus box 9 becomes
<arith exp>. Upper case names are reserved words of the language.
8. The example given at 12 is an example of HAL/S code which may be generated by
applying the syntax diagram (since some boxes, such as 9 for example, are defined
in other syntax diagrams, reference to them may be necessary to complete the
generative process).
A j +
B k -
C l *
D .
m
E /
n
F | operators
o &
G
H p literals, ¬
I q identifiers =
J r <
K literals, s >
L identifiers, t #
M reserved words u @
N v $
O w ,
P ; separators
x
Q :
y
R (blank)
z
S (
T pseudo-alphabetic )
U ' delimiters
_ identifiers
V % macros "
W
¢ text generation
X escape
Y additional extended-set symbols
numeric
Z
0 [
a 1 ]
b 2 {
c
3 literals, }
d
4 identifiers !
e
f 5 ?
g 6
h 7
i 8
9
2.3.2 Identifiers.
An identifier is a name assigned by the programmer to be a variable, label, or other
entity. Before its attributes are defined, it is syntactically known as an <identifier>. Each
valid <identifier> must satisfy the following rules:
• the total number of characters must not exceed 32;
• the first character must be alphabetic;
• any character except the first may be alphabetic or numeric;
• any character except the first or the last may be a “break character” (_).
The definition of an <identifier> generally establishes its attributes, and, in particular, its
type. Thereafter, because its type is known, it is given one of the following names, as
appropriate:
<label> ⎧arith (arithmetic)
<process-event name> ⎪char (character)
< § var name> where § ≡ ⎨bit
<template name> ⎪event
⎩structure
The manner in which its attributes are established is discussed in Section 4. The manner
in which it is thereafter referenced is discussed in Section 5.
2.3.3 Numbers.
HAL/S supports two numeric types: INTEGER and SCALAR.
INTEGER type provides all the signed integers in some finite range. INTEGER DOUBLE
supports a larger range than INTEGER single.
SCALAR type is represented as floating point numbers. As such they are an
approximation to the signed reals (engineering numbers) within some finite range and
with some finite precision. SCALAR DOUBLE supports a larger range and/or greater
precision than SCALAR single.
2.3.4 Literals.
Literals are groups of characters expressing their own values. During the execution of a
body of HAL/S code their values remain constant. Differing rules apply for the formation
of literals of differing type.
examples:
BIN‘11011000110’
HEX(3)‘F’
examples:
''
'ONE TWO THREE'
'DOG''S'
'AB¢AD' ⎤
'AB¢¢AD' ⎦ The implication that ¢A and ¢¢A have been defined as alternate characters.
§
compilation function block
compool block
function template
program block
procedure template
function
procedure
§ compool
compool template
program
2. A program complex is executable within the framework of an executive operating system, and a run time utility
library.
Program
block
statement
task block
example:
ALPHA: PROGRAM; update block
DECLARE Q;
.
. function block
.
CALL BETA ASSIGN(Q); procedure block
.
.
.
BETA: PROCEDURE ASSIGN(W);
DECLARE W;
W = W + 1;
CLOSE BETA;
.
.
.
CLOSE ALPHA;
SEMANTIC RULES:
1. The name of the <program block> is given by the <label> prefacing the block.
2. The <program block> is delimited by the <program header> statement at beginning,
and a <closing> at the end. These two delimiting statements are described in
Sections 3.7.1 and 3.7.4, respectively.
3. The contents of a <program block> consists of a <declare group> used to define data
local to the <program block>, followed by any number of executable <statement>s.
4. The normal flow of execution of the <statement>s in the block is sequential; various
types of <statement> may modify this normal sequencing in a well-defined way.
5. PROCEDURE, FUNCTION, TASK, and UPDATE blocks may appear nested within a
<program block>. The blocks may be interspersed between the <statement>s of the
<program block>, and with the exception of the UPDATE block are not executed in-
line.
6. Execution of a <program block> is accomplished by scheduling it as a process under
control of the Real Time Executive (see Section 8).
3
§ PROCEDURE
block § FUNCTION block
TASK
statement
update block
example:
NEW: TASK; procedure block
I = 1;
CLOSE NEW; function block
SEMANTIC RULES
1. The name of the block is given by the <label> prefacing the block. The definition of a
block label is considered to be in the scope of the outer block containing the block in
question. Block names must be unique within any compilation unit.
2. The block is delimited at its beginning by a header statement characteristic of the
type of block, and at the end by a <closing>. The delimiting statements are described
in Sections 3.7.1 through 3.7.4.
3. The contents of a block consists of a <declare group> used to declare data local to
statement
procedure block
label :
function block
SEMANTIC RULES:
1. If present, the <label> prefacing the <update block> gives the name of the block. If
<label> is absent, the <update block> is unnamed.
2. The block is delimited at its beginning by an <update header> statement, and at the
end by a <closing>. The delimiting statements are described in Sections 3.7.1 and
3.7.4.
3. The contents of the block consist of a <declare group> used to declare data local to
the <update block>, followed by any number of executable <statement>s.
4. The normal flow of execution of the <statement>s in the block is sequential; various
types of <statement>s may modify this normal sequencing in a well defined way.
5. Only PROCEDURE and FUNCTION blocks may be nested within an <update block>.
The nested blocks may appear interspersed between the <statement>s of the block,
and are not executed in-line.
6. An <update block> is treated like a <statement> in that it is executed in-line. In this
respect it is different from other code blocks.
7. The following <statement>s are expressly forbidden inside an <update block> in view
of its special protective function:
• I/O statements (see Section 10);
• invocations of <procedure block>s or <function block>s not themselves nested
within the <update block>;
• real-time programming statements, except for the SIGNAL, SET, and RESET
statements (see Section 8.8).
compool
block
PROGRAM 6
§ PROCEDURE template
§ FUNCTION
COMPOOL
template
SEMANTIC RULES
1. The <label> of the template constitutes the template name. It is the same name as
that of the code block to which the template corresponds.
2. The block template is delimited at its beginning by a header statement identical with
the header statement of the corresponding code block, and at the end by a <closing>.
The delimiting statements are described in Sections 3.7.1 and 3.7.4.
3. The contents of the block template consist only of a <declare group>, which has the
following significance:
• in a program <template>, the <declare group> contains no statements. All
information about external programs is contained in the <program header>;
• in a <compool template>, the <declare group> is used to declare a common data
pool identical with that of the corresponding <compool block>;
• in a <procedure template> or <function template>, the <declare group> is used to
declare the formal parameters of the corresponding <procedure block> or <function
block> (see Sections 3.7.2 and 3.7.3).
4. The keyword EXTERNAL preceding the header statement of the block template
distinguishes it from an otherwise identical code block. To a HAL/S compiler the
keyword is in effect a signal to prevent the compiler from generating object code for
the block and setting aside space for the data declared.
7
update
header
task
header UPDATE ;
program TASK ;
header
ACCESS
compool
header PROGRAM ;
ACCESS
COMPOOL ;
RIGID
SEMANTIC RULES:
1. The type of the code block or template is determined by the type of the header
statement, which is in turn indicated by one of the keywords COMPOOL,
PROGRAM, TASK, and UPDATE.
2. The keyword ACCESS causes managerial restrictions to be placed upon the usage
of the block in question. The manner of enforcement of the restriction is
implementation dependent.
3. The keyword RIGID causes COMPOOL data (except for data with the REMOTE
attribute) to be organized in the order declared and not rearranged by the compiler.
procedure 8
header
PROCEDURE
( identifier )
,
REENTRANT
;
ASSIGN ( identifier ) EXCLUSIVE ACCESS
example: ,
PROCEDURE ASSIGN (B);
type
FUNCTION spec
17
( identifier )
REENTRANT
,
;
ACCESS
example:
FUNCTION(A) SCALAR REENTRANT;
3. Any use of update blocks and LOCK data, or of EXCLUSIVE procedure or function blocks should be carefully
analyzed with respect to unfavorable timing problems if a procedure is reentered by a higher priority process.
SEMANTIC RULES:
1. The keyword FUNCTION identifies the start of a <function block> or <function
template>. It is optionally followed by a list of “formal parameters” which are
substituted by corresponding “arguments” in the invocation of the <function block>
(see Section 6.1.1).
2. The <identifier>s in the list following the FUNCTION keyword are “input parameters”
since they may not appear in any context inside the <function block> which may
cause their values to be changed.
3. Data declarations for all the formal parameters must appear in the <declare group> of
the <function block> or the <function template>.
4. <type spec> identifies the type of the <function block> or <function template>. A
<function block> may be of any type except EVENT. The formal description of the
type specification given by <type spec> is given in Section 4.7.
5. If the <function header> statement specifies neither of the keywords REENTRANT or
EXCLUSIVE, then only one real time process (see Section 8) may be executing the
<function block> at any one time; however, there is no enforcing protective
mechanism. If the keyword EXCLUSIVE is specified, then such a protective
mechanism does exist. If an EXCLUSIVE <function block> is already being executed
by a real time process when a second process tries to invoke it, the second process is
forced into the stall state (see Section 8) until the first has finished executing it. If the
keyword REENTRANT is specified, then two or more processes may execute the
<function block> “simultaneously”.
6. The keyword REENTRANT indicates to the compiler that reentrancy is desired.
However, other attributes and conditions may conflict with this overall objective. The
following effects should be noted:
• STATIC data is allocated statically and initialized statically. There is only one copy
of STATIC data which must be shared by all processes simultaneously executing
the block. Hence, in coding REENTRANTblocks, care must be taken not to
assume that STATIC variables participate in the reentrancy.
• AUTOMATICdata is allocated dynamically and initialized dynamically. Every
process simultaneously executing the block gets its own initialized copy of the data
on entry into the block. In general, all local data in a REENTRANTblock should be
declared with the AUTOMATIC attribute.
• Procedures and functions defined within a REENTRANT block must also possess
the REENTRANT attribute if they, too, declare local data which is required to
participate in the reentrancy.
In addition, for reentrancy to be preserved, the following rules must be observed:
• Update blocks4 and inline functions within a REENTRANTblock may not declare
any local data, STATIC or AUTOMATIC, because the update block does not inherit
the reentrant attribute from the enclosing function declaration;
• A procedure or function called by a REENTRANT block must itself also be
REENTRANT.
4. Any use of update blocks and LOCK data, or of EXCLUSIVE procedure or function blocks should be carefully
analyzed with respect to unfavorable timing problems if a function is reentered by a higher priority process.
closing 10
CLOSE ;
: label label
example:
ALL_DONE: CLOSE;
GENERAL RULES:
1. The name scope of a code block encompasses the entire contents of a block,
including all blocks nested within it.
2. The name defined in a name-scope is known, and therefore able to be
referenced, throughout that name-scope, including all nested blocks not
redefining it. A name defined in a name-scope is not known outside that name-
scope.
3. Names defined in all common data pools used by a <compilation> are
considered to be defined in one name-scope which encloses the outermost code
block of the <compilation>.
QUALIFICATIONS:
example:
ALPHA: PROGRAM;
DECLARE X; X known everywhere
outer name DECLARE Y; this Y known everywhere
scope: . except in BETA.
.
.
.
.
BETA: PROCEDURE; BETA is known everywhere;
DECLARE Y; new Y known in BETA only
DECLARE Z; Z known in BETA only
.
.
inner name
.
scope: .
CLOSE BETA;
.
.
.
DELTA: Y = 0;
. DELTA not known in BETA
.
.
.
CLOSE ALPHA;
TYPES ORGANIZATIONS
individual array * *
scalar character *
types
Combination
integer bit * of types
vector *
matrix *
special
event
process
event
SYNTAX:
11
declare
group
replace statement
structure template
declare statement
12
Replace ,
statement
( identifier )
REPLACE identifier
;
BY " text "
example:
REPLACE ALPHA BY "J+1" ;
REPLACE BETA (X, ANGLE) BY "SIN (X ANGLE) - EXP (X) / X" ;
parametric 12.1
replace
reference
,
identifier ( argument )
SEMANTIC RULES:
1. A reference to a parametric REPLACE statement consists of the REPLACE name
followed by a series of <argument>s enclosed in parentheses. The REPLACE name
must have been defined previously within the name scope of the reference. The
number of <argument>s must correspond to the number of parameters of the
REPLACE statement being referenced. Enclosing the reference within ¢ signs (e.g.,
¢CBETA(A,B)¢) makes the <text> visible in the compiler listing.
2. The <argument>s supplied in a parametric REPLACE reference are substituted for
each occurrence of the corresponding parameter within the source macro definitions
<text>. Note that if the parameter in question does not occur within the source macro
definition’s <text>, the <argument> is ineffective. <text> substitution is always
completed before parsing.
Example:
REPLACE BETA(X,ANGLE) BY “SIN(X ANGLE) - EXP(X)/X”;
.
.
.
Z = BETA(Y,ALPHA); WILL GENERATE SIN(Y ALPHA) - EXP(Y)/Y
3. In general, the <argument>s supplied in a parametric REPLACE reference comprise
<text> separated by commas (subject to the specific exceptions listed below). As
such, they conform to the preceding semantic rules for <text> with the following
emendations:
• Blanks are significant in <argument>s. Only the commas used to separate
<argument>s are excluded from the <text> values substituted into the macro
definition.
• The <text> string comprising an <argument> may be empty. The value substituted
in such a case is a null string.
• Within each <argument> there must be an even number of apostrophe characters
(’). The effect of this rule is to require that each character literal used must be
completely contained within a single <argument>.
• Within each <argument> there must be an even number of quotation mark
characters (“). The effect of this rule is to require that the substitution of a nested
REPLACE statement include the entire text of the replacement within a single
<argument>.
• Within each <argument> there must be a balanced number of left and right
parentheses: for each opening left parenthesis there must be a corresponding right
parenthesis.
• Commas are not separators between <argument>s under the following
circumstances:
- within a character literal.
- within REPLACE <text>.
- nested within parentheses.
start of end of
tree walk tree walk
"root"
NAME
∗→ "fork"
1
2
"branch"
structure terminal 3
minor structure
template name "leaf"
4
13
structure
template
DENSE RIGID
STRUCTURE identifier :
ALIGNED
15
sequentially defined following the colon. The order of definition has already been
described.
9. Each definition of a minor structure of structure terminal is separated from the next by
a comma.
NAME UNIQUENESS RULES:
1. <template names> may duplicate <identifiers> of any other kind within a given name
scope, but may not duplicate other <template names>.
2. In a given name scope, if a <template name> is used exclusively in qualified structure
declarations, duplications of the <identifiers> used for nodes may occur under the
following circumstances:
• Any <identifier> used for a node in one template may duplicate an <identifier> used
for a node in another template.
• Any <identifier> used for a node in a given template may duplicate another
<identifier> used for a different node in the same template, provided that a qualified
reference can distinguish the two nodes.
3. In a given name scope, if a template is ever used for a non-qualified structure variable
declaration, the duplications allowed under rule #2 within that template become
illegal.
examples:
i) definition of a template z Z
STRUCTURE Z:
1 A SCALAR, C 1
1 B VECTOR(4),
1 C, A B
2 D MATRIX(4,4), 2
2 E BIT(3); D E
Y
ii) definition of a template Y
with Z nested within it
F H
1
STRUCTURE Y:
Z G
1 F,
2 X Z-STRUCTURE, X 2
2 G INTEGER, A
1 H CHARACTER(10); B C 3
E
D 4
iii) equivalent form of template Y without nesting
Y
STRUCTURE Y:
1 F, H
2 X, F 1
3 A SCALAR,
3 B VECTOR(4), G
X 2
3 C,
4 D MATRIX(4,4), C
4 E BIT(3), 3
2 G INTEGER, A B
1 H CHARACTER(10); 4
D
E
declare 14
statement ,
,
attributes
example:
DECLARE INTEGER, A, B ARRAY (5);
SYNTAX:
attributes 15
17
type spec
*
REMOTE
AUTOMATIC
STATIC
DENSE
ALIGNED
RIGID
ACCESS
LOCK ( )
*
number
LATCHED
initialization
18
example:
ARRAY(5) SCALAR STATIC
5. See Appendix F.
• RIGID - Although legal in other contexts, the keyword is only effective when
appearing as an <attribute> in a <structure template> or in a COMPOOL. It
causes data to be organized in the order it is defined within the <structure
template>.
RESTRICTIONS FOR SIMPLE VARIABLES AND MAJOR STRUCTURES:
1. The asterisk form of array specification can only be applied to an <identifier> if it is a
formal parameter of a procedure or function. The actual length of the array is
supplied by the corresponding argument of an invocation of the procedure or function.
2. An array specification is illegal if the <identifier> is defined by the <type spec> to be a
major structure.
3. The ACCESS attribute may only be applied to <identifier> names declared in a
<compool block> or <compool template>. The LOCK attribute may only be applied to
<identifier> names declared in a <compool block>, <compool template>, <program
block>, or to the assign parameters of procedure blocks.
4. The LATCHED attribute only applies to EVENT variables (see Section 4.7).
5. The REMOTE and AUTOMATIC attributes are illegal for any <identifier> of EVENT
type. AUTOMATIC is also illegal if <identifier> is a parameter of a PROCEDURE or
FUNCTION block.
6. The attributes ALIGNED and RIGID are illegal for major structures.
7. The <initialization> attribute may not be applied to formal parameters of procedures
and functions.
RESTRICTIONS FOR STRUCTURE TERMINALS:
1. The asterisk form of array specification is not allowed.
2. The <identifier> may not be defined to be an unqualified structure by the <type spec>.
Otherwise, the type specification is the same as for simple variables.
3. The appearance of any minor attributes except DENSE, ALIGNED, and RIGID is
illegal. Appearances of DENSE and ALIGNED override such appearances on the
minor structure levels or on the <structure template> name itself.
4. An array specification is illegal if the <identifier> is defined by the <type spec> to be a
major structure.
RESTRICTIONS FOR MINOR STRUCTURES:
1. The <type spec> for a minor structure name must be empty (see Section 4.7).
2. No array specification is allowed.
3. No attributes except DENSE, ALIGNED, and RIGID are allowed. Appearances of
DENSE and ALIGNED at any level of the structure override such appearances at
higher levels or on the <structure template> name itself. The appearance of RIGID
causes structure terminals within the minor structure to be organized in the order in
which they are declared. However, RIGID at the minor structure level will not affect
the order of data within an included template specified by a structure template
<typespec>.
EXAMPLE:
STRUCTURE Y:
1 A SCALAR,
1 B VECTOR(4),
1 D MATRIX(4,4);
STRUCTURE Z RIGID:
1 F BIT(13),
1 G Y-STRUCTURE,
1 H CHARACTER(10);
The order within Z will be: F, G, H, but the order within G will not necessarily be as
declared by Y.
Figure 4-11 Rigid Structure Example
16
attributes
NONHAL number
PROCEDURE ( )
2. The NONHAL (<number>) indicates that an external routine written in some other
language is being declared. The NONHAL (<number>) may be a factored attribute
applied to a list of label declarations. The <number> is an implementation dependent
indication of the type of NONHAL linkage.
3. The form TASK is used to define the name of a <task block>. It may be required if a
<task block> is referenced before the occurrence of its definition.
17
type
spec
,
MATRIX ( arith exp arith exp )
24 24
24
SINGLE
SCALAR
DOUBLE
INTEGER
( )
BIT arith exp
24
*
CHARACTER ( arith exp )
24
EVENT
BOOLEAN
template -STRUCTURE
name
( arith exp )
24
4.8 Initialization.
The <initialization> attribute specifies the initial values to be applied to an <identifier>.
The circumstances under which the attribute is legal have been described in Section 4.5.
6. Declarations of non-qualified STRUCTUREs must occur in the same name scope as the template definition.
SYNTAX:
initialization 18
,
INITIAL *
initial
list
expression
,
§ :see rule 4 below
example:
INITIAL (2# (1, 3#5))
STRUCTURE A:
1 B,
2 C,
3 E VECTOR(3),
3 F SCALAR, structure template
2 G,
3 H EVENT,
3 I INTEGER,
1 J BIT(16);
“unqualified”
DECLARE A A-STRUCTURE,
Z A-STRUCTURE;
“qualified”
5.3 Subscripting
For the remainder of the section, a data name with known <attributes> is denoted
syntactically by <§var name>, where § stands for any of the types arithmetic, bit,
character, event, or structure. It is convenient to introduce the syntactical term <§var> to
denote any subscripted or unsubscripted <§var name>.
SYNTAX:
arith
19
bit
variables
char
§ var structure
event
var name
example:
A 1 TO 10 S subscript M
09/07/01 5-2
HAL/S Language Specification USA003088
32.0/17.0
SYNTAX:
20
event var
bit var
variable
arith var
bit pseudo-var
char var
structure var
SYNTAX:
21
subscript
component
sub
array sub :
: component
sub
; : component
array sub sub
example:
I; J, K: L :
09/07/01 5-4
HAL/S Language Specification USA003088
32.0/17.0
examples:
i) Px:
ii) Q x
Q is any simple variable of
integer, scalar, or event type
<component sub>
<array sub> see example i)
<structure sub> Q is any unarrayed structure
terminal* of integer, scalar, or
event type
iii) R x;
array 22
sub
component structure ,
sub sub
sub exp
sub
exp #
arith exp
# -
example:
# + 3 AT # -5
09/07/01 5-6
HAL/S Language Specification USA003088
32.0/17.0
3. The simple index form is denoted in the diagram by a single <sub exp>. Its value
specifies the index of a single component, array element, or structure copy to be
selected from a dimension.
4. The AT-partition is denoted by the form <arith exp> AT <sub exp>. The value of <arith
exp> is the width of the partition, and that of <sub exp> the starting index.
5. The TO-partition is denoted by the form <sub exp> TO <sub exp>. The two <sub
exp> values are the first and last indices, respectively, of the partition.
6. The asterisk form, denoted in the diagram by *, specifies the selection of all
components, elements, or copies from a dimension.
7. <sub exp> may take any of the forms shown. The value of # is taken to be the
maximum index-value in the relevant dimension (for character variables, this is the
current length).
8. Any <arith exp> in a subscript expression is an unarrayed integer or scalar
expression. Values are rounded to the nearest integer.
examples:
STRUCTURE A;
1 B SCALAR,
1 C INTEGER,
1 D VECTOR(6);
•
•
•
DECLARE A A-STRUCTURE(20);
A20 20th copy of A
A2 AT 10; 10th and 11th copies of A
(semicolon optional)
C1 C from 1st copy of A
D4 TO 6; D from 4th through 6th copies of A
(semicolon enforced)
Note: D*;4 TO 6 components 4 through 6 of D from all copies of A
09/07/01 5-8
HAL/S Language Specification USA003088
32.0/17.0
examples
STRUCTURE P:
1 Q ARRAY(5) SCALAR,
1 R SCALAR;
•
•
•
DECLARE P P-STRUCTURE(10);
09/07/01 5-10
HAL/S Language Specification USA003088
32.0/17.0
VA - a 3 - array ⎫
⎬
VB - a 3x2 - array of corresponding vector components
⎭
Example
DECLARE I ARRAY(3) INTEGER,
M MATRIX(2,2),
MA ARRAY(3)MATRIX(2,2),
MB ARRAY(2)MATRIX(2,2);
⎛ ⎡0.5 0.5 ⎤ ⎞ 1 I = 2
⎜⎢ ⎥ ⎟ 1
⎜ ⎣0.1 0.3 ⎦ ⎟
If MB ≡ ⎜ ⎟
⎜ ⎡0.2 0.7 ⎤ ⎟
⎜ ⎢0.4 0.8 ⎥⎦ ⎟⎠
⎝⎣ 2 I2 = 1
⎛ MB 1:2,* ⎞ ⎛ ⎡0.1 0.3 ⎤ ⎞
≡ ⎜ ⎟ ≡ ⎜⎜ ⎢ ⎟
then MB *:I ,* ⎜ MB ⎟ ⎝ ⎣0.2 0.7 ⎥⎦ ⎟⎠
1 TO 2 ⎝ 2:1,* ⎠
09/07/01 5-12
HAL/S Language Specification USA003088
32.0/17.0
example:
DECLARE V ARRAY(2,2) VECTOR(3);
• order of unraveling of V is Vi,*:* , i = 1, 2
• order of unraveling of each Vi,*:* , is Vi,j: , j = 1, 2
• order of unraveling of each Vi,j:* is Vi,j:k , k = 1, 2, 3
(standard HAL/S subscript notation used)
09/07/01 5-14
HAL/S Language Specification USA003088
32.0/17.0
23
expression
arith exp
bit exp
char exp
structure exp
SYNTAX:
24
arith exp _
+ *
_
.
/
examples:
I + J -(K + 2) 3 **
M.(M*N)
3 dot product.
6 if the right operand is literally “T” the transpose is indicated. If the right operand
is literally “0” the result is an identity matrix. If the right operand is a positive inte-
ger number, a repeated product is implied. If the right operand is a negative inte-
ger number, repeated product of the inverse is implied. These are the only legal
forms.
7 the operands are converted to scalar before division.
8 the operation is undefined if the value of the left operand is negative, and the
6. If the two operands of an operation are of differing precision, the result is double
precision; otherwise, the precision of the result is the precision of the operands.
However, when only one operand is a literal (which includes non-aggregate
CONSTANTS), the precision of the result is the same as the precision of the non-
literal operand. An aggregate is defined in this case as an ARRAY, STRUCTURE,
VECTOR, or MATRIX.
PRECEDENCE RULES:
1. The following table summarizes the precedence rules for arithmetic operators:
Operator Precedence Operation
FIRST
** 1 Exponeniation
<> 2 Multiplication
* 3 cross-product
. 4 dot-product
/ 5 Division
+ 6 addition and unary plus
- 6 subtraction and unary
minus
LAST
Table 6-2 Precedence Rules for Arithmetic Operators
2. If two operations of the same precedence follow each other, then the following rules
apply:
• operators * *, / are evaluated right-to-left;
• all other operators are evaluated left-to-right;
3. Overriding Rules 1 and 2, the operators <>, *, and . are evaluated so as to minimize
the total number of elemental multiplications required. However, this rule does not
modify the effective precedence order in cases where it would cause the result to be
numerically different, or the operation to be illegal.
arith var 25
19
number
normal
function S precision M
38 43
arith example:
conversion
39 (A + B)
@DOUBLE
7. Since a subscripted <arith var> is an example of an <arith exp>, the <precision> specifier may be applied by first
enclosing the <arith exp> in parentheses.
26
AND
bit exp
&
bit operand |
OR
CAT
||
examples:
B & C || ¬ D
4. The operators AND (&) and OR (|) denote logical intersection and union, respectively.
The shorter of the two <bit operand>s is left padded with binary zeroes to match the
length of the longer.
A <bit operand> appearing in a <bit exp> has the following form.
SYNTAX:
bit 27
operand
( bit exp )
NOT
bit var
event var
bit literal
normal function
bit conversion
example:
BIN ‘11010110’
bit pseudo-var
char exp
char operand ||
example:
Q ||I || QQQ
char var
normal function
char literal
example:
(A || B)
char conversion
SEMANTIC RULES:
1. A <char operand> may be a character variable, a <char exp> enclosed in
parentheses, a <char literal>, a <normal function> of character type (see Section
6.4), or a <char conversion> function (see Section 6.5.3).
structure 29.1
exp
structure var
normal function
30
condition
&
conditional
operand AND
31
|
OR
examples:
(A>B) | (A>C)
conditional 31
operand
comparison
32-5
¬
( condition )
30
NOT
example:
¬(A>B)
NOT <
¬<
comparison
NOT >
>
¬>
¬=
NOT =
>
<
example: >=
I>J
<=
Operator
= ¬= ¬> ¬<
operands NOT= > < NOT > NOT <
<= >=
VECTOR √ √
MATRIX √ √
INTEGER √ √ <- - - - - - - no arrays- - - - - - - ->
SCALAR
33
comparison
¬=
26 26
NOT =
Example:
B ¬ =BIN ‘110’
34
NOT<
¬<
comparison NOT>
¬>
28 ¬= 28
NOT=
>
<
example: >=
C = ‘A’
<=
35
comparison
¬=
NOT =
36
37
OR
example:
ALPHA OR BETA
4. The following types of event expressions are the only valid expressions for real time
programming statements:
• single event variable with or without the NOT operator,
• more than one event variable connected by all OR operators,
• more than one event variable connected by all AND operators.
An <event operand> appearing in an <event exp> has the following form:
SYNTAX:
37
event
operand )
NOT ( event exp
36
event var
19
SYNTAX:
normal 38
function
label
( expression )
example: 23
SIN (2 X) ,
• implicit integer and scalar to character conversions are allowed (This conversion is
not allowed for arrayed character parameters).
Input arguments may be viewed as being assigned to their respective input
parameters on invocation of the function. The rules applicable in the above
relaxations thus parallel the relevant assignment rules given in Section 7.3.
9. If the appearance of an invocation of a user-defined function precedes the
appearance of its <function block>, the name and type of the function must be
declared at the beginning of the containing name scope (see Section 4.6).
10. Special considerations relate to arrayed input arguments to the <normal function>. If
the corresponding input parameter is arrayed, then the arrayness must match in all
respects. In this case, the function is invoked once. If the corresponding parameter
is not arrayed, then the arrayness must match that of the <expression> containing the
function. In this case, the <normal function> is invoked once for each array element.
11. The precision of a <normal function> is not necessarily the same as the precision of
any of its parameters. The precision of a user-defined <normal function> is defined in
the type specification (see Section 4.7).
The precision for a "built-in" function is defined in Section 5 of the HAL/S-FC
Compiler System Specification.
example:
DECLARE X ARRAY(4) SCALAR;
.
.
. SIN evaluated once for each
[X] = SIN([X]); element of X
39
arith
conversion
VECTOR
MATRIX
SCALAR
S precision , subscript M
INTEGER
43 21
( expression )
arith exp #
24 ,
example:
INTEGER 2,2 (4#I + J)
3. The conversion has one or more <expression>s as arguments. The total number of
data elements implied by the argument(s) are shaped according to well-defined rules
to generate the result. The data elements in each <expression> are unraveled in
their “natural sequence”10. The result of doing this for each argument in turn is a
single linear string of data elements. This string is then reformed or “reraveled” to
generate the result.
4. Any <expression> may be preceded by the phrase <arith exp>#, where <arith exp> is
an unarrayed integer or scalar expression computable at compile time (see Appendix
F). The value of <arith exp> is rounded to the nearest integer and must be greater
than zero. It denotes the number of times the following <expression> is to be used in
the generation of the result of the conversion.
5. The nesting of <arith conversion>s is subject to implementation dependent
restrictions.
SEMANTIC RULES (INTEGER AND SCALAR):
1. If INTEGER or SCALAR are unsubscripted, and have only one unrepeated argument
of integer, scalar, bit, or character type, then if the argument is arrayed, the result of
the conversion is identically arrayed.
2. If INTEGER or SCALAR are unsubscripted, and Rule 1 does not apply, then the result
of the conversion is a linear (1-dimensional) array whose length is equal to the total
number of data elements implied by the argument(s).
3. If INTEGER or SCALAR are subscripted, the form of the <subscript> must be a
sequence of <arith exp>s separated by commas. The number of <arith exp>s is the
dimensionality of the array produced. Each <arith exp> is an unarrayed integer or
scalar expression computable at compile time. Values are rounded to the nearest
integer and must be greater than one. They denote the size of each array dimension
produced. Their products must therefore match the total number of elements implied
by the argument(s) of the conversion.
4. INTEGER and SCALAR may have arguments of any type (subject to general rule 6
above) except structure. Type conversion proceeds according to the standard
conversion rules set out in Appendix D.
5. The precision of the result is SINGLE unless forced by the precision of a <precision>
specifier.
SEMANTIC RULES (VECTOR AND MATRIX):
1. In the absence of a <subscript>, VECTOR produces a single 3-vector result; MATRIX
produces a single 3-by-3 matrix result. The number of data elements implied by the
argument(s) must therefore be equal to 3 and 9 respectively.
2. VECTOR and MATRIX cannot produce arrays of vectors and matrices.
Consequently, <subscript> may only indicate terminal subscripting.
Let [X] = 1 2 3
4 56
12 3 4 5 6 12 3 4 56
------------------ ------------------
2. Linear string is then “reraveled” into 2 X 6 array:
12 34 56
12 34 56
bit 40
conversion
28
S radix M ( char exp
BIT ( expression )
23
example: S subscript M
BIT (I + J)
21
Examples:
DECLARE X ARRAY(2,3) SCALAR;
.
.
.
BIT([X]) result is 2,3 array of bit strings
BIT1 TO 16([X]) same as above except that only bits 1 through
16 of each array element are taken
BIT@HEX(‘FACE’) result is bit pattern of hexadecimal digits repre-
sented by argument
Note: A variable enclosed in [ ] denotes that it is arrayed.
41
char
conversion
S radix M ( bit exp )
26 23
CHARACTER ( expression )
23
S subscript M
example: 21
CHARACTER @HEX(B)
bit
pseudo-var
SUBBIT ( variable )
S subscript M expression
example:
SUBBIT 5 TO 8 (K)
SEMANTIC RULES:
1. The keyword SUBBIT denotes the pseudo-variable.
2. SUBBIT has one argument only. If it appears in an assignment context, the argument
must be a <variable>. If it appears as an operand of a bit expression, the argument
must be an <expression>.
3. The argument may be of integer, scalar, bit, or character type, and may optionally be
arrayed.
4. The effect of SUBBIT is to make its argument look like an operand of bit type (if the
argument is arrayed, then it looks like an arrayed bit operand).
5. <subscript> represents component subscripting upon the pseudo-variable. It has the
same semantic meaning as if it were subscripting a bit variable (see Section 5.3.5).
6. The length of the argument in bits may in some implementations be greater than the
maximum length of a bit operand. Let the maximum length of a bit operand be N
bits. If SUBBIT is unsubscripted, only the N leftmost bits of the machine
representation of the data-type of the argument are visible. If the representation is
less than N, the number of bits visible is equal to the length of the particular data
argument.
7. Partitioning subscripts of SUBBIT may make between 2 and N bits from the
representation of the argument type visible at any time (i.e., the partition size is ≤ N.).
The partition size must be known at compile time. If the representation is less than
the specified partition size, binary zeroes are added on the left.
8. In an assignment context, SUBBIT functions may not be nested within SUBBIT
functions. Neither may they appear as assign arguments, or in READ or READALL
statements.
Example:
DECLARE P SCALAR DOUBLE;
.
.
.
SUBBIT33 TO 64(P) bits 33 through 64 of the machine representation of P
look like a 32-bit variable
bits 1 through 32 are invisible.
43
precision
@ SINGLE
DOUBLE
44
statement
basic statement
30
IF condition THEN
statement
44
basic
statement ELSE statement
example:
IF J > 0 THEN K = 1; 44 44
ELSE K = 2;
SEMANTIC RULES:
1. The IF statement, unless it is imbedded in another IF statement or in an ON ERROR
statement, may optionally be labeled with any number of <label>s.
2. The option to label the <statement> or <basic statement> of an IF statement is not
disallowed. However, such labels may only be referenced by REPEAT or EXIT
statements within the (compound) <statement> or <basic statement> thus labeled.
3. If <bit exp> appears in the IF statement, then it must be boolean (i.e., of 1-bit length).
4. If the <condition> or <bit exp> is TRUE, then the <statement> or <basic statement>
following the keyword THEN is executed. If <bit exp> is arrayed, then it is considered
to be TRUE only if all its array elements are TRUE. Execution then proceeds to the
<statement> following the IF statement.
5. If the <condition> or <bit exp> is FALSE then the <statement> or <basic statement>
following the keyword THEN is not executed. If the ELSE clause is present, then the
<statement> following the keyword ELSE is executed instead, and execution
proceeds to the <statement> following the IF statement. If the ELSE clause is
absent, execution merely proceeds to the next <statement>.
NOTE: If the ELSE clause is present, a <basic statement> rather than a
<statement> precedes the keyword ELSE. A nested IF statement,
therefore, cannot appear in this position, thus preventing the well
known ‘dangling ELSE’ problem.
46
basic
statement
variable = expression ;
: label ,
example:
ETA, KAPPA = LAMBDA + 1;
SYNTAX:
47
,
basic
statement
( expression )
23
CALL label
: label
;
ASSIGN ( variable )
20
,
example:
CALL EPSILON (A * B) ASSIGN (C);
11. In this context “call-by-reference” means the arguments are pointed to directly. “Call-by-value” means the value of
an input argument, at the invocation of a procedure, is made available to the procedure.
12. Non-REMOTE arguments may be passed into non-NAME REMOTE parameters.
Example:
STRUCTURE Z:
1 A,
2 C CHARACTER(80),
2 B VECTOR,
1 D INTEGER;
DECLARE ZZ Z-STRUCTURE(20);
.
.
.
.
CALL X ASSIGN (ZZ, ZZ.A, ZZ.A.B, ZZ.A1)
⎬
↑ ↑
⎫
⎭
⎢
legal ⎢
illegal legal
basic 48
statement
RETURN ;
: label expression
3. <expression> must match the function definition in type and dimension, with the
following exceptions:
• the lengths of bit expressions need not match;
• the lengths of character expressions need not match;
• implicit integer to scalar and scalar to integer conversions are allowed;
• implicit integer and scalar to character conversions are allowed.
The return of the function values may be viewed as the assignment of the <expres-
sion> to the function name. The rules applicable in the above exceptions thus paral-
lel the relevant assignment rules given in Section 7.3.
4. <expression> must always appear in RETURN statements of <function block>s.
Execution must always end on logically reaching a RETURN statement of such a
block, and not by logically reaching the delimiting CLOSE statement.
3 49
procedure block
3
function block
basic
statement
4
update block
55
do statement end statement
example: 51
DO WHILE J>0;
J = J -1; statement
END; 44
do
statement 50
DO ;
: label
51
do
statement
: label statement
ELSE
example:
ALPHA: DO CASE J - 1;
3. If the value of K is outside the range defined in Rule 2, and no ELSE clause appears
in the DO CASE statement, then an error condition exists. The result of such an
error is implementation dependent.
4. If the value of K is outside the range defined in Rule 2, but an ELSE clause does
appear, the <statement> following the ELSE keyword is executed instead of one of
those in the group. The option to label <statement> is not disallowed. However, such
labels may only be referenced by EXIT or REPEAT statements within the (compound)
<statement> thus labeled.
5. The presence of any code block definition in the group of <statement>s does not
change the K-indexing of the <statement>s except for UPDATE blocks (which are
considered as single statements).
52
do
statement
condition
UNTIL
: label
example:
DO WHILE I > 0;
53
do
statement
: label ,
WHILE condition
SEMANTIC RULES:
1. <arith var> is the loop variable of the DO FOR statement. It may be any unarrayed
integer or scalar variable. The initial loop variable, determined after all required sub-
scripting and NAME dereferencing, is used throughout.
2. The maximum number of times of execution of the group of <statement>s is the
number of <arith exp>s in the assignment list.
3. <arith exp> is an unarrayed INTEGER or SCALAR expression.
4. At the beginning of each cycle of execution of the group the next <arith exp> in the list
(starting from the leftmost) is evaluated and assigned to the loop variable. The
assignment follows the relevant assignment statement rules given in Section 7.3.
5. Use of the WHILE or UNTIL clause causes continuation of cycling of execution to be
dependent on the value of <condition> or <bit exp>.
6. There is no semantic restriction or <condition>. <bit exp> must be boolean and
unarrayed (i.e., of 1-bit length). The <condition> or <bit exp> is reevaluated every
time the group of <statement>s is executed.
7. If the WHILE clause is used, cycling of execution is abandoned when the value of
<condition> or <bit exp> becomes FALSE. The value is tested at the beginning of
each cycle of execution after the assignment of the loop variable. This implies that if
<condition> or <bit exp> is FALSE prior to the first cycle of execution of the group,
then the group will not be executed at all.
8. If the UNTIL clause is used, cycling of execution is abandoned when the value of
<condition> or <bit exp> becomes TRUE. The value is not tested before the first
cycle of execution. On the second and all subsequent cycles of execution, the value
is tested at the beginning of each cycle after the assignment of the loop variable. Use
of the UNTIL version therefore always guarantees at least one cycle of execution.
54
do
statement
: label
arith exp ;
example:
DO FOR I = 1 TO 30 BY 2 UNTIL J < 0;
3. If a BY clause appears in the DO FOR statement, the value assigned to the loop
variable prior to the Kth cycle of execution is equal to its value on the K-1th cycle plus
the value of <arith exp> following the BY keyword (the “increment”).
4. Assignment of values to the loop variable follows the relevant assignment rules given
in Section 7.3. In particular, if the loop variable is of integer type, and an initial value
or increment is of scalar type, the latter will be rounded to the nearest integer in the
assignment process. The effect of the loop variable assignment is identical to that of
an ordinary assignment statement: the loop variable will retain the last value
computed and assigned when the DO statement execution is completed.
5. After the value of the loop variable has been changed, it is checked against the value
of the <arith exp> following the TO keyword (the “final value”).
6. If the sign of the increment is positive, the next cycle is permitted to proceed only if the
current value of the loop variable is less than or equal to the final value.
7. If the sign of the increment is negative, the next cycle is permitted to proceed only if
the current value of the loop variable is greater than or equal to the final value.
8. If the WHILE clause is used, cycling of execution is abandoned when the value of
<condition> or <bit exp> becomes FALSE. The value is tested at the beginning of
each cycle of execution after the assignment of the loop variable. This implies that if
<condition> or <bit exp> is FALSE prior to the first cycle of execution of the group,
then the group will not be executed at all.
9. If the UNTIL clause is used, cycling of execution is abandoned when the value of
<condition> or <bit exp> becomes TRUE. The value is not tested before the first
cycle of execution. On the second and all subsequent cycles of execution, the value
is tested at the beginning of each cycle after the assignment of the loop variable. Use
of the UNTIL version therefore always guarantees at least one cycle of execution.
end 55
statement
END ;
: label label
example:
END LOOP;
SEMANTIC RULES:
1. If <label> follows the END keyword, then it must match a <label> on the <do state-
ment> opening the DO…END group.
2. The <end statement> is considered to be part of the group, in that if it is branched to
from a <statement> within the group, then depending on the form of the opening <do
statement>, another cycle of execution of the group may begin. The END statement
closing a DO CASE is not counted as another case.
56
basic
statement GO TO label
: label
EXIT
example:
REPEAT label
ONE: DO FOR I = 1 TO 10 ;
TWO: DO FOR J = 37 TO 43 ;
IF B I,J = FALSE THEN REPEAT ONE;
END;
END;
SEMANTIC RULES:
1. The GO TO <label> statement causes a branch in execution to an executable state-
ment bearing the same <label>. The latter statement must be within same name
scope as the GO TO statement. A GO TO statement may not be used to cause exe-
cution to branch into a DO…END group, or into or out of a code block.
2. The “null” statement (where no syntax except possible <label>s precede the
terminating semicolon) has no effect at runtime.
3. The EXIT statement is only legal within a DO…END group, or within such groups
nested. The form EXIT <label> controls execution relative to the enclosing DO…END
group whose <DO statement> bears <label>. The form EXIT controls execution
relative to the innermost enclosing DO…END group. Execution is caused to branch
out of the DO…END group specified or implied, to the first executable statement after
the group.
4. The REPEAT statement is only legal within a DO…END group opened with a DO
FOR , DO WHILE, or DO UNTIL statement, or within such groups nested. The form
REPEAT <label> controls execution relative to the enclosing such group whose <DO
statement> bears <label>. The form REPEAT controls execution relative to the
innermost such group. Execution is caused to abandon the current cycle of the
DO…END group. If the condition of the opening <DO statement> are still satisfied,
the next cycle of execution begins normally.
5. Code blocks (procedure, functions, etc.) may appear within DO…END groups.
However, EXIT, REPEAT, and GO TO statements may not be used to cause
execution to branch into or out of such code blocks.
12. except, of course, for the first or “primal” process which must be created by the RTE itself.
13. these states are not necessarily definitive of those actually existing in any particular implementation of the RTE.
09/07/01 8-2
HAL/S Language Specification USA003088
32.0/17.0
SYNTAX:
AT arith exp 57
24
basic
statement IN arith exp
24
SCHEDULE label
: label 36
ON event exp
( arith exp )
PRIORITY DEPENDENT
24
36
WHILE event exp
;
24
AFTER arith exp
event exp
24 36
example: EVERY arith exp
4. The phrase ON <event exp> is used to cause the process to be put in the stall state
until some event condition is satisfied. Starting from the time of execution of the
SCHEDULE statement, the <event exp> is evaluated at every “event change point”14
until its value becomes TRUE. At that time the process is placed in the ready state. If
the value of <event exp> is TRUE upon execution of the SCHEDULE statement, then
the process is immediately put in the ready state.
5. The initiation priority is set by means of the phrase PRIORITY (<arith exp>) where
<arith exp> is an unarrayed integer or scalar expression which is evaluated once on
execution of the SCHEDULE statement. Scalar values are rounded to the nearest
integral value. Its value must be consistent with the priority numbering scheme set up
for any implementation, otherwise a run time error results. A priority value must be
present in the SCHEDULE statement. Interpretation of priority is implementation
dependent.
6. When the keyword DEPENDENT is specified, the process created by the
SCHEDULE statement is dependent upon the continued existence of the scheduling
process. Note, however, that a TASK process is always ultimately dependent upon
the enclosing PROGRAM process. Thus, when scheduling a TASK from the
PROGRAM level of nesting, the keyword DEPENDENT is redundant and need not be
specified.
7. The REPEAT phrase of the SCHEDULE statement is used to specify a process which
is to be executed cyclically by the RTE until some cancellation criterion is met. If the
REPEAT phrase is not qualified, then the cycles of execution follow each other with
no intervening time delay. To cause execution of consecutive cycles to be separated
by a fixed intervening RTE-clock time delay, the qualifier AFTER <arith exp> is used.
<arith exp> is an unarrayed integer or scalar expression evaluated once at the time of
execution of the SCHEDULE statement. If the value is not greater than zero, then no
time delay results. To cause the beginning of successive cycles of execution to be
separated by a fixed RTE-clock time delay, the qualifier EVERY <arith exp> is used.
<arith exp> is an unarrayed integer or scalar expression evaluated once at the time of
execution of the SCHEDULE statement. If the value is such as to cause a cycle to try
to start execution before the previous cycle has finished execution, then a run time
error results.
8. Between the successive cycles of execution of a cyclic process, the process is put in
a stall state and retains the machine resources the RTE reserved for it. It is not
temporarily removed from the process queue.
9. The WHILE and UNTIL phrases provide a cancellation criterion for a cyclic process.
Before the cyclic process is initiated, they also provide a means of removal of the
process from the process queue. In this latter capacity, they also apply to noncyclic
processes.
09/07/01 8-4
HAL/S Language Specification USA003088
32.0/17.0
10. The UNTIL <arith exp> phrase specifies a cancellation criterion based on RTE-clock
time. <arith exp> is an unarrayed integer or scalar expression evaluated once at the
time of execution of the SCHEDULE statement. For any process, cyclic or
noncyclic, the following is true: if the value of <arith exp> is not greater than the
current RTE-clock time, then the process is never entered in the process queue.
Otherwise, a CANCEL command is issued if the RTE-clock equals <arith exp> while
the process is still on the process queue (see Section 8.4).
11. The WHILE <event exp> phrase specifies a cancellation criterion based on an event
condition. For any process, cyclic or non-cyclic, the following is true: if the value of
<event exp> is FALSE at the time of execution of the SCHEDULE statement, then
the process is never placed in the process queue. If not, then <event exp> is
evaluated at every “event change point” until its value becomes FALSE. At this time
a CANCEL command is issued if the process is still on the process queue (see
Section 8.4).
12. The UNTIL <event exp> phrase also specifies a cancellation criterion based on an
event condition. However, it differs fundamentally from the WHILE <event exp>
phrase in that it always allows at least one cycle of a cyclic process to be executed.
Consistent with this, the phrase has no meaning and, therefore, no effect in the case
of a non-cyclic process. For a cyclic process, the value of the <event exp> is
evaluated at every “event change point” from the time of execution of the
SCHEDULE statement.
If <event exp> becomes TRUE prior to the end of the first cycle, a CANCEL
command is issued at the end of the first cycle. Otherwise, if <event exp> becomes
TRUE while the process is still on the process queue, a CANCEL command is
issued at that time (see Section 8.4).
8.4 The CANCEL Statement.
Cancellation of a process may be the result of the enforcement of a cancellation criterion
in the SCHEDULE statement which created the process, or, alternatively, may be the
result of executing a CANCEL statement.
SYNTAX:
basic 58
statement
CANCEL ;
: label label
,
example:
FINISHING: CANCEL ETA, NU;
SEMANTIC RULES:
1. CANCEL <label> causes the cancellation of the process <label>. A run time error
results if the process queue contains no process with that name.15 The CANCEL
statement can be used to cancel any number of processes simultaneously.
2. If the CANCEL statement has no <label>, cancellation of the process executing the
CANCEL statement is implied.
3. If at the time of execution of the CANCEL statement, a process to be canceled has
not yet been initiated, then the process is merely removed from the process queue.
This applies to both cyclic and non-cyclic processes.
4. If at the time of execution of the CANCEL statement, a process to be canceled has
already been initiated, then the following ensues: if the process is non-cyclic and it
has already been initiated, the CANCEL statement has no effect; if the process is
cyclic, then the process is removed from the process queue at the end of the current
cycle of execution.
basic 59
statement
TERMINATE ;
: label label
example:
STOP: TERMINATE ALPHA, BETA;
15. the default action taken by the Error Recovery Executive for this and other similar errors may be to ignore the
error.
16. subject, of course, to implementation dependent safety restraints.
09/07/01 8-6
HAL/S Language Specification USA003088
32.0/17.0
SEMANTIC RULES:
1. TERMINATE <label> causes termination of the process <label>. A run time error
results if a process of that name is not in the process queue, or if it is not a dependent
son of the process currently executing the TERMINATE statement. The TERMINATE
statement can be used to terminate any number of processes simultaneously.
2. If the TERMINATE statement has no <label>, termination of the process currently
executing the TERMINATE statement is implied.
basic
statement
arith exp
4. The WAIT FOR <event exp> version specifies that the process executing the WAIT
statement is to be placed in the stall state until an event condition is satisfied. Starting
from the time of execution of the WAIT statement, the <event exp> is evaluated at
every “event change point” until its value becomes TRUE, whereupon the process is
returned to the READY state. If the value of <event exp> is TRUE upon execution of
the WAIT statement, then the statement has no effect.
basic 61
statement
UPDATE
PRIORITY TO arith ;
exp
: label label
example:
UPDATE PRIORITY GAMMA TO PRIO + 10;
09/07/01 8-8
HAL/S Language Specification USA003088
32.0/17.0
62
basic
statement
SET
SIGNAL ;
event var
: label RESET
example:
SIGNAL IOTA ;
5. If a latched event is FALSE, SIGNAL initiates all event actions, depending upon the
TRUE state of this event.
SEMANTIC RULES (unlatched <event var>s):
1. SET and RESET are illegal for unlatched <event var>s.
2. When used in a <bit expression>, an unlatched event variable is equivalent to a literal
“FALSE”.
3. SIGNAL initiates all event actions depending upon the TRUE state of this event. Note
that when an event expression depends upon a logical product of multiple <event
var>s, at most one such <event var> can be unlatched if the event action is ever to be
taken.
SUMMARY:
SET RESET SIGNAL
unlatched event illegal illegal Take all event actions
depending on TRUE
state of <event var>
latched old value 1. Set event state no action Take all event actions
event is FALSE to TRUE depending on TRUE
state of <event var>
2. Take all event
actions
depending on
TRUE state of
<event var>
latched old value no action 1. Set event state Take all event actions
event is TRUE to FALSE depending on FALSE
state of <event var>
2. Take all event
actions
depending on
FALSE state of
<event var>
Table 8-1 Latched and Unlatched Events in Set, Reset, and Signal Statements
8.9 Process-events.
Every program or task block has associated with it a “process-event” of the same name.
This process-event behaves in every way like a latched event except that it may not
appear in SET, RESET, or SIGNAL statements. Its purpose is to indicate the existence
of its associated program or task process. If a process of the same name as the
process-event exists in the process queue, the value of the process-event is TRUE,
otherwise, it is FALSE.
09/07/01 8-10
HAL/S Language Specification USA003088
32.0/17.0
09/07/01 8-12
HAL/S Language Specification USA003088
32.0/17.0
SYNTAX:
63
error spec
ERROR S number : M
S number : number M
basic
statement
: label error spec ;
OFF
ON SYSTEM ;
error spec
IGNORE
SIGNAL
RESET
statement
: label
example:
ERRONEOUS: ON ERROR 5 IGNORE AND SET IOTA;
3. The form ON ERROR…. specifies the modification of the error recovery actions for
the given <error spec>. OFF ERROR…. specifies the removal of a modification pre-
viously activated in the name scope for the same <error spec>. If no such modifica-
tion exists, the OFF ERROR is, effectively, a no-operation.
4. The presence of the IGNORE clause specifies that in the event of occurrence of a
specified error, the ERE is to take no action other than allow execution to proceed as
if the error had not occurred. The IGNORE action may not be permitted for certain
errors.
5. The presence of the SYSTEM clause specifies that in the event of the occurrence of a
specified error, the ERE is to take the standard system recovery action.
6. The form ON ERROR…<statement> specifies that <statement> is to be executed on
the occurrence of a specified error <statement> may optionally be labeled. However,
such labels may only be referenced by EXIT or REPEAT statements within the (com-
pound) <statement> thus labeled. After execution of <statement>, execution nor-
mally restarts from the executable statement following the ON ERROR statement.
Execution of <statement> itself may of course modify this.
7. It is important to note that the form ON ERROR…<statement> is itself a <statement>
while other forms of ON ERROR are <basic statement>s. The form ON
ERROR…<statement> may therefore not be the true part of an IF…THEN…ELSE
statement.
8. If an ON ERROR possesses a SYSTEM or IGNORE clause, it may also possess an
additional SIGNAL, SET, or RESET clause. The purpose is to cause the value of an
<event var> to be changed on the occurrence of a specified error. Its semantic rules
are the same as those described for the corresponding SIGNAL, SET, or RESET
statements in Section 8.8. Note that if <event var> contains a subscript expression,
then that expression will be evaluated at the time of execution of the ON ERROR
statement, not on the occurrence of the error.
PRECEDENCE RULE:
1. An ON ERROR executed within a code block always totally supersedes an ON
ERROR executed before entering the code block.
2. Within a code block the action specified by an ON ERROR is only superseded by
another if the two <error spec>s are of identical form. Similarly, an OFF ERROR nul-
lifies the effect of a previous ON ERROR only if the two <error spec>s are of identical
form. However, different forms of <error spec> may involve the same error group or
error code. It is logically possible for up to three ON ERRORs, each with a different
form of <error spec> as described in Rule 2 above, to be active simultaneously and
involve the same error code. The ON ERROR precedence order for determining the
recovery action in the event of an error occurrence is as follows:
SYNTAX:
basic 64
statement
: label example:
SEND ERROR15 ;
SEMANTIC RULES:
1. <number> : <number> is a subscript construct consisting of two unsigned integer
literals. The leftmost <number> designates the error group to which the selected
error condition belongs. The rightmost <number> denotes the error number within
the designated group. Values are restricted to the set of error codes defined for a
particular implementation. If the error code corresponds to a system-defined error,
then that error is simulated by the ERE. Simulation of certain system-defined errors
may not be permitted.
2. The action taken by the ERE after announcement of the selected error condition is
dictated by the error environment prevailing at the time of execution of the SEND
ERROR statement.
SYNTAX:
basic 65
statement
24
: label READALL
variable
20
i/o control
67
format list
82
,
When under control of a <format list>, a null field is transmitted and an error sent
whenever the field being read is entirely blank.
A null field causes the corresponding variable element to remain unchanged following
transmission.
7. For READ statements, fields must either be read using <format list> or else they must
appear in a standard external format. A list of standard external formats is given in
Appendix E. A type mismatch causes a runtime error.
66
basic statement
24
: label
variable
23
i/o control
67
format list
82
,
example: WRITE (6) ‘ANS=’ | | A+B, SKIP (2);
SYNTAX:
67
TAB
i/o control
SKIP
LINE
example:
COLUMN (I + 2) PAGE
• Unpaged files - LINE(K) positions the device mechanism at some absolute line
number in the file. On input K must be greater than zero, but not greater than the
total number of lines in the file. On output, K must merely be greater than zero. In
either case, values outside the indicated ranges cause runtime errors. Depending
upon the implementation, values of K causing backwards movement may be
illegal.
6. PAGE(K) is only applicable to paged files and specifies page movement relative to the
current page. If K is positive the movement is forward, toward the end of the file.
Depending upon the implementation, negative page values may or may not be legal.
The line value relative to the beginning of the page remains unchanged.
variable 82
format list 20
expression
23
format character
IN
expression 83
variable
20
( )
expression
23
83
format character
expression
format item
number
84
,
format
( character )
, expression
83
format item 84
I format item
85
F format item
86
E format item
86
A format item
87
U format item
32
X format item
89
P format item
91
examples: F5.2
format quote string
COLUMN (25) 90
i/o control
67
85
I format item
I
number
example: I 5
2. If the number of print positions required to represent the quantity is less than
<number>, the leftmost positions are filled with blanks. If greater than <number>, a
runtime error is sent and asterisks are printed in place of the quantity.
Example:
DECLARE A INTEGER INITIAL (3);
WRITE(6) (A, -2, A-2) IN ‘I2’;
produces:
b3-2b1
86
F format item
F number
number
E format item
E number
examples: F9.2
number
E14.3
87
A format item
A number
example: A7
88
U format item
U number
example: U16
89
X format item
X
number
example: X4
SEMANTIC RULES:
1. <number> is an unsigned positive integer.
2. The effect is the same as TAB (<number>).
Example:
READ (5) A in ‘X5, I3’;
If the input is:
12345678
then A becomes:
678.
Format quote 90
string
“ “
characters
91
P format item
P $
any
extended
character
except
$.*,
4. Blanks are allowed preceding the sign, the first digit, E, ±, and the first digit of the
exponent. Other blanks cause a runtime error.
Example:
READ(5) (X,Y) IN ‘PXXX$$.$$X$$’;
then if the input is:
01234567890
then X would be set to 345.67 and Y to 90.
For WRITE statements:
1. If a quantity to be printed is smaller than the specified field width, blanks are
appended to the left. If the quantity to be printed (including ‘-’ if needed) is larger than
the specified field width field, a runtime error is sent and the first is filled with
asterisks.
2. All characters except ‘$’, ‘*’, and ‘,’ are printed.
3. If an exponent is called for, the number takes the form:
-a.bbbE+cc
I J K
A non-negative quantity prints a blank in place of the ‘-’ sign. The leftmost digit
printed will be non-zero unless the value to be printed is exactly zero. The field
widths I, J, and K are taken from the number of ‘$’ signs in the picture. I must be
greater than zero and K large enough to hold the exponent.
Example:
DECLARE CHARACTER(100),
T INITIAL(‘P TITLE1 TITLE2 TITLE3/’),
D INITIAL(‘P $$.$$ $$.$$ $$.$$/’)
WRITE(6) IN T;
WRITE(6) DATA ARRAY$(1 TO 9) IN D;
would produce the following table:
TITLE1 TITLE2 TITLE3
98.72 -5.61 43.00
↑ ↑ ↑
column 8 17 26
68
basic
statement
file exp = expression
: label
file exp
example :
FILE (3, J + 2) = ALPHA 1 TO 1000 ;
• If no component subscripting is present, but array subscripting is, then all arrayness
must be subscripted away.
• BIT type structure terminals which have the DENSE attribute may not be used, due
to packing implications. However, an entire structure with the DENSE attribute
may be used.
• If the <variable> is a structure terminal or a minor structure node (but not a major
structure) and if the structure possesses multiple copies, then the number of
copies must be reduced to one by subscripting.
5. In the output FILE statement, there are no semantic restrictions on <expression>.
6. Compatibility between data written by an output FILE statement, and later reference to
it by an input FILE statement is assumed. The exact interpretation of compatibility is
implementation dependent. In general, the FILE statement transmits binary images of
the internal data forms, so that compatibility will be guaranteed if the <expression> of
the output FILE statement and the <variable> of the input FILE statement have the
same data type and organization.
17. The title indicates that the usage of these constructs is more suited to systems programming rather than
applications programming. The programmer is warned that unrestrained and indiscriminate use of certain of
these constructs can lead to software unreliability.
SYNTAX:
§ arith
inline 69
function § bit
char
struct
statement
10
declare group closing
11 44
example: update block
IF X =Y THEN R=FUNCTION VECTOR; 4
DECLARE A, B;
A =3X+Y;
B=X/Y;
RETURN VECTOR(A, B, 0);
CLOSE;;
T=R*V
.
.
.
6. The <§inline function> falls into one of the following four categories:
<arith inline> - <type spec> specifies an inline function of an arithmetic data type:
SCALAR, INTEGER, VECTOR, or MATRIX.
<bit inline> - <type spec> specifies an inline function of a bit type: BOOLEAN
or BIT.
<char inline> - <type spec> specifies an inline function of the CHARACTER data
type.
<struct inline> - <type spec> specifies an inline function with a structure type
specification.
The use of inline functions as operands of HAL/S expressions is discussed in Section
11.2.3.
11.2.2 %macro References.
The HAL/S %macro facility provides a means of adding functional, special-purpose
extensions to the language without requiring syntax changes or extensive rewriting of the
compiler programs. The details of the implementation of any given %macro will depend
upon its nature and purpose. Possible options include inline generation of code or links
to an external routine performing the processing of the %macro.
The syntax of %macro reference is presented in this section. The invocation of %macro
routines in various expression or statement contexts is described below in Sections
11.2.3 and 11.2.4.
SYNTAX:
arith
, 70
bit
§ char
§
struct
%macro typeless
( <%macro-arg> )
% label
arith
operand ( arith exp )
number
arith inline
arith % macro
27s
bit
operand
( bit exp )
NOT
bit var
event var
bit literal
normal function
bit conversion
bit pseudo-var
bit inline
bit %macro
29s
char
operand
( char exp )
char var
normal function
char literal
char conversion
char inline
char %macro
291s
structure
expression structure var.
normal function
structure inline
struct %macro
SEMANTIC RULES:
1. This syntax diagram is a systems language extension of the structure expression
diagram found in Section 6.1.4. The semantic rules found in Section 6.1.4 also apply
to this revised diagram.
2. <struct inline> is an inline function block which has a structure <type spec> in its
header statement.
3. <struct %macro> is a reference to a %macro which returns a value of a structure data
type.
71
basic statement
typeless
;
%macro
example: %SWAP(A,B,C);
49S
basic
statement
temporary statement
statement
update block
task block
function block
procedure block
72
temporary ,
statement
,
attributes
SEMANTIC RULES:
1. In the <temporary statement>, <attributes> may define the <identifier>s to be of any
data type except EVENT.
2. <attributes> may only specify type, precision, and arrayness.
3. No minor attribute is legal.
4. The name of <identifier> may not duplicate the name of another <identifier> in the
same name scope (procedure, function, or other block name) or of another temporary
in the same DO…END group.
53S
do TEMPORARY identifier
statement
: label
arith exp ;
,
WHILE condition
Figure 11-10 discrete DO FOR with loop TEMPORARY variable index - #53
SYNTAX:
53S
do TEMPORARY identifier
statement
: label
arith exp ;
,
WHILE condition
Figure 11-11 iterative DO FOR with loop TEMPORARY variable index - #54s
SEMANTIC RULES:
1. All the semantic rules for DO FOR statements which are given in Sections 7.6.4 and
7.6.5 apply as well to the corresponding Loop TEMPORARY forms. Additional rules
for Loop TEMPORARY variables are given below.
2. The Loop TEMPORARY variable is defined in the DO FOR statement; a Loop
TEMPORARY variable is always a single precision INTEGER variable.
3. The scope of the Loop TEMPORARY is the DO FOR group of the DO FOR statement
which defines the variable.
4. The <identifier> name used for the Loop TEMPORARY may not duplicate the name of
another <identifier> in the same name scope, nor may it duplicate the name of
another TEMPORARY variable in the same DO…END group.
11.4 The NAME Facility
This section gives a definitive description of the HAL/S NAME facility. This facility is
designed to fill the system programmer’s need for a “pointer” construct. Its basic entity is
the NAME identifier: a NAME identifier “points to” an ordinary HAL/S identifier of like
attributes. The “value” of the NAME identifier is thus the location of the identifier pointed
to (an ordinary identifier is a HAL/S identifier without the NAME attribute).
11.4.1 Identifiers with the NAME Attribute
Identifiers declared with the NAME attribute become NAME identifiers. NAME identifiers
may be declared with the following data types:
INTEGER CHARACTER
SCALAR EVENT
VECTOR STRUCTURE
MATRIX PROGRAM
BIT TASK
BOOLEAN
14S
declare ,
statement
identifier ;
DECLARE attributes
,
attributes NAME
example:
DECLARE ALPHA NAME VECTOR (7);
Examples:
DECLARE VECTOR(3) DOUBLE LOCK(2), X, Y NAME;
DECLARE P NAME TASK;
Y may point to X
P points to any task block
Figure 11-13 NAME Examples
SEMANTIC RULES (Data NAME Identifiers):
1. Arrayness Specification - in general, the arrayness specification of a NAME identifier
must match that of the ordinary identifiers pointed to, in both number and size of
dimensions.
2. Structure Copy Specification - in general, the number of copies of a NAME identifier of
a structure type must match that of the ordinary identifiers pointed to.
3. The use of the “*” array specification or structure copies specification is excluded from
declarations of NAME formal parameters.
4. Structure Type - if a NAME identifier is a structure type it may only point to ordinary
identifiers of structure type with tree equivalent structure templates.
Examples of data NAME variables
DECLARE X ARRAY(3) SCALAR,
Y ARRAY(4),
Z NAME ARRAY(4) SCALAR;
DECLARE P EVENT;
DECLARE EVENT LATCHED, V, VV NAME;
Z may point to Y but not X
Figure 11-14 NAME Array Examples
5. For any unarrayed character string name variable, the “*” form of maximum length
specification may be used. This is an extension of the use of the “*” notation which
applies now in general to character name variables as well as to formal parameters.
The Label Declarative Attributes available for use in declaring NAME identifiers which
point to HAL/S block forms have been modified to include PROGRAM and TASK
keywords and to exclude PROCEDURE and FUNCTION keywords. The following
syntax diagram is substituted for the Label Declarative Attributes diagram in Section 4.6
when declaring NAME identifiers which point to HAL/S blocks.
SYNTAX:
16s
attributes
TASK
PROGRAM
name
initialization
STATIC
AUTOMATIC
DENSE
ALIGNED
SYNTAX:
13S
structure
template
DENSE
STRUCTURE identifier :
ALIGNED
SYNTAX:
examples of structure NAME identifiers:
STRUCTURE A:
1 X NAME PROGRAM,
1 Y SCALAR,
1 Z NAME SCALAR,
1 ALPHA NAME A-STRUCTURE;
DECLARE P A-STRUCTURE;
DECLARE PP NAME A-STRUCTURE;
P.Z is a NAME identifier which may point to P.Y
PP is a NAME identifier which may point to P
PP.Z is a NAME identifier which may point to P.Z which is itself a NAME
identifier pointing somewhere. This is an instance of double
indirection.
P.ALPHA is a NAME identifier of A-structure type. The consequences of
this are discussed later.
Figure 11-17 Structure NAME Examples
name NULL
reference
sub name id
NAME ( )
sub id
22
NULL
SEMANTIC RULES:
1. <sub id> is any ordinary identifier, except an input parameter, a minor structure, an
identifier declared with CONSTANT initialization, or an ACCESS controlled identifier
to which assignment access is “denied” or not asked for. <sub name id> is any
NAME identifier.
2. Either of the above forms may possibly be modified by subscripting legal for its type
and organization. Note, however, the following specific exceptions:
• No component subscripting is allowed for bit and character types.
• If component subscripting is present, <sub id> or <sub name id> must be
subscripted so as to yield a single (unarrayed) element.
• If no component subscripting is present, but array subscripting is, then all
arrayness must be subscripted away.
Example:
DECLARE V NAME ARRAY(3) VECTOR;
.
.
.
NAME(V*:1) is illegal since it violates the second exception of semantic
rule 2 above.
Figure 11-20 NAME Variable Subscripting Example
3. Any <sub id> must have the ALIGNED attribute.
4. NAME <identifier>s may not be declared with the ACCESS attribute (see Section
11.4.1, rule 2). This does not, however, imply that the NAME facility is independent of
the ACCESS control: NAME references to <sub id>s with ACCESS control will
compile without error only if implementation dependent ACCESS requirements for
<sub id> are satisfied.
5. If <sub id> is unsubscripted, the construct delivers the location of the ordinary identifier
specified. If it is subscripted, the construct delivers the location of the part of the
specified identifier as determined by the form of the subscript. Subscripting can
change the type and dimensions of <sub id> for matching purposes.
6. If <sub name id> is unsubscripted, the construct delivers the value of the NAME
identifier specified. If it is subscripted, the value of the NAME identifier is taken to be
the location of an ordinary identifier of compatible attributes, and the subscripting
accordingly modifies the location delivered by the construct.
7. The two equivalent forms NULL and NAME(NULL) specify null NAME values.
Examples:
DECLARE X SCALAR,
V VECTOR(3),
NX NAME SCALAR,
NV NAME VECTOR(3);
.
.
.
NAME(X) yields the location of X.
NAME(NX) yields the value of NX (i.e. the location pointed to by NX).
NAME(V2) yields the location of the second element of V.
NAME(NV3) yields the location of the third element of the vector
pointed to by NV.
NAME ( name id )
basic statement 75
condition
NOT =
name reference
¬ = name reference
examples:
DECLARE X SCALAR,
NX NAME SCALAR,
.
.
.
.
NAME(NX)=NAME(X); value of NX is location of X (NX points to X).
.
.
.
IF NAME(NX)=NULL THEN RETURN;
if NX contains a null value (points at no location) then return.
77
,
name
reference
normal
function ( expression )
label
SYNTAX:
47S
,
name
reference
call
statement expression
( )
CALL label
ASSIGN ( variable )
name assign
Examples:
DECLARE XI SCALAR,
X2 NAME SCALAR,
.
.
.
P: PROCEDURE(A,B) ASSIGN(C,D);
DECLARE SCALAR, A NAME,
B,
C NAME,
D;
NAME(C) = NAME(A);
NAME(C) = NAME(B); illegal - B is an input parame-
ter
.
.
.
CLOSE;
.
.
.
NAME(X2) = NAME(XI);
CALL P(NAME(XI),XI) ASSIGN(NAME(X2),XI);
Figure 11-29 NAME Variables as Parameters Example
11.4.10 Initialization.
NAME identifiers may be declared with initialization to point to some particular identifier.
The form of NAME initialization is as follows:
SYNTAX:
79
initialization
( name )
INITIAL
reference
SEMANTIC RULES:
1. The argument of the <name reference> must be a previously declared <sub name id>
or <sub id> with <attributes> compatible with the NAME identifier being declared in
the same sense as described in Section 11.4.
2. Uninitialized NAME identifiers will have a NULL NAME value until the first NAME
assignment.
3. The argument of a <name reference> may not itself possess the NAME attribute.
Z2
Z1
Z2.C Z2.B
Z1.C Z1.B
Z3
Z3.C Z3.B
Now Z1.B.B is itself in turn a NAME identifier of A-structure type, so that if the NAME
assignment
NAME(Z1.B.B) = NAME(Z2);
is executed, then Z2.C may be referenced by using the qualified name Z1.B.B.C in a
dereferencing context.
Pictorially:
Z1 Z3 Z2
Z1 Z2
result, two values will be defined by the statement. However, the right hand side has no
arrayness, because the object pointed to is Y22 AT 1. This is a two copy section of the
structure Y2, with a unique starting location.
Pictorially:
Y1
Y2
Y1
Y2
Y1
Y2
Y1.C
Y1.B
Y1.C Y2.C Y2.B
Y1.B
Y1.C Y2.C
Y2.B
Y1.B
Y2.C
Y2.B
• For sequential I/O operations, all NAME terminals are totally ignored. NAME
terminals can take part in FILE I/O.
examples:
STRUCTURE OMICRON:
1 ALPHA SCALAR,
1 BETA ARRAY(25) INTEGER SINGLE,
1 GAMMA NAME MATRIX(10,10);
STRUCTURE TAU:
1 ALPHA SCALAR,
1 BETA ARRAY(25) INTEGER SINGLE;
DECLARE X OMICRON-STRUCTURE;
DECLARE Y TAU-STRUCTURE;
.
.
.
READ(5) X;
The structure variable X is an OMICRON-STRUCTURE, whose template
includes the NAME of a 10 x 10 matrix (GAMMA). Only the ordinary terminals
are transferred from Channel 5 by this READ operation --- the value of X.ALPHA
and the 25 values required for X.BETA. The NAME terminal X.GAMMA is
ignored.
READ(5) Y;
The structure variable Y is a TAU-STRUCTURE, whose template omits the
NAME terminal GAMMA found in the OMICRON-STRUCTURE, but is otherwise
identical. The effect of this READ statement is the same as the previous
statement as far as Channel 5 is concerned --- one value is read for Y.ALPHA
and 25 values are read for Y.BETA.
Figure 11-36 Structure NAMEs with READ Statements
80
EQUATE
Statement
EQUATE variable ;
identifier TO
EXTERNAL
example:
EQUATE EXTERNAL XYZ TO A;
EQUATE EXTERNAL QRS TO S.T5;4,3:1,6;
11S
declare
group
replace
statement
12
structure
template 13
declare
statement 14
equate
statement
80
ARITHMETIC FUNCTIONS
arguments may be INTEGER or SCALAR types
in functions with one argument, result type matches argument type (except as
specifically noted)
in functions with two arguments, unless specifically specified, result type is scalar if
either or both arguments are scalar; otherwise the result type is integer
arrayed arguments cause multiple invocations of the function, one for each array
element - arrayness of arrayed arguments must match
Name, Arguments Comments
ABS(α) |α|
CEILING(α) smallest integer ≥ α
DIV(α,β) integer division α/β (arguments rounded to integers)
FLOOR (α) largest integer ≤ α
MIDVAL(α,β,γ) the value of the argument which is algebraically between
the other two. If two or more arguments are equal, the
multiple value is returned. Result is always scalar.
MOD(α,β) α MOD β
ODD(α) TRUE 1 if α odd ⎤
FALSE 0 if α even ⎥ ⎯ result is BOOLEAN
⎦
REMAINDER(α,β) signed remainder of integer division α/β (argument
rounded to integer)
ROUND(α) nearest integer to α
SIGN(α) +1 α ≥ 0
-1 α < 0
SIGNUM(α) +1 α > 0
0 α=0
-1 α < 0
TRUNCATE(α) largest integer ≤ | α | times SIGNUM (integer (α))
ALGEBRAIC FUNCTIONS
• arguments may be integer or scalar types -- conversion to scalar occurs with integer
arguments
• result type is scalar
• arrayed arguments cause multiple invocations of the function, one for each array
element
• angular values are supplied or delivered in radians
Name, Arguments Comments
ARCCOS(α) cos -1α, | α| < 1
ARCCOSH(α) cosh -1α, ≥1
ARCSIN(α) sin -1α, | α| < 1
ARCSINH(α) sinh-1α
ARCTAN2(α,β) -π< tan-1 (α/β) < π
Proper Quadrant if:
α= k sin θ ⎫
β= k cos θ ⎬k>0
⎭
ARCTAN(α) tan-1α
ARCTANH(α) tanh-1α, | α | < 1
COS(α) cos α
COSH(α) cosh α
EXP(α) eα
LOG(α) logeα, α > 0
SIN(α) sin α
SINH(α) sinh α
SQRT(α) α,α≥0
TAN(α) tan α
TANH(α) tanh α
VECTOR-MATRIX FUNCTIONS
• arguments are vector or matrix types as indicated
• result types are as implied by mathematical operation
• arrayed arguments cause multiple invocation of the function, one for each array element
Name, Arguments Comments
ABVAL(α) length of vector α.
DET(α) determinant of square matrix α.
INVERSE(α) inverse of a nonsingular square matrix α.
TRACE(α) sum of diagonal elements of square matrix α.
TRANSPOSE(α) transpose of matrix α.
UNIT(α) unit vector in same direction as vector α.
MISCELLANEOUS FUNCTIONS
• arguments are as indicated; if none are indicated the function has no arguments
• result type is as indicated
Name, Arguments Result Type Comments
CLOCKTIME scalar returns time of day
DATE integer returns date (implementation dependent format)
ERRGRP integer returns group number of last error detected, or
zero
ERRNUM integer returns number of last error detected, or zero
PRIO integer returns priority of process calling function
RANDOM scalar returns random number from rectangular
distribution over range 0-1
RANDOMG scalar scalar returns random number from Gaussian
distribution mean zero, variance one.
RUNTIME scalar scalar returns Real Time Executive clock time
(Section 8.)
NEXTIME (<label>) scalar <label> is the name of a program or task. The
value returned is determined as follows:
a) If the specified process was scheduled with
the REPEAT ENTRY option and has begun at
least one cycle of execution, then the value is
the time the next cycle will begin.
b) If the specified process was scheduled with
the IN or AT phrase, and has not yet begun
execution, then the value is the time it will begin
execution.
c) Otherwise, the value is equal to the current
time (RUNTIME function).
CHARACTER FUNCTIONS
• first argument is character type - second argument is as indicated (any argument indicated
as character type may also be integer or scalar, whereupon conversion to character type is
implicitly assumed)
• result type is as indicated
• arrayed arguments produce multiple invocations of the function, one for each array
element - arraynesses of arrayed arguments must match
Name, Arguments Result Type Comments
INDEX(α,β) integer β is character type - if string β appears in string α ,
index pointing to the first character of β is
returned; otherwise zero is returned
LENGTH(α) integer returns length of character string
LJUST(α,β) character β is integer type - string α is expanded to length β
by padding on the right with blanks. β > length (α)
RJUST(α,β) character β is integer type - string α is expanded to length β
by padding on the left with blanks. β > length (α)
TRIM(α) character leading and trailing blanks are stripped from α
BIT FUNCTIONS
• arguments are bit type
• result is bit type
• arrayed arguments produce multiple invocations of the function, one for each array
element - arrayness of arrayed arguments must match
Name, Arguments Result Type Comments
XOR(α,β) bit Result is Exclusive OR of α and β. Length of
result is length of longer argument. Shorter
argument is left padded with binary zeros to length
of longer argument.
ARRAY FUNCTIONS
• arguments are n-dimensional arrays where n is arbitrary.
• asterisk size REMOTE ARRAYs are restricted for the MAX, MIN, PROD and SUM
functions unless a finite size array is also part of the argument
• arguments are integer or scalar type
• result type matches argument type and is unarrayed
Name, Parameters Comments
MAX(α) maximum of all elements of α.
MIN(α) minimum of all elements of α.
PROD(α) product of all elements of α.
SUM(α) sum of all elements of α.
SIZE FUNCTION
Name, Argument Comments
SIZE(α) One of the following must hold:
• α is an unsubscripted arrayed variable with a one-
dimensional array specification - function returns
length of array.
• α is an unsubscripted major structure with a
multiple copy specification - function returns
number of copies.
• α is an unsubscripted structure terminal with a
one-dimensional array specification - function
returns length of array.
Result is of integer type
+
-
* (multiply)
/
**
3. The <arith operand>s of such <arith exp>s may either be <number>s or unarrayed,
unsubscripted, simple variables (see Section 4.5) of integer or scalar type. Such
variables must previously have been declared and initialized using the CONSTANT
form (see Section 3.8).
4. The following built-in functions are also legal:
SIN EXP DATE
COS LOG CLOCKTIME
TAN SQRT
DATE and CLOCKTIME are only computed at compile time if they appear in an <ini-
tialization> construct.
BIT EXPRESSIONS (see Section 6.1.2)
1. The operators which may appear in <bit exp>s computable at compile time are:
¬
&
|
The <bit operand>s of such <bit exp>s must be either <bit literal>s or unarrayed,
unsubscripted, simple variables of bit type. Such variables must previously have
been declared and initialized using the CONSTANT form.
18. Note that this table contains information found in Section 6.1.1.
19. Note that this table contains information found in Section 6.1.3.
20. Note that this table contains information found in Section 6.1.2.
21. Note that this table contains information found in Sections 6.2 and 6.3.
22. Note that this table contains information found in Section 6.2.
Appendix I - %MACROS
The specific details of %macro operation as well as the %macros available are
implementation dependent. A generic description of %macro syntax can be found in
Section 11.2 of this document.
Individual implementations of the HAL/S language may contain %macro capabilities.
The documentation for each implementation (such as a User’s Manual) will contain the
detailed descriptions of the available %macros.
Change History
Revision Release Date Change Sections Changed
Authority
01 01/12/81 Title Page, 2-7 - 2-9, 4-2, 4-15, 4-18 - 4-19, 4-22
- 4-23, 4-27 - 4-29, 5-9, 5-12, 5-15 - 5.17.2, 5-
19, 6-3 - 6-7, 6-17, 6-25, 6-28 - 6-30, 6-32, 6-34
- 6-36, 6-38 - 6-40, 7-6 - 7-7, 7-11 - 7-12, 7-14,
7-20 - 7-23, 8-6 - 8-7, 8-11, 11-4, 11-6, 11-8, 11-
14, 11-17, 11-19, B-1, C-1 - C-8, C-10, D-1 - D-
3, E-2 - E-3, F-1, G-1 - G-11, H-2
02 25.0/9.0 09/03/93 Title Page, Section 6.2.4 (p.6-20)
03 27.0/11.0 05/22/96 Total Reprint
04 27.1/11.1 07/01/96 pp. - 6-3, 6-4, 6-13, 6-21, 11-2, D-1, G-1, G-6 -
G-7, G-10
05 28.0/12.0 08/22/97 Total reprint to bring to HAL/S documentation
standards and HTML compatibility.
CR12709 2.3.4 - p. 2-6
4.2.1 - pp. 4-3, 4-4
4.2.3 - p. 4-5
4.2.4 - p. 4-5
4.5 - P. 4-13
6.1.1 - p. 6-4
6.1.2 - pp. 6-6, 6-7, 6-11
6.2.1 - pp. 6-12, p. 6-13
6.2.2 - p. 6-13
6.2.4 - pp. 6-15, 6-17
6.3 - P. 6-7
11.2.1 - p. 11-2
App. C - p. C-4
CR12712 2.3.3 - p. 2-4
2.3.4 - p. 2-5
4.0 - p. 4-1
4.5 - pp. 4-11, 4-13
4.7 - pp. 4-15, 4-16
4.8 - pp. 4-19, 4-20
5.3.1 - p. 5-5
5.3.5 - p. 5-11
5.4.1 - p. 5-13
5.5 - P. 5-14
6.1.1 - pp. 6-2, 6-3, 6-4, 6-5
6.2.1 - pp. 6-13
6.4 - p. 6-19
6.5.1 - pp. 6-20, 6-21, 6-22, 6-23
6.5.2 - p. 6-24
6.5.3 - p. 6-25
6.5.4 - p. 6-26
6.5.5 - p. 6-28
6.6 - p. 6-28
6.7 - Deleted
7.3 - p. 7.3
7.4 - p. 7-6
7.5 - p. 7-8
7.6.4 - p. 7-11
7.6.5 - p. 7-12
8.3 - p. 8-4
8.6 - p. 8-7
11.2.1 - p. 11-3
11.2.2 - p. 11-4
11.2.3 - p. 11-5
11.3.1 - p. 11-10
11.4.1 - pp. 11-12, 11-13
App. - p. A-5
A.2
App. - pp. A-6, A-7, A-8
A.3
App. B - p. B-1
App. C - pp. C-1, C-2, C-3, C-4, C-5
App. D - pp. D-1, D-2
App. E - pp. E-1, E-2
App. F - p. F-1
App. G - pp. G-1, G-5, G-6, G-9, G-10
App. H - p. H-1
Index - pp. Index-1- Index-10
Index
Symbols
# See subscripts ..........................................................................................................5-7
$ See subscripts ...........................................................................................................2-7
%macros .............................................................................................................. I-1, 11-3
**See exponents ...........................................................................................................2-7
*See asterisk...............................................................................................................4-12
|| See CAT.....................................................................................................................6-6
¢ See escape character ................................................................................................2-6
A
ABS.............................................................................................................................. C-1
ABVAL.......................................................................................................................... C-3
ACCESS ................................................................................................. 3-7, 4-12 to 4-13
FUNCTION ..................................................................................................................3-11
NAME........................................................................................................... 11-11, 11-17
PROCEDURE ................................................................................................................3-9
AFTER ..........................................................................................................................8-4
ALIGNED ....................................................................................................................4-12
NAME................................................................................................ 11-11, 11-13, 11-17
STRUCTURE ....................................................................................................... 4-7, 4-13
ARCCOS...................................................................................................................... C-2
ARCCOSH ................................................................................................................... C-2
ARCSIN ....................................................................................................................... C-2
ARCSINH..................................................................................................................... C-2
ARCTAN ...................................................................................................................... C-2
ARCTAN2 .................................................................................................................... C-2
ARCTANH.................................................................................................................... C-2
arguments and parameters
FUNCTION ............................................................................................ 3-10, 6-18 to 6-19
NAME.......................................................................................................................11-20
PROCEDURE .............................................................................................. 3-8, 7-5 to 7-7
ARRAY........................................................................................................................4-11
arrayness ....................................................................................................... 5-10 to 5-11
arrays ..........................................................................................................................4-11
arrayed assignments .......................................................................................................7-3
arrayed comparisons .....................................................................................................6-15
in expressions ................................................................................................................6-9
order of unraveling ........................................................................................................5-13
subscripts .............................................................................................................. 5-3, 5-8
within subscripts ...........................................................................................................5-11
ASSIGN arguments and parameters .......................................................... 3-8, 7-5 to 7-7
asterisk
CHARACTER(*) ............................................................................... 4-16, 6-18, 7-6, 11-12
in comments ..................................................................................................................2-8
in initialization.................................................................................................. 4-18 to 4-20
LOCK(*) ..................................................................................................... 4-12, 7-6, 8-11
B
BIN ............................................................................................................. 2-5, 6-23, 6-25
BIT ..............................................................................................................................4-17
assignment ....................................................................................................................7-4
comparison ..................................................................................................................6-13
conversion ..................................................................................... 6-23 to 6-24, 6-27, D-1
initialization ..................................................................................................................4-20
literals...........................................................................................................................2-5
operators....................................................................................................... 6-6, F-1, H-2
blanks............................................................................................................................2-8
BOOLEAN See also BIT .............................................................................................4-17
C
CALL .............................................................................................................................7-4
NAME.......................................................................................................................11-20
CANCEL ............................................................................................................ 8-5 to 8-6
CASE See DO CASE....................................................................................................7-9
CAT (||).................................................................................................................. 6-6, 6-8
catenation See CAT ......................................................................................................6-6
CEILING....................................................................................................................... C-1
CHAR............................................................................................................................2-6
CHARACTER..............................................................................................................4-16
assignment ....................................................................................................................7-4
CHARACTER(*) ............................................................................... 4-16, 6-18, 7-6, 11-12
comparison ..................................................................................................................6-14
conversion ...........................................................................................................6-27, D-2
initialization ..................................................................................................................4-20
literals...........................................................................................................................2-6
operators...................................................................................................... 6-8, F-2, H-2
CLOCKTIME ................................................................................................................ C-3
CLOSE........................................................................................................................3-11
COLUMN ..................................................................................... 10-2, 10-5 to 10-6, 10-9
comments .....................................................................................................................2-8
comparisons
arithmetic ....................................................................................................................6-12
arrayed .......................................................................................................................6-15
BIT.............................................................................................................................6-13
CHARACTER...............................................................................................................6-14
operators...................................................................................................................... H-3
STRUCTURE ...............................................................................................................6-15
COMPOOL....................................................................................................................3-5
compilation ....................................................................................................................3-2
RIGID ................................................................................................................. 3-7, 4-13
template ........................................................................................................................3-6
CONSTANT ................................................................................................................4-18
conversions
BIT............................................................................................... 6-23 to 6-24, 6-27, D-1
CHARACTER.......................................................................................................6-27, D-2
INTEGER ...................................................................... 6-3, 6-12, 6-20 to 6-22, 6-27, D-1
MATRIX ................................................................................................ 6-20 to 6-22, 6-27
precision ....................................................................................... 6-20 to 6-22, 6-27, D-1
in assignments ....................................................................................................... 7-3
in comparisons ..................................................................................................... 6-12
in expressions ..............................................................................................6-3 to 6-5
SCALAR ....................................................................................... 6-20 to 6-22, 6-27, D-1
SUBBIT ......................................................................................................................6-25
VECTOR ............................................................................................... 6-20 to 6-22, 6-27
COS ............................................................................................................................. C-2
COSH........................................................................................................................... C-2
D
data
attributes .....................................................................................................................4-10
initialization ..................................................................................................................4-17
type............................................................................................................................4-15
DATE............................................................................................................................ C-3
DEC ........................................................................................................... 2-5, 6-23, 6-25
DECLARE ...................................................................................................................4-10
DENSE........................................................................................................................4-12
in PROCEDUREs ...........................................................................................................7-6
NAME........................................................................................................... 11-11, 11-13
STRUCTURE ....................................................................................................... 4-7, 4-13
DEPENDENT................................................................................................................8-4
DET.............................................................................................................................. C-3
DIV ............................................................................................................................... C-1
DO CASE......................................................................................................... 7-9 to 7-10
DO END ........................................................................................................................7-8
DO FOR ......................................................................................................................7-11
TEMPORARY variables .................................................................................. 11-9 to 11-10
DO UNTIL ...................................................................................................................7-10
DO WHILE ..................................................................................................................7-10
DOUBLE .................................................................................................... 2-4, 4-16, 6-27
E
ELSE.............................................................................................................................7-2
F
FILE ........................................................................................................... 10-19 to 10-20
FLOOR......................................................................................................................... C-1
formats ................................................................................................................ 10-7, E-1
FOR See DO FOR ......................................................................................................7-11
FUNCTION ........................................................................................................... 3-3, 3-4
arguments and parameters ....................................................................... 3-10, 6-18 to 6-19
NAME .............................................................................................................. 11-20
compilation ....................................................................................................................3-2
header ..........................................................................................................................3-9
inline ..........................................................................................................................11-1
label ...........................................................................................................................4-14
name scope .................................................................................................................3-12
normal ........................................................................................................................6-17
template ........................................................................................................................3-6
G
GO TO ........................................................................................................... 7-14 to 7-15
H
HEX............................................................................................................ 2-5, 6-23, 6-25
I
identifiers.......................................................................................................................2-4
IF...................................................................................................................................7-1
IGNORE........................................................................................................................9-3
IN ..................................................................................................................................8-3
L
LATCHED ......................................................................................................... 4-13, 4-20
LENGTH....................................................................................................................... C-4
LINE ...................................................................................................... 10-2, 10-5 to 10-7
literals............................................................................................................................2-4
LJUST .......................................................................................................................... C-4
LOCK ...................................................................................................... 4-12 to 4-13, 7-6
in UPDATE block ..........................................................................................................8-11
LOCK(*) ..................................................................................................... 4-12, 7-6, 8-11
LOG ............................................................................................................................. C-2
M
macros
%.........................................................................................................................11-3, I-1
REPLACE See REPLACE ................................................................................................4-2
MATRIX.......................................................................................................................4-16
assignment ....................................................................................................................7-3
comparison ..................................................................................................................6-12
conversion ............................................................................................. 6-20 to 6-22, 6-27
initialization ..................................................................................................................4-19
operators...............................................................................................................6-1, H-1
subscripts ....................................................................................................................5-10
MAX ............................................................................................................................. C-5
MIDVAL........................................................................................................................ C-1
MIN .............................................................................................................................. C-5
MOD............................................................................................................................. C-1
N
NAME........................................................................................................................11-10
arguments and parameters ...........................................................................................11-20
assignment ................................................................................................. 11-18 to 11-19
comparison ................................................................................................. 11-19 to 11-20
dereferencing .............................................................................................. 11-15 to 11-16
identifiers ..................................................................................................................11-10
initialization ................................................................................................. 11-22 to 11-23
referencing ................................................................................................................11-16
O
OCT ........................................................................................................... 2-5, 6-23, 6-25
ODD ............................................................................................................................. C-1
OFF ERROR.................................................................................................................9-1
ON.................................................................................................................................8-4
ON ERROR...................................................................................................................9-1
operators
arithmetic ..............................................................................................................6-1, H-1
BIT............................................................................................................... 6-6, F-1, H-2
CHARACTER................................................................................................. 6-8, F-2, H-2
comparison ................................................................................................................... H-3
computable at compile time .................................................................................... F-1 to F-2
conditional ...........................................................................................................6-10, H-2
EVENT ...............................................................................................................6-16, H-2
operand data type ...........................................................................................................6-2
order of precedence ........................................................... 6-4, 6-6, 6-10, 6-16, H-1 to H-2
P
PAGE ....................................................................................................... 10-2, 10-5, 10-7
precedence
EVENT .......................................................................................................................6-16
ON ERROR ...................................................................................................................9-4
operators.......................................................................... 6-4, 6-6, 6-10, 6-16, H-1 to H-2
precision
conversion ..................................................................................... 6-20 to 6-22, 6-27, D-1
in assignments ....................................................................................................... 7-3
in comparisons ..................................................................................................... 6-12
in expressions ..............................................................................................6-3 to 6-5
DOUBLE .................................................................................................... 2-4, 4-16, 6-27
in PROCEDUREs ...........................................................................................................7-6
of FUNCTIONs ................................................................................................ 6-18 to 6-19
SINGLE ..................................................................................................... 2-4, 4-16, 6-27
PRIO ............................................................................................................................ C-3
PRIORITY .....................................................................................................................8-4
PROCEDURE ...............................................................................................................3-3
arguments and parameters ............................................................................. 3-8, 7-5 to 7-7
NAME ................................................................................................ 11-20 to 11-21
CALL statement ................................................................................................... 7-1 to 7-4
compilation ....................................................................................................................3-2
header ..........................................................................................................................3-8
name scope .................................................................................................................3-12
template ........................................................................................................................3-6
PROD........................................................................................................................... C-5
PROGRAM ...................................................................................................................3-2
compilation ....................................................................................................................3-1
header ..........................................................................................................................3-7
NAME.......................................................................................................................11-13
template ........................................................................................................................3-6
R
RANDOM ..................................................................................................................... C-3
RANDOMG .................................................................................................................. C-3
READ
I/O formats ..................................................................................................................10-7
READALL....................................................................................................................10-1
READ ..........................................................................................................................10-1
REENTRANT
FUNCTION ..................................................................................................................3-10
PROCEDURE ..................................................................................................... 3-8 to 3-9
REMAINDER ............................................................................................................... C-1
REMOTE........................................................................................................ 4-12 to 4-13
in PROCEDUREs ...........................................................................................................7-6
NAME.......................................................................................................................11-14
REPEAT......................................................................................................... 7-14 to 7-15
AFTER .........................................................................................................................8-4
EVERY .............................................................................................................. 8-3 to 8-4
REPLACE .....................................................................................................................4-2
parametric .......................................................................................................... 4-3 to 4-4
reserved words .............................................................................................................2-4
RESET ...................................................................................................... 8-8 to 8-10, 9-3
RETURN ................................................................................................... 3-11, 7-7 to 7-8
RIGID ..........................................................................................................................4-13
COMPOOL ....................................................................................................................3-7
STRUCTURE ........................................................................................... 4-7, 4-13 to 4-14
RJUST ......................................................................................................................... C-4
ROUND........................................................................................................................ C-1
RUNTIME..................................................................................................................... C-3
S
SCALAR.............................................................................................................. 2-4, 4-16
assignment ....................................................................................................................7-3
comparison ..................................................................................................................6-12
conversion ..................................................................................... 6-20 to 6-22, 6-27, D-1
initialization ..................................................................................................................4-19
literals...........................................................................................................................2-5
operators...............................................................................................................6-1, H-1
SCHEDULE ..................................................................................................................8-2
SEND ERROR ...................................................................................................... 9-1, 9-4
SET ........................................................................................................... 8-8 to 8-10, 9-3
SHL .............................................................................................................................. C-4
T
TAB ....................................................................................................... 10-2, 10-5 to 10-6
TAN .............................................................................................................................. C-2
U
UNIT............................................................................................................................. C-3
UNTIL See also DO UNTIL.........................................................................................7-10
with SCHEDULE statement .................................................................................... 8-4 to 8-5
UPDATE block ................................................................................. 3-4 to 3-5, 4-12, 8-11
header ..........................................................................................................................3-7
within REENTRANT block.................................................................................... 3-9 to 3-10
UPDATE PRIORITY......................................................................................................8-8
V
variables........................................................................................................................2-4
VECTOR .....................................................................................................................4-16
assignment ....................................................................................................................7-3
comparison ..................................................................................................................6-12
conversion ............................................................................................. 6-20 to 6-22, 6-27
initialization ..................................................................................................................4-19
operators...............................................................................................................6-1, H-1
subscripts ....................................................................................................................5-10
W
WAIT .................................................................................................................. 8-7 to 8-8
WHILE See also DO WHILE.......................................................................................7-10
with SCHEDULE statement .................................................................................... 8-4 to 8-5
WRITE ........................................................................................................... 10-4 to 10-5
I/O formats ..................................................................................................................10-7
X
XOR ............................................................................................................................. C-5
NASA-JSC
*BV N. Moses
MS4 D. Stamper
EV111 EV Library (D. Wall)
USA-Houston
*USH-121G SFOC Technical Library
USH-634G Abel Puente
USH-64A6X L.W. Wingo
USH-633L Anita Senviel
USH-633L Benjamin L. Peterson
USH-633L Cory L. Driskill
USH-633L Judy M. Hardin
USH-633L Mark E. Lading
USH-633L Quinn L. Larson
USH-633L James T. Tidwell
USH-633L Vicente Aguilar
USH-633L Betty A. Pages
USH-633L Jeremy C. Battan
USH-633L George H. Ashworth
USH-634L Mark Caronna
USH-634L Burk J. Royer
*USH-635L Joy C. King
USH-635L Ling J. Kuo
USH-635L Trang K. Nguyen
USH-635L Billy L. Pate
USH-635L Karen H. Pham
*USH-635L Dan A. Strauss
USH-635L Pete Koester
USH-632L Renne Siewers
*USH-635L Barbara Whitfield (2)
Boeing
HS1-40 B. Frere
[email protected]
Submit NASA distribution changes, including initiator’s name and phone number, to JSC Data Management/BV or call 281-
244-8506. Submit USA distribution changes to USA Data Management/USH-121E or via e-mail to usadm@usa-
spaceops.com. Most documents are available electronically via USA Intranet Web (usa1.unitedspacealliance.com), Space
Flight Operations Contract (SFOC), SFOC Data and Deliverables.
Indicates hardcopy
11/23/2005 7:35 AM