neitzel@infbs.UUCP (Martin Neitzel) (06/24/89)
The following is a three-way-diff comparing all three editions at once.
The "diff3" command numbers the input files '1', '2', and '3'. These
numbers are referring to PIM2, PIM3, and PIM4 respectively.
====3
1:99,100c
2:99,100c
denotes the character with the given (octal) ordinal number (and is of
type CHAR, see 6.1).
3:99,100c
denotes the character with the given (octal) ordinal number and is of
type CHAR (see 6.1), i.e. is a character constant.
====1
1:132,133c
A single-character string is of type CHAR, a string consisting of n > 1
characters is of type (see 6.4)
2:132c
3:132c
A string consisting of n characters is of type (see 6.4)
====3
1:135c
2:134c
ARRAY [0..n-1] OF CHAR
3:134c
ARRAY [0..n] OF CHAR
====1
1:144c
identifiers. The symbols # and <> are synonyms, and so are & and AND.
2:143,144c
3:143,144c
identifiers. The symbols # and <> are synonyms, and so are &, AND,
and ~, NOT.
====1
1:204c
are separated by a period.
2:204c
3:204c
are separated by a period. Standard identifiers appear below.
====1
1:208c
The following are standard identifiers:
2:208,222c
3:208,222c
ABS (10.2) INCL (10.2)
BITSET (6.6) INTEGER (6.1)
BOOLEAN (6.1) LONGINT (6.1)
CAP (10.2) LONGREAL (6.1)
CARDINAL (6.1) MAX (10.2)
CHAR (6.1) MIN (10.2)
CHR (10.2) NIL (6.7)
DEC (10.2) ODD (10.2)
EXCL (10.2) ORD (10.2)
FALSE (6.1) PROC (6.8)
FLOAT (10.2) REAL (6.1)
HALT (10.2) SIZE (10.2)
HIGH (10.2) TRUE (6.1)
INC (10.2) TRUNC (10.2)
VAL (10.2)
====1
1:210,225c
ABS (10.2) HIGH (10.2)
BITSET (6.6) INC (10.2)
BOOLEAN (6.1) INCL (10.2)
CAP (10.2) INTEGER (6.1)
CARDINAL (6.1) NEW (10.2)
CHAR (6.1) NIL (6.7)
CHR (10.2) ODD (10.2)
DEC (10.2) ORD (10.2)
DISPOSE (10.2) PROC (6.8)
EXCL (10.2) REAL (6.1)
FALSE (6.1) TRUE (6.1)
FLOAT (10.2) TRUNC (10.2)
HALT (10.2) VAL (10.2)
2:223a
3:223a
====1
1:232,241c
$ ConstExpression = SimpleConstExpr [relation SimpleConstExpr].
$ relation = "=" | "#" | "<>" | "<" | "<=" | ">" | ">=" | IN.
$ SimpleConstExpr = ["+"|"-"] ConstTerm {AddOperator ConstTerm}.
$ AddOperator = "+" | "-" | OR.
$ ConstTerm = ConstFactor {MulOperator ConstFactor}.
$ MulOperator = "*" | "/" | DIV | MOD | AND | "&".
$ ConstFactor = qualident | number | string | set |
$ "(" ConstExpression ")" | NOT ConstFactor.
$ set = [qualident] "{" [element {"," element}] "}".
$ element = ConstExpression [".." ConstExpression].
2:230c
3:230c
$ ConstExpression = expression.
====1
1:243,245c
The meaning of operators is explained in Chapter 8. The identifier
preceding the left brace of a set specifies the type of the set. If
it is omitted, the standard type BITSET is assumed (see 6.6).
2:232,234c
3:232,234c
A constant expression is an expression which can be evaluated by a
mere textual scan without actually executing the program. Its
operands are constants. (see Ch.8).
====1
1:251a
2:241c
3:241c
bound = MAX (INTEGER) - N
====1
1:284,285c
1. A variable of type INTEGER assumes as values the integers between
MinInt and MaxInt.
2:274,275c
3:274,275c
1. INTEGER comprises the integers between MIN(INTEGER) and
MAX(INTEGER).
====1
1:287,288c
2. A variable of type CARDINAL assumes as values the integers between
0 and MaxCard.
2:277c
3:277c
2. CARDINAL comprises the integers between 0 and MAX(CARDINAL).
====1
1:290,291c
3. A variable of type BOOLEAN assumes the truth values TRUE or FALSE.
These are the only values of this type.
2:279c
3:279c
3. BOOLEAN comprises the truth values TRUE or FALSE.
====1
1:293,294c
4. A variable of type CHAR assumes as elements values the character
set provided by the used computer system.
2:281c
3:281c
4. CHAR denotes the character set provided by the used computer system.
====1
1:296c
5. A variable of type REAL assumes as values real numbers.
2:283c
3:283c
5. REAL (and LONGREAL) denote finite sets of real numbers.
====1
1:298,299c
For implementations on 16-bit computers, MinInt = -32678, MaxInt =
32767, and MaxCard = 65535.
2:285,286c
3:285,286c
6. LONGINT comprises the integers between MIN(LONGINT) and
MAX(LONGINT).
====1
1:327c
$ SubrangeType = "[" ConstExpression ".." ConstExpression "]".
2:314c
3:314c
$ SubrangeType = [ident] "[" ConstExpression ".." ConstExpression "]".
====1
1:335,336c
If the lower bound is a non-negative integer, the base type of the
subrange is taken to be CARDINAL;
2:322,324c
3:322,324c
The base type can be specified by an identifier preceding the bounds.
If it is omitted, and if the lower bound is a non-negative integer,
the base type of the subrange is taken to be CARDINAL;
====1
1:401c
$ CASE [ident ":"] qualident OF variant { "|" variant }
2:389c
3:389c
$ CASE [ident] ":" qualident OF variant { "|" variant }
====1
1:403c
$ variant = CaseLabelList ":" FieldListSequence.
2:391c
3:391c
$ variant = [CaseLabelList ":" FieldListSequence].
====1
1:458,459c
to T. A pointer value is generated by a call to the standard
procedure NEW (see 10.2).
2:446,447c
3:446,447c
to T. A pointer value is generated by a call to an allocation
procedure in a storage management module.
====1
1:511c
t: TreePtr
2:498a
3:498a
====3
1:564,567c
2:551,554c
four classes of operators. The operator NOT has the highest
precedence, followed by the so-called multiplying operators, then the
so-called adding operators, and finally, with lowest precedence, the
relational operators. Sequences of operators of the same precedence
3:551,554c
four classes of operators. The operator NOT has the highest prcits
execution, i.e. for the "returned" value. The (types of these) actual
parameters must correspond to the formal parameters as specified in
the procedure's declaration (see operators of the same precedence
====1
1:570a
2:558c
3:558c
$ relation = "=" | "#" | "<" | "<=" | ">" | ">=" | IN.
====1
1:571a
2:560c
3:560c
$ AddOperator = "+" | "-" | OR.
====1
1:572a
2:562c
3:562c
$ MulOperator = "*" | "/" | DIV | MOD | AND.
====1
1:574a
2:565,566c
3:565,566c
$ set = [qualident] "{" [element {"," element}] "}".
$ element = expression [".." expression].
====1
1:609,611c
x MOD y is equal to the remainder of the division x DIV y (for
y>0)
x = (x DIV y) * y + (x MOD y)
2:601,602c
3:601,602c
x MOD y is equal to the remainder of the division x DIV y
x = (x DIV y) * y + (x MOD y), 0 <= (x MOD y) < y
====3
1:717,718c
2:708,709c
A string of length n1 can be assigned to a string variable of length
n2 > n1.
3:708,709c
A string of length n1 can be assigned to a array variable with n2 > n1
elements of type CHAR.
====1
1:719a
2:711c
3:711c
A string of length 1 is compatible with the type CHAR.
====2
1:751,752c
2:743,744c
types of corresponding actual and formal parameters must be identical
in the case of variable parameters, or assignment compatible in the
3:743,744c
types of corresponding actual and formal parameters must be compatible
in the case of variable parameters and assignment compatible in the
====1
1:809c
$ case = CaseLabelList ":" StatementSequence.
2:801c
3:801c
$ case = [CaseLabelList ":" StatementSequence].
====1
1:881c
assignment compatible with v; C must be a constant of type INTEGER or
2:873c
3:873c
compatible with v; C must be a constant of type INTEGER or
====1
1:1029,1030c
In the case of variable parameters it must be compatible with its
corresponding actual parameter (see 9.2),
2:1021,1022c
3:1021,1022c
In the case of variable parameters it must be identical with its
corresponding actual parameter (see 9.2, and 12. for exceptions);
====3
1:1105c
2:1097c
FLOAT(x) x of type CARDINAL represented as a value of
3:1097c
FLOAT(x) x of type INTEGER represented as a value of
====1
1:1109a
2:1102,1105c
3:1102,1105c
MAX(T) the maximum value of type T.
MIN(T) the minimum value of type T.
====
1:1116a
2:1113,1116c
SIZE(T) the number of storage units required by a
variable of type T, or the number of storage
units required by the variable T.
3:1113,1115c
SIZE(T) the number of storage units required by a
variable of type T.
====3
1:1118c
2:1118c
(of type CARDINAL).
3:1117c
(of type INTEGER).
====1
1:1137,1139c
NEW and DISPOSE are translated into calls to ALLOCATE and DEALLOCATE,
procedures that are either explicitly programmed or imported from
another module.
2:1136a
3:1135a
====1
1:1141,1150c
NEW(p) = ALLOCATE(p,TSIZE(T))
DISPOSE(p) = DEALLOCATE(p,TSIZE(T))
NEW(p,t1,t2,...) = ALLOCATE(p,TSIZE(T,t1,t2,...))
DISPOSE(p,t1,t2,...) = DEALLOCATE(p,TSIZE(T,t1,t2,...))
TSIZE is defined in Chapter 12, and p is declared as "VAR p: POINTER
TO T". These procedures must be compatible with the type
PROCEDURE(VAR ADDRESS, CARDINAL)
2:1137a
3:1136a
====3
1:1166a
2:1153a
3:1153c
The module identifier is repeated at the end of the declaration.
====3
1:1174c
2:1161c
The module identifier is repeated at the end of the declaration.
3:1160a
====1
1:1202,1203c
If a module identifier is exported, then all identifiers occurring in
that module's export list are also exported.
2:1188a
3:1187a
====1
1:1205,1208c
Standard identifiers are always imported automatically. As a
consequence, standard identifiers can be declared in procedures only,
but not in modules, including the compilation unit (see Ch. 14).
2:1189a
3:1188a
====3
1:1273c
2:1254c
VAR i: CARDINAL;
3:1253c
VAR i: INTEGER;
====3
1:1280c
2:1261c
VAR i,j: CARDINAL; found: BOOLEAN;
3:1260c
VAR i,j: INTEGER; found: BOOLEAN;
====3
1:1292c
2:1273c
PROCEDURE ReturnTrack (k: CARDINAL);
3:1272c
PROCEDURE ReturnTrack (k: INTEGER);
====1
1:1321,1323c
The module SYSTEM exports the types WORD, ADDRESS, PROCESS, and the
procedures ADR, SIZE, TSIZE, NEWPROCESS, TRANSFER, and possibly other
identifiers depending on the implementation being used (see Ch. 13).
2:1302,1305c
3:1301,1304c
The facilities exported from the module SYSTEM are specified by
individual implementations. Normally, the types WORD and ADDRESS, and
the procedures ADR, TSIZE, NEWPROCESS, TRANSFER, are among them (see
also Ch. 13).
====1
1:1330c
This includes the types CARDINAL, INTEGER, BITSET, and all pointers.
2:1311a
3:1310a
====1
1:1342a
2:1324,1326c
3:1323,1325c
If a formal parameter is of type ADDRESS, the corresponding actual
parameter may be of any pointer type, even if the formal parameter is
a VAR parameter.
====1
1:1353c
BEGIN a := lastused; INC (lastused,n)
2:1337c
3:1336c
BEGIN a := lastused; lastused := lastused+n
====1
1:1360,1363c
is of type ADDRESS. SIZE(x) denotes the number of storage units
assigned to the variable x. TSIZE(T) is the number od storage units
assigned to any variable of type T. SIZE and TSIZE are of type
CARDINAL.
2:1344,1346c
3:1343,1345c
is of type ADDRESS. TSIZE(T) is the number od storage units assigned
to any variable of type T. TSIZE is of an arithmetic type depending
on the implementation.
====3
1:1365,1368c
2:1348,1351c
Examples:
ADR(lastused) TSIZE(Node)
3:1346a
====1
1:1376c
The second facility is used in variable declarations.
2:1359,1360c
3:1354,1355c
The second, non-standard facility may be provided in variable
declarations.
====2
1:1385c
2:1368a
3:1364c
For examples, refer to 13.2.
====1
1:1404c
A: ADDRESS; n: CARDINAL; VAR p1:PROCESS)
2:1387c
3:1383c
A: ADDRESS; n: CARDINAL; VAR p1:ADDRESS)
====1
1:1417c
PROCEDURE TRANSFER (VAR p1, p2:PROCESS)
2:1400c
3:1396c
PROCEDURE TRANSFER (VAR p1, p2:ADDRESS)
====
1:1422,1423c
procedures, as well as the type PROCESS, must be imported from the
module SYSTEM.
2:1405c
procedures must be imported.
3:1401c
procedures must be imported from the module SYSTEM.
====1
1:1443c
PROCEDURE IOTRANSFER (VAR p1, p2: PROCESS; va: CARDINAL)
2:1425c
3:1421c
PROCEDURE IOTRANSFER (VAR p1, p2: ADDRESS; va: CARDINAL)
====2
1:1450,1451c
2:1432,1433c
device. The procedure IOTRANSFER must be imported, and should be
considered as PDP-11 implementation-specific.
3:1428,1429c
device. The procedure IOTRANSFER must be imported from the module
SYSTEM, and should be considered as PDP-11 implementation-specific.
====1
1:1467,1469c
The following example (programmed for the PDP-11) shows a module with
a process that acts as a driver for a typewriter. The module contains
a buffer B for N characters.
2:1448a
3:1444a
====1
1:1471,1510c
MODULE Typewriter [4]; (* typewriter interrupt priority = 4 *)
FROM SYSTEM IMPORT
PROCESS, NEWPROCESS, TRANSFER, IOTRANSFER, LISTEN,
WORD, ADR, SIZE;
EXPORT typeout;
CONST N = 32;
VAR n: INTEGER; (* no. of chars in buffer *)
in, out: [1..N];
B: ARRAY [1..N] OF CHAR;
PRO: PROCESS; (* producer *)
CON: PROCESS; (* consumer = typewriter driver *)
wsp: ARRAY [1..50] OF WORD;
TWS [177564B]: BITSET; (* status register *)
TWB [177566B]: CHAR; (* buffer register *)
PROCEDURE typeout (ch: CHAR);
BEGIN INC(n);
WHILE n>N DO LISTEN END;
B[in] := ch; in := in MOD N + 1;
IF n=0 THEN TRANSFER(PRO,CON) END
END typeout;
PROCEDURE driver;
BEGIN
LOOP DEC(n);
IF n<0 THEN TRANSFER(CON,PRO) END;
TWB := B[out]; out := out MOD n + 1;
TWS := {6}; IOTRANSFER(CON,PRO,64B); TWS := {}
END
END driver;
BEGIN n:=0; in:=1; out:=1;
NEWPROCESS(driver, ADR(wsp), SIZE(wsp), CON);
TRANSFER (PRO,CON)
END Typewriter
LISTEN must be a procedure that lowers the processor's priority level
so that pending interrupts may be accepted.
2:1449a
3:1445a
====1
1:1527c
contains the export list, constant, type, and variable declarations,
2:1466c
3:1462c
contains constant, type, and variable declarations,
====1
1:1535,1536c
$ DefinitionModule = DEFINITION MODULE ident ";" {import}
$ [export] {definition} END ident ".".
2:1474,1475c
3:1470,1471c
$ DefinitionModule = DEFINITION MODULE ident ";"
$ {import} {definition} END ident ".".
====1
1:1546,1547c
definition/implementation module pair on one side and its clients on
the other side.
2:1485,1489c
3:1481,1485c
implementation module on one side and its clients on the other side.
The definition module contains those declarations which are relevant
to the client modules, and presumably no other ones. Hence, the
definition module acts as the implementation module's (extended)
export list, and all its declared objects are exported.
====1
1:1549c
Definition modules require the use of qualified export. Type
2:1491c
3:1487c
Definition modules imply the use of qualified export. Type
====
1:1559c
pointers and to subranges of standard types.
2:1501,1508c
pointers.
Assignment and test for equality are applicable to all opaque types.
As in local modules, the body of an implementation module acts as an
initialization facility for its local objects. Before its execution,
the imported modules are initialized in the order in which they are
listed. If circular references occur among modules, their order of
initialization is not defined.
3:1497,1504c
pointers and to subranges of standard types.
Assignment and test for equality are applicable to all opaque types.
As in local modules, the body of an implementation module acts as an
initialization facility for its local objects. Before its execution,
the imported modules are initialized in the order in which they are
listed. If circular references occur among modules, their order of
initialization is not defined.