Browse Source

+ import catch, throw and stack management win16 api functions

git-svn-id: trunk@31540 -
nickysn 10 years ago
parent
commit
10a01c0127
2 changed files with 22 additions and 0 deletions
  1. 16 0
      rtl/win16/winprocs.pp
  2. 6 0
      rtl/win16/wintypes.pp

+ 16 - 0
rtl/win16/winprocs.pp

@@ -1,5 +1,9 @@
 unit winprocs;
 unit winprocs;
 
 
+{$if defined(FPC_MM_COMPACT) or defined(FPC_MM_LARGE) or defined(FPC_MM_HUGE)}
+  {$define VAR_PARAMS_ARE_FAR}
+{$endif}
+
 interface
 interface
 
 
 uses
 uses
@@ -50,6 +54,18 @@ procedure OutputDebugString(OutputString: LPCSTR); external 'KERNEL';
 
 
 function SetErrorMode(Mode: UINT): UINT; external 'KERNEL';
 function SetErrorMode(Mode: UINT): UINT; external 'KERNEL';
 
 
+{ Catch/Throw and stack management }
+
+function Catch(CatchBuf: LPCATCHBUF): SmallInt; external 'KERNEL';
+procedure Throw(CatchBuf: LPCATCHBUF; ThrowBack: SmallInt); external 'KERNEL';
+{$ifdef VAR_PARAMS_ARE_FAR}
+function Catch(var CatchBuf: TCatchBuf): SmallInt; external 'KERNEL';
+procedure Throw(var CatchBuf: TCatchBuf; ThrowBack: SmallInt); external 'KERNEL';
+{$endif}
+
+procedure SwitchStackBack; external 'KERNEL';
+procedure SwitchStackTo(StackSegment, StackPointer, StackTop: UINT); external 'KERNEL';
+
 implementation
 implementation
 
 
 function LOBYTE(w: Word): Byte;
 function LOBYTE(w: Word): Byte;

+ 6 - 0
rtl/win16/wintypes.pp

@@ -87,6 +87,12 @@ const
   SEM_NOGPFAULTERRORBOX  = $0002;
   SEM_NOGPFAULTERRORBOX  = $0002;
   SEM_NOOPENFILEERRORBOX = $8000;
   SEM_NOOPENFILEERRORBOX = $8000;
 
 
+type
+  LPCATCHBUF = ^CATCHBUF; far;
+  CATCHBUF = array [0..8] of SmallInt;
+  PCatchBuf = ^TCatchBuf;
+  TCatchBuf = CATCHBUF;
+
 implementation
 implementation
 
 
 end.
 end.