taddr1.pp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. {****************************************************************}
  2. { CODE GENERATOR TEST PROGRAM }
  3. {****************************************************************}
  4. { NODE TESTED : secondaddr() }
  5. {****************************************************************}
  6. { PRE-REQUISITES: secondload() }
  7. { secondassign() }
  8. { secondcalln() }
  9. {****************************************************************}
  10. { DEFINES: }
  11. {****************************************************************}
  12. { REMARKS: }
  13. {****************************************************************}
  14. program taddr;
  15. {$ifdef fpc}
  16. {$mode fpc}
  17. {$endif}
  18. procedure testprocvar;
  19. begin
  20. WriteLn('Hello world!');
  21. end;
  22. type
  23. tmyobj = object
  24. procedure writeit;
  25. end;
  26. procedure tmyobj.writeit;
  27. begin
  28. WriteLn('Salutations!');
  29. end;
  30. const
  31. chararray : array[0..7] of char =
  32. ('A',
  33. 'B',
  34. 'C',
  35. 'D',
  36. 'E',
  37. 'F',
  38. 'G',
  39. #0
  40. );
  41. var
  42. procptr: procedure;
  43. pcharptr : pchar;
  44. plongint : ^longint;
  45. long: longint;
  46. ptr: pointer;
  47. begin
  48. { Test procedure variable }
  49. procptr:=@testprocvar;
  50. Write('Value should be ''Hello world!''...');
  51. procptr;
  52. { Test normal variable }
  53. pcharptr := @chararray;
  54. Inc(pcharptr,2);
  55. Write('Value should be ''CDEFG''...');
  56. WriteLn(pcharptr);
  57. long := $F0F0;
  58. plongint := @long;
  59. Write('Value should be 61680...');
  60. WriteLn(plongint^);
  61. { Test method pointers }
  62. { PROCVARLOAD = TRUE testing }
  63. { Write('Value should be ''Salutations!''...');}
  64. ptr:[email protected];
  65. { ptr;}
  66. end.