From 207dbcdfb542c693c9e391eff1e63101840261e4 Mon Sep 17 00:00:00 2001 From: Brian G Date: Sun, 26 Feb 2017 09:31:12 +0000 Subject: [PATCH] [update] - added pipe and stream support to terminal class git-svn-id: svn://localhost/gambas/trunk@8105 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- comp/src/gb.form.terminal/.icon.png | Bin 7608 -> 7678 bytes comp/src/gb.form.terminal/.project | 3 +- .../.src/TerminalView/FTestTerminalView.form | 2 +- .../.src/TerminalView/PipeTest.class | 209 ++++++++++++++++++ .../.src/TerminalView/PipeTest.form | 75 +++++++ .../.src/TerminalView/PipedTask.class | 74 +++++++ .../.src/TerminalView/TerminalFilter.class | 2 +- .../TerminalView/TerminalFilter_VT100.class | 2 +- .../.src/TerminalView/TerminalView.class | 90 ++++++-- comp/src/gb.form.terminal/.startup | 3 +- 10 files changed, 441 insertions(+), 19 deletions(-) create mode 100644 comp/src/gb.form.terminal/.src/TerminalView/PipeTest.class create mode 100644 comp/src/gb.form.terminal/.src/TerminalView/PipeTest.form create mode 100644 comp/src/gb.form.terminal/.src/TerminalView/PipedTask.class diff --git a/comp/src/gb.form.terminal/.icon.png b/comp/src/gb.form.terminal/.icon.png index e8fc91df2dd1420a8ae995970edfe8d8b541019a..544d3693e8e233b594fd508da3b53d6a8ae410a2 100644 GIT binary patch literal 7678 zcmbVxcT^KyxBi461Oy39s!2dVKxqofD=kJ)dI=rrAWaldL23xSNe5}t+pB}NlFCPrWPHZvnHBLD!* z8tST80Dyo$ApndHJXk*b+X+0-KEh}i!N5--%rP1~XYf=ve*^$$M8Gj8kWIs-Z2&k| zprLxh$oKiL+(8dVt-J|>7vjL@>p_i`@dV|}xUp~vVpq0vU03V8zl=JxC;hiPgdV=vpP0#>~$EPcM}D&&(`-wW!g_Gpw_Ev=^N zI`>e{t9|ZYe6*nYm6fm|g(J%Y0^x8B?Em&<64B^E7kn_{_OsKEQO}Gg)~^RMbWC0w z(afg@ZNG~rDzSTEvT)r6gk?1P3 z5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KabQGY4EG2$&N>{m1QD zT(7gjSUeFbyoRNBxL$Gbuwm+2?av#hq9;yiqDRJwPzxf&;!Z?-5u3<*V?Gp*!VS`>FbYyRK`vc;Wg~*l$%h598%g@nR|Sb1_q4KQ)08rm-g5! zNKD&AE^)-YCJS?0_8Oh9=arc@^?%Ot$o(T`%w%%>FU^D7)H&}%2(WiwG;K_so0+i_ zeQBVp1L~cf7DjN=UGo61#O-rr?xIs@tX|jpfQjg78#_BK!T`hYRgk2h3HPw^2pXU!KmQLkV^>xjYjKKTVBl&26+Xf4B&AcOFhphpeE?jX;l=( z57s7n;M|2)BU}6_t-*r7EhG_*3TD-JOyk$j*swGS3=XMhT`^T;v~n~Se_+dHZU|Cn zn^*CQOb3A=(th|`6+@-$1+zq+W&Xh#u$+(KWv1~0@ca0>gt^(q#Z(2r9X|&`10EklbecEeIKKbt@p>Un_UD}C{f{i(v z=@lD;H=m3wUs5|$PZmJbe7!7D@XdsdocKKvn~JeO0oF<>v755SD2=DMkfeIJ1)eW8t!*I9{<{5{dSN%2*c0Bx4&H){sDmuu)^ezEZ zmyb^CJVKqNij79)ff>7vuzm*2m*cK_Q76f0WhWRolYL*Mz^gv@XCbJZ!J*&>JUrwN z!RaB+93Ru=ZT{N7bZ7YbRW?m&$w+-P7Ays^0)_-8kZ8YcD1jBeaUL`+SRS2)(29$J z$Y36r_A%lO=HsWg^MVmkNI}MVK`nz}vvem50`lJF*yZSanT5=b12b%b z{$V5n*?S{8J`v0~cENO3L|uj91>k#3B5h&Zd_Sx(E{9j*H{_}?OO9z! diff --git a/comp/src/gb.form.terminal/.project b/comp/src/gb.form.terminal/.project index f60c90886..909e58863 100644 --- a/comp/src/gb.form.terminal/.project +++ b/comp/src/gb.form.terminal/.project @@ -1,13 +1,14 @@ # Gambas Project File 3.0 # Compiled with Gambas 3.9.90 Title=Gambas Terminal control -Startup=FTestTerminalView +Startup=PipeTest Icon=terminalview.png Version=3.9.90 VersionFile=1 Component=gb.image Component=gb.gui Component=gb.form +Component=gb.net Authors="BenoƮt Minisini\nFabien Bodard" TabSize=2 Language=fr diff --git a/comp/src/gb.form.terminal/.src/TerminalView/FTestTerminalView.form b/comp/src/gb.form.terminal/.src/TerminalView/FTestTerminalView.form index 882b90eb1..80075fd0e 100644 --- a/comp/src/gb.form.terminal/.src/TerminalView/FTestTerminalView.form +++ b/comp/src/gb.form.terminal/.src/TerminalView/FTestTerminalView.form @@ -43,7 +43,7 @@ } } { Timer1 #Timer - #MoveScaled(117,17) + #MoveScaled(4,63) Delay = 50 } } diff --git a/comp/src/gb.form.terminal/.src/TerminalView/PipeTest.class b/comp/src/gb.form.terminal/.src/TerminalView/PipeTest.class new file mode 100644 index 000000000..ceef0ecf0 --- /dev/null +++ b/comp/src/gb.form.terminal/.src/TerminalView/PipeTest.class @@ -0,0 +1,209 @@ +' Gambas class file + +Private $hPipeIn As File +Private $hPipeOut As File +Private InPipe As File +Private OutPipe As File +Private $hMySock As Socket + +Public TheTask As PipedTask + + + +Public Sub Form_Open() + + OutPipe = Pipe "/tmp/MyPipeIn" For Write ' providers output pipe + $hPipeIn = Pipe "/tmp/MyPipeIn" For Read Watch + + $hPipeOut = Pipe "/tmp/MyPipeOut" For Write ' open this first so other side never blocks + InPipe = Pipe "/tmp/MyPipeOut" For Read ' providers in pipe + + + If Not Term.Piped(OutPipe, InPipe) Then + + Close $hPipeOut + Close InPipe + Close OutPipe + Close $hPipeIn + $hPipeIn = Null + $hPipeOut = Null + InPipe = Null + OutPipe = Null + + Endif + +End + +Public Sub file_read() + + If Not Lof($hPipeIn) Then Return + + DataFromTerminal.Text &= Read #$hPipeIn, Lof($hPipeIn) + +End + +Public Sub sndTxt_Click() + + If TheTask Then + TaskStop_Click() + Endif + + If Not $hPipeIn Then + Form_Open() + Endif + + Write #$hPipeOut, dataToSend.Text + +End + +Public Sub KillSession_Click() + + Term.Kill() + + If $hPipeIn Then Close #$hPipeIn + If $hPipeOut Then Close #$hPipeOut + If InPipe Then Close InPipe + If OutPipe Then Close OutPipe + + $hPipeIn = Null + $hPipeOut = Null + InPipe = Null + OutPipe = Null + + +End + + + +Public Sub TaskTest_Click() + + If TheTask Then Return + + PipedTask.$sInputFileName = "/tmp/MyPipeIn" + PipedTask.$sOutputFileName = "/tmp/MyPipeOut" + + TheTask = New PipedTask As "TheBestTask" ' Start the task which should wait on the input stream until opened by the terminal + + Wait 1 + + If TheTask Then + + InPipe = Pipe PipedTask.$sInputFileName For Write + OutPipe = Pipe PipedTask.$sOutputFileName For Read + + Term.Piped(InPipe, OutPipe) ' tell the terminal about the remote task + + Endif + +End + + + +Public Sub TaskStop_Click() + + If Not Thetask Then Return + + Term.Kill() + + TheTask.Stop() + + Close InPipe + Close OutPipe + + Thetask = Null + InPipe = Null + OutPipe = Null + +End + +Public Sub TheBestTask_Read(buffer As String) + + DataFromTerminal.text &= "Task stdout -> " & buffer ' display from task stdout + +End + +Public Sub TheBestTask_kill() + DataFromTerminal.text &= "Task Killed" +End + + + +Public Sub StartRs232_Click() + + $hPipeIn = SerialPort1.Open() + $hPipeOut = $hPipeIn() + + If Not Term.Piped($hPipeIn, $hPipeOut) Then + + Close $hPipeOut + Close $hPipeIn + $hPipeIn = Null + $hPipeOut = Null + + + Endif + +End + +Public Sub Stoprs232_Click() + + KillSession_Click ' should be same as this + +End + +Public Sub Button2_Click() +Dim Port As Integer +Dim host As String + + + $hMySock = New Socket As "Socket1" + Port = Val(PortNumber.text) + host = HostName.text + + $hMySock.Connect(Host, port) + + DataFromTerminal.text &= "Opening Socket host = " & Host & ", Port = " & Str$(Port) & "\n" + +End + +Public Sub Socket1_Found() + + DataFromTerminal.text &= "Found Socket\n" +End + + + +Public Sub Socket1_Ready() + + + DataFromTerminal.text &= "Ready to send receive on socket\n" + + Term.Piped($hMySock, $hMySock) + +End + + + +Public Sub TCPSTOP_Click() + + If Not $hMySock Then Return + Term.Kill + Close #$hMySock + $hMySock = Null + DataFromTerminal.text &= "Closed for send receive on socket\n" + +End + +Public Sub Socket1_Error() + + DataFromTerminal.text &= "Error on socket(" & Str$($hMySock.Status) & ")\n" + $hMySock = Null + +End + +Public Sub Socket1_Closed() + + DataFromTerminal.text &= "Event Closed for send receive on socket\n" + + +End diff --git a/comp/src/gb.form.terminal/.src/TerminalView/PipeTest.form b/comp/src/gb.form.terminal/.src/TerminalView/PipeTest.form new file mode 100644 index 000000000..fef93472f --- /dev/null +++ b/comp/src/gb.form.terminal/.src/TerminalView/PipeTest.form @@ -0,0 +1,75 @@ +# Gambas Form File 3.0 + +{ Form Form + MoveScaled(0,0,147,69) + { Term TerminalView + MoveScaled(2,4,58,56) + } + { sndTxt Button + MoveScaled(132,4,13,4) + Text = ("Send data") + } + { dataToSend TextBox + MoveScaled(66,3,61,6) + Text = ("Test Data to the terminal") + } + { DataFromTerminal TextArea + MoveScaled(66,15,65,41) + } + { Label1 Label + MoveScaled(67,11,44,4) + Text = ("Data From Terminal") + } + { KillSession Button + MoveScaled(132,20,14,6) + Text = ("kill Session") + } + { TaskTest Button + MoveScaled(132,27,14,6) + Text = ("Task Testing") + } + { TaskStop Button + MoveScaled(132,33,14,5) + Text = ("Task Stop") + } + { Timer1 #Timer + #MoveScaled(29,61) + } + { SerialPort1 #SerialPort + #MoveScaled(43,61) + FlowControl = SerialPort.None + PortName = "/dev/ttyS0" + } + { StartSession Button + MoveScaled(132,14,14,6) + Text = ("Start Session") + } + { StartRs232 Button + MoveScaled(132,40,14,6) + Text = ("Start Rs232") + } + { Stoprs232 Button + MoveScaled(132,46,14,5) + Text = ("Stop Rs232") + } + { Button2 Button + MoveScaled(132,57,14,5) + Text = ("TCP test") + } + { Socket1 #Socket + #MoveScaled(54,61) + Host = "localhost" + } + { TCPSTOP Button + MoveScaled(132,62,14,5) + Text = ("TCP Stop") + } + { HostName TextBox + MoveScaled(67,57,63,5) + Text = ("127.0.0.1") + } + { PortNumber TextBox + MoveScaled(67,62,63,5) + Text = ("23") + } +} diff --git a/comp/src/gb.form.terminal/.src/TerminalView/PipedTask.class b/comp/src/gb.form.terminal/.src/TerminalView/PipedTask.class new file mode 100644 index 000000000..8097db4fb --- /dev/null +++ b/comp/src/gb.form.terminal/.src/TerminalView/PipedTask.class @@ -0,0 +1,74 @@ +' Gambas class file + +Export +Inherits Task + +Private $hPipeIn As File +Private $hPipeOut As File + +Static Public $sInputFileName As String +Static Public $sOutputFileName As String + + +Public Sub Main() + Dim i As Integer = 1 + + Print "Task is up and running" + + $hPipeOut = Pipe $sOutputFileName For Write + + Print "Task has opened output file : " & $sOutputFileName + Wait 2 + Print "Waited 2 Seconds" + + $hPipeIn = Pipe $sInputFileName For Read Watch ' we should hang on this till the other side starts + + Print "Task IO in " & $sInputFilename + + Do + + Wait 5 + + Print " Task Is alive " & i + Inc i + If $hPipeIn.EndOfFile Then + Print " Task Pipe Closed on other end" + Wait 1 + Break + Endif + + Loop + + +End + +Public Sub file_read() + + Dim $sBuffer As String + Dim $sChar As String + + + Print "Got read message" + + If Lof($hPipeIn) Then + + $sBuffer = "Term Key Rx .. Echoed back ---->" + + $sChar = Read #$hPipeIn, Lof($hPipeIn) + + Write #$hPipeOut, $sChar + + Print $sBuffer & $sChar + + Endif + +End + +Public Sub _kill() + + Print "Exit task" + + Close #$hPipeIn + Close #$hPipeOut + +End diff --git a/comp/src/gb.form.terminal/.src/TerminalView/TerminalFilter.class b/comp/src/gb.form.terminal/.src/TerminalView/TerminalFilter.class index f8bcbd58b..902d62f43 100644 --- a/comp/src/gb.form.terminal/.src/TerminalView/TerminalFilter.class +++ b/comp/src/gb.form.terminal/.src/TerminalView/TerminalFilter.class @@ -16,7 +16,7 @@ Public Sub OutputTo((hView) As TerminalView, (hScreen) As TerminalScreen, (hProc End -Public Sub InputTo((hView) As TerminalView, (hScreen) As TerminalScreen, (hProcess) As Process, (iKeyCode) As Integer, (sText) As String, Optional (bNormal) As Boolean = True, (bShift) As Boolean, (bControl) As Boolean) As Boolean +Public Sub InputTo((hView) As TerminalView, (hScreen) As TerminalScreen, (hProcess) As Stream, (iKeyCode) As Integer, (sText) As String, Optional (bNormal) As Boolean = True, (bShift) As Boolean, (bControl) As Boolean) As Boolean End diff --git a/comp/src/gb.form.terminal/.src/TerminalView/TerminalFilter_VT100.class b/comp/src/gb.form.terminal/.src/TerminalView/TerminalFilter_VT100.class index 585c6a89f..c9b41b16a 100644 --- a/comp/src/gb.form.terminal/.src/TerminalView/TerminalFilter_VT100.class +++ b/comp/src/gb.form.terminal/.src/TerminalView/TerminalFilter_VT100.class @@ -632,7 +632,7 @@ NOT_IMPLEMENTED: End -Public Sub InputTo(hView As TerminalView, hScreen As TerminalScreen, hProcess As Process, iCode As Integer, sText As String, Optional bNormal As Boolean = True, bShift As Boolean, bControl As Boolean) As Boolean +Public Sub InputTo(hView As TerminalView, hScreen As TerminalScreen, hProcess As Stream, iCode As Integer, sText As String, Optional bNormal As Boolean = True, bShift As Boolean, bControl As Boolean) As Boolean If bNormal Then diff --git a/comp/src/gb.form.terminal/.src/TerminalView/TerminalView.class b/comp/src/gb.form.terminal/.src/TerminalView/TerminalView.class index e312ea46f..102b34c08 100644 --- a/comp/src/gb.form.terminal/.src/TerminalView/TerminalView.class +++ b/comp/src/gb.form.terminal/.src/TerminalView/TerminalView.class @@ -47,6 +47,9 @@ Private $hMouseTimer As Timer Private $bTermUseMouse As Boolean Private $hProcess As Process +Private $hPipeIn As Stream ' Added this BG to support pipe io to and from the ScreenTop +Private $hPipeOut As Stream ' added this BG to support pipe io to and from the screen + Private $fStart As Float Private $hFilter As TerminalFilter @@ -562,13 +565,25 @@ End Public Sub View_KeyPress() 'If Key.Text Then $hScreen.Print(Replace(Key.Text, "\r", "\n")) - If Not $hProcess Then Return + + If Not $hProcess And Not $hPipeout Then Return ' added BG to allow redirection of io If $hOutputTimer.Enabled Then $hOutputTimer.Trigger + + If $hPipeOut Then ' added BG to allow redirection of io + + If $hFilter.InputTo(Me, $hScreen, $hPipeOut, Key.Code, Key.Text, Key.Normal, Key.Shift, Key.Control) Then + EnsureVisible + Stop Event + Endif + + Else - If $hFilter.InputTo(Me, $hScreen, $hProcess, Key.Code, Key.Text, Key.Normal, Key.Shift, Key.Control) Then - EnsureVisible - Stop Event + If $hFilter.InputTo(Me, $hScreen, $hProcess, Key.Code, Key.Text, Key.Normal, Key.Shift, Key.Control) Then + EnsureVisible + Stop Event + Endif + Endif End @@ -676,7 +691,7 @@ Public Sub Exec(Command As String[], Optional Environment As String[]) As Proces Dim aEnv As String[] - If $hProcess Then Return + If Not (IsNull($hProcess) Or IsNull($hPipeOut)) Then Return aEnv = ["TERM=xterm"] If Environment Then aEnv.Insert(Environment) @@ -695,7 +710,7 @@ Public Sub Shell(Command As String, Optional Environment As String[]) As Process Dim aEnv As String[] - If $hProcess Then Return + If Not (IsNull($hProcess) Or IsNull($hPipeOut)) Then Return aEnv = ["TERM=xterm"] If Environment Then aEnv.Insert(Environment) @@ -710,6 +725,27 @@ Public Sub Shell(Command As String, Optional Environment As String[]) As Process End + +' allow a connection to a filter or other task + +Public Sub Piped(PipeOut As Variant, PipeIn As Variant) As Boolean ' added BG this function to use as a piped terminal + + + If $hProcess Then Return + + $hPipeOut = PipeOut + $hPipeIn = PipeIn + + $hPipeIn.Watch(gb.Read, True) + Object.Attach($hPipeIn, Me, "Process") + + $fStart = Timer + + Return True + +End + + Public Sub Process_Kill() If $sBuffer Then OutputTimer_Timer @@ -718,12 +754,18 @@ Public Sub Process_Kill() End + Public Sub Process_Read() Dim sData As String - - sData = Read #$hProcess, Lof($hProcess) - + + If $hPipeIn Then + Read #$hPipeIn, sData, Lof($hPipeIn) + Stop Event + Else + sData = Read #$hProcess, Lof($hProcess) + Endif + $sBuffer &= sData If Len($sBuffer) > 65536 Or If (Timer - $fStart) > 0.25 Then @@ -744,7 +786,12 @@ End Public Sub OutputTimer_Timer() $fStart = Timer - $hFilter.OutputTo(Me, $hScreen, $hProcess, $sBuffer) + + If $hPipeOut Then + $hFilter.OutputTo(Me, $hScreen, $hPipeOut, $sBuffer) ' added this BG to support piped io + Else + If $hProcess Then $hFilter.OutputTo(Me, $hScreen, $hProcess, $sBuffer) + Endif $sBuffer = "" $hOutputTimer.Stop EnsureVisible @@ -792,8 +839,19 @@ End Public Sub Kill() - Try $hProcess.Kill - + + If $hProcess Then + Try $hProcess.Kill + Else ' added BG to end the piped session + If $hPipeIn Then + Process_Read() ' Get the last data in stream and display it + $hPipeIn.Watch(gb.Read, False) + + $hPipeIn = Null ' dont close the pipes its the owners problem + $hPipeOut = Null + Endif + Endif + End Private Function Blink_Read() As Boolean @@ -830,13 +888,17 @@ Public Sub Paste() Dim sText As String - If Not $hProcess Then Return + If Not $hProcess Or Not $hPipeOut Then Return ' Added BG to support Pipes sText = Clipboard.Paste("text/plain") If Not sText Then Return If $hFilter.BracketedPasteActive Then sText = "\e[200~" & sText & "\e[200~" - $hFilter.InputTo(Me, $hScreen, $hProcess, 0, sText) + If $hPipeOut Then + $hFilter.InputTo(Me, $hScreen, $hPipeOut, 0, sText) + Else + $hFilter.InputTo(Me, $hScreen, $hProcess, 0, sText) + Endif EnsureVisible End diff --git a/comp/src/gb.form.terminal/.startup b/comp/src/gb.form.terminal/.startup index cc52f8f4b..1da80cfb8 100644 --- a/comp/src/gb.form.terminal/.startup +++ b/comp/src/gb.form.terminal/.startup @@ -1,4 +1,4 @@ -FTestTerminalView +PipeTest Gambas Terminal control 0 0 @@ -7,4 +7,5 @@ Gambas Terminal control gb.image gb.gui gb.form +gb.net