10.2. The standard prelude {The declarations of the standard-prelude comprise "environment enquiries", which supply information concerning a specific property of the implementation {2.2.2.c }, "standard modes", "standard operators and functions", "synchronization operations" and "transput declarations" (which are given in section 10.3 ).}
a) INT int lengths = © 1 plus the number of extra lengths of integers \R{2.1.3.1.d} ©;
b) INT int shorths = © 1 plus the number of extra shorths of integers \R{2.1.3.1.d} ©;
c) #L# INT #l# max int = © the largest {\calf L} integral value \R{2.2.2.b} ©;
d) INT real lengths = © 1 plus the number of extra lengths of real numbers \R{2.1.3.1.d} ©;
e) INT real shorths = © 1 plus the number of extra shorths of real numbers \R{2.1.3.1.d} ©;
f) #L# REAL #l# max real = © the largest {\calf L} real value \R{2.2.2.b} ©;
g) #L# REAL #l# small real = © the smallest {\calf L} real value such that both {\-{\calf L} 1 + {\teneul\char'140} small real > {\calf L} 1} and {\-{\calf L} 1 - {\teneul\char'140} small real <{} {\calf L} 1} \R{2.2.2.b} ©;
h) INT bits lengths = © 1 plus the number of extra widths \R{j} of bits ©;
i) INT bits shorths = © 1 plus the number of extra shorths \R{j} of bits ©;
j) INT #l# bits width = © the number of elements in {\teneul\char'140} {\-bits}; see {\calf L} {\-BITS} \R{10.2.2.g}; this number increases (decreases) with the "size", i.e., the number of 'long's (minus the number of 'short's) of which '{\teneul\char'140}' is composed, until a certain size is reached, viz., "the number of extra widths" (minus "the number of extra shorths") of bits, after which it is constant ©;
k) INT bytes lengths = © 1 plus the number of extra widths \R{m} of bytes ©;
l) INT bytes shorths = © 1 plus the number of extra shorths \R{m} of bytes ©;
m) INT #l# bytes width = © the number of elements in {\teneul\char'140} {\-bytes}; see {\calf L} {\-BYTES} \R{10.2.2.h}; this number increases (decreases) with the "size", i.e., the number of 'long's (minus the number of 'short's) of which '{\teneul\char'140}' is composed, until a certain size is reached, viz., "the number of extra widths" (minus "the number of extra shorths") of bytes, after which it is constant ©;
n) OP ABS = (CHAR a) INT : © the integral equivalent \R{2.1.3.1.g} of the character 'a' ©;
o) OP REPR = (INT a) CHAR: © that character 'x', if it exists, for which ABS x = a ©;
p) INT max abs char = © the largest integral equivalent \R{2.1.3.1.g} of a character ©;
q) CHAR null character = © some character ©;
r) CHAR flip = © the character used to represent 'true' during transput \R{10.3.3.1.a, 10.3.3.2.a} ©;
s) CHAR flop = © the character used to represent 'false' during transput ©;
t) CHAR errorchar = © the character used to represent unconvertible arithmetic values\R{10.3.2.1.b, c, d, e, f} during transput ©;
u) CHAR blank = " ";
a) #(#CO#)#MODE VOID = © an actual-declarer specifying the mode \q{void} ©;
b) MODE BOOL = © an actual-declarer specifying the mode \q{boolean} ©;
c) MODE #L# INT = © an actual-declarer specifying the mode \q{{\calf L} integral} ©;
d) MODE #L# REAL = © an actual-declarer specifying the mode \q{{\calf L} real} ©;
e) MODE CHAR = © an actual-declarer specifying the mode \q{character} ©;
f) MODE #L# COMPL = STRUCT (#L# REAL re, im);
g) MODE #L# BITS STRUCT([1 : #l# bits width] BOOL #l# #F#fff);
\c{See 10.2.1.j}{\Cb The field-selector is hidden from the user in order that he may not break open the structure; in particular, he may not subscript the field.}
h) MODE #L# BYTES = STRUCT([1: #l# bytes width] CHAR #l# #F#fff); #:\c{See 10.2.1.m}
i) #(#CO#)#MODE STRING = FLEX[1: 0]CHAR;
10.2.3. Standard operators and functions
a) PRIO MINUSAB = 1, PLUSAB = 1, TIMESAB = 1, DIVAB = 1, OVERAB = 1, MODAB = 1, PLUSTO = 1,
-:= = 1, +:= = 1, *:= = 1, \g{\ast}:= = 1, /:= = 1, +:= = 1, %:= = 1, +\g{\ast}:= = 1, %*:= = 1, %\g{\ast}:= = 1, +=: = 1,
#|#OR = 2, OR = 2,
& = 3, AND = 3,
= = 4, EQ = 4, /= = 4, /{}= = 4, NE = 4,
< = 5, LT = 5, <= = 5, <{}= = 5, LE = 5, >= = 5, >{}= = 5, GE = 5, > = 5, GT = 5,
- = 6, + = 6,
* = 7, \g{\ast} = 7, / = 7, % = 7, OVER = 7, %* = 7, %\g{\ast} = 7, MOD = 7, [] = 7, ELEM = 7,
^ = 8, \g{\ast\ast} = 8, \g{\downarrow} = 8, UP = 8, DOWN = 8, SHL = 8, SHR = 8, LWB = 8, UPB = 8, {\floor} = 8, {\ceil} = 8,
\g{\bot} = 9, +* = 9, +\g{\ast} = 9, I = 9;
10.2.3.1. Rows and associated operations
a) MODE #a# ROWS = © an actual-declarer specifying a mode united from \R{2.1.3.6.a} a sufficient set of modes each of which begins with \q{row} ©;
b) OP #[#LWB #, \floor# = (INT n, ROWS a) INT : © the lower bound in the \g{n}-th bound pair of the descriptor of the value of 'a', if that bound pair exists ©;
c) OP #[#UPB #, \ceil# = (INT n, ROWS a) INT: © the upper bound in the \g{n}-th bound pair of the descriptor of the value of 'a', if that bound pair exists ©;
d) OP #[#LWB #, \floor# =(ROWS a) INT: 1 LWB a;
e) OP #[#UPB #, \ceil# =(ROWS a) INT: 1 UPB a;
}
{\Cb The term "sufficient set", as used in a above and also in 10.3.2.2.b and d, implies that no intended particular-program should fail to be produced (nor any unintended particular-program be produced) by the syntax solely on account of an insufficiency of modes in that set.\Ce\par}
10.2.3.2. Operations on boolean operands
a) OP ⦓∨, OR⦔ = (BOOL b) BOOL: (a | TRUE | b);
b) OP ⦓∧, &, AND⦔ = (BOOL a, b) BOOL: (a | b | FALSE);
c) OP ⦓¬, ~, NOT⦔ = (BOOL a) BOOL: (a | FALSE | TRUE);
d) OP ⦓=, EQ⦔ = (BOOL a, b) BOOL: (a & b) #|#OR ( ~ a & ~ b);
e) OP ⦓≠, /=, NE⦔ = (BOOL a, b) BOOL: ~ (a = b);
f) OP ABS = (BOOL a) INT: (a | 1 | 0);
}
10.2.3.3. Operations on integral operands
a) 10.2.3.4. Operations on real operands
10.2.3.5. Operations on arithmetic operands
OP ⦓<, LT⦔ = (#L# INT a, b) BOOL: © \gtrue/ if the value of 'a' is smaller than \R{2.1.3.1.e} that of 'b' and \gfalse/ otherwise ©;
b) OP ⦓<=, ≤, LE⦔ = (#L# INT a, b) BOOL: ~ (b
a)
c) OP ⦓=, EQ⦔ = (#L# INT a, b) BOOL: a <=b & b <=a;
d) OP ⦓≠, /=, NE⦔ = (#L# INT a, b) BOOL: ~ (a = b);
e) OP ⦓≥, >=, GE⦔ = (#L# INT a, b) BOOL: b<=a;
f) OP ⦓>, GT⦔ = (#L# INT a, b) BOOL: b< a;
g) OP - = (#L# INT a, b) #L# INT: © the value of 'a' minus \R{2.1.3.1.e} that of 'b' ©;
h) OP - = (#L# INT a) #L# INT :#L# 0-a;
i) OP + = (#L# INT a, b) #L# INT :a - -b;
j) OP + = (#L# INT a) #L# INT : a;
k) OP ABS = (#L# INT a) #L# INT : (a < #L# 0 | -a | a);
l)
OP ⦓*, \g{\ast}} = (#L# INT a, b) #L# INT:
BEGIN #L# INT s := #L# 0, i := ABS b;
WHILE i >= #L# 1
DO s := s + a, i := i - #L# 1 OD;
( b < #L# 0 | -s | s)
END;
m)
OP ⦓%, OVER⦔ =(#L# INT a, b) #L# INT:
IF b /= #L# 0
THEN #L# INT q := #L# 0, r := ABS a;
WHILE (r := r- ABS b) >= #L# 0 DO q := q + #L# 1 OD;
( a< #L# 0 & b>#L# 0 #|#OR a >= #L# 0 & b < #L# 0 | -q | q)
FI;
n) OP ⦓%*, %\g{\ast}, MOD⦔ =(#L# INT a, i) #L# INT : (#L# INT r = a - a % b * b; r < 0 | r + ABS b | r);
o) OP / = (#L# INT a, b) #L# REAL : #L# REAL (a) /#L# REAL (b);
p) OP ⦓^, \g{\ast\ast}, UP⦔ =(#L# INT a, INT b) #L# INT : (b >= 0 | #L# INT p := #L# 1; TO b DO p := p * a OD; p);
q) OP LENG = (#L# INT a) LONG #L# INT : © the long {\calf L} integral value lengthened from \R{2.1.3.1.e} the value of 'a' ©;
r) OP SHORTEN = (LONG #L# INT a) #L# INT : © the {\calf L} integral value, if it exists, which can be lengthened to \R{2.1.3.1.e} the value of 'a' ©;
s) OP ODD =(#L# INT a) BOOL: ABS a %* #L#2 = #L#1;
t) OP SIGN =(#L# INT a) INT: (a>#L# 0 | 1 |: a < #L#0 | -1 | 0);
u) OP ⦓\g{\bot⦔, +*, +\g{\ast}, I} =(#L# INT a, b) #L# COMPL :(a, b);
OP ⦓<, LT⦔ =(#L# REAL a, b) BOOL: © \gtrue/ if the value of 'a' is smaller than \R{2.1.3.1.e} that of 'b' and \gfalse/ otherwise ©;
b) OP ⦓<=, <{}=, LE⦔ =(#L# REAL a, b)BOOL: ~ (b
a)
c) OP ⦓=, EQ⦔ =(#L# REAL a, b) BOOL:a <= b & b <= a;
d) OP ⦓/=, /{}=, NE⦔ =(#L# REAL a, b) BOOL: ~ (a=b);
e) OP ⦓>=, >{}=, GE⦔ =(#L# REAL a, b) BOOL:b <= a;
f) OP ⦓>, GT⦔ =(#L# REAL a, b) BOOL: b<a;
g) OP - = (#L# REAL a, b) #L# REAL : © the value of 'a' minus \R{2.1.3.1.e} that of 'b' ©;
h) OP - =(#L# REAL a) #L# REAL : #L# 0-a;
i) OP + =(#L# REAL a, b) #L# REAL : a - - b;
j) OP + =(#L# REAL a) #L# REAL : a;
k) OP ABS =(#L# REAL a) #L# REAL :(a < #L# 0 | -a | a);
l) OP ⦓*, \g{\ast}⦔ =(#L# REAL a, b) #L# REAL : © the value of 'a' times \R{2.1.3.1.e} that of 'b' ©;
m) OP / = (#L# REAL a, b) #L# REAL : © the value of 'a' divided by \R{2.1.3.1.e} that of 'b' ©;
n) OP LENG = (#L# REAL a) LONG #L# REAL : © the long {\calf L} real value lengthened from \R{2.1.3.1.e} the value of 'a' ©;
o) OP SHORTEN = (LONG #L# REAL a) #L# REAL : © if {\-ABS a <= {\calf S} LENG {\teneul\char'140} max real}, then a {\-{\calf L} REAL} value 'v' such that, for any {\-{\calf L} REAL} value 'w', {\-ABS (LENG v - a) <= ABS (LENG w - a)} ©;
p) OP ROUND = (#L# REAL a) #L# INT : © a {\calf L} integral value, if one exists, which is widenable to \R{2.1.3.1.e} a {\-{\calf L} REAL} value differing by not more than one-half from the value of 'a' ©;
q) OP SIGN =(#L# REAL a) INT:(a>#L# 0 | 1 |: a < #L# 0 | -1 | 0);
r)
OP ⦓ENTIER, \floor⦔ =(#L# REAL a) #L# INT:
BEGIN #L# INT j := #L# 0;
WHILE j < a DO j := j + #L#1 OD;
WHILE j > a DO j := j - #L#1 OD;
j
END;
s) OP ⦓\g{\bot⦔, +*, +\g{\ast}, I} =(#L# REAL a, b) #L# COMPL :(a, b);
OP #P# = (#L# REAL a, #L# INT b) #L# REAL :a #P# #L# REAL (b);
b) OP #P# = (#L# INT a, #L# REAL b) #L# REAL : #L# REAL (a) #P# b;
c) OP #R# = (#L# REAL a, #L# INT b) BOOL: a #R# #L# REAL (b);
d) OP #R# = (#L# INT a, #L# REAL b) BOOL: #L# REAL (a) #R# b;
e) OP ⦓\g{\bot}, +*, +\g{\ast}, I⦔ = (#L# REAL a, #L# INT b) #L# COMPL :(a, b);
f) OP ⦓\g{\bot}, +*, +\g{\ast}, I⦔ = (#L# INT a, #L# REAL b) #L# COMPL : (a, b);
g) OP ⦓^, \g{\ast\ast}, UP⦔ = (#L# REAL a, INT b) #L# REAL : (#L# REAL p := #L# 1; TO ABS b DO p := p * a OD; (b >= 0 | p | #L#1 / p));
10.2.3.6. Operations on character operands
a) OP #R# (CHAR a, b) BOOL: ABS a #R# ABS b; #:\R{10.2.1.n}#
b) OP + =(CHAR a, b) STRING: (a, b);
10.2.3.7. Operations on complex operands
a) OP RE = (#L# COMPL a) #L# REAL : re OF a;
b) OP IM = (#L# COMPL a) #L# REAL : im OF a;
c) OP ABS = (#L# COMPL a) #L# REAL :#l# sqrt(RE a^2 + IM a^2);
d) OP ARG = (#L# COMPL a) #L# REAL :
IF #L# REAL re = RE a, im = IM a;
re /= #L# 0 #|#OR im /= #L# 0
THEN IF ABS re > ABS im
THEN #l# arctan(im / re) + #l# pi/ #L# 2 *
( im < #L# 0 | SIGN re - 1 | 1 - SIGN re)
ELSE - #L# arctan (re / im) + #l# pi / #L# 2 * SIGN im
FI
FI;
OP CONJ = (#L# COMPL a) #L# COMPL : RE a I - IM a;
OP \br{=, EQ} = (#L# COMPL a, b) BOOL: RE a = RE b & IM a = IM b;
OP \br{/=, /{}=, NE} = (#L# COMPL a, b) BOOL: ~ (a = b);
OP - = (#L# COMPL a, b) #L# COMPL : (RE a - RE b) I (IM a - IM b);
OP - = (#L# COMPL a) #L# COMPL : -RE a I -IM a;
OP + = (#L# COMPL a, b) #L# COMPL: (RE a + RE b) I (IM a + IM b);
OP + = (#L# COMPL a) #L# COMPL: a;
OP \br{*,\g{\ast}} = (#L# COMPL a, b) #L# COMPL : (RE a * RE b - IM a * IM b) I (RE a * IM b + IM a * RE b);
m) OP / = (#L# COMPL a, b) #L# COMPL:
( #L# REAL d = RE(b * CONJ b); #L# COMPL n = a * CONJ b;
(RE n/d) I (IM n/d));
OP LENG = (#L# COMPL a) LONG #L# COMPL : LENG RE a I LENG IM a;
OP SHORTEN = (LONG #L# COMPL a) #L# COMPL : SHORTEN RE a I SHORTEN IM a;
OP #P# = (#L# COMPL a, #L# INT b) #L# COMPL : a #P# #L# COMPL (b);
OP #P# = (#L# COMPL a, #L# REAL b) #L# COMPL : a #P# #L# COMPL (b);
OP #P# = (#L# INT a, #L# COMPL b) #L# COMPL : #L# COMPL (a) #P# b;
OP #P# = (#L# REAL a, #L# COMPL b) #L# COMPL : #L# COMPL (a) #P# b;
OP \br{^, \g{\ast\ast}, UP} = (#L# COMPL a, INT b) #L# COMPL : (#L# COMPL p := #L# 1; TO ABS b DO p := p * a OD; (b >= 0 | p | #L# 1/p));
OP #E# = (#L# COMPL a, #L# INT b) BOOL: a #E# #L# COMPL (b);
OP #E# = (#L# COMPL a, #L# REAL b) BOOL: a #E# #L# COMPL (b);
OP #E# = (#L# INT a, #L# COMPL b) BOOL: b #E# a;
OP #E# = (#L# REAL a, #L# COMPL b) BOOL: b #E# a;
10.2.3.8. Bits and associated operations
a) OP \br{=, EQ} =(#L# BITS a, b) BOOL:
BEGIN BOOL c;
FOR i TO #l# bits width
WHILE c := (#l# #F# OF a) [i]=(#l# #F# OF b) [i]
DO SKIP OD;
c
END;
OP \br{/=, /{}=, NE} =(#L# BITS a, b) BOOL: (a=b);
c) OP \br{#|#OR, OR} =(#L# BITS a, b) #L# BITS :
BEGIN #L# BITS c;
FOR i TO #l# bits width
DO (#l# #F# OF c) [i] = (#l# #F# OF a) [i] OR (#l# #F# OF b) [i] OD;
c
END;
d) OP \br{&, AND} = (#L# BITS a, b) #L# BITS :
BEGIN #L# BITS c;
FOR i TO #l# bits width
DO (#l# #F# OF c) [i]:= (#l# #F# OF a) [i] & (#l# #F# OF b)[i] OD;
c
END;
OP \br{<=, <{}=, LE} =(#L# BITS a, b)BOOL:(a OR b) = b;
OP \br{>=, >{}=, GE} =(#L# BITS a, b)BOOL: b <= a;
g) OP \br{^ , UP, SHL}=(#L# BITS a, INT b)#L# BITS :
IF ABS b <= #l# bits width
THEN #L# BITS c := a;
TO ABS b
DO IF b>0 THEN
FOR i FROM 2 TO #l# bits width
DO (#l# #F# OF e) [i - 1] := (#l# #F# OF c) [i] OD;
( #l# #F# OF c) [#l# bits width] := FALSE
ELSE
FOR i FROM #l# bits width BY -1 TO 2
DO (#l# #F# OF c) [i] := (#l# #F# OF c) [i - 1] OD;
( #l# #F# OF c)[1] := FALSE
FI OD;
c
FI ;
OP \br{#L# DOWN, SHR} = (#L# BITS x, INT n) #L# BITS : x ^ -n;
i) OP ABS =(#L# BITS a)#L# INT :
BEGIN #L# INT c := #L# 0;
FOR i TO #l# bits width
DO c := #L#2 * c + #K# ABS (#l# #F# OF a)[i] OD;
c
END;
j) OP BIN =(#L# INT a)#L# BITS :
IF a >= #L# 0
THEN #L# INT b := a; #L# BITS c;
FOR i FROM #l# bits width BY - 1 TO 1
DO (#l# #F# OF c)[i] := ODD b; b := b % #L# 2 OD;
c
FI;
k)OP \br{ELEM, []} =(INT a, #L# BITS b)BOOL: (#l# #F# OF b) [a];
l)PROC #l# bits pack = ([ ] BOOL a) #L# BITS : IF INT n = UPB a[@1]; n <= #l# bits width THEN #L# BITS c; FOR i TO #l# bits width DO (#l# #F# OF c) [i] := ( i <= #l# bits width -n | FALSE | a[@1][i - #l# bits width + n ]) OD; c FI;
m) OP \br{~ , NOT} =(#L# BITS a)#L# BITS :
BEGIN #L# BITS c;
FOR i TO #l# bits width DO (#l# #F# OF c)[i] := ~(#l# #F# OF a)[i] OD;
c
END;
OP LENG = (#L# BITS a) LONG #L# BITS : long #l# bits pack (a);
OP SHORTEN = (LONG #L# BITS a) #L# BITS : #l# bits pack ([ ] BOOL (a) [long #l# bits width - #l# bits width + 1: ]);
10.2.3.9. Bytes and associated operations
a) OP #R# = (#L# BYTES a, b) BOOL: STRING (a) #R# STRING (b);
b) OP \br{ELEM, []} =(INT a, #L# BYTES b)CHAR:(#l# #F# OF b)[a];
c) PROC #l# bytes pack = (STRING a) #L# BYTES:
IF INT n= UPB a [@1];
n <= #l# bytes width
THEN #L# BYTES c;
FOR i TO #l# bytes width
DO (#l# #F# OF c)[i]:= (i <= n | a[@1] [i] | nullcharacter) OD;
c
FI;
OP LENG = (#L# BYTES a) LONG #L# BYTES: long #l# bytes pack (a);
OP SHORTEN = (LONG #L# BYTES a) #L# BYTES: #l# bytes pack (STRING (a) [ : #l# bytes width ]);
10.2.3.10. Strings and associated operations
a) OP \br{<, LT} =(STRING a, b)BOOL:
BEGIN INT m = UPB a[@1], n = UPB b[@1]; INT c := 0;
FOR i TO (m < n | m | n)
WHILE (c := ABS a [@1] [i] - ABS b[@1] [i])=0
DO SKIP OD;
( c = 0 | m < n & n > 0 OR c < 0)
END;
OP \br{<=, <{}=, LE} =(STRING a, b)BOOL: ~(b < a);
OP \br{=, EQ} =(STRING a, b)BOOL: a <= b & b >= a;
OP \br{/=, /{}=, NE} =(STRING a, b)BOOL: ~(a = b);
OP \br{>=, >{}=, GE} =(STRING a, b)BOOL: b <= a;
OP \br{>, GT} =(STRING a, b) BOOL: b<a;
OP #R# = (STRING a, CHAR b) BOOL: a #R# STRING (b);
OP #R# = (CHAR a, STRING b) BOOL: STRING (a) #R# b;
i) OP + = (STRING a, b) STRING:
( INT m=(INT la = UPB a[@1]; la< 0 | 0 | la),
n=(INT lb = UPB b[@1]; lb<0 | 0 | lb);
[ 1: m+n]CHAR c;
c[1 : m] := a[@1]; c[m + 1 : m + n] := b[@1]; c);
OP + = (STRING a, CHAR b) STRING: a + STRING (b);
OP + = (CHAR a, STRING b) STRING: STRING (a) + b;
OP \br{*,\g{\ast}} =(STRING a, INT b) STRING: (STRING c; TO b DO c := c + a OD; c);
OP \br{*,\g{\ast}} =(INT a, STRING b) STRING: b * a;
OP \br{*,\g{\ast}} = (CHAR a, INT b) STRING: STRING (a) * b;
OP \br{*,\g{\ast}} =(INT a, CHAR b) STRING: b * a;
{\Cb The operations defined in a, g and h imply that if {\-ABS "a" < ABS "b"}, then {\-""< "a"}; {\-"a"< "b"}; {\-"aa"< "ab"}; {\-"aa"< "ba"}; {\-"ab"< "b"} and {\-"ab"< "ba"}.}
10.2.3.11. Operations combined with assignations
a) OP \br{MINUSAB, -:=} =(REF #L# INT a, #L# INT b)REF #L# INT : a := a-b;
b) OP \br{MINUSAB, -:=} =(REF #L# REAL a, #L# REAL b)REF #L# REAL : a := a-b;
c) OP \br{MINUSAB, -:=} = (REF #L# COMPL a, #L# COMPL b) REF #L# COMPL : a := a -b;
d) OP \br{PLUSAB, +:=} =(REF #L# INT a, #L# INT b)REF #L# INT :a := a + b;
e) OP \br{PLUSAB, +:=} =(REF #L# REAL a, #L# REAL b)REF #L# REAL : a := a + b;
f) OP \br{PLUSAB, +:=} =(REF #L# COMPL a, #L# COMPL b)REF #L# COMPL : a := a + b;
g) OP \br{TIMESAB, *:=, \g{\ast}:=} = (REF #L# INT a, #L# INT b)REF #L# INT :a := a * b;
h) OP \br{TIMESAB, *:=, \g{\ast}:=} = (REF #L# REAL a, #L# REAL b) REF #L# REAL : a := a * b;
i) OP \br{TIMESAB, *:=, \g{\ast}:=} = (REF #L# COMPL a, #L# COMPL b) REF #L# COMPL : a := a * b;
j) OP \br{OVERAB, %:= , %:=} =(REF #L# INT a, #L# INT b)REF #L# INT :a := a % b;
k) OP \br{MODAB, +*:=, \g{\ast}:=, %*:=} = (REF #L# INT a, #L# INT b)REF #L# INT : a := a %* b;
l) OP \br{DIVAB, /:=} =(REF #L# REAL a, #L# REAL b)REF #L# REAL :a := a/b;
m) OP \br{DIVAB, /:=} =(REF #L# COMPL a, #L# COMPL b)REF #L# COMPL : a := a /b;
n) OP #Q# = (REF #L# REAL a, #L# INT b)REF #L# REAL : a #Q# #L# REAL (b);
o) OP #Q# = (REF #L# COMPL a, #L# INT b)REF #L# COMPL : a #Q# #L# COMPL (b);
p) OP #Q# = (REF #L# COMPL a, #L# REAL b) REF #L# COMPL : a #Q# #L# COMPL (b);
q) OP \br{PLUSAB, +:=} = (REF STRING a, STRING b) REF STRING: a := a + b;
r) OP \br{PLUSTO , +=:} = (STRING a, REF STRING b) REF STRING: b := a + b;
s) OP \br{PLUSAB, +:=} =(REF STRING a, CHAR b) REF STRING: a +:= STRING(b);
t) OP \br{PLUSTO , +=:} = (CHAR a, REF STRING b) REF STRING: STRING (a) +=: b;
u) OP \br{TIMESAB, *:=} =(REF STRING a, INT b)REF STRING: a := a * b;
10.2.3.12. Standard mathematical constants and functions
a)
10.2.4. Synchronization operations
The elaboration of a parallel-clause P {3.3.1.c
} in
an environ E is termed a "parallel action". The elaboration of a
constituent unit of P in E is termed a "process" of
that parallel action.
Any elaboration A {in some environ} of either of
the ENCLOSED-clauses delineated by the pragmats {9.2.1.b
} PR
start of incompatible part PR and
PR finish of incompatible part
PR in the forms 10.2.4.d
and 10.2.4.e
is incompatible with {2.1.4.2.e
} any elaboration B
of either of those
ENCLOSED-clauses if A and B are
descendent actions {2.1.4.2.b
} of different processes
of some same parallel action.
a) MODE SEMA = STRUCT(REF INT F);
b) OP LEVEL =(INT a)SEMA: (SEMA s; F OF s :=
HEAP INT := a; s);
c) OP LEVEL =(SEMA a)INT: F OF a;
#L# REAL #l# pi = © a {\calf L} {\-REAL} value close to \matsw\pi\matsw ; see Math. of Comp. V. 16, 1962, pp. 80-99 ©;
b) PROC #l# sqrt=(#L# REAL x)#L# REAL : © if {\- x > {\calf L} 0} , a {\calf L} {\-REAL} value close to the square root of 'x' ©;
c) PROC #l# exp = (#L# REAL x) #L# REAL : © a {\calf L} {\-REAL} value, if one exists, close to the exponential function of 'x' ©;
d) PROC #l# ln = (#L# REAL x) #L# REAL : © a {\calf L} {\-REAL} value, if one exists, close to the natural logarithm of x ©;
e) PROC #l# cos = (#L# REAL x) #L# REAL : © a {\calf L} {\-REAL} value close to the cosine of 'x' ©;
f) PROC #l# arccos=(#L# REAL x)#L# REAL : © if {-ABS x <= {\calf L} 1}, a {\calf L} {\-REAL} value close to the inverse cosine of 'x', {\-{\calf L} 0 <= {\teneul\char'140} arccos (x) <= {\teneul\char'140} pi} ©;
g) PROC #l# sin = (#L# REAL x) #L# REAL : © a {\calf L} {\-REAL} value close to the sine of x ©;
h) PROC #l# arcsin=(#L# REAL x)#L# REAL : © if {\-ABS x <= {\calf L} 1}, a {\calf L} {\-REAL} value close to the inverse sine of 'x', {\-ABS {\teneul\char'140} arcsin(x) <= {\teneul\char'140} pi /{\calf L} 2} ©;
i) PROC #l# tan = (#L# REAL x) #L# REAL : © a {\calf L} {\-REAL} value, if one exists, close to the tangent of 'x' ©;
j) PROC #l# arctan=(#L# REAL x)#L# REAL : © a {\calf L} {\-REAL} value close to the inverse tangent of 'x', {\-ABS {\teneul\char'140} arctan(x) <= {\teneul\char'140} pi/{\calf L} 2} ©;
k) PROC #l# next random = (REF #L# INT a) #L# REAL : ( a := © the next pseudo-random {\calf L} integral value after 'a' from a uniformly distributed sequence on the interval [{\calf L} 0,{\teneul\char'140} maxint] ©;
© the real value corresponding to 'a' according to some mapping of integral values [{\calf L} 0, {\teneul\char'140} max int] into real values [{\calf L} 0, {\calf L} 1) \c{i.e., such that {\-0 <= x < 1}} such that the sequence of real values so produced preserves the properties of pseudo-randomness and uniform distribution of the sequence of integral values ©);
OP DOWN = (SEMA edsger) VOID:
BEGIN REF INT dijkstra = F OF edsger;
WHILE
PR start of incompatible part PR
IF dijkstra >= 1 THEN dijkstra -:= 1; FALSE
ELSE
© let
e)
OP UP = (SEMA edsger) VOID:
PR start of incompatible part PR
IF REF INT dijkstra = Fff OF edsger; (dijkstra +:= 1) >= 1
THEN
© all processes are resumed {2.1.4.3.g} which are halted because the i nteger referred to by the name yielded by 'dijkstra' was smaller than one ©
FI
PR finish of incompatible part PR;
Next