1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
/pc { pstack clear } def
{ 3 2 add } exec pc
/exectest { 10 2 add } def
/exectest load exec pc
3 9 /add load exec pc
(string) exec pc
true { (executed if block) } if pc
false { (executed if block) } if pc
/trueaction { (executed if block) } def
/falseaction { (executed else block) } def
true { trueaction } { falseaction } ifelse pc
false { trueaction } { falseaction } ifelse pc
/counter 0 def
3 { counter counter 1 add /counter exch def } repeat pc
/counter 0 def
{ counter counter 1 add /counter exch def
counter 5 eq { exit } if } loop pc
/underflow { 100 index } def
{ undefflow } stopped { [(jump here as expected) _newerror _errorname] } { (jump here unexpectedly) } ifelse pc
/break { stop } def
{ break } stopped { [(jump here as expected) _newerror _errorname] } { (jump here unexpectedly) } ifelse pc
{ 3 2 { //add } exec } exec pc
-1 -1 -5 { == } for
1 2 10 { == } for
(exit in for:) =
/counter 0 def
0 2 10 { counter 1 add /counter exch def
6 eq { exit } if
} for
counter 4 eq {
(=> passed) =
} {
(=> failed) =
} ifelse
(exit in forall string:) =
(abc) { dup ?b eq { exit } { pop } ifelse } forall
?b eq {
(=> passed) =
} if
(exit in forall array:) =
[?a ?b ?c] { dup ?b eq { exit } { pop } ifelse } forall
?b eq {
(=> passed) =
} if
(exit in forall dict:) =
<< ?a /a ?b /b ?c /c >> { pop dup ?b eq { exit } { pop } ifelse } forall
?b eq {
(=> passed) =
} if
(---------------- countexecstack ----------------) ==
true { countexecstack == } if
(---------------- execstack ----------------) ==
countexecstack array execstack ==
(---------------- exception handling ----------------) ==
{
{ exit } loop
(OK: this code just after loop should be executed) ==
} stopped {
(FAIL: 'exit' should not be caught here.) ==
} {
(OK: 'exit' should not be caught here.) ==
} ifelse
{
{ stop } loop
(SOMETHING WRONG: this code just after loop should not be executed) ==
} stopped {
(OK: 'stop' should be caught here.) ==
} {
(FAIL: 'stop' should not be caught by loop.) ==
} ifelse
|