tmacnonlocalgoto.pp 642 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. program tmacnonlocalgoto;
  2. {$MODE MACPAS}
  3. label
  4. 1;
  5. var
  6. failed: Boolean;
  7. procedure Global(l: longint);
  8. label 2;
  9. procedure Local(v: longint);
  10. begin
  11. if (v = 1) then
  12. Global(v+1)
  13. else if (v = 3) then
  14. goto 2
  15. else
  16. goto 1;
  17. failed := true;
  18. end;
  19. begin
  20. Local(l+1);
  21. 2:
  22. if (l <> 2) then
  23. failed := true;
  24. Local(5);
  25. failed := true;
  26. end;
  27. begin
  28. failed := false;
  29. Global(0);
  30. 1:
  31. if failed then
  32. writeln('Failed')
  33. else
  34. writeln('Succeded');
  35. {$IFC NOT UNDEFINED FPC}
  36. if failed then
  37. Halt(1);
  38. {$ENDC}
  39. end.