test.pas 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. program TestProgram;
  2. uses Test2;
  3. const A = 1234;
  4. B = $1234;
  5. ConstBool1 = true;
  6. ConstBool2 = boolean(5);
  7. ConstChar = 'A';
  8. ConstSet = ['A'..'Z'];
  9. ConstSet2 = [15..254];
  10. ConstFloat = 3.1415;
  11. type
  12. PObj = ^TObj;
  13. TObj = object
  14. constructor Init;
  15. function Func: boolean;
  16. procedure Proc; virtual;
  17. destructor Done; virtual;
  18. private
  19. Z: integer;
  20. end;
  21. TObj2 = object(TObj)
  22. procedure Proc; virtual;
  23. end;
  24. TClass = class
  25. constructor Create;
  26. end;
  27. TClass2 = class(TClass)
  28. end;
  29. EnumTyp = (enum1,enum2,enum3);
  30. ArrayTyp = array[1..10] of EnumTyp;
  31. ProcTyp = function(A: word; var B: longint; const C: EnumTyp): real;
  32. SetTyp = set of EnumTyp;
  33. const
  34. ConstOrd = enum1;
  35. var Hello : word;
  36. X: PRecord;
  37. Bool: boolean;
  38. T : TRecord;
  39. Str20 : string[20];
  40. Str255: string;
  41. ArrayW: array[2..45] of word;
  42. ArrayVar: ArrayTyp;
  43. EnumVar: (enumElem1,enumElem2,enumElem3);
  44. EnumVar2: EnumTyp;
  45. FileVar: file;
  46. FileVarR: file of TRecord;
  47. FileVarW: file of word;
  48. ProcVar: procedure;
  49. ProcVarD: function(X: real): boolean;
  50. ProcVarI: ProcTyp;
  51. SetVarD: set of char;
  52. SetVarI: SetTyp;
  53. Float1: real;
  54. Float2: double;
  55. Float3: comp;
  56. Float4: extended;
  57. Pointer1: pointer;
  58. Pointer2: PObj;
  59. ClassVar1: TClass;
  60. ClassVar2: TClass2;
  61. Obj1: TObj;
  62. Obj2: TObj2;
  63. constructor TObj.Init;
  64. begin
  65. Z:=1;
  66. end;
  67. function TObj.Func: boolean;
  68. begin
  69. Func:=true;
  70. end;
  71. procedure TObj.Proc;
  72. begin
  73. if Func=false then Halt;
  74. end;
  75. destructor TObj.Done;
  76. begin
  77. end;
  78. procedure TObj2.Proc;
  79. begin
  80. Z:=4;
  81. end;
  82. constructor TClass.Create;
  83. begin
  84. end;
  85. function Func1(x,z : word; var y : boolean; const r: TRecord): shortint;
  86. procedure test_local(c,f : longint);
  87. var
  88. int_loc : longint;
  89. begin
  90. Writeln('dummy for browser');
  91. end;
  92. begin
  93. if Hello=0 then X:=0 else X:=1;
  94. test_local(0,2);
  95. Func1:=X;
  96. end;
  97. var i : longint;
  98. BEGIN
  99. X:=nil;
  100. writeln('Hello world!');
  101. Writeln('ParamCount = ',ParamCount);
  102. For i:=0 to paramcount do
  103. writeln('Paramstr(',i,') = ',Paramstr(i));
  104. writeln(IsOdd(3));
  105. writeln(Func1(5,5,Bool,T));
  106. Halt;
  107. END.