| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- Listing:
- 1 IMPLEMENTATION MODULE perms;
- 2
- 3 PROCEDURE NextPerm(n:CARDINAL; VAR s:ARRAY OF BYTE;
- ***** ^ undeclared identifier
- 4 VAR wrap:BOOLEAN);
- 5 VAR
- 6 i:CARDINAL; (* s[i-1] is the most significant byte changed *)
- 7 j:CARDINAL; (* s[j] is the byte to be swapped with s[i-1] *)
- 8 tmp:BYTE;
- ***** ^ undeclared identifier
- 9
- 10
- 11
- 12 BEGIN
- 13 IF n = 0 THEN
- 14 wrap := TRUE;
- 15 RETURN;
- 16 END;
- 17 i := n - 1;
- 18
- 19
- 20
- 21 LOOP
- 22 IF i = 0 THEN
- 23 wrap := TRUE;
- 24 EXIT;
- 25 END;
- 26
- 27
- 28
- 29 IF s[i-1] < s[i] THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 30 j := n - 1;
- 31 WHILE s[j] <= s[i-1] DO
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 32 j := j - 1;
- 33 END;
- 34 tmp := s[j]; s[j] := s[i-1]; s[i-1] := tmp; (* swap *)
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 35 wrap := FALSE;
- 36 EXIT;
- 37 END;
- 38 i := i - 1;
- 39 END;
- 40
- 41
- 42
- 43
- 44 (* s[i]..s[n-1] are in reverse order, reversing them
- 45 yields the minimum permutation we require *)
- 46 j := n - 1;
- 47 WHILE i < j DO
- 48 tmp := s[j]; s[j] := s[i]; s[i] := tmp;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 49 i := i + 1;
- 50 j := j - 1;
- 51 END;
- 52 END NextPerm;
- ***** ^ not supported yet
- 53
- 54 END perms.
- ***** ^ not supported yet
- 55
- 32 errors
|