mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-22 13:31:20 +02:00
* Patch from Vincent Snijders to implement NumberOfBytesAvailable for pipes
git-svn-id: trunk@6275 -
This commit is contained in:
parent
1a32e4fdf5
commit
4155eb6e04
@ -20,3 +20,11 @@ Function CreatePipeHandles (Var Inhandle,OutHandle : Longint) : Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
|
||||
Function TInputPipeStream.GetNumBytesAvailable: DWord;
|
||||
|
||||
begin
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
|
@ -13,10 +13,18 @@
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
// No pipes under dos, sorry...
|
||||
// No pipes under beos, sorry...
|
||||
|
||||
Function CreatePipeHandles (Var Inhandle,OutHandle : Longint) : Boolean;
|
||||
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
|
||||
Function TInputPipeStream.GetNumBytesAvailable: DWord;
|
||||
|
||||
begin
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
|
@ -20,3 +20,11 @@ Function CreatePipeHandles (Var Inhandle,OutHandle : THandle) : Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
|
||||
Function TInputPipeStream.GetNumBytesAvailable: DWord;
|
||||
|
||||
begin
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
|
@ -28,13 +28,17 @@ Type
|
||||
EPipeSeek = Class (EPipeError);
|
||||
EPipeCreation = Class (EPipeError);
|
||||
|
||||
{ TInputPipeStream }
|
||||
|
||||
TInputPipeStream = Class(THandleStream)
|
||||
Private
|
||||
FPos : Int64;
|
||||
function GetNumBytesAvailable: DWord;
|
||||
public
|
||||
Function Write (Const Buffer; Count : Longint) :Longint; Override;
|
||||
Function Seek (Offset : Longint;Origin : Word) : longint;override;
|
||||
Function Read (Var Buffer; Count : Longint) : longint; Override;
|
||||
property NumBytesAvailable: DWord read GetNumBytesAvailable;
|
||||
end;
|
||||
|
||||
TOutputPipeStream = Class(THandleStream)
|
||||
|
@ -20,3 +20,11 @@ Function CreatePipeHandles (Var Inhandle,OutHandle : Longint) : Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
|
||||
Function TInputPipeStream.GetNumBytesAvailable: DWord;
|
||||
|
||||
begin
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
// Unsupported for the moment...
|
||||
|
||||
Function CreatePipeHandles (Var Inhandle,OutHandle : THandle) : Boolean;
|
||||
|
||||
@ -20,3 +21,10 @@ begin
|
||||
Result := false; {dont know how to do that with netware clib}
|
||||
end;
|
||||
|
||||
|
||||
Function TInputPipeStream.GetNumBytesAvailable: DWord;
|
||||
|
||||
begin
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
// Unsupported for the moment...
|
||||
|
||||
Function CreatePipeHandles (Var Inhandle,OutHandle : THandle) : Boolean;
|
||||
|
||||
@ -20,3 +21,10 @@ begin
|
||||
Result := false; {todo}
|
||||
end;
|
||||
|
||||
|
||||
Function TInputPipeStream.GetNumBytesAvailable: DWord;
|
||||
|
||||
begin
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
|
@ -24,3 +24,11 @@ Function CreatePipeHandles (Var Inhandle,OutHandle : Longint) : Boolean;
|
||||
begin
|
||||
CreatePipeHandles := DosCreatePipe (InHandle, OutHandle, PipeBufSize) = 0;
|
||||
end;
|
||||
|
||||
Function TInputPipeStream.GetNumBytesAvailable: DWord;
|
||||
|
||||
begin
|
||||
// TODO: find out if this is possible in OS/2
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
|
@ -14,8 +14,7 @@
|
||||
**********************************************************************}
|
||||
|
||||
Uses
|
||||
Unix
|
||||
;
|
||||
BaseUnix, Unix, TermIO;
|
||||
|
||||
Function CreatePipeHandles (Var Inhandle,OutHandle : Longint) : Boolean;
|
||||
|
||||
@ -23,3 +22,11 @@ begin
|
||||
Result := (AssignPipe (Inhandle,OutHandle)<>-1);
|
||||
end;
|
||||
|
||||
|
||||
Function TInputPipeStream.GetNumBytesAvailable: DWord;
|
||||
|
||||
begin
|
||||
if fpioctl(Handle, FIONREAD, @Result)<0 then
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
|
@ -33,3 +33,11 @@ Function CreatePipeHandles (Var Inhandle,OutHandle : THandle) : Boolean;
|
||||
begin
|
||||
Result := CreatePipe (@Inhandle,@OutHandle,@piInheritablePipe,PipeBufSize);
|
||||
end;
|
||||
|
||||
|
||||
Function TInputPipeStream.GetNumBytesAvailable: DWord;
|
||||
begin
|
||||
if not PeekNamedPipe(Handle, nil, 0, nil, @Result, nil) then
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
|
@ -13,8 +13,18 @@
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
// Unsupported for the moment...
|
||||
|
||||
Function CreatePipeHandles (Var Inhandle,OutHandle : THandle) : Boolean;
|
||||
// No pipes under dos, sorry...
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
|
||||
Function TInputPipeStream.GetNumBytesAvailable: DWord;
|
||||
|
||||
begin
|
||||
// Windows CE doesn´t have the API function PeekNamedPipe
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user