home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / catch / xception.pas < prev   
Pascal/Delphi Source File  |  1987-11-13  |  891b  |  41 lines

  1. unit Xception; { Exception handling via CATCH and THROW }
  2.  
  3. {$D+}
  4.  
  5. interface
  6.  
  7. type
  8.   Target = record
  9.            Private: array[1..10] of byte; { "Abstract data type" }
  10.            Point:   pointer;              { The THROWing point }
  11.            end;
  12.   ExceptionMode =
  13.     (ExceptionSet, ExceptionUsed);
  14.  
  15. function Catch(var Exception: Target): ExceptionMode;
  16.  
  17. procedure Throw(var Exception: Target);
  18.  
  19. function CanonicThrowingPoint(var Exception: Target): pointer;
  20.  
  21. implementation
  22.  
  23. {$L Xception.obj }
  24.  
  25. function Catch(var Exception: Target): ExceptionMode; external;
  26.  
  27. procedure Throw(var Exception: Target); external;
  28.  
  29. function CanonicThrowingPoint(var Exception: Target): pointer;
  30. type
  31.   DWord = record
  32.           Lo, Hi: word;
  33.           end;
  34. begin
  35.   Dec(DWord(Exception.Point).Hi, PrefixSeg + $10);
  36.   CanonicThrowingPoint := Exception.Point;
  37. end;
  38.  
  39. end.
  40.  
  41.