{█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█}
{█ █}
{█ Virtual Pascal Utilities Library v1.1 █}
{█ ─────────────────────────────────────────────────█}
{█ Copyright (C) 1995 fPrint UK Ltd █}
{█ █}
{▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀}
Unit VPUtils;
Interface
{$Delphi+,PureInt+}
uses
Use32, Os2Def, Os2Base, Strings;
{ --- System Information functions --- }
{ Get the version of OS/2 }
function Os2Version : Word;
{ Returns the time of day in milliseconds }
function GetTimemSec : LongInt;
{ Get the process id of the current foreground process }
function GetForegroundProcessId : Word;
{ --- Disk related functions --- }
type
DriveTypes = ( dtFloppy, dtHDFAT, dtHDHPFS, dtInvalid, dtNovellNet, dtCDRom, dtLAN );
DriveSet = Set of 'A'..'Z';
{ Get the volume label of the specified drive letter }
function GetVolumeLabel( Drive : Char ) : String;
{ Search for fName in Current Dir, then in the PATH }
function FileExistsOnPath( FName : string; var FullName : string ) : Boolean;
{ Check if specified file handle is console(True) or redirected(False) }
function IsFileHandleConsole( Handle : Word ) : Boolean;
{ Get the current boot drive letter }
function GetBootDrive : Char;
{ Get the format of a drive letter }
function GetDriveType( Ch: Char ) : DriveTypes;
{ Get a list of all valid drive letters }
procedure GetValidDrives( var Drives : DriveSet );
{ --- Keyboard functions --- }
{ Set/reset a bit in the keyboard state - works ONLY in full screen mode! }
Procedure SetKeyboardState( Bit : SmallWord; _Or : Boolean );
{ Get the state of a keyboard status bit }
Function GetKeyboardState( Bit : SmallWord ) : Boolean;
{ Get current codepage; 0 if the hardware codepage is used }
Function GetCodePage : Word;
{ Check the next available character in the keyboard buffer }
Function PeekKey( Var Ch : Char ) : Boolean;
{ --- Screen related functions --- }
Procedure SetBorder;
{ Get the number of text columns, rows and colours }
Procedure GetVideoModeInfo( Var Cols, Rows, Colours : Word );
{ Set the number of text columns and rows }
Function SetVideoMode( Cols, Rows : Word ) : Boolean;
{ Get the state of ANSI interpretation }
Function GetANSIState : Boolean;
{ Set the state of ANSI interpretation }
Procedure SetANSI( State : Boolean );
{ Get the cursor size }
Function GetCursorSize : Word;
{ Set the cursor size }
procedure SetCursorSize(Startline, EndLine : Byte);
{ Hide the cursor }
procedure HideCursor;
{ Show the cursor }
procedure ShowCursor;
{ --- String functions --- }
{ Return zero-padded string representation of Number of length N }
Function Int2StrZ( Number : Longint; N : Byte ) : String;
{ Return string representation of Number }
Function Int2Str( Number : Longint ) : String;
{ Return hexadecimal equivalent of parameter Number as a string }
Function Int2Hex( Number : Longint; N : Byte ) : String;
{ Return hexadecimal equivalent of Pointer }
Function Ptr2Hex( p : Pointer ) : String;
{ --- System functions --- }
{ Start a thread with default parameters, returning thread ID }
Function VPBeginThread( ThreadFunc : tThreadFunc; StackSize : Word; Parameters : Pointer ) : TID;
{ Return the amount of memory allocated on the heap }
function MemUsed: Longint;
{ --- Math functions --- }
Function Max( a,b : Longint ) : Longint; inline;
begin
if a > b then
Max := a
else
Max := b;
end;
Function Min( a,b : Longint ) : Longint; inline;
begin
if a < b then
Min := a
else
Min := b;
end;
Implementation
end.