tderef.pp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. {****************************************************************}
  2. { CODE GENERATOR TEST PROGRAM }
  3. {****************************************************************}
  4. { NODE TESTED : secondderef() }
  5. {****************************************************************}
  6. { PRE-REQUISITES: secondload() }
  7. { secondassign() }
  8. { secondcalln() }
  9. { secondadd() }
  10. { secondtypeconv() }
  11. {****************************************************************}
  12. { DEFINES: }
  13. {****************************************************************}
  14. { REMARKS: }
  15. {****************************************************************}
  16. program tderef;
  17. type
  18. plongint = ^longint;
  19. ttestarray = array[1..64] of byte;
  20. ptestarray = ^ttestarray;
  21. pbyte = ^byte;
  22. procedure fail;
  23. begin
  24. Writeln('Failed!');
  25. halt(1);
  26. end;
  27. var
  28. pl : plongint;
  29. parray : ptestarray;
  30. passed : boolean;
  31. ptr : pbyte;
  32. b: byte;
  33. Begin
  34. Write('secondderef() test...');
  35. passed := true;
  36. new(pl);
  37. new(parray);
  38. { left : LOC_REFERENCE }
  39. pl^:= $F0F0;
  40. if pl^ <> $F0F0 then
  41. passed := false;
  42. FillChar(parray^,sizeof(ttestarray),0);
  43. ptr:=pbyte((ptrint(parray)+32));
  44. ptr^ := $A0;
  45. if parray^[33] <> $A0 then
  46. passed := false;
  47. { left : LOC_REGISTER }
  48. b:=(pbyte((ptrint(parray)+32))^);
  49. if b <> $A0 then
  50. passed := false;
  51. dispose(pl);
  52. dispose(parray);
  53. if passed then
  54. WriteLn('Success.')
  55. else
  56. Fail;
  57. end.