Last change
on this file since daf4c89 was
466fa01,
checked in by Peter A. Buhr <pabuhr@…>, 5 years ago
|
add diagrams and example programs
|
-
Property mode set to
100644
|
File size:
1.0 KB
|
Line | |
---|
1 | BEGIN |
---|
2 | CLASS FmtLines; |
---|
3 | HIDDEN ch, main; ! private members; |
---|
4 | BEGIN |
---|
5 | CHARACTER ch; ! communication; |
---|
6 | |
---|
7 | PROCEDURE main; ! mimic uC++ coroutine main; |
---|
8 | BEGIN |
---|
9 | INTEGER g, b; |
---|
10 | |
---|
11 | WHILE TRUE DO BEGIN ! for as many characters; |
---|
12 | FOR g := 1 STEP 1 UNTIL 5 DO BEGIN ! groups of 5; |
---|
13 | FOR b := 1 STEP 1 UNTIL 4 DO BEGIN ! blocks of 4; |
---|
14 | OutChar( ch ); |
---|
15 | Detach; ! suspend(); |
---|
16 | END; |
---|
17 | OutText( " " ); |
---|
18 | END; |
---|
19 | OutImage; ! start newline; |
---|
20 | END; |
---|
21 | END; |
---|
22 | |
---|
23 | PROCEDURE prt( chp ); |
---|
24 | CHARACTER chp; |
---|
25 | BEGIN |
---|
26 | ch := chp; ! communication; |
---|
27 | Call( THIS FmtLines ); ! resume(); |
---|
28 | END; |
---|
29 | ! FmtLines constructor code; |
---|
30 | Detach; ! return to declaration; |
---|
31 | main; ! call main as last line of constructor; |
---|
32 | END FmtLines; |
---|
33 | ! program main equivalent; |
---|
34 | REF(FmtLines) fmt; ! objects are references; |
---|
35 | INTEGER i; |
---|
36 | |
---|
37 | fmt :- NEW FmtLines; |
---|
38 | FOR i := Rank( ' ' ) STEP 1 UNTIL Rank( 'z' ) DO BEGIN |
---|
39 | fmt.prt( Char( i ) ); |
---|
40 | END |
---|
41 | END; |
---|
42 | |
---|
43 | ! Local Variables: ; |
---|
44 | ! tab-width: 4 ; |
---|
45 | ! compile-command: "cim Format.sim" ; |
---|
46 | ! End: ; |
---|
Note: See
TracBrowser
for help on using the repository browser.