浏览代码

* DosCalls dependency removed to avoid type redefinitions

Tomas Hajny 23 年之前
父节点
当前提交
1cad10952b
共有 2 个文件被更改,包括 81 次插入5 次删除
  1. 7 3
      fcl/os2/classes.pp
  2. 74 2
      fcl/os2/thread.inc

+ 7 - 3
fcl/os2/classes.pp

@@ -1,7 +1,7 @@
 {
     $Id$
     This file is part of the Free Component Library (FCL)
-    Copyright (c) 1999-2000 by Michael Van Canneyt and Florian Klaempfl
+    Copyright (c) 1999-2002 by the Free Pascal development team
 
     Classes unit for OS/2
 
@@ -24,12 +24,12 @@ unit Classes;
 interface
 
 uses
-  DosCalls, (* Needed here (i.e. before SysUtils) to avoid type clashes. *)
   strings,
   sysutils;
 
 {$i classesh.inc}
 
+
 implementation
 
 uses
@@ -38,6 +38,7 @@ uses
 { OS - independent class implementations are in /inc directory. }
 {$i classes.inc}
 
+
 initialization
   CommonInit;
 
@@ -47,7 +48,10 @@ finalization
 end.
 {
   $Log$
-  Revision 1.4  2000-12-19 00:43:07  hajny
+  Revision 1.5  2002-02-10 13:38:14  hajny
+    * DosCalls dependency removed to avoid type redefinitions
+
+  Revision 1.4  2000/12/19 00:43:07  hajny
     + FCL made compilable under OS/2
 
   Revision 1.3  2000/08/25 17:32:16  hajny

+ 74 - 2
fcl/os2/thread.inc

@@ -1,7 +1,7 @@
 {
     $Id$
     This file is part of the Free Component Library (FCL)
-    Copyright (c) 1999-2000 by the Free Pascal development team
+    Copyright (c) 1999-2002 by the Free Pascal development team
 
     See the file COPYING.FPC, included in this distribution,
     for details about the copyright.
@@ -15,11 +15,80 @@
 {*                             TThread                                      *}
 {****************************************************************************}
 
+(* OS/2 specific declarations - see unit DosCalls for descriptions *)
+
+type
+ TByteArray = array [0..$fff0] of byte;
+ PByteArray = ^TByteArray;
+
+ TThreadEntry = function (Param: pointer): longint; cdecl;
+
+ TSysThreadIB = record
+                 TID, Priority, Version: longint;
+                 MCCount, MCForceFlag: word;
+                end;
+ PSysThreadIB = ^TSysThreadIB;
+
+ TThreadInfoBlock = record
+                     Exh_Chain, Stack, StackLimit: pointer;
+                     TIB2: PSysThreadIB;
+                     Version, Ordinal: longint;
+                    end;
+ PThreadInfoBlock = ^TThreadInfoBlock;
+ PPThreadInfoBlock = ^PThreadInfoBlock;
+
+ TProcessInfoBlock = record
+                      PID, ParentPID, HMTE: longint;
+                      Cmd, Env: PByteArray;
+                      flStatus, tType: longint;
+                     end;
+ PProcessInfoBlock = ^TProcessInfoBlock;
+ PPProcessInfoBlock = ^PProcessInfoBlock;
+
+
+const
+ deThread = 0;
+ deProcess = 1;
+
+ dtSuspended = 1;
+ dtStack_Commited = 2;
+
+ dtWait = 0;
+ dtNoWait = 1;
+
+
+procedure DosGetInfoBlocks (PATIB: PPThreadInfoBlock; 
+              PAPIB: PPProcessInfoBlock); cdecl; external 'DOSCALLS' index 312;
+
+function DosSetPriority (Scope, TrClass, Delta, PortID: longint): longint;
+                                          cdecl; external 'DOSCALLS' index 236;
+
+procedure DosExit (Action, Result: longint); cdecl;
+                                                 external 'DOSCALLS' index 233;
+
+function DosCreateThread (var TID: longint; Address: TThreadEntry;
+         aParam: pointer; Flags: longint; StackSize: longint): longint; cdecl;
+                                                 external 'DOSCALLS' index 311;
+
+function DosKillThread (TID: longint): longint; cdecl;
+                                                 external 'DOSCALLS' index 111;
+
+function DosResumeThread (TID: longint): longint; cdecl;
+                                                 external 'DOSCALLS' index 237;
+
+function DosSuspendThread (TID: longint): longint; cdecl;
+                                                 external 'DOSCALLS' index 238;
+
+function DosWaitThread (var TID: longint; Option: longint): longint; cdecl;
+                                                 external 'DOSCALLS' index 349;
+
+
 const
  Priorities: array [TThreadPriority] of word = ($100, $200, $207, $20F, $217,
   $21F, $300);
  ThreadCount: longint = 0;
 
+(* Implementation of exported functions *)
 
 procedure AddThread (T: TThread);
 begin
@@ -162,7 +231,10 @@ end;
 
 {
   $Log$
-  Revision 1.4  2001-10-09 02:21:00  carl
+  Revision 1.5  2002-02-10 13:38:14  hajny
+    * DosCalls dependency removed to avoid type redefinitions
+
+  Revision 1.4  2001/10/09 02:21:00  carl
   * bugfix #1639 (IsMultiThread varialbe setting)
 
   Revision 1.3  2000/12/19 00:43:07  hajny