|
|
1.1 ! root 1: # PDCO(2) ! 2: # ! 3: # Programmer-defined control operations ! 4: # ! 5: # Ralph E. Griswold and Michael Novak ! 6: # ! 7: # Last modified 8/11/84 ! 8: # ! 9: ! 10: procedure Alt(a) ! 11: local x ! 12: while x := @a[1] do suspend x ! 13: while x := @a[2] do suspend x ! 14: end ! 15: ! 16: procedure Colseq(a) ! 17: suspend |@!a ! 18: end ! 19: ! 20: procedure Comseq(a) ! 21: local x1, x2 ! 22: while x1 := @a[1] do ! 23: (x1 === @a[2]) | fail ! 24: if @a[2] then fail else return *a[1] ! 25: end ! 26: ! 27: procedure Cond(a) ! 28: local i, x ! 29: every i := 1 to *a do ! 30: if x := @a[i] then { ! 31: suspend x ! 32: suspend |@a[i] ! 33: fail ! 34: } ! 35: end ! 36: ! 37: procedure Every(a) ! 38: while @a[1] do @^a[2] ! 39: end ! 40: ! 41: procedure Galt(a) ! 42: local e ! 43: every e := !a do suspend |@e ! 44: end ! 45: ! 46: procedure Lcond(a) ! 47: local i ! 48: every i := 1 to *a by 2 do ! 49: if @a[i] then { ! 50: suspend |@a[i + 1] ! 51: fail ! 52: } ! 53: end ! 54: ! 55: procedure Limit(a) ! 56: local i, x ! 57: while i := @a[2] do { ! 58: a[1] := ^a[1] ! 59: every 1 to i do ! 60: if x := @a[1] then suspend x ! 61: else break ! 62: } ! 63: end ! 64: ! 65: procedure Ranseq(a) ! 66: local x ! 67: while x := @?a do suspend x ! 68: end ! 69: ! 70: procedure Repalt(a) ! 71: local x ! 72: repeat { ! 73: while x := @a[1] do suspend x ! 74: if *a[1] = 0 then fail ! 75: else a[1] := ^a[1] ! 76: } ! 77: end ! 78: ! 79: procedure Resume(a) ! 80: local i ! 81: while i := @a[2] do { ! 82: a[1] := ^a[1] ! 83: every 1 to i do if @a[1] then @^a[3] else break ! 84: } ! 85: end ! 86: ! 87: procedure Select(a) ! 88: local i, j, x ! 89: j := 0 ! 90: while i := @a[2] do { ! 91: while j < i do ! 92: if x := @a[1] then j +:= 1 ! 93: else fail ! 94: if i = j then suspend x ! 95: else stop("selection sequence error") ! 96: } ! 97: end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.