Initial import Unix pipe class WIP

This commit is contained in:
mysticbbs 2012-09-06 04:33:44 -04:00
parent 44c5230db7
commit eac1eebc7e
1 changed files with 94 additions and 0 deletions

94
mdl/m_pipe_unix.pas Normal file
View File

@ -0,0 +1,94 @@
Unit m_Pipe_Unix;
{$I M_OPS.PAS}
Interface
Uses
m_DateTime,
m_FileIO,
m_Strings;
Type
TPipeUnix = Class
PipeID : Word;
Connected : Boolean;
IsClient : Boolean;
PipeDir : String;
Constructor Create (Dir: String; Client: Boolean; ID: Word);
Destructor Destroy; Override;
// Server functions
Function CreatePipe : Boolean;
Function WaitForPipe (Secs: LongInt) : Boolean;
// Client functions
Function ConnectPipe (Secs: LongInt) : Boolean;
// General functions
Procedure SendToPipe (Var Buf; Len: Longint);
Procedure ReadFromPipe (Var Buf; Len: LongInt; Var bRead: LongInt);
Procedure Disconnect;
End;
Implementation
Constructor TPipeUnix.Create (Dir: String; Client: Boolean; ID: Word);
Begin
Connected := False;
IsClient := Client;
PipeDir := DirSlash(Dir);
PipeID := ID;
End;
Destructor TPipeUnix.Destroy;
Begin
If Connected Then Disconnect;
Inherited Destroy;
End;
Function TPipeUnix.CreatePipe : Boolean;
Begin
Result := False;
IsClient := False;
Result := True;
End;
Procedure TPipeUnix.SendToPipe (Var Buf; Len: LongInt);
Begin
If Not Connected Then Exit;
End;
Procedure TPipeUnix.ReadFromPipe (Var Buf; Len: LongInt; Var bRead: LongInt);
Begin
bRead := 0;
If Not Connected Then Exit;
End;
Function TPipeUnix.WaitForPipe (Secs: LongInt) : Boolean;
Begin
Result := Connected;
If Connected Then Exit;
Result := Connected;
End;
Function TPipeUnix.ConnectPipe (Secs: LongInt) : Boolean;
Begin
Result := False;
Connected := False;
IsClient := True;
Result := Connected;
End;
Procedure TPipeUnix.Disconnect;
Begin
If Not Connected Then Exit;
Connected := False;
End;
End.