tmacprocvar.pp 732 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. program tmacprocvar;
  2. {$MODE MACPAS}
  3. {Tests of different ways of handling functions in MW, THINK Pascal and FPC}
  4. type
  5. SInt8 = -128..127;
  6. Ptr = ^SInt8;
  7. ProcPtr = Ptr; {This is the definition of ProcPtr in Apples Univ Interfaces}
  8. procedure A;
  9. begin
  10. Writeln('Hello');
  11. end;
  12. procedure B (procedure X);
  13. begin
  14. X;
  15. end;
  16. {$IFC UNDEFINED THINK_Pascal }
  17. { ** Not supported in THINK Pascal ** }
  18. type
  19. M = procedure;
  20. var
  21. n: M;
  22. procedure C (Y: M);
  23. begin
  24. Y;
  25. end;
  26. {$ENDC}
  27. procedure D (Z: ProcPtr);
  28. begin
  29. Writeln(Ord(Z));
  30. end;
  31. begin
  32. B(A);
  33. D(@A);
  34. {$IFC UNDEFINED THINK_Pascal }
  35. { ** Not supported in THINK Pascal ** }
  36. B(@A);
  37. n := nil;
  38. n := A;
  39. if nil <> n then
  40. C(n);
  41. C(A);
  42. C(@A);
  43. {$ENDC}
  44. end.