Paste number 156711: PIO diff

Paste number 156711: PIO diff
Pasted by: p
When:1 year, 6 months ago
Share:Tweet this! | http://paste.lisp.org/+3CX3
Channel:None
Paste contents:
Raw Source | XML | Display As
--- PIO-old.txt	2015-10-12 20:52:11.732235066 +0200
+++ PIO-new.txt	2015-10-12 20:51:54.968258793 +0200
@@ -1,8 +1,8 @@
-                    Programming in Oberon
+                              Programming
                                        A Tutorial
 
                         A derivative of Programming in Modula-2 (1982)
-                                Niklaus Wirth (rev. 22.2.2014)
+                                Niklaus Wirth (rev. 5.10.2015)
 
 
 
@@ -1056,7 +1056,7 @@
 their intended meaning. However, this meaning is not inherent in the character code, but only
 defined by its interpretation. At this point it suffices to remember that these characters are (usually)
 not printable.
-                                       Table of ASCII characters
+
                 0        10      20       30      40       50      60       70
            0    nul      dle              0       @        P       `        p
            1    soh      dc1     !        1       A        Q       a        q
@@ -1074,6 +1074,7 @@
            D    cr       gs      -        =       M        ]       m        }
            E    so       rs      .        >       N        ^       n        ~
            F    si       us      /        ?       O        _       o        del
+                                       Table of ASCII characters
 Constants of type CHAR are denoted by the character being enclosed in quote marks. They are
 single-element strings. They can be assigned to variables of type CHAR. These values cannot be
 used in arithmetic operations. Arithmetic operators can be applied, however, to their ordinal
@@ -1089,7 +1090,6 @@
 ORD("0") = 30H = 48. They are typically used in routines converting sequences of digits into
 
 
-
                                                                                                        19
 N.Wirth, Programming in Oberon, 2014
 
@@ -1137,8 +1137,7 @@
 
 8. Constant and Variable Declarations
 It has been mentioned previously that all identifiers used in a program must be declared in the
-program's heading, unless they are standard identifiers known in every program (or are imported
-from some other module).
+program's heading, unless they are standard identifiers known in every program.
 If an identifier is to denote a constant value, it must be introduced by a constant declaration which
 indicates the value for which the constant identifier stands. A constant declaration has the form
       ConstantDeclaration = identifier "=" ConstExpression.
@@ -1148,6 +1147,7 @@
 declarations is preceded by the symbol CONST. Example:
 
 
+
                                                                                                             20
 N.Wirth, Programming in Oberon, 2014
 
@@ -1731,7 +1731,7 @@
 several arrays to which the procedure should be applicable. Redefining it for each such array would
 be cumbersome, inelegant, and can be avoided by introducing its operand as a parameter as
 follows.
-      PROCEDURE Add(VAR x: Vector);
+      PROCEDURE Add (x: Vector);
         VAR i: INTEGER;
       BEGIN sum := 0;
         FOR i := 0 TO N-1 DO sum := x[i] + sum END
@@ -1858,15 +1858,14 @@
       END power;
 Possible calls are
       u := power(2.5, 3)
-      A[i] := power(B[i], 2)
-      u := x + power(y, i+1) / power(z, i-1)
+      A[i] := power(B[i], 2) + 10
 The result is specified by an expression at the end of the procedure body, preceded by the symbol
 RETURN. Calls within an expression are called function designators. Their syntax is the same as
 that of procedure calls. However, a parameter list is mandatory, although it may be empty.
 
 We now revisit the previous example of adding the elements of an array and formulate it as a
 function procedure.
-      PROCEDURE sum(VAR a: Vector; n: INTEGER): REAL;
+      PROCEDURE sum (a: Vector; n: INTEGER): REAL;
        VAR i: INTEGER; s: REAL;
       BEGIN s := 0.0;
        FOR i := 0 TO n-1 DO s := a[i] + s END ;
@@ -1875,7 +1874,7 @@
 This procedure, as previously specified, sums the elements a[0] ... a[n-1], where n is given as a
 value parameter, and may be different from (but not larger than!) the number of elements N. A more
 elegant solution specifies a as an open array, omitting the explicit indication of the array's size.
-      PROCEDURE sum(VAR x: ARRAY OF REAL): REAL;
+      PROCEDURE sum (x: ARRAY OF REAL): REAL;
        VAR i: INTEGER; s: REAL;
       BEGIN s := 0.0;
        FOR i := 0 TO LEN(x)-1 DO s := x[i] + s END ;
@@ -1897,6 +1896,7 @@
 designator itself. The consequence is that e.g. the values
 
 
+
                                                                                                       32
 N.Wirth, Programming in Oberon, 2014
 
@@ -2255,7 +2255,7 @@
 and that of a designator is
       designator = qualident {selector} .
       selector = "." identifier | "[" ExpList "]" | "^".
-Note: Oberon’s concept of record type extension is not discussed in this book.
+Note: For Oberon’s concept of record type extension see Ch. 23 (Part 4).
 
 17. Dynamic Data Structures and Pointers
 Array and record structures share the common property that they are static. This implies that
@@ -3239,6 +3239,7 @@
       BEGIN Texts.OpenScanner(S, Oberon.Par.text, Oberon.Par.pos); Texts.Scan(S);
 
 
+
                                                                                                         54
 N.Wirth, Programming in Oberon, 2014
 
@@ -3443,16 +3444,15 @@
          IF p IS Line THEN DrawLine(p)
          ELSIF p IS Circle THEN DrawCircle(p)
          …………
-
+         END ;
+         p := p.next
+      END
 
 
                                                                                                           58
 N.Wirth, Programming in Oberon, 2014
 
 
-         END ;
-         p := p.next
-      END
 We will discover in the next section that there is actually a better, shorter way of expressing this
 action.
 The type test is a necessary feature, because Oberon has deviated from the dogma of strictly static
@@ -3504,12 +3504,15 @@
       WHILE p # NIL DO p.draw(p); p := p.next END
 and in each call automatically the appropriate drawing procedure is activated.
 
+23.4. Handlers and Messages
+
+
+
 
                                                                                                      59
 N.Wirth, Programming in Oberon, 2014
 
 
-23.4. Handlers and Messages
 In Part 3 of this text, the importance of proper decomposition (modularization) of systems was
 emphasized. A module restricts the visibility of declarations and incorporates the concept of
 information hiding. In object-oriented languages a type definition, i.e. a class declaration, assumes
@@ -3565,6 +3568,8 @@
       END Broadcast
 
 
+
+
                                                                                                        60
 N.Wirth, Programming in Oberon, 2014
 

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.