Skip to content

Commit

Permalink
Several important fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
aplteam committed Jul 22, 2021
1 parent f902e45 commit d395ed2
Show file tree
Hide file tree
Showing 14 changed files with 47 additions and 29 deletions.
2 changes: 2 additions & 0 deletions APLSource/LogDog/CRLF.aplf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
rCRLF
r⎕UCS 13 10
1 change: 0 additions & 1 deletion APLSource/LogDog/CreateViewer.aplf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
n.Viewer.Size[0]-4+n.Statusbar.Size

n.SB_Info.Text''
n.Viewer.Visible1
n.Viewer.onKeyPress'OnKeyPressInViewer'
n.∆form.CaptionGetCaption n
n.∆form.CursorObjcursorWas
Expand Down
2 changes: 1 addition & 1 deletion APLSource/LogDog/Find.aplf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
n2CreateFindGUI n
⎕NQ n2.SearchFor'GotFocus'
res⎕DQ n2.∆form
:If 0res
:If 0=res
:OrIf n2.Cancelres
:Trap 6
⎕EX'n2.∆form.n'
Expand Down
6 changes: 6 additions & 0 deletions APLSource/LogDog/History.aplf
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
History
* 3.0.1 ⋄ 2021-07-22
* Bug fixes
* Under some circumstances LogDog crashed on its first attempt to refresh the GUI
* Due to Dyalog bug <01896> sometimes Linefeed got injected into the GUI. Circumvention
implemented but at the expense of additonal memory usage.
* When the size of a log file was reduced by some means, or re-created, then LogDog crashed.
* 3.0.0 ⋄ 2021-07-12
* Bug fixes
* Log files from Unix were not shown correctly since LogDog expected CRLF (Windows)
Expand Down
19 changes: 12 additions & 7 deletions APLSource/LogDog/InitialReadOfLogfile.aplf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
nInitialReadOfLogfile n;data;noOf;startByte;bytes
nInitialReadOfLogfile n;noOf;startByte;bytes;data
We read blocks of `blockSize` or less characters from the end of the file
and then make them records.
We collect those records until we reach n.∆Parms.NoOfRecords records or
Expand All @@ -23,14 +23,19 @@
:If 0=bytes(⎕NREAD n.∆tno,82,(n.∆Parms.BlockSizen.∆FileSize),startByte)
:Leave
:EndIf
noOf++/LFbytes
databytes,data
noOf+bytes+.=LF
startByte0startByte-bytes
databytes,data
bytes''
:Until (n.∆Parms.NoOfRecordsnoOf)(data)=n.∆FileSize
n.∆ReadLogFromdata
dataLF ##.APLTreeUtils2.Split data
data(-0=¯1data)data
data(-(data)n.∆Parms.NoOfRecords)data
n.∆NextStartBytebytes
dataCRLF ##.APLTreeUtils2.Split data
data¯1(0=(¯1+data)data)data Drop last record if empty
:If n.∆Parms.NoOfRecords<data
data(-n.∆Parms.NoOfRecords)data Cut it back
:EndIf
n.Viewer.Visible0
n.Viewer.Textdata
n.Viewer.SelText(21+data),¨1
n.Viewer.Visible1
Done
2 changes: 1 addition & 1 deletion APLSource/LogDog/OnFindNext.aplf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
hit,1n.∆Parms.Hits
n.Viewer.SelTextHighlight hit
n.∆Parms.Hits1n.∆Parms.Hits
0n.∆Parms.Hits:n.SB_Info.Text{''}n.FindNext.Active0
0=n.∆Parms.Hits:n.SB_Info.Text{''}n.FindNext.Active0
n.SB_Info.Text(n.∆Parms.Hits),' hit',((1<n.∆Parms.Hits)/'s'),' remaining.'
}
2 changes: 1 addition & 1 deletion APLSource/LogDog/OnOkInSearchForm.aplf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
rfmsg
n2Get_n rf
nGet_n n2.∆form.##
:If ~0n2.SearchFor.Text
:If 0n2.SearchFor.Text
{}{2 ⎕NQ .Freeze'Select'}(0=n.Freeze.State)n
n.∆Parms.SearchTextn2.SearchFor.Text
n.∆Parms.CaseSensitiven2.CaseSensitive.State
Expand Down
2 changes: 1 addition & 1 deletion APLSource/LogDog/OpenLogFile.aplf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
:Trap 19
n.∆tnon.∆filename ⎕NTIE 0 64
n.∆LastFileSize
n.ReadLogFrom0
n.NextStartByte0
:Else
⎕DL 1
tryFlag+1
Expand Down
30 changes: 18 additions & 12 deletions APLSource/LogDog/ReadLastRecords.aplf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
upToDateReadLastRecords n;size;fileSize;maxNumberOfBytes;noOfBytes;noOfRecords;maxNoOfRecords;bytes
isUpToDateReadLastRecords n;size;fileSize;maxNumberOfBytes;noOfBytes;noOfRecords;maxNoOfRecords;bytes
We read all data that has been written since the last read operation.
In case the max number of records is exceeded we reduce the number of
records shown plus 15%.
Expand All @@ -9,27 +9,33 @@
fileSize⎕NSIZE n.∆tno
:If fileSizen.∆LastFileSize
n.∆form.OnTop0
upToDate1
isUpToDate1
:ElseIf fileSize<n.∆LastFileSize
nInitialReadOfLogfile n
isUpToDate1
:Else
n.∆FileSizefileSize
:If n.Freeze.State
n.SB_FileSize.Text'Log size: ',(FormatFileSize n.∆FileSize),' !'
upToDate0
n.SB_FileSize.Text'Log size: ',(FormatFileSize n.∆FileSize),' (!)'
isUpToDate0
:Else
maxNumberOfBytes⎕WA÷10
noOfBytesmaxNumberOfBytesfileSize-n.ReadLogFrom
bytes(⎕NREAD n.∆tno,82,noOfBytes,n.ReadLogFrom)
upToDatenoOfBytes=bytes
noOfBytesmaxNumberOfBytesfileSize-n.NextStartByte
bytes(⎕NREAD n.∆tno,82,noOfBytes,n.NextStartByte)
isUpToDatenoOfBytes=bytes
:If 0<noOfBytes
n.∆ReadLogFrom+noOfBytes
bytesLF ##.APLTreeUtils2.Split bytes
bytes¯1(0=¯1bytes)bytes Drop last if empty
noOfRecordsn.Viewer.Textn.Viewer.Text,bytes
:If n.∆Parms.NoOfRecords<noOfRecords
n.∆NextStartByte+noOfBytes
bytesCRLF ##.APLTreeUtils2.Split bytes
bytes¯1(0=(¯1+bytes)bytes)bytes Drop last record if empty
n.Viewer.Text,bytes
bytes''
noOfRecordsn.Viewer.Text
:If n.∆Parms.NoOfRecords<noOfRecords Did it grow too large?
maxNoOfRecordsn.∆Parms.NoOfRecords-n.∆Parms.NoOfRecords÷15 15% buffer
n.Viewer.Text(-maxNoOfRecords)n.Viewer.Text
:EndIf
n.Viewer.SelText(21+noOfRecords),¨1
n.Viewer.Visible1
:EndIf
n.∆LastFileSizefileSize
n.SB_FileSize.Text'Log size: ',FormatFileSize n.∆FileSize
Expand Down
4 changes: 2 additions & 2 deletions APLSource/LogDog/Search.aplf
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
r
buffEscapeSpecialRegExChars n.Viewer.Text
indn.∆Parms.SearchText ⎕S(2 0 1)('Mode' 'L')('IC'(~n.∆Parms.CaseSensitive))buff
:If 0ind
:If 0=ind
n.SB_Info.Text'No hit found'
n.Viewer.SelText2n.Viewer.SelText[0]
:Else
n.∆Parms.Hitsind
hit,1n.∆Parms.Hits
n.Viewer.SelTextHighlight hit
n.SB_Info.Text(n.∆Parms.Hits),' hit',((1<n.∆Parms.Hits)/'s'),' in total'
n.SB_Info.Text(n.∆Parms.Hits),' hit',((1<n.∆Parms.Hits)/'s'),' in total'
n.∆Parms.Hits1n.∆Parms.Hits
n.FindNext.Active0<n.∆Parms.Hits
:EndIf
Expand Down
2 changes: 1 addition & 1 deletion APLSource/LogDog/Version.aplf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
rVersion
See also History
r'LogDog' '3.0.0+58' '2021-07-12'
r'LogDog' '3.0.1+62' '2021-07-22'
2 changes: 1 addition & 1 deletion Docs/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ You can start the Help independently from LogDog by double-clicking `ViewHelp.ex
For details go to <https://github.com/aplteam/LogDog>

|Kai Jaeger | 2014-04-27 |
|Last update | 2021-07-12 |
|Last update | 2021-07-22 |
2 changes: 1 addition & 1 deletion LogDog.iss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; This script is best executed by LogDog's "Make" utility.

#define MyAppVersion "3.0.0+58"
#define MyAppVersion "3.0.1+62"
#define MyAppName "LogDog"
#define MyAppPublisher "APL Team Ltd"
#define MyAppURL "https://github.com/aplteam/LogDog"
Expand Down
Binary file modified project.dws
Binary file not shown.

0 comments on commit d395ed2

Please sign in to comment.