Browse Source

CHanges at the request of Thomas hajt

michael 26 years ago
parent
commit
aa90381b86
7 changed files with 298 additions and 2360 deletions
  1. 61 53
      rtl/os2/bsedev.pas
  2. 10 6
      rtl/os2/crt.pas
  3. 201 202
      rtl/os2/kbdcalls.pas
  4. 2 4
      rtl/os2/moucalls.pas
  5. 0 2082
      rtl/os2/objects.pas
  6. 23 10
      rtl/os2/tests/testkbd.pas
  7. 1 3
      rtl/os2/viocalls.pas

+ 61 - 53
rtl/os2/bsedev.pas

@@ -7,8 +7,12 @@ unit bsedev;
 
 
   interface
   interface
   
   
-    uses
-       os2def;
+type
+(* The following line is only due to problems with cardinal *)
+(* arithmetics and should be removed as soon as possible.   *)
+ cardinal = longint;
+ PCardinal = ^cardinal;
+ PByte = ^byte;
 
 
     const
     const
        IOCTL_ASYNC = $0001;
        IOCTL_ASYNC = $0001;
@@ -23,6 +27,8 @@ unit bsedev;
        IOCTL_GENERAL = $000B;
        IOCTL_GENERAL = $000B;
        ASYNC_SETBAUDRATE = $0041;
        ASYNC_SETBAUDRATE = $0041;
        ASYNC_SETLINECTRL = $0042;
        ASYNC_SETLINECTRL = $0042;
+       ASYNC_EXTSETBAUDRATE = $0043;
+       ASYNC_SETEXTBAUDRATE = $0043;
        ASYNC_TRANSMITIMM = $0044;
        ASYNC_TRANSMITIMM = $0044;
        ASYNC_SETBREAKOFF = $0045;
        ASYNC_SETBREAKOFF = $0045;
        ASYNC_SETMODEMCTRL = $0046;
        ASYNC_SETMODEMCTRL = $0046;
@@ -32,6 +38,8 @@ unit bsedev;
        ASYNC_SETDCBINFO = $0053;
        ASYNC_SETDCBINFO = $0053;
        ASYNC_GETBAUDRATE = $0061;
        ASYNC_GETBAUDRATE = $0061;
        ASYNC_GETLINECTRL = $0062;
        ASYNC_GETLINECTRL = $0062;
+       ASYNC_EXTGETBAUDRATE = $0063;
+       ASYNC_GETEXTBAUDRATE = $0063;
        ASYNC_GETCOMMSTATUS = $0064;
        ASYNC_GETCOMMSTATUS = $0064;
        ASYNC_GETLINESTATUS = $0065;
        ASYNC_GETLINESTATUS = $0065;
        ASYNC_GETMODEMOUTPUT = $0066;
        ASYNC_GETMODEMOUTPUT = $0066;
@@ -213,8 +221,8 @@ unit bsedev;
 
 
     type
     type
        DCBINFO = record
        DCBINFO = record
-          usWriteTimeout : USHORT;
-          usReadTimeout : USHORT;
+          usWriteTimeout : word;
+          usReadTimeout : word;
           fbCtlHndShake : BYTE;
           fbCtlHndShake : BYTE;
           fbFlowReplace : BYTE;
           fbFlowReplace : BYTE;
           fbTimeout : BYTE;
           fbTimeout : BYTE;
@@ -242,29 +250,29 @@ unit bsedev;
 
 
     type
     type
        BIOSPARAMETERBLOCK = record
        BIOSPARAMETERBLOCK = record
-          usBytesPerSector : USHORT;
+          usBytesPerSector : word;
           bSectorsPerCluster : BYTE;
           bSectorsPerCluster : BYTE;
-          usReservedSectors : USHORT;
+          usReservedSectors : word;
           cFATs : BYTE;
           cFATs : BYTE;
-          cRootEntries : USHORT;
-          cSectors : USHORT;
+          cRootEntries : word;
+          cSectors : word;
           bMedia : BYTE;
           bMedia : BYTE;
-          usSectorsPerFAT : USHORT;
-          usSectorsPerTrack : USHORT;
-          cHeads : USHORT;
-          cHiddenSectors : ULONG;
-          cLargeSectors : ULONG;
+          usSectorsPerFAT : word;
+          usSectorsPerTrack : word;
+          cHeads : word;
+          cHiddenSectors : cardinal;
+          cLargeSectors : cardinal;
           abReserved : array[0..6-1] of BYTE;
           abReserved : array[0..6-1] of BYTE;
-          cCylinders : USHORT;
+          cCylinders : word;
           bDeviceType : BYTE;
           bDeviceType : BYTE;
-          fsDeviceAttr : USHORT;
+          fsDeviceAttr : word;
        end;
        end;
 
 
        PBIOSPARAMETERBLOCK = ^BIOSPARAMETERBLOCK;
        PBIOSPARAMETERBLOCK = ^BIOSPARAMETERBLOCK;
 
 
        SCREENGROUP = record
        SCREENGROUP = record
-          idScreenGrp : USHORT;
-          fTerminate : USHORT;
+          idScreenGrp : word;
+          fTerminate : word;
        end;
        end;
 
 
        PSCREENGROUP = ^SCREENGROUP;
        PSCREENGROUP = ^SCREENGROUP;
@@ -277,9 +285,9 @@ unit bsedev;
        PFRAME = ^FRAME;
        PFRAME = ^FRAME;
 
 
        KBDTYPE = record
        KBDTYPE = record
-          usType : USHORT;
-          reserved1 : USHORT;
-          reserved2 : USHORT;
+          usType : word;
+          reserved1 : word;
+          reserved2 : word;
        end;
        end;
 
 
        PKBDTYPE = ^KBDTYPE;
        PKBDTYPE = ^KBDTYPE;
@@ -310,21 +318,21 @@ unit bsedev;
 {$PACKRECORDS 1}
 {$PACKRECORDS 1}
 
 
        RXQUEUE = record
        RXQUEUE = record
-          cch : USHORT;
-          cb : USHORT;
+          cch : word;
+          cb : word;
        end;
        end;
 
 
        PRXQUEUE = ^RXQUEUE;
        PRXQUEUE = ^RXQUEUE;
 
 
        DEVICEPARAMETERBLOCK = record
        DEVICEPARAMETERBLOCK = record
-          reserved1 : USHORT;
-          cCylinders : USHORT;
-          cHeads : USHORT;
-          cSectorsPerTrack : USHORT;
-          reserved2 : USHORT;
-          reserved3 : USHORT;
-          reserved4 : USHORT;
-          reserved5 : USHORT;
+          reserved1 : word;
+          cCylinders : word;
+          cHeads : word;
+          cSectorsPerTrack : word;
+          reserved2 : word;
+          reserved3 : word;
+          reserved4 : word;
+          reserved5 : word;
        end;
        end;
 
 
        PDEVICEPARAMETERBLOCK = ^DEVICEPARAMETERBLOCK;
        PDEVICEPARAMETERBLOCK = ^DEVICEPARAMETERBLOCK;
@@ -332,23 +340,23 @@ unit bsedev;
 {$PACKRECORDS 2}
 {$PACKRECORDS 2}
 
 
        PTRDRAWFUNCTION = record
        PTRDRAWFUNCTION = record
-          usReturnCode : USHORT;
+          usReturnCode : word;
           pfnDraw : pointer;
           pfnDraw : pointer;
           {!!!!!!!! pfnDraw : PFN; }
           {!!!!!!!! pfnDraw : PFN; }
-          pchDataSeg : PCH;
+          pchDataSeg : pointer;
        end;
        end;
 
 
        PPTRDRAWFUNCTION = ^PTRDRAWFUNCTION;
        PPTRDRAWFUNCTION = ^PTRDRAWFUNCTION;
 
 
        PTRDRAWADDRESS = record
        PTRDRAWADDRESS = record
-          reserved : USHORT;
+          reserved : word;
           ptrdfnc : PTRDRAWFUNCTION;
           ptrdfnc : PTRDRAWFUNCTION;
        end;
        end;
 
 
        PPTRDRAWADDRESS = ^PTRDRAWADDRESS;
        PPTRDRAWADDRESS = ^PTRDRAWADDRESS;
 
 
        SHIFTSTATE = record
        SHIFTSTATE = record
-          fsState : USHORT;
+          fsState : word;
           fNLS : BYTE;
           fNLS : BYTE;
        end;
        end;
 
 
@@ -374,56 +382,56 @@ unit bsedev;
 
 
     type
     type
        HOTKEY = record
        HOTKEY = record
-          fsHotKey : USHORT;
-          uchScancodeMake : UCHAR;
-          uchScancodeBreak : UCHAR;
-          idHotKey : USHORT;
+          fsHotKey : word;
+          uchScancodeMake : byte;
+          uchScancodeBreak : byte;
+          idHotKey : word;
        end;
        end;
 
 
        PHOTKEY = ^HOTKEY;
        PHOTKEY = ^HOTKEY;
 
 
        MONITORPOSITION = record
        MONITORPOSITION = record
-          fPosition : USHORT;
-          index : USHORT;
-          pbInBuf : ULONG;
-          offOutBuf : USHORT;
+          fPosition : word;
+          index : word;
+          pbInBuf : cardinal;
+          offOutBuf : word;
        end;
        end;
 
 
        PMONITORPOSITION = ^MONITORPOSITION;
        PMONITORPOSITION = ^MONITORPOSITION;
 
 
        RATEDELAY = record
        RATEDELAY = record
-          usDelay : USHORT;
-          usRate : USHORT;
+          usDelay : word;
+          usRate : word;
        end;
        end;
 
 
        PRATEDELAY = ^RATEDELAY;
        PRATEDELAY = ^RATEDELAY;
 
 
        CODEPAGEINFO = record
        CODEPAGEINFO = record
           pbTransTable : PBYTE;
           pbTransTable : PBYTE;
-          idCodePage : USHORT;
-          idTable : USHORT;
+          idCodePage : word;
+          idTable : word;
        end;
        end;
 
 
        PCODEPAGEINFO = ^CODEPAGEINFO;
        PCODEPAGEINFO = ^CODEPAGEINFO;
 
 
        CPID = record
        CPID = record
-          idCodePage : USHORT;
-          Reserved : USHORT;
+          idCodePage : word;
+          Reserved : word;
        end;
        end;
 
 
        PCPID = ^CPID;
        PCPID = ^CPID;
 
 
        LDTADDRINFO = record
        LDTADDRINFO = record
-          pulPhysAddr : PULONG;
-          cb : USHORT;
+          pulPhysAddr : PCardinal;
+          cb : word;
        end;
        end;
 
 
        PLDTADDRINFO = ^LDTADDRINFO;
        PLDTADDRINFO = ^LDTADDRINFO;
 
 
        PTRDRAWDATA = record
        PTRDRAWDATA = record
-          cb : USHORT;
-          usConfig : USHORT;
-          usFlag : USHORT;
+          cb : word;
+          usConfig : word;
+          usFlag : word;
        end;
        end;
 
 
 {$PACKRECORDS NORMAL}
 {$PACKRECORDS NORMAL}

+ 10 - 6
rtl/os2/crt.pas

@@ -11,6 +11,8 @@
 
 
 unit crt;
 unit crt;
 
 
+{$ASMMODE ATT}
+
 interface
 interface
 
 
 uses dos;
 uses dos;
@@ -185,9 +187,9 @@ begin
                 movw 8(%ebp),%bx
                 movw 8(%ebp),%bx
                 shrw $4,%bx
                 shrw $4,%bx
                 cmpb $2,%bl
                 cmpb $2,%bl
-                jne crtsetmode_a1
+                jne .L_crtsetmode_a1
                 decw %ax
                 decw %ax
-            crtsetmode_a1:
+            .L_crtsetmode_a1:
                 mov $0x30,%bl
                 mov $0x30,%bl
                 int $0x10
                 int $0x10
             end;
             end;
@@ -203,9 +205,9 @@ begin
                 and $15,%bl
                 and $15,%bl
                 mov $1,%ax
                 mov $1,%ax
                 cmp $1,%bl
                 cmp $1,%bl
-                jne crtsetmode_b1
+                jne .L_crtsetmode_b1
                 mov $3,%al
                 mov $3,%al
-            crtsetmode_b1:
+            .L_crtsetmode_b1:
                 int $0x10
                 int $0x10
             {Use alternate print-screen function.}
             {Use alternate print-screen function.}
                 mov $0x12,%ah
                 mov $0x12,%ah
@@ -608,7 +610,8 @@ begin
                             asm
                             asm
                                 movw $0x1300,%ax
                                 movw $0x1300,%ax
                                 movb $0,%bh
                                 movb $0,%bh
-                                movb U_CRT_TEXTATTR,%bl
+                                movb TEXTATTR,%bl
+{                                movb U_CRT_TEXTATTR,%bl }
                                 movb y,%dh
                                 movb y,%dh
                                 movb x,%dl
                                 movb x,%dl
                                 movw n,%cx
                                 movw n,%cx
@@ -843,7 +846,8 @@ begin
             asm
             asm
                 mov $0x0f,%ah
                 mov $0x0f,%ah
                 int $0x10
                 int $0x10
-                mov %al,_MODE
+{                mov %al,_MODE }
+                mov %al,MODE
             end;
             end;
             case mode of
             case mode of
                 0,1:
                 0,1:

+ 201 - 202
rtl/os2/kbdcalls.pas

@@ -67,8 +67,6 @@ Coding style:
 interface
 interface
 {***************************************************************************}
 {***************************************************************************}
 
 
-uses    strings;
-
 {$ifdef FPK}
 {$ifdef FPK}
     {$packrecords 1}
     {$packrecords 1}
 {$endif FPK}
 {$endif FPK}
@@ -76,57 +74,58 @@ uses    strings;
 const
 const
 {return codes / error constants (those marked with * shouldn't occur under
 {return codes / error constants (those marked with * shouldn't occur under
 normal conditions)}
 normal conditions)}
-    NO_ERROR                        =  0;
-    ERROR_SEM_TIMEOUT               =121;
-    ERROR_KBD_PARAMETER             =373;
-    ERROR_KBD_NO_DEVICE             =374; {*}
-    ERROR_KBD_INVALID_IOWAIT        =375; {*}
-    ERROR_KBD_INVALID_LENGTH        =376;
-    ERROR_KBD_INVALID_ECHO_MASK     =377;
-    ERROR_KBD_INVALID_INPUT_MASK    =378;
-    ERROR_KBD_SMG_ONLY              =407; {*}
-    ERROR_KBD_INVALID_ASCIIZ        =408;
-    ERROR_KBD_INVALID_MASK          =409;
-    ERROR_KBD_REGISTER              =410;
-    ERROR_KBD_DEREGISTER            =411;
-    ERROR_KBD_INVALID_HANDLE        =439;
-    ERROR_KBD_NO_MORE_HANDLE        =440;
-    ERROR_KBD_CANNOT_CREATE_KCB     =441;
-    ERROR_KBD_CODEPAGE_LOAD_INCOMPL =442; {*}
-    ERROR_KBD_INVALID_CODEPAGE_ID   =443; {*}
-    ERROR_KBD_NO_CODEPAGE_SUPPORT   =444; {*}
-    ERROR_KBD_FOCUS_REQUIRED        =445;
-    ERROR_KBD_FOCUS_ALREADY_ACTIVE  =446; {*}
-    ERROR_KBD_KEYBOARD_BUSY         =447;
-    ERROR_KBD_INVALID_CODEPAGE      =448;
-    ERROR_KBD_UNABLE_TO_FOCUS       =449; {*}
-    ERROR_KBD_DETACHED              =464;
-    ERROR_KBD_NO_CONSOLE            =500; {*}
-    ERROR_KBD_EXTENDED_SG           =504;
+    No_Error                        =  0;
+    Error_Invalid_Parameter         = 87;
+    Error_Sem_TimeOut               =121;
+    Error_Kbd_Parameter             =373;
+    Error_Kbd_No_Device             =374; {*}
+    Error_Kbd_Invalid_IOWait        =375; {*}
+    Error_Kbd_Invalid_Length        =376;
+    Error_Kbd_Invalid_Echo_Mask     =377;
+    Error_Kbd_Invalid_Input_Mask    =378;
+    Error_Kbd_Smg_Only              =407; {*}
+    Error_Kbd_Invalid_ASCIIZ        =408;
+    Error_Kbd_Invalid_Mask          =409;
+    Error_Kbd_Register              =410;
+    Error_Kbd_Deregister            =411;
+    Error_Kbd_Invalid_Handle        =439;
+    Error_Kbd_No_more_Handle        =440;
+    Error_Kbd_Cannot_Create_KCB     =441;
+    Error_Kbd_Codepage_Load_Incompl =442; {*}
+    Error_Kbd_Invalid_CodePage_ID   =443; {*}
+    Error_Kbd_No_CodePage_Support   =444; {*}
+    Error_Kbd_Focus_Required        =445;
+    Error_Kbd_Focus_Already_Active  =446; {*}
+    Error_Kbd_Keyboard_Busy         =447;
+    Error_Kbd_Invalid_CodePage      =448;
+    Error_Kbd_Unable_To_Focus       =449; {*}
+    Error_Kbd_Detached              =464;
+    Error_Kbd_No_Console            =500; {*}
+    Error_Kbd_Extended_SG           =504;
 
 
 {FnMask}
 {FnMask}
-    KR_KBDCHARIN        =$00000001;
-    KR_KBDPEEK          =$00000002;
-    KR_KBDFLUSHBUFFER   =$00000004;
-    KR_KBDGETSTATUS     =$00000008;
-    KR_KBDSETSTATUS     =$00000010;
-    KR_KBDSTRINGIN      =$00000020;
-    KR_KBDOPEN          =$00000040;
-    KR_KBDCLOSE         =$00000080;
-    KR_KBDGETFOCUS      =$00000100;
-    KR_KBDFREEFOCUS     =$00000200;
-    KR_KBDGETCP         =$00000400;
-    KR_KBDSETCP         =$00000800;
-    KR_KBDXLATE         =$00001000;
-    KR_KBDSETCUSTXT     =$00002000;
+    kr_KbdCharIn        =$00000001;
+    kr_KbdPeek          =$00000002;
+    kr_KbdFlushBuffer   =$00000004;
+    kr_KbdGetStatus     =$00000008;
+    kr_KbdSetStatus     =$00000010;
+    kr_KbdStringIn      =$00000020;
+    kr_KbdOpen          =$00000040;
+    kr_KbdClose         =$00000080;
+    kr_KbdGetFocus      =$00000100;
+    kr_KbdFreeFocus     =$00000200;
+    kr_KbdGetCP         =$00000400;
+    kr_KbdSetCP         =$00000800;
+    kr_KbdXLate         =$00001000;
+    kr_KbdSetCustXT     =$00002000;
 
 
 {WaitFlag}
 {WaitFlag}
-    IO_WAIT     =0;
+    IO_Wait     =0;
         {KbdCharIn: wait for a character if one is not available}
         {KbdCharIn: wait for a character if one is not available}
         {KbdGetFocus: wait for the focus}
         {KbdGetFocus: wait for the focus}
         {KbdStringIn: in binary input mode, wait until CharBuf is full, in    }
         {KbdStringIn: in binary input mode, wait until CharBuf is full, in    }
         {             ASCII input mode wait until a carriage return is pressed}
         {             ASCII input mode wait until a carriage return is pressed}
-    IO_NOWAIT   =1;
+    IO_NoWait   =1;
         {KbdCharIn: immediate return if no character is available}
         {KbdCharIn: immediate return if no character is available}
         {KbdGetFocus: do not wait for the focus}
         {KbdGetFocus: do not wait for the focus}
         {KbdStringIn: send an immediate return if no characters are available,}
         {KbdStringIn: send an immediate return if no characters are available,}
@@ -134,46 +133,46 @@ normal conditions)}
         {             length); not supported in ASCII input mode              }
         {             length); not supported in ASCII input mode              }
 
 
 {TKbdInfo.fsMask}
 {TKbdInfo.fsMask}
-    KEYBOARD_ECHO_ON            =$0001; {echo is on}
-    KEYBOARD_ECHO_OFF           =$0002; {echo is off}
-    KEYBOARD_BINARY_MODE        =$0004; {binary mode is on}
-    KEYBOARD_ASCII_MODE         =$0008; {ASCII mode is on}
-    KEYBOARD_MODIFY_STATE       =$0010; {shift state is modified}
-    KEYBOARD_MODIFY_INTERIM     =$0020; {interim character flags are modified}
-    KEYBOARD_MODIFY_TURNAROUND  =$0040; {turn-around character is modified}
-    KEYBOARD_2B_TURNAROUND      =$0080; {length of the turn-around character  }
+    Keyboard_Echo_On            =$0001; {echo is on}
+    Keyboard_Echo_Off           =$0002; {echo is off}
+    Keyboard_Binary_Mode        =$0004; {binary mode is on}
+    Keyboard_ASCII_Mode         =$0008; {ASCII mode is on}
+    Keyboard_Modify_State       =$0010; {shift state is modified}
+    Keyboard_Modify_Interim     =$0020; {interim character flags are modified}
+    Keyboard_Modify_TurnAround  =$0040; {turn-around character is modified}
+    Keyboard_2B_TurnAround      =$0080; {length of the turn-around character  }
                                         {(meaningful only if                  }
                                         {(meaningful only if                  }
-                                        {KEYBOARD_MODIFY_TURNAROUND bit is on)}
-    KEYBOARD_SHIFT_REPORT       =$0100; {shift return is on}
+                                        {Keyboard_Modify_TurnAround bit is on)}
+    Keyboard_Shift_Report       =$0100; {shift return is on}
 
 
 {TKbdInfo.fsState/TKbdKeyInfo.fsState/TKbdTrans.fsState}
 {TKbdInfo.fsState/TKbdKeyInfo.fsState/TKbdTrans.fsState}
-    KBDSTF_RIGHTSHIFT           =$0001;
-    KBDSTF_LEFTSHIFT            =$0002;
-    KBDSTF_CONTROL              =$0004;
-    KBDSTF_ALT                  =$0008;
-    KBDSTF_SCROLLLOCK_ON        =$0010;
-    KBDSTF_NUMLOCK_ON           =$0020;
-    KBDSTF_CAPSLOCK_ON          =$0040;
-    KBDSTF_INSERT_ON            =$0080;
-    KBDSTF_LEFTCONTROL          =$0100;
-    KBDSTF_LEFTALT              =$0200;
-    KBDSTF_RIGHTCONTROL         =$0400;
-    KBDSTF_RIGHTALT             =$0800;
-    KBDSTF_SCROLLLOCK           =$1000;
-    KBDSTF_NUMLOCK              =$2000;
-    KBDSTF_CAPSLOCK             =$4000;
-    KBDSTF_SYSREQ               =$8000;
+    KbdStF_RightShift           =$0001;
+    KbdStF_LeftShift            =$0002;
+    KbdStF_Control              =$0004;
+    KbdStF_Alt                  =$0008;
+    KbdStF_ScrollLock_On        =$0010;
+    KbdStF_Numlock_On           =$0020;
+    KbdStF_Capslock_On          =$0040;
+    KbdStF_Insert_On            =$0080;
+    KbdStF_LeftControl          =$0100;
+    KbdStF_LeftAlt              =$0200;
+    KbdStF_RightControl         =$0400;
+    KbdStF_RightAlt             =$0800;
+    KbdStF_ScrollLock           =$1000;
+    KbdStF_NumLock              =$2000;
+    KbdStF_CapsLock             =$4000;
+    KbdStF_SysReq               =$8000;
 
 
 {TKbdTrans.fbStatus}
 {TKbdTrans.fbStatus}
-    KBDTRF_SHIFT_KEY_IN         =$01;   {shift status returned}
+    KbdTrF_Shift_Key_In         =$01;   {shift status returned}
                                         {without character    }
                                         {without character    }
-    KBDTRF_EXTENDED_KEY_IN      =$02;   {extended key code }
+    KbdTrF_Extended_Key_In      =$02;   {extended key code }
                                         {from the keyboard,}
                                         {from the keyboard,}
                                         {not a character   }
                                         {not a character   }
-    KBDTRF_CONVERSION_REQUEST   =$20;   {immediate conversion}
+    KbdTrF_Conversion_Request   =$20;   {immediate conversion}
                                         {requested           }
                                         {requested           }
-    KBDTRF_FINAL_CHAR_IN        =$40;   {either $40 or $80 or both}
-    KBDTRF_INTERIM_CHAR_IN      =$80;   {must be present          }
+    KbdTrF_Final_Char_In        =$40;   {either $40 or $80 or both}
+    KbdTrF_Interim_Char_In      =$80;   {must be present          }
 
 
 {TKbdHWID.idKbd}
 {TKbdHWID.idKbd}
     Keyboard_Undetermined   =$0000; {undetermined keyboard type}
     Keyboard_Undetermined   =$0000; {undetermined keyboard type}
@@ -200,15 +199,15 @@ type
         case boolean of
         case boolean of
         false:(
         false:(
         chScan:byte;    {scan Code received from the keyboard}
         chScan:byte;    {scan Code received from the keyboard}
-        fbStatus:byte;  {state of the keystroke event, see KBDTRF_*}
+        fbStatus:byte;  {state of the keystroke event, see KbdTrF_* constants}
         bNlsShift:byte; {NLS shift status (always 0?)}
         bNlsShift:byte; {NLS shift status (always 0?)}
-        fsState:word;   {shift key status, see KBDSTF_*}
+        fsState:word;   {shift key status, see KbdStF_* constants}
         Time:cardinal); {time stamp indicating when a key was pressed,}
         Time:cardinal); {time stamp indicating when a key was pressed,}
                         {specified in milliseconds from the time      }
                         {specified in milliseconds from the time      }
                         {the system was started                       }
                         {the system was started                       }
         true:(
         true:(
-        chScan2:char;   (* should be chScan and bNlsShift, but this *)
-        fbStatus2:byte; (* construct is unsupported currently       *)
+        chScan2:char;   (* should be chScan, fbStatus and bNlsShift,   *)
+        fbStatus2:byte; (* but this construct is unsupported currently *)
         bNlsShift2:char);
         bNlsShift2:char);
     end;
     end;
     PKbdKeyInfo=^TKbdKeyInfo;
     PKbdKeyInfo=^TKbdKeyInfo;
@@ -260,7 +259,7 @@ type
                             {               $AB54 = 88 and 89 Key Enhanced    }
                             {               $AB54 = 88 and 89 Key Enhanced    }
                             {                        Keyboards                }
                             {                        Keyboards                }
                             {               $AB85 = 122 Key Enhanced Keyboard }
                             {               $AB85 = 122 Key Enhanced Keyboard }
-                            {- see KEYBOARD_* constants                       }
+                            {- see Keyboard_* constants                       }
         usReserved1,        {reserved, returned set to zero (secondary ID?)}
         usReserved1,        {reserved, returned set to zero (secondary ID?)}
         usReserved2:word;   {reserved, returned set to zero}
         usReserved2:word;   {reserved, returned set to zero}
     end;
     end;
@@ -280,9 +279,10 @@ type
             case boolean of
             case boolean of
             false:(
             false:(
             chScan,         {scan Code received from the keyboard}
             chScan,         {scan Code received from the keyboard}
-            fbStatus,       {state of the keystroke event, see KBDTRF_*}
+            fbStatus,       {state of the keystroke event,}
+                            {see KbdTrF_* constants       }
             bNlsShift:byte; {NLS shift status (always 0?)}
             bNlsShift:byte; {NLS shift status (always 0?)}
-            fsState:word;   {shift key status, see KBDSTF_*}
+            fsState:word;   {shift key status, see KbdStF_* constants}
             Time:cardinal;  {time stamp indicating when a key was pressed,}
             Time:cardinal;  {time stamp indicating when a key was pressed,}
                             {specified in milliseconds from the time      }
                             {specified in milliseconds from the time      }
                             {the system was started                       }
                             {the system was started                       }
@@ -1230,12 +1230,12 @@ a dynamic link entry point name of a routine that receives control when any of
 the registered functions are called. Maximum length is 32 bytes, FnMask - see
 the registered functions are called. Maximum length is 32 bytes, FnMask - see
 KR_* constants}
 KR_* constants}
 {Possible return codes:
 {Possible return codes:
-    0         NO_ERROR
-    408       ERROR_KBD_INVALID_ASCIIZ
-    409       ERROR_KBD_INVALID_MASK
-    410       ERROR_KBD_REGISTER
-    464       ERROR_KBD_DETACHED
-    504       ERROR_KBD_EXTENDED_SG}
+    0         No_Error
+    408       Error_Kbd_Invalid_ASCIIZ
+    409       Error_Kbd_Invalid_Mask
+    410       Error_Kbd_Register
+    464       Error_Kbd_Detached
+    504       Error_Kbd_Extended_SG}
 {Remarks:
 {Remarks:
 * There can be only one KbdRegister call outstanding for each session without
 * There can be only one KbdRegister call outstanding for each session without
   an intervening KbdDeRegister. KbdDeRegister must be issued by the same
   an intervening KbdDeRegister. KbdDeRegister must be issued by the same
@@ -1246,32 +1246,32 @@ function KbdRegister(ModuleName,ProcName:string;FnMask:cardinal):word;
 {Deregister a keyboard subsystem previously registered within a session - only
 {Deregister a keyboard subsystem previously registered within a session - only
 the process that issued the KbdRegister may issue KbdDeRegister.}
 the process that issued the KbdRegister may issue KbdDeRegister.}
 {Possible return codes:
 {Possible return codes:
-    0         NO_ERROR
-    411       ERROR_KBD_DEREGISTER
-    464       ERROR_KBD_DETACHED
-    504       ERROR_KBD_EXTENDED_SG}
+    0         No_Error
+    411       Error_Kbd_Deregister
+    464       Error_Kbd_Detached
+    504       Error_Kbd_Extended_SG}
 function KbdDeRegister:word;
 function KbdDeRegister:word;
 
 
 {Return a character data record from the keyboard.}
 {Return a character data record from the keyboard.}
-{Key - see TKbdKeyInfo record type, WaitFlag - see IO_WAIT and IO_NOWAIT
+{Key - see TKbdKeyInfo record type, WaitFlag - see IO_Wait and IO_NoWait
 constants, KbdHandle is the default keyboard (0) or a logical keyboard.}
 constants, KbdHandle is the default keyboard (0) or a logical keyboard.}
 {Possible return codes are:
 {Possible return codes are:
-    0         NO_ERROR
-    375       ERROR_KBD_INVALID_IOWAIT
-    439       ERROR_KBD_INVALID_HANDLE
-    445       ERROR_KBD_FOCUS_REQUIRED
-    447       ERROR_KBD_KEYBOARD_BUSY
-    464       ERROR_KBD_DETACHED
-    504       ERROR_KBD_EXTENDED_SG}
+    0         No_Error
+    375       Error_Kbd_Invalid_IOWait
+    439       Error_Kbd_Invalid_Handle
+    445       Error_Kbd_Focus_Required
+    447       Error_Kbd_Keyboard_Busy
+    464       Error_Kbd_Detached
+    504       Error_Kbd_Extended_SG}
 {Remarks:
 {Remarks:
 * On an enhanced keyboard, the secondary enter key returns the normal
 * On an enhanced keyboard, the secondary enter key returns the normal
-  character 0DH and a scan code of E0H.
+  character 0Dh and a scan code of E0h.
 * Double-byte character codes (DBCS) require two function calls to obtain the
 * Double-byte character codes (DBCS) require two function calls to obtain the
   entire code.
   entire code.
 * If shift report is set with KbdSetStatus, the CharData record returned
 * If shift report is set with KbdSetStatus, the CharData record returned
   reflects changed shift information only.
   reflects changed shift information only.
 * Extended ASCII codes are identified with the status byte, bit 1 on and the
 * Extended ASCII codes are identified with the status byte, bit 1 on and the
-  ASCII character code being either 00H or E0H. Both conditions must be
+  ASCII character code being either 00h or E0h. Both conditions must be
   satisfied for the character to be an extended keystroke.  For extended
   satisfied for the character to be an extended keystroke.  For extended
   ASCII codes, the scan code byte returned is the second code (extended
   ASCII codes, the scan code byte returned is the second code (extended
   code). Usually the extended ASCII code is the scan code of the primary key
   code). Usually the extended ASCII code is the scan code of the primary key
@@ -1288,21 +1288,21 @@ without removing it from the buffer.}
 {Key - see TKbdKeyInfo record type, KbdHandle is the default keyboard (0)
 {Key - see TKbdKeyInfo record type, KbdHandle is the default keyboard (0)
 or a logical keyboard.}
 or a logical keyboard.}
 {Possible return codes are:
 {Possible return codes are:
-    0         NO_ERROR
-    439       ERROR_KBD_INVALID_HANDLE
-    445       ERROR_KBD_FOCUS_REQUIRED
-    447       ERROR_KBD_KEYBOARD_BUSY
-    464       ERROR_KBD_DETACHED
-    504       ERROR_KBD_EXTENDED_SG}
+    0         No_Error
+    439       Error_Kbd_Invalid_Handle
+    445       Error_Kbd_Focus_Required
+    447       Error_Kbd_Keyboard_Busy
+    464       Error_Kbd_Detached
+    504       Error_Kbd_Extended_SG}
 {Remarks:
 {Remarks:
 * On an enhanced keyboard, the secondary enter key returns the normal
 * On an enhanced keyboard, the secondary enter key returns the normal
-  character 0DH and a scan code of E0H.
+  character 0Dh and a scan code of E0h.
 * Double-byte character codes (DBCS) require two function calls to obtain the
 * Double-byte character codes (DBCS) require two function calls to obtain the
   entire code.
   entire code.
 * If shift report is set with KbdSetStatus the CharData record returned,
 * If shift report is set with KbdSetStatus the CharData record returned,
   reflects changed shift information only.
   reflects changed shift information only.
 * Extended ASCII codes are identified with the status byte, bit 1 on and the
 * Extended ASCII codes are identified with the status byte, bit 1 on and the
-  ASCII character code being either 00H or E0H. Both conditions must be
+  ASCII character code being either 00h or E0h. Both conditions must be
   satisfied for the character to be an extended keystroke. For extended
   satisfied for the character to be an extended keystroke. For extended
   ASCII codes, the scan code byte returned is the second code (extended
   ASCII codes, the scan code byte returned is the second code (extended
   code). Usually the extended ASCII code is the scan code of the primary key
   code). Usually the extended ASCII code is the scan code of the primary key
@@ -1316,15 +1316,15 @@ function KbdPeek(var Key:TKbdKeyInfo;KbdHandle:word):word;
 
 
 {Read a character string (character codes only) from the keyboard.}
 {Read a character string (character codes only) from the keyboard.}
 {CharBuf is a buffer for returned characters, LenInOut - see TStringInBuf
 {CharBuf is a buffer for returned characters, LenInOut - see TStringInBuf
-record type, WaitFlag - see IO_WAIT and IO_NOWAIT constants, KbdHandle is the
+record type, WaitFlag - see IO_Wait and IO_NoWait constants, KbdHandle is the
 default keyboard (0) or a logical keyboard.}
 default keyboard (0) or a logical keyboard.}
 {Possible return codes are:
 {Possible return codes are:
-    0         NO_ERROR
-    375       ERROR_KBD_INVALID_IOWAIT
-    439       ERROR_KBD_INVALID_HANDLE
-    445       ERROR_KBD_FOCUS_REQUIRED
-    464       ERROR_KBD_DETACHED
-    504       ERROR_KBD_EXTENDED_SG}
+    0         No_Error
+    375       Error_Kbd_Invalid_IOWait
+    439       Error_Kbd_Invalid_Handle
+    445       Error_Kbd_Focus_Required
+    464       Error_Kbd_Detached
+    504       Error_Kbd_Extended_SG}
 {Remarks:
 {Remarks:
 * The character strings may be optionally echoed on the display if echo mode
 * The character strings may be optionally echoed on the display if echo mode
   is set. When echo is on each character is echoed as it is read from the
   is set. When echo is on each character is echoed as it is read from the
@@ -1332,7 +1332,7 @@ default keyboard (0) or a logical keyboard.}
   KbdSetStatus and KbdGetStatus for more information.
   KbdSetStatus and KbdGetStatus for more information.
 * The default input mode is ASCII. In ASCII mode, 2-byte character codes only
 * The default input mode is ASCII. In ASCII mode, 2-byte character codes only
   return in complete form. An extended ASCII code is returned in a 2-byte
   return in complete form. An extended ASCII code is returned in a 2-byte
-  string. The first byte is 0DH or E0H and the next byte is an extended code.
+  string. The first byte is 0Dh or E0h and the next byte is an extended code.
 * In input mode (binary, ASCII), the following returns can be set and
 * In input mode (binary, ASCII), the following returns can be set and
   retrieved with KbdSetStatus and KbdGetStatus:
   retrieved with KbdSetStatus and KbdGetStatus:
     Turnaround Character
     Turnaround Character
@@ -1355,12 +1355,12 @@ function KbdStringIn(CharBuf:PChar;LenInOutP:PStringInBuf;WaitFlag:word;
 {Clear the keystroke buffer.}
 {Clear the keystroke buffer.}
 {KbdHandle is the default keyboard (0) or a logical keyboard.}
 {KbdHandle is the default keyboard (0) or a logical keyboard.}
 {Possible return codes are:
 {Possible return codes are:
-    0         NO_ERROR
-    439       ERROR_KBD_INVALID_HANDLE
-    445       ERROR_KBD_FOCUS_REQUIRED
-    447       ERROR_KBD_KEYBOARD_BUSY
-    464       ERROR_KBD_DETACHED
-    504       ERROR_KBD_EXTENDED_SG}
+    0         No_Error
+    439       Error_Kbd_Invalid_Handle
+    445       Error_Kbd_Focus_Required
+    447       Error_Kbd_Keyboard_Busy
+    464       Error_Kbd_Detached
+    504       Error_Kbd_Extended_SG}
 {Remarks:
 {Remarks:
 * KbdFlushBuffer completes when the handle has access to the physical
 * KbdFlushBuffer completes when the handle has access to the physical
   keyboard (focus), or is equal to zero and no other handle has the focus.}
   keyboard (focus), or is equal to zero and no other handle has the focus.}
@@ -1370,15 +1370,15 @@ function KbdFlushBuffer(KbdHandle:word):word;
 {Status - see TKbdInfo record type, KbdHandle is the default keyboard (0) or
 {Status - see TKbdInfo record type, KbdHandle is the default keyboard (0) or
 a logical keyboard.}
 a logical keyboard.}
 {Possible return codes are:
 {Possible return codes are:
-    0         NO_ERROR
-    376       ERROR_KBD_INVALID_LENGTH
-    377       ERROR_KBD_INVALID_ECHO_MASK
-    378       ERROR_KBD_INVALID_INPUT_MASK
-    439       ERROR_KBD_INVALID_HANDLE
-    445       ERROR_KBD_FOCUS_REQUIRED
-    447       ERROR_KBD_KEYBOARD_BUSY
-    464       ERROR_KBD_DETACHED
-    504       ERROR_KBD_EXTENDED_SG}
+    0         No_Error
+    376       Error_Kbd_Invalid_length
+    377       Error_Kbd_Invalid_Echo_Mask
+    378       Error_Kbd_Invalid_Input_Mask
+    439       Error_Kbd_Invalid_Handle
+    445       Error_Kbd_Focus_Required
+    447       Error_Kbd_Keyboard_Busy
+    464       Error_Kbd_Detached
+    504       Error_Kbd_Extended_SG}
 {Remarks:
 {Remarks:
 * Shift return (bit 8 in sysstate) must be disabled in ASCII mode.
 * Shift return (bit 8 in sysstate) must be disabled in ASCII mode.
 * KbdSetStatus is ignored for a Vio-windowed application.}
 * KbdSetStatus is ignored for a Vio-windowed application.}
@@ -1388,19 +1388,19 @@ function KbdSetStatus(var Status:TKbdInfo;KbdHandle:word):word;
 {Status - see TKbdInfo record type, KbdHandle is the default keyboard (0) or
 {Status - see TKbdInfo record type, KbdHandle is the default keyboard (0) or
 a logical keyboard.}
 a logical keyboard.}
 {Possible return codes:
 {Possible return codes:
-    0         NO_ERROR
-    376       ERROR_KBD_INVALID_LENGTH
-    439       ERROR_KBD_INVALID_HANDLE
-    445       ERROR_KBD_FOCUS_REQUIRED
-    447       ERROR_KBD_KEYBOARD_BUSY
-    464       ERROR_KBD_DETACHED
-    504       ERROR_KBD_EXTENDED_SG}
+    0         No_Error
+    376       Error_Kbd_Invalid_Length
+    439       Error_Kbd_Invalid_Handle
+    445       Error_Kbd_Focus_Required
+    447       Error_Kbd_Keyboard_Busy
+    464       Error_Kbd_Detached
+    504       Error_Kbd_Extended_SG}
 {Remarks:
 {Remarks:
 * The initial state of the keyboard is established by the system at
 * The initial state of the keyboard is established by the system at
   application load time. Some default states may be modified by the
   application load time. Some default states may be modified by the
   application through KbdSetStatus. KbdGetStatus returns only those keyboard
   application through KbdSetStatus. KbdGetStatus returns only those keyboard
   parameters initially set by KbdSetStatus. The returned parameters are:
   parameters initially set by KbdSetStatus. The returned parameters are:
-  Input Mode, Interim Character Flags, Shift State, Echo State, Turnaround
+  Input Mode, Interim Character Flags, Shift State, Echo State, TurnAround
   Character
   Character
 * KbdGetStatus completes only when the handle has access to the physical
 * KbdGetStatus completes only when the handle has access to the physical
   keyboard (focus) or the handle is 0 and no other handle has the focus.}
   keyboard (focus) or the handle is 0 and no other handle has the focus.}
@@ -1413,13 +1413,13 @@ application's data area, must be equivalent to one of the code-page IDs
 specified on the CONFIG.SYS CODEPAGE= statement or 0, an error results
 specified on the CONFIG.SYS CODEPAGE= statement or 0, an error results
 otherwise, KbdHandle is the default keyboard (0) or a logical keyboard.}
 otherwise, KbdHandle is the default keyboard (0) or a logical keyboard.}
 {Possible return codes:
 {Possible return codes:
-    0         NO_ERROR
-    439       ERROR_KBD_INVALID_HANDLE
-    445       ERROR_KBD_FOCUS_REQUIRED
-    447       ERROR_KBD_KEYBOARD_BUSY
-    448       ERROR_KBD_INVALID_CODEPAGE
-    464       ERROR_KBD_DETACHED
-    504       ERROR_KBD_EXTENDED_SG}
+    0         No_Error
+    439       Error_Kbd_Invalid_Handle
+    445       Error_Kbd_Focus_Required
+    447       Error_Kbd_Keyboard_Busy
+    448       Error_Kbd_Invalid_CodePage
+    464       Error_Kbd_Detached
+    504       Error_Kbd_Extended_SG}
 {Remarks:
 {Remarks:
 * Keyboard code page support is not available without the DEVINFO=KBD
 * Keyboard code page support is not available without the DEVINFO=KBD
   statement in the CONFIG.SYS file.}
   statement in the CONFIG.SYS file.}
@@ -1431,13 +1431,13 @@ page for a specified keyboard handle in CodePage, it is one of the code page
 IDs specified in the CONFIG.SYS CODEPAGE= statement or 0000. KbdHandle is
 IDs specified in the CONFIG.SYS CODEPAGE= statement or 0000. KbdHandle is
 the default keyboard (0) or a logical keyboard.}
 the default keyboard (0) or a logical keyboard.}
 {Possible return codes:
 {Possible return codes:
-    0         NO_ERROR
-    373       ERROR_KBD_PARAMETER
-    439       ERROR_KBD_INVALID_HANDLE
-    445       ERROR_KBD_FOCUS_REQUIRED
-    447       ERROR_KBD_KEYBOARD_BUSY
-    464       ERROR_KBD_DETACHED
-    504       ERROR_KBD_EXTENDED_SG}
+    0         No_Error
+    373       Error_Kbd_Parameter
+    439       Error_Kbd_Invalid_Handle
+    445       Error_Kbd_Focus_Required
+    447       Error_Kbd_Keyboard_Busy
+    464       Error_Kbd_Detached
+    504       Error_Kbd_Extended_SG}
 {Remarks:
 {Remarks:
 * CodePage is set to the currently active keyboard code page. A value of 0
 * CodePage is set to the currently active keyboard code page. A value of 0
   indicates the code page translation table in use is the ROM code page
   indicates the code page translation table in use is the ROM code page
@@ -1447,11 +1447,11 @@ function KbdGetCp(Reserved:cardinal;var CodePage:word;KbdHandle:word):word;
 {Create a new logical keyboard.}
 {Create a new logical keyboard.}
 {Handle for the new logical keyboard returned in KbdHandle.}
 {Handle for the new logical keyboard returned in KbdHandle.}
 {Possible return codes:
 {Possible return codes:
-    0         NO_ERROR
-    440       ERROR_KBD_NO_MORE_HANDLE
-    441       ERROR_KBD_CANNOT_CREATE_KCB
-    464       ERROR_KBD_DETACHED
-    504       ERROR_KBD_EXTENDED_SG}
+    0         No_Error
+    440       Error_Kbd_No_More_Handle
+    441       Error_Kbd_Cannot_Create_KCB
+    464       Error_Kbd_Detached
+    504       Error_Kbd_Extended_SG}
 {Remarks:
 {Remarks:
 * KbdOpen blocks while another thread has the keyboard focus (by way of
 * KbdOpen blocks while another thread has the keyboard focus (by way of
   KbdGetFocus) until the thread with the focus issues KbdFreeFocus.
   KbdGetFocus) until the thread with the focus issues KbdFreeFocus.
@@ -1465,10 +1465,10 @@ function KbdOpen(var KbdHandle:word):word;
 {Close the existing logical keyboard identified by the keyboard handle}
 {Close the existing logical keyboard identified by the keyboard handle}
 {KbdHandle is the default keyboard (0) or a logical keyboard}
 {KbdHandle is the default keyboard (0) or a logical keyboard}
 {Possible return codes:
 {Possible return codes:
-    0         NO_ERROR
-    439       ERROR_KBD_INVALID_HANDLE
-    464       ERROR_KBD_DETACHED
-    504       ERROR_KBD_EXTENDED_SG}
+    0         No_Error
+    439       Error_Kbd_Invalid_Handle
+    464       Error_Kbd_Detached
+    504       Error_Kbd_Extended_SG}
 {Remarks:
 {Remarks:
 * KbdClose blocks while another thread has the keyboard focus (by way of
 * KbdClose blocks while another thread has the keyboard focus (by way of
   KbdGetFocus) until the thread with the focus issues KbdFreeFocus.
   KbdGetFocus) until the thread with the focus issues KbdFreeFocus.
@@ -1483,21 +1483,21 @@ function KbdClose(KbdHandle:word):word;
 {Bind the logical keyboard to the physical keyboard.}
 {Bind the logical keyboard to the physical keyboard.}
 {KbdHandle is the default keyboard (0) or a logical keyboard}
 {KbdHandle is the default keyboard (0) or a logical keyboard}
 {Possible return codes:
 {Possible return codes:
-    0         NO_ERROR
-    439       ERROR_KBD_INVALID_HANDLE
-    445       ERROR_KBD_FOCUS_REQUIRED
-    464       ERROR_KBD_DETACHED
-    504       ERROR_KBD_EXTENDED_SG}
+    0         No_Error
+    439       Error_Kbd_Invalid_Handle
+    445       Error_Kbd_Focus_Required
+    464       Error_Kbd_Detached
+    504       Error_Kbd_Extended_SG}
 function KbdGetFocus(WaitFlag,KbdHandle:word):word;
 function KbdGetFocus(WaitFlag,KbdHandle:word):word;
 
 
 {Free the logical-to-physical keyboard bond created by KbdGetFocus.}
 {Free the logical-to-physical keyboard bond created by KbdGetFocus.}
 {KbdHandle is the default keyboard (0) or a logical keyboard}
 {KbdHandle is the default keyboard (0) or a logical keyboard}
 {Possible return codes:
 {Possible return codes:
-    0         NO_ERROR
-    439       ERROR_KBD_INVALID_HANDLE
-    445       ERROR_KBD_FOCUS_REQUIRED
-    464       ERROR_KBD_DETACHED
-    504       ERROR_KBD_EXTENDED_SG}
+    0         No_Error
+    439       Error_Kbd_Invalid_Handle
+    445       Error_Kbd_Focus_Required
+    464       Error_Kbd_Detached
+    504       Error_Kbd_Extended_SG}
 {Remarks:
 {Remarks:
 * KbdFreeFocus may be replaced by issuing KbdRegister. Unlike other keyboard
 * KbdFreeFocus may be replaced by issuing KbdRegister. Unlike other keyboard
   subsystem functions, the replaced KbdFreeFocus is called only if there is
   subsystem functions, the replaced KbdFreeFocus is called only if there is
@@ -1505,11 +1505,11 @@ function KbdGetFocus(WaitFlag,KbdHandle:word):word;
 function KbdFreeFocus(KbdHandle:word):word;
 function KbdFreeFocus(KbdHandle:word):word;
 
 
 {Synchronize access from a keyboard subsystem to the keyboard device driver.}
 {Synchronize access from a keyboard subsystem to the keyboard device driver.}
-{WaitFlag - see IO_WAIT and IO_NOWAIT constants (wait / don't wait for access
+{WaitFlag - see IO_Wait and IO_NoWait constants (wait / don't wait for access
 to the device driver.}
 to the device driver.}
 {Possible return codes:
 {Possible return codes:
-    0         NO_ERROR
-    121       ERROR_SEM_TIMEOUT}
+    0         No_Error
+    121       Error_Sem_TimeOut}
 {Remarks:
 {Remarks:
 * KbdSynch blocks all other threads within a session until return from the
 * KbdSynch blocks all other threads within a session until return from the
   subsystem to the router. To ensure proper synchronization, KbdSynch should
   subsystem to the router. To ensure proper synchronization, KbdSynch should
@@ -1520,9 +1520,9 @@ function KbdSynch (WaitFlag:word):word;
 
 
 {Raise the priority of the foreground keyboard's thread.}
 {Raise the priority of the foreground keyboard's thread.}
 {Possible return codes:
 {Possible return codes:
-    0         NO_ERROR
-    447       ERROR_KBD_KEYBOARD_BUSY
-    504       ERROR_KBD_EXTENDED_SG}
+    0         No_Error
+    447       Error_Kbd_Keyboard_Busy
+    504       Error_Kbd_Extended_SG}
 {Remarks:
 {Remarks:
 * KbdSetFgnd marks the current process that owns the keyboard. Threads in
 * KbdSetFgnd marks the current process that owns the keyboard. Threads in
   this process receive a priority boost. The previous foreground keyboard
   this process receive a priority boost. The previous foreground keyboard
@@ -1535,14 +1535,14 @@ function KbdSetFgnd:word;
 {HWID is a pointer to the caller's data area, see TKbdHWID, KbdHandle is the
 {HWID is a pointer to the caller's data area, see TKbdHWID, KbdHandle is the
 default keyboard (0) or a logical keyboard.}
 default keyboard (0) or a logical keyboard.}
 {Possible return codes:
 {Possible return codes:
-    0         NO_ERROR
-    373       ERROR_KBD_PARAMETER
-    447       ERROR_KBD_KEYBOARD_BUSY
-    464       ERROR_KBD_DETACHED
-    504       ERROR_KBD_EXTENDED_SG}
+    0         No_Error
+    373       Error_Kbd_Parameter
+    447       Error_Kbd_Keyboard_Busy
+    464       Error_Kbd_Detached
+    504       Error_Kbd_Extended_SG}
 {Remarks:
 {Remarks:
 * In past OS/2 releases, all keyboards could be supported by knowing the
 * In past OS/2 releases, all keyboards could be supported by knowing the
-  hardware family information available with keyboard IOCTL 77H. However,
+  hardware family information available with keyboard IOCTL 77h. However,
   with the addition of the 122-key keyboard, recognition was not containable
   with the addition of the 122-key keyboard, recognition was not containable
   by hardware family information alone. The 122-key keyboard has a number of
   by hardware family information alone. The 122-key keyboard has a number of
   differences from other keyboards. Therefore, applications performing
   differences from other keyboards. Therefore, applications performing
@@ -1560,12 +1560,12 @@ function KbdSetHWID(HWIDP:PKbdHWID;KbdHandle:word):word;
 {TransData - see TKbdTransData, KbdHandle is the default keyboard (0) or a
 {TransData - see TKbdTransData, KbdHandle is the default keyboard (0) or a
 logical keyboard.}
 logical keyboard.}
 {Possible return codes:
 {Possible return codes:
-    0         NO_ERROR
-    439       ERROR_KBD_INVALID_HANDLE
-    445       ERROR_KBD_FOCUS_REQUIRED
-    447       ERROR_KBD_KEYBOARD_BUSY
-    464       ERROR_KBD_DETACHED
-    504       ERROR_KBD_EXTENDED_SG}
+    0         No_Error
+    439       Error_Kbd_Invalid_Handle
+    445       Error_Kbd_Focus_Required
+    447       Error_Kbd_Keyboard_Busy
+    464       Error_Kbd_Detached
+    504       Error_Kbd_Extended_SG}
 {Remarks:
 {Remarks:
 * It may take several calls to complete a translation because of accent key
 * It may take several calls to complete a translation because of accent key
   combinations, or other complex operations.
   combinations, or other complex operations.
@@ -1584,14 +1584,14 @@ for a specified handle (the format of the translation table is documented in
 the Set Code Page IOCTL 50h), KbdHandle is the default keyboard (0) or a
 the Set Code Page IOCTL 50h), KbdHandle is the default keyboard (0) or a
 logical keyboard.}
 logical keyboard.}
 {Possible return codes:
 {Possible return codes:
-    0         NO_ERROR
-    377       ERROR_KBD_INVALID_ECHO_MASK
-    378       ERROR_KBD_INVALID_INPUT_MASK
-    439       ERROR_KBD_INVALID_HANDLE
-    445       ERROR_KBD_FOCUS_REQUIRED
-    447       ERROR_KBD_KEYBOARD_BUSY
-    464       ERROR_KBD_DETACHED
-    504       ERROR_KBD_EXTENDED_SG}
+    0         No_Error
+    377       Error_Kbd_Invalid_Echo_Mask
+    378       Error_Kbd_Invalid_Input_Mask
+    439       Error_Kbd_Invalid_Handle
+    445       Error_Kbd_Focus_Required
+    447       Error_Kbd_Keyboard_Busy
+    464       Error_Kbd_Detached
+    504       Error_Kbd_Extended_SG}
 {Remarks:
 {Remarks:
 * The translate table must be maintained in the caller's memory. No copy of
 * The translate table must be maintained in the caller's memory. No copy of
   the translate table is made by KbdSetCustXt.
   the translate table is made by KbdSetCustXt.
@@ -1730,4 +1730,3 @@ external 'EMXWRAP' index 201;
 
 
 end.
 end.
 
 
-

+ 2 - 4
rtl/os2/moucalls.pas

@@ -67,8 +67,6 @@ Coding style:
 interface
 interface
 {***************************************************************************}
 {***************************************************************************}
 
 
-uses    strings;
-
 {$ifdef FPK}
 {$ifdef FPK}
     {$packrecords 1}
     {$packrecords 1}
 {$endif FPK}
 {$endif FPK}
@@ -77,6 +75,7 @@ const
 {return codes / error constants (those marked with * shouldn't occur under
 {return codes / error constants (those marked with * shouldn't occur under
 normal conditions)}
 normal conditions)}
     NO_ERROR                        =  0;
     NO_ERROR                        =  0;
+    Error_Invalid_Parameter         = 87;
     ERROR_SEM_TIMEOUT               =121;
     ERROR_SEM_TIMEOUT               =121;
     ERROR_MOUSE_NO_DEVICE           =385;
     ERROR_MOUSE_NO_DEVICE           =385;
     ERROR_MOUSE_INV_HANDLE          =386; {*}
     ERROR_MOUSE_INV_HANDLE          =386; {*}
@@ -461,7 +460,7 @@ MouHandle is the mouse device handle from a previous MouOpen call.}
     14-12     Background color
     14-12     Background color
     11        Intensity
     11        Intensity
     10-8      Foreground color
     10-8      Foreground color
-    7-0       Character}
+    7-0       Character
 * For other custom displays and for the extended modes of the EGA attachment,
 * For other custom displays and for the extended modes of the EGA attachment,
   it is possible to set the display to modes that require multiple bit planes.
   it is possible to set the display to modes that require multiple bit planes.
   In these cases, the area sized by the row and column limits must be repeated
   In these cases, the area sized by the row and column limits must be repeated
@@ -1084,4 +1083,3 @@ external 'MOUCALLS' index 10;
 
 
 
 
 end.
 end.
-

+ 0 - 2082
rtl/os2/objects.pas

@@ -1,2082 +0,0 @@
-{**********[ SOURCE FILE OF FREE VISION ]***************}
-{                                                       }
-{   Parts Copyright (c) 1992,96 by Florian Klaempfl     }
-{   [email protected]                     }
-{                                                       }
-{   Parts Copyright (c) 1996 by Frank ZAGO              }
-{   [email protected]                                }
-{                                                       }
-{   Parts Copyright (c) 1995 by MH Spiegel              }
-{                                                       }
-{   Parts Copyright (c) 1996 by Leon de Boer            }
-{   [email protected]                                     }
-{                                                       }
-{              THIS CODE IS FREEWARE                    }
-{*******************************************************}
-
-{***************[ SUPPORTED PLATFORMS ]*****************}
-{  16 and 32 Bit compilers                              }
-{     DOS      - Turbo Pascal 7.0 +      (16 Bit)       }
-{              - FPK Pascal              (32 Bit)       }
-{     DPMI     - Turbo Pascal 7.0 +      (16 Bit)       }
-{     WINDOWS  - Turbo Pascal 7.0 +      (16 Bit)       }
-{     OS2      - Virtual Pascal 0.3 +    (32 Bit)       }
-{                SpeedPascal 1.5 G +     (32 Bit)       }
-{                C'T patch to BP         (16 Bit)       }
-{*******************************************************}
-
-UNIT Objects;
-
-{$I os.inc}
-
-{<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>}
-                                  INTERFACE
-{<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>}
-
-{ ******************************* REMARK ****************************** }
-{  FPK does not accept  $IFNDEF compiler defines and mishandles $IFDEF  }
-{  with constants. Can we please get this error fixed!!!!!              }
-{ ****************************** END REMARK *** Leon de Boer, 10May96 * }
-
-{====Compiler conditional defines to sort platforms out =============}
-{$DEFINE NotFPKPascal}                                { Predefine Not FPK }
-{$DEFINE NotOS2}                                      { Predefine NOT OS2 }
-
-{$IFDEF FPK}                                          { FPK PASCAL }
-   {$DEFINE FPKPascal}                                { Set FPK definition }
-   {$DEFINE DOS_OS}                                   { Define DOS_OS }
-   {$DEFINE CODE_32_BIT}                              { 32 BIT CODE }
-   {$UNDEF USE_BGI}                                   { Can't use BGI }
-   {$UNDEF NotFPKPascal}                              { This is FPK pascal }
-{$ENDIF}
-
-{$IFDEF MSDOS}                                        { MSDOS PLATFORM }
-   {$DEFINE DOS_OS}                                   { Define DOS_OS }
-{$ENDIF}
-
-{$IFDEF DPMI}                                         { DPMI PLATFORM }
-   {$DEFINE DOS_OS}                                   { Define DOS_OS }
-{$ENDIF}
-
-{$IFDEF Windows}                                      { WINDOWS platform }
-   {$DEFINE ADV_OS}                                   { Set as advanced }
-   {$UNDEF USE_BGI}                                   { Can't use BGI }
-{$ENDIF}
-
-{$IFDEF OS2}                                          { OS2 platform }
-   {$DEFINE ADV_OS}                                   { Set as advanced }
-   {$IFNDEF FPK}
-    {$DEFINE BPOS2}                                    { Define BPOS2 }
-   {$ENDIF FPK}
-   {$UNDEF NotOS2}                                    { This is OS2 compiler }
-   {$UNDEF USE_BGI}                                   { Can't use BGI }
-   {$UNDEF DOS_OS}
-{$ENDIF}
-
-{$IFDEF VirtualPascal}                                { VIRTUAL PASCAL }
-   {$DEFINE CODE_32_BIT}                              { 32 BIT CODE }
-   {$DEFINE ASM_32_BIT}                               { 32 BIT ASSSEMBLER }
-   {$DEFINE API_32_BIT}                               { 32 BIT API CALLS }
-   {$UNDEF BPOS2}                                     { Undefine BPOS2 }
-{$ENDIF}
-
-{$IFDEF Speed}                                        { SPEED PASCAL }
-   {$DEFINE CODE_32_BIT}                              { 32 BIT CODE }
-   {$DEFINE ASM_32_BIT}                               { 32 BIT ASSSEMBLER }
-   {$DEFINE API_32_BIT}                               { 32 BIT API CALLS }
-   {$UNDEF BPOS2}                                     { Undefine BPOS2 }
-{$ENDIF}
-{--------------------------------------------------------------------}
-
-{ ******************************* REMARK ****************************** }
-{ How about FPK accepting all the standard compiler directives even if  }
-{ It just ignores them for now!!                                        }
-{ ****************************** END REMARK *** Leon de Boer, 10May96 * }
-
-{==== Compiler directives ===========================================}
-{$IFDEF FPKPascal}                                    { FPK PASCAL }
-   {$E-}
-   {$DEFINE NoExceptions}
-   {$DEFINE SString}
-
-   CONST
-      Sw_MaxData = 128*1024*1024;                     { Maximum data size }
-
-   TYPE
-      Sw_Word    = LongInt;                           { Long integer now }
-      Sw_Integer = LongInt;                           { Long integer now }
-
-   TYPE
-      FuncPtr = FUNCTION (Item: Pointer; _EBP: Sw_Word): Boolean;
-      ProcPtr = PROCEDURE (Item: Pointer; _EBP: Sw_Word);
-
-{$ENDIF}
-{$IFDEF NotFPKPascal}                                 { ALL OTHER COMPILERS }
-   {$N-} {  No 80x87 code generation }
-   {$O+} { This unit may be overlaid }
-   {$X+} { Extended syntax is ok }
-   {$F+} { Force far calls }
-   {$A+} { Word Align Data }
-   {$G+} { 286 Code optimization - if you're on an 8088 get a real computer }
-   {$R-} { Disable range checking }
-   {$S-} { Disable Stack Checking }
-   {$I-} { Disable IO Checking }
-   {$Q-} { Disable Overflow Checking }
-   {$V-} { Turn off strict VAR strings }
-   {$B-} { Allow short circuit boolean evaluations }
-
-   {$IFNDEF CODE_32_BIT}                              { 16 BIT DEFINITIONS }
-   CONST
-      Sw_MaxData = 65520;                             { Maximum data size }
-
-   TYPE
-      Sw_Word    = Word;                              { Standard word }
-      Sw_Integer = Integer;                           { Standard integer }
-   {$ELSE}                                            { 32 BIT DEFINITIONS }
-   CONST
-      Sw_MaxData = 128*1024*1024;                     { Maximum data size }
-
-   TYPE
-      Sw_Word    = LongInt;                           { Long integer now }
-      Sw_Integer = LongInt;                           { Long integer now }
-   {$ENDIF}
-
-   TYPE
-   {$IFDEF VirtualPascal}                             { VP is different }
-      FuncPtr = FUNCTION (Item: Pointer): Boolean;
-   {$ELSE}                                            { All others }
-      FuncPtr = FUNCTION (Item: Pointer; _EBP: Sw_Word): Boolean;
-   {$ENDIF}
-
-   TYPE
-   {$IFDEF VirtualPascal}                             { VP is different }
-      ProcPtr = PROCEDURE (Item: Pointer);
-   {$ELSE}                                            { All others }
-      ProcPtr = PROCEDURE (Item: Pointer; _EBP: Sw_Word);
-   {$ENDIF}
-
-{$ENDIF}
-{---------------------------------------------------------------------}
-
-CONST
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                         STREAM ERROR STATE MASKS                        Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-   stOk         =  0;                                 { No stream error }
-   stError      = -1;                                 { Access error }
-   stInitError  = -2;                                 { Initialize error }
-   stReadError  = -3;                                 { Stream read error }
-   stWriteError = -4;                                 { Stream write error }
-   stGetError   = -5;                                 { Get object error }
-   stPutError   = -6;                                 { Put object error }
-   stSeekError  = -7;                                 { Seek error in stream }
-   stOpenError  = -8;                                 { Error opening stream }
-
-CONST
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                       STREAM ACCESS MODE CONSTANTS                      Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-   stCreate    = $3C00;                               { Create new file }
-   stOpenRead  = $3D00;                               { Read access only }
-   stOpenWrite = $3D01;                               { Write access only }
-   stOpen      = $3D02;                               { Read/write access }
-
-CONST
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                         TCollection ERROR CODES                         Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-   coIndexError = -1;                                 { Index out of range }
-   coOverflow   = -2;                                 { Overflow }
-
-CONST
-{ ******************************* REMARK ****************************** }
-{   These are completely NEW FREE VISION ONLY constants that are used   }
-{  in conjuction with CreateStream a NEW FREE VISION call. This call    }
-{  tries creating a stream in the order of the Strategy Mask and will   }
-{  return the successfully created stream or nil if it fails.           }
-{ ****************************** END REMARK *** Leon de Boer, 15May96 * }
-
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                      STREAM CREATE STRATEGY MASKS                       Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-   sa_XMSFirst   = $8000;                             { Use XMS memory 1st }
-   sa_EMSFirst   = $4000;                             { Use EMS memory 1st }
-   sa_RAMFirst   = $2000;                             { Use RAM memory 1st }
-   sa_DISKFirst  = $1000;                             { Use DISK space 1st }
-   sa_XMSSecond  = $0800;                             { Use XMS memory 2nd }
-   sa_EMSSecond  = $0400;                             { Use EMS memory 2nd }
-   sa_RAMSecond  = $0200;                             { Use RAM memory 2nd }
-   sa_DISKSecond = $0100;                             { Use DISK space 2nd }
-   sa_XMSThird   = $0080;                             { Use XMS memory 3rd }
-   sa_EMSThird   = $0040;                             { Use EMS memory 3rd }
-   sa_RAMThird   = $0020;                             { Use RAM memory 3rd }
-   sa_DISKThird  = $0010;                             { Use DISK space 3rd }
-   sa_XMSFourth  = $0008;                             { Use XMS memory 4th }
-   sa_EMSFourth  = $0004;                             { Use EMS memory 4th }
-   sa_RAMFourth  = $0002;                             { Use RAM memory 4th }
-   sa_DISKFourth = $0001;                             { Use DISK space 4th }
-
-CONST
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                          GENERAL USE CONSTANTS                          Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-{$IFDEF VirtualPascal}
-   vmtHeaderSize = 12;                                { VMT header size }
-{$ELSE}
-   vmtHeaderSize = 8;                                 { VMT header size }
-{$ENDIF}
-
-CONST
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                   MAXIMUM COLLECTION SIZE CONSTANT                      Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-   MaxCollectionSize = Sw_MaxData DIV SizeOf(Pointer);{ Max collection size }
-
-TYPE
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                              CHARACTER SET                              Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-   TCharSet = SET Of Char;                            { Character set }
-   PCharSet = ^TCharSet;                              { Character set ptr }
-
-TYPE
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                              GENERAL ARRAYS                             Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-   TByteArray = ARRAY [0..Sw_MaxData-1] Of Byte;      { Byte array }
-   PByteArray = ^TByteArray;                          { Byte array pointer }
-
-   TWordArray = ARRAY [0..Sw_MaxData DIV 2-1] Of Word;{ Word array }
-   PWordArray = ^TWordArray;                          { Word array pointer }
-
-TYPE
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                           DOS FILENAME STRING                           Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-{$IFDEF DOS_OS}                                       { DOS/DPMI DEFINE }
-   FNameStr = String[79];                             { DOS filename }
-{$ENDIF}
-{$IFDEF Windows}                                      { WINDOWS DEFINE }
-   FNameStr = PChar;                                  { Windows filename }
-{$ENDIF}
-{$IFDEF OS2}                                          { OS2 DEFINE }
-   FNameStr = String;                                 { OS2 filename }
-{$ENDIF}
-
-TYPE
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                           DOS ASCIIZ FILENAME                           Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-   AsciiZ = Array [0..255] Of Char;                   { Filename array }
-
-TYPE
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                          GENERAL TYPE POINTERS                          Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-   PByte    = ^Byte;                                  { Byte pointer }
-   PWord    = ^Word;                                  { Word pointer }
-   PLongInt = ^LongInt;                               { LongInt pointer }
-   PString  = ^String;                                { String pointer }
-
-{***************************************************************************}
-{                            RECORD DEFINITIONS                             }
-{***************************************************************************}
-TYPE
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                         TYPE CONVERSION RECORDS                         Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-   WordRec = RECORD
-     Lo, Hi: Byte;                                    { Word to bytes }
-   END;
-
-   LongRec = RECORD
-     Lo, Hi: Word;                                    { LongInt to words }
-   END;
-
-   PtrRec = RECORD
-     Ofs, Seg: Word;                                  { Pointer to words }
-   END;
-
-TYPE
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                 TStreamRec RECORD - STREAM OBJECT RECORD                Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-   PStreamRec = ^TStreamRec;                          { Stream record ptr }
-   TStreamRec = RECORD
-      ObjType: Sw_Word;                               { Object type id }
-      VmtLink: Sw_Word;                               { VMT link }
-      Load : Pointer;                                 { Object load code }
-      Store: Pointer;                                 { Object store code }
-      Next : Sw_Word;                                 { Bytes to next }
-   END;
-
-{***************************************************************************}
-{                            OBJECT DEFINITIONS                             }
-{***************************************************************************}
-
-TYPE
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                       TPoint RECORD - POINT RECORD                      Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-   TPoint = RECORD
-      X, Y: Integer;                                  { Point co-ordinates }
-   END;
-
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                     TRect OBJECT - RECTANGLE OBJECT                     Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-   TRect = OBJECT
-         A, B: TPoint;                                { Corner points }
-      FUNCTION Empty: Boolean;
-      FUNCTION Equals (R: TRect): Boolean;
-      FUNCTION Contains (P: TPoint): Boolean;
-      PROCEDURE Copy (R: TRect);
-      PROCEDURE Union (R: TRect);
-      PROCEDURE Intersect (R: TRect);
-      PROCEDURE Move (ADX, ADY: Integer);
-      PROCEDURE Grow (ADX, ADY: Integer);
-      PROCEDURE Assign (XA, YA, XB, YB: Integer);
-   END;
-   PRect = ^TRect;
-
-TYPE
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                 TObject OBJECT - BASE ANCESTOR OBJECT                   Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-   TObject = OBJECT
-      CONSTRUCTOR Init;
-      PROCEDURE Free;
-      DESTRUCTOR Done;                                               Virtual;
-   END;
-   PObject = ^TObject;
-
-TYPE
-{ ******************************* REMARK ****************************** }
-{  Two new virtual methods have been added to the object in the form of }
-{  Close and Open. The main use here is in the Disk Based Descendants   }
-{  the calls open and close the given file so these objects can be      }
-{  used like standard files. All existing code will compile and work    }
-{  completely normally oblivious to these new methods.                  }
-{ ****************************** END REMARK *** Leon de Boer, 15May96 * }
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                TStream OBJECT - STREAM ANCESTOR OBJECT                  Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-   TStream = OBJECT (TObject)
-         Status   : Integer;                          { Stream status }
-         ErrorInfo: Integer;                          { Stream error info }
-      FUNCTION Get: PObject;
-      FUNCTION StrRead: PChar;
-      FUNCTION GetPos: LongInt;                                      Virtual;
-      FUNCTION GetSize: LongInt;                                     Virtual;
-      FUNCTION ReadStr: PString;
-      PROCEDURE Close;                                               Virtual;
-      PROCEDURE Reset;
-      PROCEDURE Flush;                                               Virtual;
-      PROCEDURE Truncate;                                            Virtual;
-      PROCEDURE Put (P: PObject);
-      PROCEDURE Seek (Pos: LongInt);                                 Virtual;
-      PROCEDURE StrWrite (P: PChar);
-      PROCEDURE WriteStr (P: PString);
-      PROCEDURE Open (OpenMode: Word);                               Virtual;
-      PROCEDURE Error (Code, Info: Integer);                         Virtual;
-      PROCEDURE Read (Var Buf; Count: Sw_Word);                      Virtual;
-      PROCEDURE Write (Var Buf; Count: Sw_Word);                     Virtual;
-      PROCEDURE CopyFrom (Var S: TStream; Count: Longint);
-   END;
-   PStream = ^TStream;
-
-TYPE
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ               TDosStream OBJECT - DOS FILE STREAM OBJECT                Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-   TDosStream = OBJECT (TStream)
-         Handle: Integer;                             { DOS file handle }
-         FName : AsciiZ;                              { AsciiZ filename }
-      CONSTRUCTOR Init (FileName: FNameStr; Mode: Word);
-      DESTRUCTOR Done;                                               Virtual;
-      FUNCTION GetPos: Longint;                                      Virtual;
-      FUNCTION GetSize: Longint;                                     Virtual;
-      PROCEDURE Close;                                               Virtual;
-      PROCEDURE Seek (Pos: LongInt);                                 Virtual;
-      PROCEDURE Open (OpenMode: Word);                               Virtual;
-      PROCEDURE Read (Var Buf; Count: Sw_Word);                      Virtual;
-      PROCEDURE Write (Var Buf; Count: Sw_Word);                     Virtual;
-   END;
-   PDosStream = ^TDosStream;
-
-TYPE
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ               TBufStream OBJECT - BUFFERED DOS FILE STREAM              Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-   TBufStream = OBJECT (TDosStream)
-   END;
-   PBufStream = ^TBufStream;
-
-TYPE
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                  TEmsStream OBJECT - EMS STREAM OBJECT                  Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-   TEmsStream = OBJECT (TStream)
-   END;
-   PEmsStream = ^TEmsStream;
-
-TYPE
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                  TXmsStream OBJECT - XMS STREAM OBJECT                  Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-   TXmsStream = OBJECT (TStream)
-   END;
-   PXmsStream = ^TXmsStream;
-
-TYPE
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ              TMemoryStream OBJECT - MEMORY STREAM OBJECT                Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-   TMemoryStream = OBJECT (TStream)
-   END;
-   PMemoryStream = ^TMemoryStream;
-
-TYPE
-  TItemList = Array [0..MaxCollectionSize - 1] Of Pointer;
-  PItemList = ^TItemList;
-
-{ ******************************* REMARK ****************************** }
-{    The changes here look worse than they are. The Sw_Integer simply   }
-{  switches between Integers and LongInts if switched between 16 and 32 }
-{  bit code. All existing code will compile without any changes.        }
-{ ****************************** END REMARK *** Leon de Boer, 10May96 * }
-
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ             TCollection OBJECT - COLLECTION ANCESTOR OBJECT             Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-   TCollection = OBJECT (TObject)
-         Items: PItemList;                            { Item list pointer }
-         Count: Sw_Integer;                           { Item count }
-         Limit: Sw_Integer;                           { Item limit count }
-         Delta: Sw_Integer;                           { Inc delta size }
-      CONSTRUCTOR Init (ALimit, ADelta: Sw_Integer);
-      CONSTRUCTOR Load (Var S: TStream);
-      DESTRUCTOR Done;                                               Virtual;
-      FUNCTION At (Index: Sw_Integer): Pointer;
-      FUNCTION IndexOf (Item: Pointer): Sw_Integer;                  Virtual;
-      FUNCTION GetItem (Var S: TStream): Pointer;                    Virtual;
-      FUNCTION LastThat (Test: Pointer): Pointer;
-      FUNCTION FirstThat (Test: Pointer): Pointer;
-      PROCEDURE Pack;
-      PROCEDURE FreeAll;
-      PROCEDURE DeleteAll;
-      PROCEDURE Free (Item: Pointer);
-      PROCEDURE Insert (Item: Pointer);                              Virtual;
-      PROCEDURE Delete (Item: Pointer);
-      PROCEDURE AtFree (Index: Sw_Integer);
-      PROCEDURE FreeItem (Item: Pointer);                            Virtual;
-      PROCEDURE AtDelete (Index: Sw_Integer);
-      PROCEDURE ForEach (Action: Pointer);
-      PROCEDURE SetLimit (ALimit: Sw_Integer);                       Virtual;
-      PROCEDURE Error (Code, Info: Integer);                         Virtual;
-      PROCEDURE AtPut (Index: Sw_Integer; Item: Pointer);
-      PROCEDURE AtInsert (Index: Sw_Integer; Item: Pointer);
-      PROCEDURE Store (Var S: TStream);
-      PROCEDURE PutItem (Var S: TStream; Item: Pointer);             Virtual;
-   END;
-   PCollection = ^TCollection;
-
-TYPE
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ         TSortedCollection OBJECT - SORTED COLLECTION ANCESTOR           Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-   TSortedCollection = OBJECT (TCollection)
-         Duplicates: Boolean;                         { Duplicates flag }
-      CONSTRUCTOR Init (ALimit, ADelta: Sw_Integer);
-      CONSTRUCTOR Load (Var S: TStream);
-      FUNCTION KeyOf (Item: Pointer): Pointer;                       Virtual;
-      FUNCTION IndexOf (Item: Pointer): Sw_Integer;                  Virtual;
-      FUNCTION Compare (Key1, Key2: Pointer): Sw_Integer;            Virtual;
-      FUNCTION Search (Key: Pointer; Var Index: Sw_Integer): Boolean;Virtual;
-      PROCEDURE Insert (Item: Pointer);                              Virtual;
-      PROCEDURE Store (Var S: TStream);
-   END;
-   PSortedCollection = ^TSortedCollection;
-
-TYPE
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ          TStringCollection OBJECT - STRING COLLECTION OBJECT            Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-   TStringCollection = OBJECT (TSortedCollection)
-      FUNCTION GetItem (Var S: TStream): Pointer;                    Virtual;
-      FUNCTION Compare (Key1, Key2: Pointer): Sw_Integer;            Virtual;
-      PROCEDURE FreeItem (Item: Pointer);                            Virtual;
-      PROCEDURE PutItem (Var S: TStream; Item: Pointer);             Virtual;
-   END;
-   PStringCollection = ^TStringCollection;
-
-TYPE
-{ ******************************* REMARK ****************************** }
-{    This is a completely NEW FREE VISION ONLY object which holds a     }
-{  collection of strings but does not alphabetically sort them. It is   }
-{  a very useful object as you will find !!!!                           }
-{ ****************************** END REMARK *** Leon de Boer, 15May96 * }
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ        TUnSortedStrCollection - UNSORTED STRING COLLECTION OBJECT       Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-   TUnSortedStrCollection = OBJECT (TStringCollection)
-      PROCEDURE Insert (Item: Pointer);                              Virtual;
-   END;
-   PUnSortedStrCollection = ^TUnSortedStrCollection;
-
-{***************************************************************************}
-{                            INTERFACE ROUTINES                             }
-{***************************************************************************}
-
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                   DYNAMIC STRING INTERFACE ROUTINES                     Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-FUNCTION NewStr (Const S: String): PString;
-PROCEDURE DisposeStr (P: PString);
-
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                       STREAM INTERFACE ROUTINES                         Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-PROCEDURE Abstract;
-PROCEDURE RegisterError;
-
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                     NEW FREE VISION STREAM ROUTINES                     Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-
-{ ******************************* REMARK ****************************** }
-{   This NEW FREE VISION call tries creating a stream in the order of   }
-{  the Strategy Mask and will return the successfully created stream    }
-{  or nil if it fails using the strategy given.                         }
-{ ****************************** END REMARK *** Leon de Boer, 15May96 * }
-FUNCTION CreateStream (Strategy: Word; ReqSize: LongInt): PStream;
-
-{ ******************************* REMARK ****************************** }
-{   As we have to provide these NEW FREE VISION CALLS as part of our    }
-{  stream support we might as well provide them on the interface! They  }
-{  mimic the behaviour of the OS2 API calls in most cases.              }
-{ ****************************** END REMARK *** Leon de Boer, 16May96 * }
-
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                    NEW FREE VISION DOS FILE ROUTINES                    Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-
-{=DosFileOpen=========================================================
-Calls the operating system to try to open the file denoted by the given
-AsciiZ filename in the requested file mode. Any error is held in
-DosStreamError and the call will return zero. If successful and no error
-occurs the call will return the file handle of the opened file.
--> Platforms DOS/DPMI/WIN - Checked 16May96 LdB
-=====================================================================}
-FUNCTION DosFileOpen (Var FileName: AsciiZ; Mode: Word): Word;
-
-{=DosRead============================================================
-Calls the operating system to read BufferLength bytes of data from
-the file denoted by the handle to the bufferarea. Any error in attempting
-to read from the file is held in DosStreamError and returned from call.
-If the return is zero (ie no error) BytesMoved contains the number of
-bytes read from the file.
--> Platforms DOS/DPMI/WIN - Checked 16May96 LdB
-=====================================================================}
-FUNCTION DosRead(Handle: Word; Var BufferArea; BufferLength: Sw_Word;
-Var BytesMoved: Sw_Word): Word;
-
-{=DosWrite===========================================================
-Calls the operating system to write to BufferLength bytes of data from
-the bufferarea to the file denoted by the handle. Any error in attempting
-to write to the file is held in DosStreamError and returned from call.
-If the return is zero (ie no error) BytesMoved contains the number of
-bytes written to the file.
--> Platforms DOS/DPMI/WIN - Checked 16May96 LdB
-=====================================================================}
-FUNCTION DosWrite(Handle: Word; Var BufferArea; BufferLength: Sw_Word;
-Var BytesMoved: Sw_Word): Word;
-
-{=DosSetFilePtr======================================================
-Calls the operating system to move the file denoted by the handle to
-to the requested position. The move method can be: 0 = absolute offset;
-1 = offset from present location; 2 = offset from end of file;
-Any error is held in DosErrorStream and returned from the call.
-If the return is zero (ie no error) NewPos contains the new absolute
-file position.
--> Platforms DOS/DPMI/WIN - Checked 16May96 LdB
-=====================================================================}
-FUNCTION DosSetFilePtr (Handle: Word; Pos: LongInt; MoveType: Word;
-Var NewPos: LongInt): Word;
-
-{=DosClose===========================================================
-Calls the operating system to close the file handle provided. Any error
-in attempting to close file is held DosErrorStream.
--> Platforms DOS/DPMI/WIN - Checked 16May96 LdB
-=====================================================================}
-PROCEDURE DosClose (Handle: Word);
-
-CONST
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                      INITIALIZED PUBLIC VARIABLES                       Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-   StreamError: Pointer = Nil;                        { Stream error ptr }
-{$IFDEF NotFPKPascal}
-   DosStreamError: Sw_Word = $0;                      { Dos stream error }
-{$ENDIF}
-
-{ ******************************* REMARK ****************************** }
-{  FPK does not accept local variables with it's assembler which means  }
-{  these have to be global. Can we please get this error fixed!!!!!     }
-{ ****************************** END REMARK *** Leon de Boer, 10May96 * }
-{$IFDEF FPKPascal}                                    { FPK Pascal compiler }
-VAR HoldEBP: Sw_Word; TransferHandle: Sw_Word;
-    DosStreamError: Sw_Word ;                         { Dos stream error }
-{$ENDIF}
-
-
-{<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>}
-                                IMPLEMENTATION
-{<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>}
-{$IFDEF Windows}                                      { WINDOWS CODE }
-USES WinTypes, WinProcs;                              { Standard units }
-{$ENDIF}
-
-{$IFDEF Speed}                                        { SPEED PASCAL CODE }
-USES BseDos;                                          { Speed Pascal def }
-{$ENDIF}
-
-{$IFDEF VirtualPascal}                                { VIRTUAL PASCAL CODE }
-USES OS2Base;                                         { Virtual Pascal base }
-{$ENDIF}
-
-{$IFDEF BPOS2}                                        { C'T PATCH TO BP CODE }
-
-   FUNCTION DosClose (Handle: Word): Word; FAR;
-     EXTERNAL 'DOSCALLS' Index 59;                    { Dos close function }
-
-   FUNCTION DosOpen (FileName: PChar; Var Handle: Word;
-     Var ActionTaken: Word; FileSize: LongInt;
-     FileAttr: Word; OpenFlag, OpenMode: Word;
-     Reserved: Pointer): Word; FAR;
-     EXTERNAL 'DOSCALLS' Index 70;                    { Dos open function }
-
-   FUNCTION DosRead(Handle: Word; Var BufferArea;
-     BufferLength: Word; Var BytesRead : Word): Word; FAR;
-     EXTERNAL 'DOSCALLS' Index 137;                   { Dos read procedure }
-
-   FUNCTION DosWrite(Handle: Word; Var BufferArea;
-     BufferLength: Word; Var BytesRead : Word): Word; FAR;
-     EXTERNAL 'DOSCALLS' Index 138;                   { Dos write procedure }
-
-   FUNCTION DosSetFilePtr (Handle: Word; ulOffset: LongInt;
-     MoveType: Word; Var NewPointer: LongInt): LongInt; FAR;
-     EXTERNAL 'DOSCALLS' Index 58;                    { Dos write procedure }
-{$ENDIF}
-
-{$IFDEF OS2}                                          { OS2 CODE }
-CONST
-{ Private Os2 File mode magic numbers }
-   FmInput  = $20;                                    { Open file for input }
-   FmOutput = $31;                                    { Open file for output }
-   FmInout  = $42;                                    { Open file }
-   FmClosed = $0;                                     { Close file }
-{$ENDIF}
-
-{$IFDEF DPMI}                                         { DPMI CODE }
-  {$DEFINE NewExeFormat}                              { New format EXE }
-{$ENDIF}
-
-{$IFDEF ADV_OS}                                       { WINDOWS/OS2 CODE }
-  {$DEFINE NewExeFormat}                              { New format EXE }
-{$ENDIF}
-
-CONST
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                     INITIALIZED PRIVATE VARIABLES                       Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-   StreamTypes: Sw_Word = $0;                         { Stream types }
-
-{***************************************************************************}
-{                               OBJECT METHODS                              }
-{***************************************************************************}
-
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                          TRect OBJECT METHODS                           Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-
-PROCEDURE CheckEmpty (Var Rect: TRect);
-{ ******************************* REMARK ****************************** }
-{  This is is my desired code but FPK does not like the with statement  }
-{  Can we please get this error fixed!!!!!                              }
-{ ****************************** END REMARK *** Leon de Boer, 10May96 * }
-{   With Rect Do Begin }
-{     If (A.X >= B.X) OR (A.Y >= B.Y) Then Begin    }   { Zero of reversed }
-{       A.X := 0;                                   }   { Clear a.x }
-{       A.Y := 0;                                   }   { Clear a.y }
-{       B.X := 0;                                   }   { Clear b.x }
-{       B.Y := 0;                                   }   { Clear b.y }
-{     End; }
-{   End; }
-BEGIN
-   If (Rect.A.X >= Rect.B.X) OR
-   (Rect.A.Y >= Rect.B.Y) Then Begin                  { Zero of reversed }
-     Rect.A.X := 0;                                   { Clear a.x }
-     Rect.A.Y := 0;                                   { Clear a.y }
-     Rect.B.X := 0;                                   { Clear b.x }
-     Rect.B.Y := 0;                                   { Clear b.y }
-   End;
-END;
-
-{ ******************************* REMARK ****************************** }
-{  This is a bug fix of EMPTY from the original code which was:         }
-{  Empty := (A.X = B.X) AND (A.Y = B.Y)                                 }
-{ ****************************** END REMARK *** Leon de Boer, 10May96 * }
-
-{**TRect********************************************************************}
-{  Empty -> Platforms DOS/DPMI/WIN/OS2 - Checked 10May96 LdB                }
-{***************************************************************************}
-FUNCTION TRect.Empty: Boolean;
-BEGIN
-   Empty := (A.X >= B.X) OR (A.Y >= B.Y);             { Empty result }
-END;
-
-{**TRect********************************************************************}
-{  Equals -> Platforms DOS/DPMI/WIN/OS2 - Checked 10May96 LdB               }
-{***************************************************************************}
-FUNCTION TRect.Equals (R: TRect): Boolean;
-BEGIN
-   Equals := (A.X = R.A.X) AND (A.Y = R.A.Y) AND
-   (B.X = R.B.X) AND (B.Y = R.B.Y);                   { Equals result }
-END;
-
-{ ******************************* REMARK ****************************** }
-{  This is a bug fix of Contains from the original code which was:      }
-{   Contains := (P.X >= A.X) AND (P.X <= B.X) AND                       }
-{     (P.Y >= A.Y) AND (P.Y <= B.Y)                                     }
-{ ****************************** END REMARK *** Leon de Boer, 10May96 * }
-
-{**TRect********************************************************************}
-{  Contains -> Platforms DOS/DPMI/WIN/OS2 - Checked 10May96 LdB             }
-{***************************************************************************}
-FUNCTION TRect.Contains (P: TPoint): Boolean;
-BEGIN
-   Contains := (P.X >= A.X) AND (P.X < B.X) AND
-     (P.Y >= A.Y) AND (P.Y < B.Y);                    { Contains result }
-END;
-
-{**TRect********************************************************************}
-{  Copy -> Platforms DOS/DPMI/WIN/OS2 - Checked 10May96 LdB                 }
-{***************************************************************************}
-PROCEDURE TRect.Copy (R: TRect);
-BEGIN
-   A := R.A;                                          { Copy point a }
-   B := R.B;                                          { Copy point b }
-END;
-
-{**TRect********************************************************************}
-{  Union -> Platforms DOS/DPMI/WIN/OS2 - Checked 10May96 LdB                }
-{***************************************************************************}
-PROCEDURE TRect.Union (R: TRect);
-BEGIN
-   If (R.A.X < A.X) Then A.X := R.A.X;                { Take if smaller }
-   If (R.A.Y < A.Y) Then A.Y := R.A.Y;                { Take if smaller }
-   If (R.B.X > B.X) Then B.X := R.B.X;                { Take if larger }
-   If (R.B.Y > B.Y) Then B.Y := R.B.Y;                { Take if larger }
-END;
-
-{**TRect********************************************************************}
-{  Intersect -> Platforms DOS/DPMI/WIN/OS2 - Checked 10May96 LdB            }
-{***************************************************************************}
-PROCEDURE TRect.Intersect (R: TRect);
-BEGIN
-   If (R.A.X > A.X) Then A.X := R.A.X;                { Take if larger }
-   If (R.A.Y > A.Y) Then A.Y := R.A.Y;                { Take if larger }
-   If (R.B.X < B.X) Then B.X := R.B.X;                { Take if smaller }
-   If (R.B.Y < B.Y) Then B.Y := R.B.Y;                { Take if smaller }
-   CheckEmpty(Self);                                  { Check if empty }
-END;
-
-{**TRect********************************************************************}
-{  Move -> Platforms DOS/DPMI/WIN/OS2 - Checked 10May96 LdB                 }
-{***************************************************************************}
-PROCEDURE TRect.Move (ADX, ADY: Integer);
-BEGIN
-   Inc(A.X, ADX);                                     { Adjust A.X }
-   Inc(A.Y, ADY);                                     { Adjust A.Y }
-   Inc(B.X, ADX);                                     { Adjust B.X }
-   Inc(B.Y, ADY);                                     { Adjust B.Y }
-END;
-
-{**TRect********************************************************************}
-{  Grow -> Platforms DOS/DPMI/WIN/OS2 - Checked 10May96 LdB                 }
-{***************************************************************************}
-PROCEDURE TRect.Grow (ADX, ADY: Integer);
-BEGIN
-   Dec(A.X, ADX);                                     { Adjust A.X }
-   Dec(A.Y, ADY);                                     { Adjust A.Y }
-   Inc(B.X, ADX);                                     { Adjust B.X }
-   Inc(B.Y, ADY);                                     { Adjust B.Y }
-   CheckEmpty(Self);                                  { Check if empty }
-END;
-
-{**TRect********************************************************************}
-{  Assign -> Platforms DOS/DPMI/WIN/OS2 - Checked 10May96 LdB               }
-{***************************************************************************}
-PROCEDURE TRect.Assign (XA, YA, XB, YB: Integer);
-BEGIN
-   A.X := XA;                                         { Hold A.X value }
-   A.Y := YA;                                         { Hold A.Y value }
-   B.X := XB;                                         { Hold B.X value }
-   B.Y := YB;                                         { Hold B.Y value }
-END;
-
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                          TObject OBJECT METHODS                         Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-
-TYPE
-   DummyObject = OBJECT (TObject)                     { Internal object }
-     Data: RECORD END;                                { Helps size VMT link }
-   END;
-
-{ ******************************* REMARK ****************************** }
-{ I Prefer this code because it self sizes VMT link rather than using a }
-{ fixed record structure thus it should work on all compilers without a }
-{ specific record to match each compiler.                               }
-{ ****************************** END REMARK *** Leon de Boer, 10May96 * }
-CONSTRUCTOR TObject.Init;
-VAR LinkSize: LongInt; Dummy: DummyObject;
-BEGIN
-   LinkSize := LongInt(@Dummy.Data)-LongInt(@Dummy);  { Calc VMT link size }
-   FillChar(Pointer(LongInt(@Self)+LinkSize)^,
-     SizeOf(Self)-LinkSize, #0);                      { Clear data fields }
-END;
-
-{**TObject******************************************************************}
-{  Free -> Platforms DOS/DPMI/WIN/OS2 - Checked 10May96 LdB                 }
-{***************************************************************************}
-PROCEDURE TObject.Free;
-BEGIN
-   Dispose(PObject(@Self), Done);                     { Dispose of self }
-END;
-
-{**TObject******************************************************************}
-{  Done -> Platforms DOS/DPMI/WIN/OS2 - Checked 10May96 LdB                 }
-{***************************************************************************}
-DESTRUCTOR TObject.Done;
-BEGIN                                                 { Abstract method }
-END;
-
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                          TStream OBJECT METHODS                         Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-
-{ ******************************* REMARK ****************************** }
-{  Bug fix of TStream.StrRead from the original code which was:         }
-{  GetMem(P, L+1) can fail and return Nil which should be checked!      }
-{ ****************************** END REMARK *** Leon de Boer, 10May96 * }
-
-{**TStream******************************************************************}
-{  StrRead -> Platforms DOS/DPMI/WIN/OS2 - Checked 10May96 LdB              }
-{***************************************************************************}
-FUNCTION TStream.StrRead: PChar;
-VAR L: Word; P: PChar;
-BEGIN
-   Read(L, SizeOf(L));                                { Read length }
-   If (L=0) Then StrRead := Nil Else Begin            { Check for empty }
-     GetMem(P, L + 1);                                { Allocate memory }
-     If (P<>Nil) Then Begin                           { Check allocate okay }
-       Read(P[0], L);                                 { Read the data }
-       P[L] := #0;                                    { Terminate with #0 }
-     End;
-     StrRead := P;                                    { Return PChar }
-   End;
-END;
-
-{ ******************************* REMARK ****************************** }
-{  Bug fix of TStream.ReadStr from the original code which was:         }
-{  GetMem(P, L+1) can fail and return Nil which should be checked!      }
-{ ****************************** END REMARK *** Leon de Boer, 10May96 * }
-
-{**TStream******************************************************************}
-{  ReadStr -> Platforms DOS/DPMI/WIN/OS2 - Checked 10May96 LdB              }
-{***************************************************************************}
-FUNCTION TStream.ReadStr: PString;
-VAR L: Byte; P: PString;
-BEGIN
-   Read(L, 1);                                        { Read string length }
-   If (L > 0) Then Begin
-     GetMem(P, L + 1);                                { Allocate memory }
-     If (P<>Nil) Then Begin                           { Check allocate okay }
-       P^[0] := Char(L);                              { Hold length }
-       Read(P^[1], L);                                { Read string data }
-     End;
-     ReadStr := P;                                    { Return string ptr }
-   End Else ReadStr := Nil;
-END;
-
-{**TStream******************************************************************}
-{  GetPos -> Platforms DOS/DPMI/WIN/OS2 - Checked 10May96 LdB               }
-{***************************************************************************}
-FUNCTION TStream.GetPos: LongInt;
-BEGIN                                                 { Abstract method }
-   Abstract;                                          { Abstract error }
-END;
-
-{**TStream******************************************************************}
-{  GetSize -> Platforms DOS/DPMI/WIN/OS2 - Checked 10May96 LdB              }
-{***************************************************************************}
-FUNCTION TStream.GetSize: LongInt;
-BEGIN                                                 { Abstract method }
-   Abstract;                                          { Abstract error }
-END;
-
-{**TStream******************************************************************}
-{  Close -> Platforms DOS/DPMI/WIN/OS2 - Checked 10May96 LdB                }
-{***************************************************************************}
-PROCEDURE TStream.Close;
-BEGIN                                                 { Abstract method }
-END;
-
-{**TStream******************************************************************}
-{  Reset -> Platforms DOS/DPMI/WIN/OS2 - Checked 10May96 LdB                }
-{***************************************************************************}
-PROCEDURE TStream.Reset;
-BEGIN
-   Status := 0;                                       { Clear status }
-   ErrorInfo := 0;                                    { Clear error info }
-END;
-
-{**TStream******************************************************************}
-{  Flush -> Platforms DOS/DPMI/WIN/OS2 - Checked 10May96 LdB                }
-{***************************************************************************}
-PROCEDURE TStream.Flush;
-BEGIN                                                 { Abstract method }
-END;
-
-{**TStream******************************************************************}
-{  Truncate -> Platforms DOS/DPMI/WIN/OS2 - Checked 10May96 LdB             }
-{***************************************************************************}
-PROCEDURE TStream.Truncate;
-BEGIN
-   Abstract;                                          { Abstract error }
-END;
-
-{**TStream******************************************************************}
-{  Seek -> Platforms DOS/DPMI/WIN/OS2 - Checked 10May96 LdB                 }
-{***************************************************************************}
-PROCEDURE TStream.Seek (Pos: LongInt);
-BEGIN
-   Abstract;                                          { Abstract error }
-END;
-
-{**TStream******************************************************************}
-{  StrWrite -> Platforms DOS/DPMI/WIN/OS2 - Checked 10May96 LdB             }
-{***************************************************************************}
-PROCEDURE TStream.StrWrite (P: PChar);
-VAR L: Word; Q: PByteArray;
-BEGIN
-   L := 0;                                            { Preset no size }
-   Q := PByteArray(P);                                { Transfer type }
-   If (Q<>Nil) Then While (Q^[L]<>0) Do Inc(L);       { Calc PChar length }
-   Write(L, SizeOf(L));                               { Store PChar length }
-   If (P<>Nil) Then Write(P[0], L);                   { Write data }
-END;
-
-{**TStream******************************************************************}
-{  WriteStr -> Platforms DOS/DPMI/WIN/OS2 - Checked 10May96 LdB             }
-{***************************************************************************}
-PROCEDURE TStream.WriteStr (P: PString);
-CONST Empty: String[1] = '';
-BEGIN
-   If (P<>Nil) Then Write(P^, Length(P^) + 1)         { Write string }
-     Else Write(Empty, 1);                            { Write empty string }
-END;
-
-{**TStream******************************************************************}
-{  Open -> Platforms DOS/DPMI/WIN/OS2 - Checked 10May96 LdB                 }
-{***************************************************************************}
-PROCEDURE TStream.Open (OpenMode: Word);
-BEGIN                                                 { Abstract method }
-END;
-
-{**TStream******************************************************************}
-{  Error -> Platforms DOS/DPMI/WIN/OS2 - Checked 10May96 LdB                }
-{***************************************************************************}
-PROCEDURE TStream.Error (Code, Info: Integer);
-TYPE TErrorProc = Procedure(Var S: TStream);
-BEGIN
-   Status := Code;                                    { Hold error code }
-   ErrorInfo := Info;                                 { Hold error info }
-   If (StreamError<>Nil) Then
-     TErrorProc(StreamError)(Self);                   { Call error ptr }
-END;
-
-{**TStream******************************************************************}
-{  Read -> Platforms DOS/DPMI/WIN/OS2 - Checked 10May96 LdB                 }
-{***************************************************************************}
-PROCEDURE TStream.Read (Var Buf; Count: Sw_Word);
-BEGIN
-   Abstract;                                          { Abstract error }
-END;
-
-{**TStream******************************************************************}
-{  Write -> Platforms DOS/DPMI/WIN/OS2 - Checked 10May96 LdB                }
-{***************************************************************************}
-PROCEDURE TStream.Write (Var Buf; Count: Sw_Word);
-BEGIN
-   Abstract;                                          { Abstract error }
-END;
-
-{**TStream******************************************************************}
-{  CopyFrom -> Platforms DOS/DPMI/WIN/OS2 - Checked 10May96 LdB             }
-{***************************************************************************}
-PROCEDURE TStream.CopyFrom (Var S: TStream; Count: Longint);
-VAR W: Word; Buffer: Array[0..1023] of Byte;
-BEGIN
-   While (Count > 0) Do Begin
-     If (Count > SizeOf(Buffer)) Then                 { To much data }
-       W := SizeOf(Buffer) Else W := Count;           { Size to transfer }
-     S.Read(Buffer, W);                               { Read from stream }
-     Write(Buffer, W);                                { Write to stream }
-     Dec(Count, W);                                   { Dec write count }
-   End;
-END;
-
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                        TDosStream OBJECT METHODS                        Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-
-{**TDosStream***************************************************************}
-{  Init -> Platforms DOS/DPMI/WIN/OS2 - Checked 16May96 LdB                 }
-{***************************************************************************}
-CONSTRUCTOR TDosStream.Init (FileName: FNameStr; Mode: Word);
-BEGIN
-   Inherited Init;                                    { Call ancestor }
-   {$IFDEF Windows}
-   AnsiToOem(FileName, FName);                        { Ansi to OEM }
-   {$ELSE}
-   FileName := FileName+#0;                           { Make asciiz }
-   Move(FileName[1], FName, Length(FileName));        { Create asciiz name }
-   {$ENDIF}
-   Handle := DosFileOpen(FName, Mode);                { Open the file }
-   If (Handle=0) Then Begin                           { Open failed }
-     Error(stInitError, DosStreamError);              { Call error }
-     Status := stInitError;                           { Set fail status }
-     Handle := -1;                                    { Set invalid handle }
-   End;
-END;
-
-{**TDosStream***************************************************************}
-{  Done -> Platforms DOS/DPMI/WIN/OS2 - Checked 16May96 LdB                 }
-{***************************************************************************}
-DESTRUCTOR TDosStream.Done;
-BEGIN
-   If (Handle <> -1) Then DosClose(Handle);           { Close the file }
-   Inherited Done;                                    { Call ancestor }
-END;
-
-{**TDosStream***************************************************************}
-{  GetPos -> Platforms DOS/DPMI/WIN/OS2 - Checked 16May96 LdB               }
-{***************************************************************************}
-FUNCTION TDosStream.GetPos: LongInt;
-VAR NewPosition: LongInt;
-BEGIN
-   If (Status=stOk) Then Begin                        { Check status okay }
-     If (Handle = -1) Then DosStreamError := 103      { File not open }
-       Else DosStreamError := DosSetFilePtr(Handle,
-        0, 1, NewPosition);                           { Get file position }
-     If (DosStreamError<>0) Then Begin                { Check for error }
-        Error(stError, DosStreamError);               { Identify error }
-        NewPosition := -1;                            { Invalidate position }
-     End;
-     GetPos := NewPosition;                           { Return file position }
-   End Else GetPos := -1;                             { Stream in error }
-END;
-
-{**TDosStream***************************************************************}
-{  GetSize -> Platforms DOS/DPMI/WIN/OS2 - Checked 16May96 LdB              }
-{***************************************************************************}
-FUNCTION TDosStream.GetSize: LongInt;
-VAR CurrentPos, FileEndPos: LongInt;
-BEGIN
-   If (Status=stOk) Then Begin                        { Check status okay }
-     If (Handle = -1) Then DosStreamError := 103      { File not open }
-       Else DosStreamError := DosSetFilePtr(Handle,
-        0, 1, CurrentPos);                            { Current position }
-     If (DosStreamError=0) Then Begin                 { Check no errors }
-        DosStreamError := DosSetFilePtr(Handle, 0, 2,
-          FileEndPos);                                { Locate end of file }
-        If (DosStreamError=0) Then
-          DosSetFilePtr(Handle, 0, 1, CurrentPos);    { Reset position }
-     End;
-     If (DosStreamError<>0) Then Begin                { Check for error }
-        Error(stError, DosStreamError);               { Identify error }
-        FileEndPos := -1;                             { Invalidate size }
-     End;
-     GetSize := FileEndPos;                           { Return file size }
-   End Else GetSize := -1;                            { Stream in error }
-END;
-
-{**TDosStream***************************************************************}
-{  Close -> Platforms DOS/DPMI/WIN/OS2 - Checked 16May96 LdB                }
-{***************************************************************************}
-PROCEDURE TDosStream.Close;
-BEGIN
-   If (Handle <> -1) Then DosClose(Handle);           { Close the file }
-   Handle := -1;                                      { Handle now invalid }
-END;
-
-{**TDosStream***************************************************************}
-{  Seek -> Platforms DOS/DPMI/WIN/OS2 - Checked 16May96 LdB                 }
-{***************************************************************************}
-PROCEDURE TDosStream.Seek (Pos: LongInt);
-VAR NewPosition: LongInt;
-BEGIN
-   If (Status=stOk) Then Begin                        { Check status okay }
-     If (Pos < 0) Then Pos := 0;                      { Negatives removed }
-     If (Handle = -1) Then DosStreamError := 103      { File not open }
-       Else DosStreamError := DosSetFilePtr(Handle,
-         Pos, 0, NewPosition);                        { Set file position }
-     If ((DosStreamError<>0) OR (NewPosition<>Pos))   { We have an error }
-     Then Begin
-       If (DosStreamError<>0) Then                    { Error was detected }
-         Error(stError, DosStreamError)               { Specific seek error }
-         Else Error(stSeekError, 0);                  { General seek error }
-     End;
-   End;
-END;
-
-{**TDosStream***************************************************************}
-{  Open -> Platforms DOS/DPMI/WIN/OS2 - Checked 16May96 LdB                 }
-{***************************************************************************}
-PROCEDURE TDosStream.Open (OpenMode: Word);
-BEGIN
-   If (Handle = -1) Then Begin                        { File not open }
-     Handle := DosFileOpen(FName, OpenMode);          { Open the file }
-     If (Handle=0) Then Begin                         { File open failed }
-       Error(stOpenError, DosStreamError);            { Call error }
-       Handle := -1;                                  { Set invalid handle }
-     End;
-   End;
-END;
-
-{**TDosStream***************************************************************}
-{  Read -> Platforms DOS/DPMI/WIN/OS2 - Checked 16May96 LdB                 }
-{***************************************************************************}
-PROCEDURE TDosStream.Read (Var Buf; Count: Sw_Word);
-VAR BytesMoved: Sw_Word;
-BEGIN
-   If (Status=stOk) Then Begin                        { Check status }
-     If (Handle = -1) Then BytesMoved := 0 Else       { File not open }
-       DosStreamError := DosRead(Handle, Buf, Count,
-         BytesMoved);                                 { Read from file }
-     If ((DosStreamError<>0) OR (BytesMoved<>Count))  { We have an error }
-     Then Begin
-       If (DosStreamError<>0) Then                    { Error was detected }
-         Error(stError, DosStreamError)               { Specific read error }
-         Else Error(stReadError, 0);                  { General read error }
-     End;
-   End Else FillChar(Buf, Count, #0);                 { Error clear buffer }
-END;
-
-{**TDosStream***************************************************************}
-{  Write -> Platforms DOS/DPMI/WIN/OS2 - Checked 16May96 LdB                }
-{***************************************************************************}
-PROCEDURE TDosStream.Write (Var Buf; Count: Sw_Word);
-VAR BytesMoved: Sw_Word;
-BEGIN
-   If (Status=stOk) Then Begin
-     If (Handle=-1) Then BytesMoved := 0 Else         { File not open }
-       DosStreamError := DosWrite(Handle, Buf, Count,
-         BytesMoved);                                 { Write to file }
-     If ((DosStreamError<>0) OR (BytesMoved<>Count))  { We have an error }
-     Then Begin
-       If (DosStreamError<>0) Then                    { Error was detected }
-         Error(stError, DosStreamError)               { Specific write error }
-         Else Error(stWriteError, 0);                 { General write error }
-     End;
-   End;
-END;
-
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                      TCollection OBJECT METHODS                         Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-
-CONSTRUCTOR TCollection.Init (ALimit, ADelta: Sw_Integer);
-BEGIN
-   Inherited Init;                                    { Call ancestor }
-   Delta := ADelta;                                   { Set increment }
-   SetLimit(ALimit);                                  { Set limit }
-END;
-
-CONSTRUCTOR TCollection.Load (Var S: TStream);
-VAR C, I: Sw_Integer;
-BEGIN
-   S.Read(Count, SizeOf(Count));                      { Read count }
-   S.Read(Limit, SizeOf(Limit));                      { Read limit }
-   S.Read(Delta, SizeOf(Delta));                      { Read delta }
-   Items := Nil;                                      { Clear item pointer }
-   C := Count;                                        { Hold count }
-   I := Limit;                                        { Hold limit }
-   Count := 0;                                        { Clear count }
-   Limit := 0;                                        { Clear limit }
-   SetLimit(I);                                       { Set requested limit }
-   Count := C;                                        { Set count }
-   For I := 0 To C-1 Do AtPut(I, GetItem(S));         { Get each item }
-END;
-
-DESTRUCTOR TCollection.Done;
-BEGIN
-   FreeAll;                                           { Free all items }
-   SetLimit(0);                                       { Release all memory }
-END;
-
-FUNCTION TCollection.At (Index: Sw_Integer): Pointer;
-BEGIN
-   If (Index < 0) OR (Index >= Count) Then Begin      { Invalid index }
-     Error(coIndexError, Index);                      { Call error }
-     At := Nil;                                       { Return nil }
-   End Else At := Items^[Index];                      { Return item }
-END;
-
-{ ******************************* REMARK ****************************** }
-{  Bug fix of TCollection.IndexOf from the original code which was:     }
-{  For I := 0 To Count-1 Do  <- What happens if count=0!!!!             }
-{ ****************************** END REMARK *** Leon de Boer, 10May96 * }
-FUNCTION TCollection.IndexOf (Item: Pointer): Sw_Integer;
-VAR I: Sw_Integer;
-BEGIN
-   If (Count>0) Then Begin                            { Count is positive }
-     For I := 0 To Count-1 Do                         { For each item }
-       If (Items^[I]=Item) Then Begin                 { Look for match }
-         IndexOf := I;                                { Return index }
-         Exit;                                        { Now exit }
-       End;
-   End;
-   IndexOf := -1;                                     { Return index }
-END;
-
-FUNCTION TCollection.GetItem (Var S: TStream): Pointer;
-BEGIN
-   GetItem := S.Get;                                  { Item off stream }
-END;
-
-FUNCTION TCollection.LastThat (Test: Pointer): Pointer;
-VAR I: LongInt; P: FuncPtr; {$IFDEF NotFPKPascal} Hold_EBP: Sw_Word; {$ENDIF}
-BEGIN
-   {$IFDEF FPKPascal}                                 { FPK pascal compiler }
-   ASM
-     MOVL (%EBP), %EAX;                               { Load EBP }
-     MOVL %EAX, U_OBJECTS_HOLDEBP;                    { Store to global }
-   END;
-   {$ELSE}                                            { Other compilers }
-   ASM
-     {$IFNDEF CODE_32_BIT}                            { 16 BIT CODE }
-       MOV AX, [BP];                                  { Load AX from BP }
-       {$IFDEF Windows}
-       AND AL, 0FEH;                                  { Windows make even }
-       {$ENDIF}
-       MOV Hold_EBP, AX;                              { Hold value }
-     {$ELSE}                                          { 32 BIT CODE }
-       MOV EAX, [EBP];                                { Load EAX from EBP }
-       MOV Hold_EBP, EAX;                             { Hold value }
-     {$ENDIF}
-   END;
-   {$ENDIF}
-   P := FuncPtr(Test);                                { Set function ptr }
-   For I := Count DownTo 1 Do Begin                   { Down from last item }
-     {$IFDEF FPKPascal}
-       {$$$$$ crahes the compiler
-       If P(Items^[I-1], HoldEBP) Then
-       } Begin          { Test each item }
-     {$ELSE}
-       {$IFDEF VirtualPascal}
-         If P(Items^[I-1]) Then Begin                 { Test each item }
-       {$ELSE}
-         If P(Items^[I-1], Hold_EBP) Then Begin       { Test each item }
-       {$ENDIF}
-     {$ENDIF}
-       LastThat := Items^[I-1];                       { Return item }
-       Exit;                                          { Now exit }
-     End;
-   End;
-   LastThat := Nil;                                   { None passed test }
-END;
-
-FUNCTION TCollection.FirstThat (Test: Pointer): Pointer;
-VAR I: LongInt; P: FuncPtr; {$IFDEF NotFPKPascal} Hold_EBP: Sw_Word; {$ENDIF}
-BEGIN
-   {$IFDEF FPKPascal}                                 { FPK pascal compiler }
-   ASM
-     MOVL (%EBP), %EAX;                               { Load EBP }
-     MOVL %EAX, U_OBJECTS_HOLDEBP;                    { Store to global }
-   END;
-   {$ELSE}                                            { Other compilers }
-   ASM
-     {$IFNDEF CODE_32_BIT}                            { 16 BIT CODE }
-       MOV AX, [BP];                                  { Load AX from BP }
-       {$IFDEF Windows}
-       AND AL, 0FEH;                                  { Windows make even }
-       {$ENDIF}
-       MOV Hold_EBP, AX;                              { Hold value }
-     {$ELSE}                                          { 32 BIT CODE }
-       MOV EAX, [EBP];                                { Load EAX from EBP }
-       MOV Hold_EBP, EAX;                             { Hold value }
-     {$ENDIF}
-   END;
-   {$ENDIF}
-   P := FuncPtr(Test);                                { Set function ptr }
-   For I := 1 To Count Do Begin                       { Up from first item }
-     {$IFDEF FPKPascal}
-       {$$$$$$ crashes the compiler
-       If P(Items^[I-1], HoldEBP) Then }
-       Begin          { Test each item }
-     {$ELSE}
-       {$IFDEF VirtualPascal}
-         If P(Items^[I-1]) Then Begin                 { Test each item }
-       {$ELSE}
-         If P(Items^[I-1], Hold_EBP) Then Begin       { Test each item }
-       {$ENDIF}
-     {$ENDIF}
-       FirstThat := Items^[I-1];                      { Return item }
-       Exit;                                          { Now exit }
-     End;
-   End;
-   FirstThat := Nil;                                  { None passed test }
-END;
-
-{ ******************************* REMARK ****************************** }
-{  Bug fix of TCollection.Pack from the original code which was:        }
-{  While (I<Count) Do  -  Yes but who forget to initialize variable I   }
-{  If count is equal to zero this was going to crash big time and you   }
-{  must re-adjust the count value - Basically it was stuffed!!!         }
-{ ****************************** END REMARK *** Leon de Boer, 10May96 * }
-PROCEDURE TCollection.Pack;
-VAR I, J: Sw_Integer;
-BEGIN
-   If (Count>0) Then Begin                            { Count is positive }
-     I := 0;                                          { Initialize dest }
-     For J := 1 To Count Do Begin                     { For each item }
-       If (Items^[J]<>Nil) Then Begin                 { Entry is non nil }
-         Items^[I] := Items^[J];                      { Transfer item }
-         Inc(I);                                      { Advance dest }
-       End;
-     End;
-     Count := I;                                      { Adjust count }
-   End;
-END;
-
-PROCEDURE TCollection.FreeAll;
-VAR I: Sw_Integer;
-BEGIN
-   For I := 0 To Count-1 Do FreeItem(At(I));          { Release each item }
-   Count := 0;                                        { Clear item count }
-END;
-
-PROCEDURE TCollection.DeleteAll;
-BEGIN
-   Count := 0;                                        { Clear item count }
-END;
-
-PROCEDURE TCollection.Free (Item: Pointer);
-BEGIN
-   Delete(Item);                                      { Delete from list }
-   FreeItem(Item);                                    { Free the item }
-END;
-
-PROCEDURE TCollection.Insert (Item: Pointer);
-BEGIN
-   AtInsert(Count, Item);                             { Insert item }
-END;
-
-PROCEDURE TCollection.Delete (Item: Pointer);
-BEGIN
-   AtDelete(IndexOf(Item));                           { Delete from list }
-END;
-
-PROCEDURE TCollection.AtFree (Index: Sw_Integer);
-VAR Item: Pointer;
-BEGIN
-   Item := At(Index);                                 { Retreive item ptr }
-   AtDelete(Index);                                   { Delete item }
-   FreeItem(Item);                                    { Free the item }
-END;
-
-PROCEDURE TCollection.FreeItem (Item: Pointer);
-VAR P: PObject;
-BEGIN
-   P := PObject(Item);                                { Convert pointer }
-   If (P<>Nil) Then Dispose(P, Done);                 { Dispose of object }
-END;
-
-PROCEDURE TCollection.AtDelete (Index: Sw_Integer);
-BEGIN
-   If (Index >= 0) AND (Index < Count) Then Begin     { Valid index }
-     Dec(Count);                                      { One less item }
-     If (Count>Index) Then Move(Items^[Index+1],
-      Items^[Index], (Count-Index)*Sizeof(Pointer));  { Shuffle items down }
-   End Else Error(coIndexError, Index);               { Index error }
-END;
-
-PROCEDURE TCollection.ForEach (Action: Pointer);
-VAR I: LongInt; P: ProcPtr; {$IFDEF NotFPKPascal} Hold_EBP: Sw_Word; {$ENDIF}
-BEGIN
-   {$IFDEF FPKPascal}                                 { FPK pascal compiler }
-   ASM
-     MOVL (%EBP), %EAX;                               { Load EBP }
-     MOVL %EAX, U_OBJECTS_HOLDEBP;                    { Store to global }
-   END;
-   {$ELSE}                                            { Other compilers }
-   ASM
-     {$IFNDEF CODE_32_BIT}                            { 16 BIT CODE }
-       MOV AX, [BP];
-       {$IFDEF WINDOWS}
-       AND AL, 0FEH;                                  { Windows make even }
-       {$ENDIF}
-       MOV Hold_EBP, AX;                              { Hold value }
-     {$ELSE}                                          { 32 BIT CODE }
-       MOV EAX, [EBP];                                { Load EAX from EBP }
-       MOV Hold_EBP, EAX;                             { Hold value }
-     {$ENDIF}
-   END;
-   {$ENDIF}
-   P := ProcPtr(Action);                              { Set procedure ptr }
-   For I := 1 To Count Do                             { Up from first item }
-     {$IFDEF FPKPascal}
-       P(Items^[I-1], HoldEBP);                       { Call with each item }
-     {$ELSE}
-       {$IFDEF VirtualPascal}
-         P(Items^[I-1]);                              { Call with each item }
-       {$ELSE}
-         P(Items^[I-1], Hold_EBP);                    { Call with each item }
-       {$ENDIF}
-    {$ENDIF}
-END;
-
-{ ******************************* REMARK ****************************** }
-{  Bug fix of TCollection.SetLimit from the original code which was:    }
-{  getmem(p,alimit*sizeof(pointer));  <- This can fail OR ALimit=0      }
-{  move(items^,p^,count*sizeof(Pointer)); <- This would now crash!      }
-{ ****************************** END REMARK *** Leon de Boer, 10May96 * }
-PROCEDURE TCollection.SetLimit (ALimit: Sw_Integer);
-VAR AItems: PItemList;
-BEGIN
-   If (ALimit < Count) Then ALimit := Count;          { Stop underflow }
-   If (ALimit > MaxCollectionSize) Then
-     ALimit := MaxCollectionSize;                     { Stop overflow }
-   If (ALimit <> Limit) Then Begin                    { Limits differ }
-     If (ALimit = 0) Then AItems := Nil Else          { Alimit=0 nil entry }
-       GetMem(AItems, ALimit * SizeOf(Pointer));      { Allocate memory }
-     If (AItems<>Nil) OR (ALimit=0) Then Begin        { Check success }
-       If (AItems <>Nil) AND (Items <> Nil) Then      { Check both valid }
-         Move(Items^, AItems^, Count*SizeOf(Pointer));{ Move existing items }
-       If (Limit <> 0) AND (Items <> Nil) Then        { Check old allocation }
-         FreeMem(Items, Limit * SizeOf(Pointer));     { Release memory }
-       Items := AItems;                               { Update items }
-       Limit := ALimit;                               { Set limits }
-     End;
-   End;
-END;
-
-PROCEDURE TCollection.Error (Code, Info: Integer);
-BEGIN
-   RunError(212 - Code);                              { Run error }
-END;
-
-PROCEDURE TCollection.AtPut (Index: Sw_Integer; Item: Pointer);
-BEGIN
-   If (Index >= 0) AND (Index < Count) Then           { Index valid }
-     Items^[Index] := Item                            { Put item in index }
-     Else Error(coIndexError, Index);                 { Index error }
-END;
-
-{ ******************************* REMARK ****************************** }
-{  Bug fix of TCollection.AtInsert from the original code which was:    }
-{  original remark: copy old items, count is tested by move             }
-{  Move(Items^[Index], Items^[Index+1],(Count-Index)*Sizeof(Pointer));  }
-{  This does not work you must work from the back down!!!!              }
-{ ****************************** END REMARK *** Leon de Boer, 10May96 * }
-PROCEDURE TCollection.AtInsert (Index: Sw_Integer; Item: Pointer);
-VAR I: Sw_Integer;
-BEGIN
-   If (Index >= 0) AND (Index <= Count) Then Begin    { Valid index }
-     If (Count=Limit) Then  SetLimit(Limit+Delta);    { Expand size if able }
-     If (Limit>Count) Then Begin
-       If (Index < Count) Then Begin                  { Not last item }
-         For I := Count DownTo Index Do               { Start from back }
-           Items^[I] := Items^[I-1];                  { Move each item }
-       End;
-       Items^[Index] := Item;                         { Put item in list }
-       Inc(Count);                                    { Inc count }
-     End Else Error(coOverflow, Index);               { Expand failed }
-   End Else Error(coIndexError, Index);               { Index error }
-END;
-
-PROCEDURE TCollection.Store (Var S: TStream);
-
-   PROCEDURE DoPutItem (P: Pointer); FAR;
-   BEGIN
-     PutItem(S, P);                                   { Put item on stream }
-   END;
-
-BEGIN
-   S.Write(Count, SizeOf(Count));                     { Write count }
-   S.Write(Limit, SizeOf(Limit));                     { Write limit }
-   S.Write(Delta, SizeOf(Delta));                     { Write delta }
-   ForEach(@DoPutItem);                               { Each item to stream }
-END;
-
-PROCEDURE TCollection.PutItem (Var S: TStream; Item: Pointer);
-BEGIN
-   S.Put(Item);                                       { Put item on stream }
-END;
-
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                      TSortedCollection OBJECT METHODS                   Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-
-CONSTRUCTOR TSortedCollection.Init (ALimit, ADelta: Sw_Integer);
-BEGIN
-   Inherited Init(ALimit, ADelta);                    { Call ancestor }
-   Duplicates := False;                               { Clear flag }
-END;
-
-CONSTRUCTOR TSortedCollection.Load (Var S: TStream);
-BEGIN
-   Inherited Load(S);                                 { Call ancestor }
-   S.Read(Duplicates, SizeOf(Duplicates));            { Read duplicate flag }
-END;
-
-FUNCTION TSortedCollection.KeyOf (Item: Pointer): Pointer;
-BEGIN
-   KeyOf := Item;                                     { Return item }
-END;
-
-FUNCTION TSortedCollection.IndexOf (Item: Pointer): Sw_Integer;
-VAR I: Sw_Integer;
-BEGIN
-   IndexOf := -1;                                     { Preset result }
-   If Search(KeyOf(Item), I) Then Begin               { Search for item }
-     If Duplicates Then                               { Duplicates allowed }
-       While (I < Count) AND (Item <> Items^[I]) Do
-         Inc(I);                                      { Count duplicates }
-     If (I < Count) Then IndexOf := I;                { Return result }
-   End;
-END;
-
-FUNCTION TSortedCollection.Compare (Key1, Key2: Pointer): Sw_Integer;
-BEGIN
-   Abstract;                                          { Abstract method }
-END;
-
-FUNCTION TSortedCollection.Search (Key: Pointer; Var Index: Sw_Integer): Boolean;
-VAR L, H, I, C: Sw_Integer;
-BEGIN
-   Search := False;                                   { Preset failure }
-   L := 0;                                            { Start count }
-   H := Count - 1;                                    { End count }
-   While (L <= H) Do Begin
-     I := (L + H) SHR 1;                              { Mid point }
-     C := Compare(KeyOf(Items^[I]), Key);             { Compare with key }
-     If (C < 0) Then L := I + 1 Else Begin            { Item to left }
-       H := I - 1;                                    { Item to right }
-       If C = 0 Then Begin                            { Item match found }
-         Search := True;                              { Result true }
-         If NOT Duplicates Then L := I;               { Force kick out }
-       End;
-     End;
-   End;
-   Index := L;                                        { Return result }
-END;
-
-PROCEDURE TSortedCollection.Insert (Item: Pointer);
-VAR I: Sw_Integer;
-BEGIN
-   If NOT Search(KeyOf(Item), I) OR Duplicates Then   { Item valid }
-     AtInsert(I, Item);                               { Insert the item }
-END;
-
-PROCEDURE TSortedCollection.Store (Var S: TStream);
-BEGIN
-   TCollection.Store(S);                              { Call ancestor }
-   S.Write(Duplicates, SizeOf(Duplicates));           { Write duplicate flag }
-END;
-
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                    TStringCollection OBJECT METHODS                     Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-
-FUNCTION TStringCollection.GetItem (Var S: TStream): Pointer;
-BEGIN
-   GetItem := S.ReadStr;                              { Get new item }
-END;
-
-FUNCTION TStringCollection.Compare (Key1, Key2: Pointer): Sw_Integer;
-VAR I, J: Integer; P1, P2: PString;
-BEGIN
-   P1 := PString(Key1);                               { String 1 pointer }
-   P2 := PString(Key2);                               { String 2 pointer }
-   If (Length(P1^)<Length(P2^)) Then J := Length(P1^)
-     Else J := Length(P2^);                           { Shortest length }
-   I := 1;                                            { First character }
-   While (I<J) AND (P1^[I]=P2^[I]) Do Inc(I);         { Scan till fail }
-   If (P1^[I]=P2^[I]) Then Compare := 0 Else          { Strings matched }
-     If (P1^[I]<P2^[I]) Then Compare := -1 Else       { String1 < String2 }
-        Compare := 1;                                 { String1 > String2 }
-END;
-
-PROCEDURE TStringCollection.FreeItem (Item: Pointer);
-BEGIN
-   DisposeStr(Item);                                  { Dispose item }
-END;
-
-PROCEDURE TStringCollection.PutItem (Var S: TStream; Item: Pointer);
-BEGIN
-   S.WriteStr(Item);                                  { Write string }
-END;
-
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                  TUnSortedStrCollection OBJECT METHODS                  Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-PROCEDURE TUnSortedStrCollection.Insert (Item: Pointer);
-BEGIN
-   AtInsert(Count, Item);                             { NO sorting insert }
-END;
-
-
-
-
-FUNCTION TStream.Get: PObject;
-BEGIN
-END;
-
-PROCEDURE TStream.Put (P: PObject);
-BEGIN
-END;
-
-{***************************************************************************}
-{                            INTERFACE ROUTINES                             }
-{***************************************************************************}
-
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                   DYNAMIC STRING INTERFACE ROUTINES                     Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-FUNCTION NewStr (Const S: String): PString;
-VAR P: PString;
-BEGIN
-   If (S = '') Then P := Nil Else Begin               { Return nil }
-     GetMem(P, Length(S) + 1);                        { Allocate memory }
-     If (P<>Nil) Then P^ := S;                        { Hold string }
-   End;
-   NewStr := P;                                       { Return result }
-END;
-
-PROCEDURE DisposeStr (P: PString);
-BEGIN
-   If (P <> Nil) Then FreeMem(P, Length(P^) + 1);     { Release memory }
-END;
-
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                       STREAM INTERFACE ROUTINES                         Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-
-PROCEDURE Abstract;
-BEGIN
-   RunError(211);                                     { Abstract error }
-END;
-
-PROCEDURE RegisterError;
-BEGIN
-   RunError(212);                                     { Register error }
-END;
-
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                     NEW FREE VISION STREAM ROUTINES                     Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-
-FUNCTION CreateStream (Strategy: Word; ReqSize: LongInt): PStream;
-VAR Stream: PStream;
-BEGIN
-   Stream := Nil;                                     { Preset failure }
-   While (Strategy <> 0) AND (Stream = Nil) Do Begin
-     If (Strategy AND sa_XMSFirst <> 0) Then Begin    { ** XMS STREAM ** }
-     End Else
-     If (Strategy AND sa_EMSFirst <> 0) Then Begin    { ** EMS STREAM ** }
-     End Else
-     If (Strategy AND sa_RamFirst <> 0) Then Begin    { ** RAM STREAM ** }
-     End Else
-     If (Strategy AND sa_DiskFirst <> 0) Then Begin   { ** DISK STREAM ** }
-     End;
-     If (Stream<>Nil) AND (Stream^.Status <> stOk)    { Stream in error }
-     Then Begin
-       Dispose(Stream, Done);                         { Dispose stream }
-       Stream := Nil;                                 { Clear pointer }
-     End;
-     Strategy := Strategy SHL 4;                      { Next strategy mask }
-   End;
-   CreateStream := Stream;                            { Return stream result }
-END;
-
-{ÞßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÝ}
-{Þ                    NEW FREE VISION DOS FILE ROUTINES                    Ý}
-{ÞÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÝ}
-
-{***************************************************************************}
-{  DosFileOpen -> Platforms DOS/DPMI/WIN/OS2 - Checked 16May96 LdB          }
-{***************************************************************************}
-FUNCTION DosFileOpen (Var FileName: AsciiZ; Mode: Word): Word;
-{$IFDEF NotOS2}                                       { DOS/DPMI/WINDOWS }
-   {$IFDEF FPKPascal}                                 { FPK Pascal compiler }
-     {$IFDEF GO32V2}
-var regs : trealregs;
-BEGIN
-         syscopytodos(longint(@FileName),256);
-         regs.realedx:=tb mod 16;
-         regs.realds:=tb div 16;
-         regs.realeax := Mode;
-         regs.realecx:=0;
-         sysrealintr($21,regs);
-         if (regs.realflags and 1) <> 0 then
-           begin
-           InOutRes:=lo(regs.realeax);
-           DosFileOpen:=-1;
-           exit;
-           end else
-           DosFileOpen:=regs.realeax;
-END;
-    {$ELSE not GO32V2}
-BEGIN
-   ASM
-     XOR %AX, %AX;                                    { Clear error }
-     MOVW %AX, U_OBJECTS_DOSSTREAMERROR;
-     MOVL Filename, %EDX;                             { Filename to open }
-     XOR %CX, %CX;
-     MOVW Mode, %AX;                               { Mode to open file }
-     PUSHL %EBP;
-     INT $0x21;                                         { Open/create the file }
-     POPL %EBP;
-     JNC EXIT1;
-     MOV %AX, U_OBJECTS_DOSSTREAMERROR;               { Hold error }
-     XOR %AX, %AX;                                    { Open failed }
-   EXIT1:
-     MOV %AX, U_OBJECTS_TRANSFERHANDLE;               { Hold opened handle }
-   END;
-   DosFileOpen := TransferHandle;                     { Return handle }
-END;
-     {$ENDIF GO32V2}
-   {$ELSE}                                            { Other compilers }
-ASSEMBLER;
-   ASM
-     XOR AX, AX;                                      { Dos error cleared }
-     MOV DosStreamError, AX;
-     MOV AX, Mode;                                    { Mode to open file }
-     PUSH DS;
-     LDS DX, FileName;                                { Filename to open }
-     XOR CX, CX;
-     INT $21;                                         { Open/create file }
-     POP DS;
-     JNC @@Exit1;                                     { Check for error }
-     MOV DosStreamError, AX;
-     XOR AX, AX;                                      { Open fail return 0 }
-   @@Exit1:
-   END;
-   {$ENDIF}
-{$ELSE}                                               { OS2 CODE }
-{$IFNDEF FPK}
-VAR Attr, OpenFlags, OpenMode: Word; Success, Handle, ActionTaken: Sw_Word;
-BEGIN
-   Case Mode Of
-     stCreate: Begin                                  { Create file }
-         Attr := $20;                                 { Archive file }
-         OpenFlags := 18;                             { Open flags }
-         OpenMode := FmInOut;                         { Input/output file }
-       End;
-     stOpenRead: Begin                                { Open file for read }
-         Attr := $0;                                  { Any attributes }
-         OpenFlags := 1;                              { Open flags }
-         OpenMode := FmInput;                         { Input file }
-       End;
-     stOpenWrite: Begin                               { Open file for write }
-         Attr := $0;                                  { Any attributes }
-         OpenFlags := 1;                              { Open flags }
-         OpenMode := FmOutput;                        { Output file }
-       End;
-     stOpen: Begin                                    { Open file read/write }
-         Attr := $0;                                  { Any attributes }
-         OpenFlags := 1;                              { Open flags }
-         OpenMode := FmInOut;                         { Input/output file }
-       End;
-   End;
-   {$IFDEF Speed}                                     { Speed pascal differs }
-   DosStreamError := DosOpen(CString(FileName), Handle,
-   {$ELSE}                                            { Other OS2 compilers }
-   DosStreamError := DosOpen(@FileName[0], Handle,
-   {$ENDIF}
-     ActionTaken, 0, Attr, OpenFlags, OpenMode, Nil); { Open the file }
-   If (DosStreamError=0) Then DosFileOpen := Handle   { Successful open }
-     Else DosFileOpen := 0;                           { Fail so return zero }
-END;
-{$ELSE FPK}
-BEGIN
-   ASM
-     XOR %AX, %AX;                                    { Clear error }
-     MOVW %AX, U_OBJECTS_DOSSTREAMERROR;
-     MOVL Filename, %EDX;                             { Filename to open }
-     XOR %CX, %CX;
-     MOVW Mode, %AX;                                  { Mode to open file }
-     CALL ___SYSCALL;                                 { Open/create the file }
-     JNC EXIT1;
-     MOV %AX, U_OBJECTS_DOSSTREAMERROR;               { Hold error }
-     XOR %AX, %AX;                                    { Open failed }
-   EXIT1:
-     MOV %AX, U_OBJECTS_TRANSFERHANDLE;               { Hold opened handle }
-   END;
-   DosFileOpen := TransferHandle;                     { Return handle }
-END;
-{$ENDIF FPK}
-{$ENDIF}
-
-{***************************************************************************}
-{  DosRead -> Platforms DOS/DPMI/WIN - Checked 16May96 LdB                  }
-{***************************************************************************}
-FUNCTION DosRead (Handle: Word; Var BufferArea; BufferLength: Sw_Word;
-Var BytesMoved: Sw_Word): Word;
-{$IFDEF FPKPascal}                                    { FPK pascal compiler }
-{$IFDEF GO32V2}
-BEGIN
-BytesMoved:=system.dosread(Handle,longint(@BufferArea),BufferLength);
-DosRead:=InOutRes;
-End;
-{$ELSE not GO32V2}
-{$IFNDEF OS2}
-BEGIN
-   ASM
-     MOVL BufferArea, %EDX;                             { Buffer for data }
-     MOVL BufferLength, %CX;                              { Bytes to read }
-     MOVB $0x3F, %AH;
-     MOVW Handle, %BX;                              { Load file handle }
-     PUSHL %EBP;
-     INT $0x21;                                         { Read from file }
-     POPL %EBP;
-     JC EXIT2;                                        { Check for error }
-     MOVL BytesMoved, %EDI;
-     MOVZWL %AX, %EAX;
-     MOVL %EAX, (%EDI);                               { Update bytes moved }
-     XOR %EAX, %EAX;                                  { Clear register }
-   EXIT2:
-     MOV %AX, U_OBJECTS_DOSSTREAMERROR;               { DOS error returned }
-   END;
-   DosRead := DosStreamError;                         { Return any error }
-END;
-{$ELSE OS2}
-BEGIN
-   ASM
-     MOVL BufferArea, %EDX;                             { Buffer for data }
-     MOVL BufferLength, %CX;                              { Bytes to read }
-     MOVB $0x3F, %AH;
-     MOVW Handle, %BX;                                { Load file handle }
-     CALL ___SYSCALL;                                 { Read from file }
-     JC EXIT2;                                        { Check for error }
-     MOVL BytesMoved, %EDI;
-     MOVZWL %AX, %EAX;
-     MOVL %EAX, (%EDI);                               { Update bytes moved }
-     XOR %EAX, %EAX;                                  { Clear register }
-   EXIT2:
-     MOV %AX, U_OBJECTS_DOSSTREAMERROR;               { DOS error returned }
-   END;
-   DosRead := DosStreamError;                         { Return any error }
-END;
-{$ENDIF OS2}
-{$EndIf GO32V2}
-{$ELSE}                                               { Other compilers }
-ASSEMBLER;
-   ASM
-     PUSH DS;
-     LDS DX, BufferArea;                              { Data dest buffer }
-     MOV CX, BufferLength;
-     MOV BX, Handle;                                  { Load file handle }
-     MOV AH, $0x3F;
-     INT $0x21;                                         { Read from file }
-     POP DS;
-     JC @@Exit2;                                      { Check for error }
-     LES DI, BytesMoved;
-     MOV ES:[DI], AX;                                 { Update bytes moved }
-     XOR AX, AX;
-   @@Exit2:
-     MOV DosStreamError, AX;                          { DOS error returned }
-   END;
-{$ENDIF}
-
-{***************************************************************************}
-{  DosWrite -> Platforms DOS/DPMI/WIN - Checked 16May96 LdB                 }
-{***************************************************************************}
-FUNCTION DosWrite (Handle: Word; Var BufferArea; BufferLength: Sw_Word;
-Var BytesMoved: Sw_Word): Word;
-{$IFDEF FPKPascal}                                    { FPK pascal compiler }
-{$IFDEF GO32V2}
-BEGIN
-system.doswrite(Handle,longint(@BufferArea),BufferLength);
-BytesMoved:=BufferLength;
-DosWrite:=InOutRes;
-End;
-{$ELSE not GO32V2}
-BEGIN
-   ASM
-     MOVL BufferArea, %EDX;                             { Buffer with data }
-     MOVL BufferLength, %CX;                              { Bytes to write }
-     MOVB $0x40, %AH;
-     MOVW Handle, %BX;                              { Load file handle }
-     PUSHL %EBP;
-     INT $0x21;                                         { Write to file }
-     POPL %EBP;
-     JC EXIT3;                                        { Check for error }
-     MOVL BytesMoved, %EDI;
-     MOVZWL %AX, %EAX;
-     MOVL %EAX, (%EDI);                               { Update bytes moved }
-     XOR %EAX, %EAX;
-   EXIT3:
-     MOV %AX, U_OBJECTS_DOSSTREAMERROR;               { DOS error returned }
-   END;
-   DosWrite := DosStreamError;                        { Return any error }
-END;
-{$ENDIF GO32V2}
-{$ELSE}                                               { Other compilers }
-ASSEMBLER;
-   ASM
-     PUSH DS;
-     LDS DX, BufferArea;                              { Data source buffer }
-     MOV CX, BufferLength;
-     MOV BX, Handle;                                  { Load file handle }
-     MOV AH, $40;
-     INT $21;                                         { Write to file }
-     POP DS;
-     JC @@Exit3;                                      { Check for error }
-     LES DI, BytesMoved;
-     MOV ES:[DI], AX;                                 { Update bytes moved }
-     XOR AX, AX;
-   @@Exit3:
-     MOV DosStreamError, AX;                          { DOS error returned }
-   END;
-{$ENDIF}
-
-{***************************************************************************}
-{  DosSetFilePtr -> Platforms DOS/DPMI/WIN - Checked 16May96 LdB            }
-{***************************************************************************}
-FUNCTION DosSetFilePtr (Handle: Word; Pos: LongInt; MoveType: Word;
-VAR NewPos: LongInt): Word;
-{$IFDEF FPKPascal}                                    { FPK pascal compiler }
-{$IFNDEF OS2}
-BEGIN
-   ASM
-     MOVW MoveType, %AX;                              { Load move type }
-     MOVB $0x42, %AH;
-     MOVW POS, %DX;                              { Load file position }
-     MOVL POS, %ECX;
-     SHRL $16,%ECX;
-     MOVW Handle, %BX;                              { Load file handle }
-     PUSHL %EBP;
-     INT $0x21;                                         { Position the file }
-     POPL %EBP;
-     JC EXIT4;
-     MOVL NewPos, %EDI;                              { New position address }
-     MOVW %AX, %BX;
-     MOVW %DX, %AX;
-     SHLL $0x10, %EAX;                                   { Roll to high part }
-     MOVW %BX, %AX;
-     MOVL %EAX, (%EDI);                               { Update new position }
-     XOR %EAX, %EAX;
-   EXIT4:
-     MOVW %AX, U_OBJECTS_DOSSTREAMERROR;              { DOS error returned }
-   END;
-   DosSetFilePtr := DosStreamError;                   { Return any error }
-END;
-{$ELSE OS2}
-BEGIN
-   ASM
-     MOVW MoveType, %AX;                              { Load move type }
-     MOVB $0x42, %AH;
-     MOVW POS, %DX;                                  { Load file position }
-     MOVL POS, %ECX;
-     SHRL $16,%ECX;
-     MOVW Handle, %BX;                               { Load file handle }
-     CALL ___SYSCALL;                                { Position the file }
-     JC EXIT4;
-     MOVL NewPos, %EDI;                              { New position address }
-     MOVW %AX, %BX;
-     MOVW %DX, %AX;
-     SHLL $0x10, %EAX;                                   { Roll to high part }
-     MOVW %BX, %AX;
-     MOVL %EAX, (%EDI);                               { Update new position }
-     XOR %EAX, %EAX;
-   EXIT4:
-     MOVW %AX, U_OBJECTS_DOSSTREAMERROR;              { DOS error returned }
-   END;
-   DosSetFilePtr := DosStreamError;                   { Return any error }
-END;
-{$ENDIF OS2}
-{$ELSE}                                               { Other compilers }
-ASSEMBLER;
-   ASM
-     MOV AX, MoveType;                                { Load move type }
-     MOV AH, $42;
-     MOV DX, Pos.Word[0];                             { Load file position }
-     MOV CX, Pos.Word[2];
-     MOV BX, Handle;                                  { Load file handle }
-     INT $21;                                         { Position the file }
-     JC @@Exit4;
-     LES DI, NewPos;                                  { New position address }
-     MOV ES:[DI], AX;
-     MOV ES:[DI+2], DX;                               { Update new position }
-     XOR AX, AX;
-   @@Exit4:
-     MOV DosStreamError, AX;                          { DOS error returned }
-   END;
-{$ENDIF}
-
-{***************************************************************************}
-{  DosClose -> Platforms DOS/DPMI/WIN - Checked 16May96 LdB                 }
-{***************************************************************************}
-PROCEDURE DosClose (Handle: Word);
-{$IFDEF FPKPascal}                                    { FPK pascal compiler }
-{$IFNDEF OS2}
-BEGIN
-   ASM
-     XOR %AX, %AX;
-     MOVW %AX, U_OBJECTS_DOSSTREAMERROR;              { DOS error cleared }
-     MOVB $0x3E, %AH;
-     MOVW Handle, %BX;                               { DOS file handle }
-     PUSHL %EBP;
-     INT $0x21;                                         { Close the file }
-     POPL %EBP;
-     JNC EXIT5;
-     MOVW %AX, U_OBJECTS_DOSSTREAMERROR;              { DOS error returned }
-   EXIT5:
-   END;
-END;
-{$ELSE OS2}
-BEGIN
-   ASM
-     XOR %AX, %AX;
-     MOVW %AX, U_OBJECTS_DOSSTREAMERROR;              { DOS error cleared }
-     MOVB $0x3E, %AH;
-     MOVW Handle, %BX;                                { DOS file handle }
-     CALL ___SYSCALL;                                 { Close the file }
-     JNC EXIT5;
-     MOVW %AX, U_OBJECTS_DOSSTREAMERROR;              { DOS error returned }
-   EXIT5:
-   END;
-END;
-{$ENDIF OS2}
-{$ELSE}                                               { Other compilers }
-ASSEMBLER;
-   ASM
-     XOR AX, AX;                                      { DOS error cleared }
-     MOV DosStreamError, AX;
-     MOV BX, Handle;                                  { DOS file handle }
-     MOV AH, $3E;
-     INT $21;                                         { Close the file }
-     JNC @@Exit5;
-     MOV DosStreamError, AX;                          { DOS error returned }
-   @@Exit5:
-   END;
-{$ENDIF}
-
-
-END.

+ 23 - 10
rtl/os2/tests/testkbd.pas

@@ -1,17 +1,28 @@
 program TestKBD;
 program TestKBD;
 {$X+}
 {$X+}
 
 
+{$IFNDEF OS2}
+ Sorry, this code is for OS/2 only...
+{$ENDIF}
+
 uses
 uses
-{$IFDEF FPK}
+{$IFDEF FPC}
  KbdCalls;
  KbdCalls;
 {$ELSE}
 {$ELSE}
- Os2Base, Os2Def;
+ {$IFDEF VIRTUALPASCAL}
+ Os2Base;
+ {$ELSE}
+  {$IFDEF SPEED}
+ BseSub;
+  {$ELSE}
+ Os2Subs;
+  {$ENDIF}
+ {$ENDIF}
 {$ENDIF}
 {$ENDIF}
 
 
 function ExtKeyPressed: boolean;       (* 'key' is here as well e.g. a shift *)
 function ExtKeyPressed: boolean;       (* 'key' is here as well e.g. a shift *)
 var
 var
- C: char;
-{$IFDEF VIRTUALPASCAL}
+{$IFNDEF VER70} (* patched Borland Pascal *)
  KI: KbdKeyInfo;
  KI: KbdKeyInfo;
  K: KbdInfo;
  K: KbdInfo;
 {$ELSE}
 {$ELSE}
@@ -23,14 +34,16 @@ begin
  B := false;
  B := false;
  K.cb := SizeOf (K);
  K.cb := SizeOf (K);
  KbdGetStatus (K, 0);
  KbdGetStatus (K, 0);
-{ FillChar (KI, SizeOf (KI), 0);
- KbdCharIn (KI, IO_NOWAIT, 0);}
- ExtKeyPressed :=
-{ (KI.chScan <> 0) and (KI.chScan and $80 = 0) or }
-                                                    (K.fsState and $FF0F <> 0);
+ KbdPeek (KI, 0);
+ if (KI.fbStatus and $FE <> 0) or (K.fsState and $FF0F <> 0) then
+ begin
+  ExtKeyPressed := true;
+  if KI.fbStatus and $FE <> 0 then KbdCharIn (KI, IO_NOWAIT, 0);
+ end else ExtKeyPressed := false;
 end;
 end;
 
 
 begin
 begin
- WriteLn ('Press any _shift_ (or Alt, Ctrl etc.) key to continue ...');
+ repeat until not (ExtKeyPressed);
+ WriteLn (#13#10'Press _any_ key to continue (including shifts etc.) ...');
  repeat until ExtKeyPressed;
  repeat until ExtKeyPressed;
 end.
 end.

+ 1 - 3
rtl/os2/viocalls.pas

@@ -68,8 +68,6 @@ Coding style:
 interface
 interface
 {***************************************************************************}
 {***************************************************************************}
 
 
-uses    strings;
-
 {$ifdef FPK}
 {$ifdef FPK}
     {$packrecords 1}
     {$packrecords 1}
 {$endif FPK}
 {$endif FPK}
@@ -78,6 +76,7 @@ uses    strings;
 const
 const
 {return codes / error constants}
 {return codes / error constants}
     NO_ERROR                        =  0;
     NO_ERROR                        =  0;
+    Error_Invalid_Parameter         = 87;
     ERROR_VIO_INVALID_MASK          =349;
     ERROR_VIO_INVALID_MASK          =349;
     ERROR_VIO_PTR                   =350;
     ERROR_VIO_PTR                   =350;
     ERROR_VIO_APTR                  =351;
     ERROR_VIO_APTR                  =351;
@@ -1097,4 +1096,3 @@ external 'EMXWRAP' index 30;
 {external 'PMVIOP' index 30;}
 {external 'PMVIOP' index 30;}
 
 
 end.
 end.
-