home *** CD-ROM | disk | FTP | other *** search
/ PC Format Collection 48 / SENT14D.ISO / tech / delphi / disk15 / vcl.pak / VIRTINTF.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1995-08-24  |  1.8 KB  |  79 lines

  1.  
  2. {*******************************************************}
  3. {                                                       }
  4. {       Delphi Visual Component Library                 }
  5. {                                                       }
  6. {       Copyright (c) 1995 Borland International        }
  7. {                                                       }
  8. {*******************************************************}
  9.  
  10. unit VirtIntf;
  11.  
  12. interface
  13.  
  14. const
  15.   FaultHandlerSignature = '__VCLFAULTHANDLER';
  16.  
  17. type
  18.   TInterface = class
  19.   public
  20.     procedure Free;
  21.     procedure Release; virtual; export;
  22.     function GetVersion: Integer; virtual; export;
  23.   end;
  24.  
  25.   { TIStream - This provides a pure virtual interface to a physical stream }
  26.  
  27.   TIStream = class(TInterface)
  28.   public
  29.     function Read(var Buffer; Count: Longint): Longint; virtual; export; abstract;
  30.     function Write(const Buffer; Count: Longint): Longint; virtual; export; abstract;
  31.     function Seek(Offset: Longint; Origin: Word): Longint; virtual; export; abstract;
  32.     function GetModifyTime: Longint; virtual; export; abstract;
  33.   end;
  34.  
  35. function ReleaseException: string;
  36.  
  37. implementation
  38.  
  39. uses SysUtils;
  40.  
  41. { TInterface }
  42.  
  43. procedure TInterface.Free;
  44. begin
  45.   if Self <> nil then Release;
  46. end;
  47.  
  48. procedure TInterface.Release;
  49. begin
  50.   Destroy;
  51. end;
  52.  
  53. function TInterface.GetVersion: Integer;
  54. begin
  55.   Result := 0;
  56. end;
  57.  
  58. { Exception handling }
  59.  
  60. function ReleaseException: string;
  61. type
  62.   TRaiseFrame = record
  63.     NextRaise: Word;
  64.     ExceptAddr: Pointer;
  65.     ExceptObject: TObject;
  66.     NextExcept: Word;
  67.   end;
  68. begin
  69.   with TRaiseFrame(Ptr(SSeg, RaiseList)^) do
  70.   begin
  71.     Result := Exception(ExceptObject).Message;
  72.     ExceptObject.Destroy;
  73.     RaiseList := NextRaise;
  74.     ExceptList := NextExcept;
  75.   end;
  76. end;
  77.  
  78. end.
  79.