test.pas 2.4 KB

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