home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 February / Chip_2000-02_cd.bin / zkuste / Delphi / navody / tt / objvm.exe / UNITS / ValStack.pas < prev    next >
Pascal/Delphi Source File  |  1998-03-13  |  1KB  |  59 lines

  1. unit ValStack;
  2.  
  3. interface
  4. uses LangValue,
  5.      LangValueList,LangValMessages;
  6. type TValStack=class(IValStack)
  7.      protected
  8.        function rdFrameValues(No:integer):ILangValue;override;
  9.      public
  10.        Items:TLangValueList;
  11.        function Pop:ILangValue;override;
  12.        procedure Push(a:ILangValue);override;
  13.        procedure DropFrame;override;
  14.        function  FrameCount:integer;override;
  15.        constructor Create;
  16.        destructor  Destroy;override;
  17.     end;
  18. implementation
  19. function  TValStack.rdFrameValues;
  20.           begin
  21.             if No>FrameCount-1 then
  22.             begin
  23.  
  24.             end;
  25.             Result:=Items[Items.Count-FrameCount-1+No];
  26.           end;
  27. function  TValStack.Pop;
  28.           begin
  29.             Result:=Items[Items.Count-1];
  30.             Items.Remove(Items.Count-1);
  31.           end;
  32. procedure TValStack.Push;
  33.           begin
  34.             Items.Add(a);
  35.           end;
  36. procedure TValStack.DropFrame;
  37.           Var i:Integer;
  38.           begin
  39.             for i:=0 to FrameCount do
  40.             begin
  41.               Pop.Free;
  42.             end;
  43.           end;
  44. function  TValStack.FrameCount;
  45.           begin
  46.             Result:=Items[Items.Count-1].AsInteger;
  47.           end;
  48. constructor TValStack.Create;
  49.           begin
  50.             Items:=TLangValueList.Create;
  51.           end;
  52. destructor  TValStack.Destroy;
  53.           begin
  54.             Items.Free;
  55.             Inherited Destroy;
  56.           end;
  57.  
  58. end.
  59.