Skip to content

Commit

Permalink
Two important bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
aplteam committed Jul 25, 2019
1 parent 902cdcc commit fab390f
Show file tree
Hide file tree
Showing 21 changed files with 167 additions and 114 deletions.
1 change: 1 addition & 0 deletions APLSource/Fire-1/Assert-1.aplf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Assert{'' (,1),:r1 ⎕ML3 ⎕SIGNAL 1(),11}
1 change: 0 additions & 1 deletion APLSource/Fire-1/GUI-7/RemoveFromHitList-2441.aplf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* List of indices into the Hit list.
* Empty vector. In that case SelItems of the Hit list rules.
rows{##.A.Where n.HitList.SelItems}(0=)
_{{.⎕EX }/}¨n.HitList.Data[rows;0 1]
(~/rowsalln.HitList.Items):'Invalid right argument'⎕SIGNAL 11
remainall~rows
n.HitList.Itemsn.HitList.Items[remain]
Expand Down
15 changes: 7 additions & 8 deletions APLSource/Fire-1/History-1.aplf
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
History
⍝ Contains information regarding the last release. A full history is available on GitHub. (This line is ignored)
* 7.2.2
* When an object was removed from the hit list then the message in the status bar was not changed accordingly.
* When an object was removed from the hit via "Report Hits" then the context menu should not offer "Remove" again.
* A "Hit report" windows should be closed automatically when the user hits either "Find" or "Replace".
* A "Replace" operation should clear the hit list because it might well be outdated.
* Information provided in the status bar improved.
* 7.2.1
* Bug fix: the "Search for" field lost its memory ot one stage.
* 7.2.3
* Bug fixes:
* With commit from 2019-05-30 a serious bug was introduced regarding removing any items from the hit list.\\
Rather than just removing the selected items the objects were also deleted from the workspace. However,
acre was **not** told to delete them, so after re-opening the project everything was back again.
* The assignment of a variable in a namespace script was ignored when on the same line a dfn was defined
and the next function was a trad fun that carried the definition of a dfns.
\\
For information regarding older version see <https://github.com/aplteam/Fire/releases>
1 change: 0 additions & 1 deletion APLSource/Fire-1/ProcessList-81.aplf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
buffScanScripts container name type
:EndIf
r,buff
(0¨,¨r)/'.' There was once a strange bug, so we check just in case...
:If ∆CANCEL
:Leave
:EndIf
Expand Down
48 changes: 16 additions & 32 deletions APLSource/Fire-1/RemoveFnsAndOpr-1241.aplf
Original file line number Diff line number Diff line change
@@ -1,41 +1,25 @@
bodyRemoveFnsAndOpr body;mask;b1;b2;b;split;ind;buffer;hits;part;start;length;buff
bodyRemoveFnsAndOpr body;masked;tradFns;b1;b0;b;isCR
Remove all functions and operators from script code ⍵.
This is necessary because fns and opr are dealt with already as if
they were members of an ordinary namespace, so we just need to focus
on stuff outside functions and operators, typically comments and the
assignment of any variables.
We must ignore "∇{}" inside comments and text, and we must be able to
deal with both, multiline dfns and interlocked dfns.
maskReplace.MaskText¨body
mask{(()=i''): ()i}¨mask
(body mask){1Simplify CR,¨}¨body mask
b1'{'=mask
b2'}'=mask
b(CRmask)b20(+\b1)-+\b2
(b1/b)0 Let the "{" survive - we need this later
deal with both, multiline dfns, nested dfns and dfns without a name.
maskedReplace.MaskText¨body
masked{(()=i''): ()i}¨masked Remove comments from `masked`
(body masked){1Simplify CR,¨}¨body masked We need a simple vector from now an
isCRbody=CR CR must survive to keep the original structure intact
tradFns{\}''=masked Where are trad fns?
(tradFns/body)' ' Remove...
(tradFns/masked)' ' ...them!
b1'{'=masked Opening curlies
b0'}'=masked Closing curlies
b(maskedCR)b00(+\b1)-+\b0 Where are the (possibly nested) dfns?
(b1/b)0 Let the "{" survive - we need this later for removing the dfn names
(b/body)' '
(b/mask)' '
body[Where(CRmask)({\}''=mask)]' '
((mask='}')/mask)' '
body'\w{1,}←\{'⎕R ReplaceAssignedDfnNameBySpacebody Get rid of "name←{"
(('{'=masked)/body)' ' Get rid of opening curlies (lambdas)
(isCR/body)CR Brings the CRs back for sure (those tfns might have been replaced by spaces)
bodyCR A.Split body
maskCR A.Split mask
b1/¨mask='{'
b2~''¨b1/mask Those in b1 have no "⋄"
indb2/Where b1 Transform into index
mask[ind](¨mask[ind])¨' ' ...therefore they are getting blanks.
b1[b2/Where b1]0 Forget those
:If 0<+/b1 Are there any "⋄" at all?
split{1,''=}¨b1/mask
buffersplit{⎕IO⎕ML1 '',}¨b1/body
:AndIf 0<+/b2{/'←{'}¨¨buffer
(b2/buffer){1,/{(/'←{'):(,)' ' }¨}¨b2/buffer
(b1/body)buffer
:EndIf
Get rid of "name←{"
hits'\w{1,}←\{'⎕S 2 0 1body
:For part start length :In hits
buffpartbody
buff(-start)(length' '),lengthstartbuff
(partbody)buff
:EndFor
Done
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
:Else
masked##.A.dlb masked
fnsNames{¯1+'{'}¨({/'←{'}¨masked)/¨masked
((fnsNames)=indfnsNamesname)/'. ⍝ Something is very wrong here!'
'Something is very wrong here!'Assert(fnsNames)indfnsNamesname
:If 1<code Replaced by a muli-line definition?!
:If 1=tl
tl0tl
Expand Down
53 changes: 0 additions & 53 deletions APLSource/Fire-1/Replace-1/TestPerformance-11.aplf

This file was deleted.

4 changes: 4 additions & 0 deletions APLSource/Fire-1/ReplaceAssignedDfnNameBySpace-1448081.aplf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ReplaceAssignedDfnNameBySpace{
ns
ns.Lengths' '
}
2 changes: 1 addition & 1 deletion APLSource/Fire-1/ReportHits-41/MarkUpHits-51.aplf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
:Return
:EndTrap
(0body)/0
body1##.Simplify ##.NL,¨body
body(1##.Simplify ##.NL,¨body),' '
body0 ##.ReplaceSpecialChars¨body
body[ind]'<span class="diff">',¨body[ind]
bool2(body)1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
rs,(~1=ss)'<span class="diff">&</span>'
datass ⎕R rsoptions{300>,: (300),'...'}data
fullName(ref),'.',name
r'<a href="#',fullName,'" id="',fullName,'"> <h2>',(rn),'. ',fullName,'</h2></a><p>',r,'/p>'
r'<a href="#',fullName,'" id="',fullName,'"> <h2>',(rn),'. ',fullName,'</h2></a><span class="diff">',r,'</span>'
r('<div class="obj">'),r,'</div>'
Done
2 changes: 1 addition & 1 deletion APLSource/Fire-1/Version-1.aplf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
rVersion
See also `History`
r(1¯1⎕NPARTS⎕THIS)'7.2.2.111' '2019-07-21'
r(1¯1⎕NPARTS⎕THIS)'7.2.3.112' '2019-07-25'
31 changes: 31 additions & 0 deletions APLSource/TestCases-11/Test_Replace_005-21.aplf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
RTest_Replace_005(stopFlag batchFlag);n;ref;n2;⎕TRAP
Replace string "foo" in a namespace script that contains nested dfns.
⎕TRAP(999 'C' '. ⍝ Deliberate error')(0 'N')
R∆Failed

Preconditions
1 #._Fire.Fire.Run 0
n#._Fire.Fire.GUI.n
#.⎕SHADOW'TEMP'
'TEMP'#.⎕NS''
ref#.TEMP.⎕FIX':Namespace MyNamespace' 'MyDfn←{' 'a←1' 'sub←{' 'a←''foo''' '}' '42' '}' ':EndNamespace'
Assert 42ref.MyDfn
n.LookIn.Text'#.TEMP'
n.SearchFor.Text'foo'

{}∆Select n.StartBtn
0.2 ∆Process n.Form
GoToTidyUp n.HitList.Items,'MyDfn'

{}∆Select n.ReplaceBtn
∆Process n.Form
n2#._Fire.Fire.Replace.n
n2.ReplaceBy.Text'_GOO_'

{}∆Select n2.StartBtn
∆Process n.Form

GoToTidyUp 1+/'a←''_GOO_'''1,/(⎕UCS 13),¨⎕SRC ref

∆TidyUp:
CloseFire
31 changes: 31 additions & 0 deletions APLSource/TestCases-11/Test_Replace_006-21.aplf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
RTest_Replace_006(stopFlag batchFlag);n;ref;n2;⎕TRAP
Replace string "foo" in a namespace script that contains a ⋄-separated fns assignment and a vars assignment on a single line
⎕TRAP(999 'C' '. ⍝ Deliberate error')(0 'N')
R∆Failed

Preconditions
1 #._Fire.Fire.Run 0
n#._Fire.Fire.GUI.n
#.⎕SHADOW'TEMP'
'TEMP'#.⎕NS''
ref#.TEMP.⎕FIX':Namespace MyNamespace' 'MyDfn←{''foo''} ⋄ pi←2.14' '' ':EndNamespace'
Assert'foo'ref.MyDfn
n.LookIn.Text'#.TEMP'
n.SearchFor.Text'foo'

{}∆Select n.StartBtn
0.2 ∆Process n.Form
GoToTidyUp n.HitList.Items,'MyDfn'

{}∆Select n.ReplaceBtn
∆Process n.Form
n2#._Fire.Fire.Replace.n
n2.ReplaceBy.Text'_GOO_'

{}∆Select n2.StartBtn
∆Process n.Form

GoToTidyUp 1+/'''_GOO_'''1,/(⎕UCS 13),¨⎕SRC ref

∆TidyUp:
CloseFire
32 changes: 32 additions & 0 deletions APLSource/TestCases-11/Test_Replace_008-21.aplf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
RTest_Replace_008(stopFlag batchFlag);n;ref;n2;⎕TRAP;body
Replace "42" by 2.14". This was once a bug: it crashed on "Find" and, after fixing that, caused an endless loop in "Replace"
⎕TRAP(999 'C' '. ⍝ Deliberate error')(0 'N')
R∆Failed

Preconditions
1 #._Fire.Fire.Run 0
n#._Fire.Fire.GUI.n
#.⎕SHADOW'TEMP'
'TEMP'#.⎕NS''
ref#.TEMP.⎕FIX':Namespace NS' 'f1←{r←⍺{PI←42 ⋄ ⍺+⍵}⍵ ⋄ 1+r} ⋄ f2←f1∘⌽' '∇ Fns y;a;b' 'PI←42' 'a←⍬ ⋄ b←{⍵}' '' 'PI←42' ':EndNamespace'
Assert 42ref.PI
n.LookIn.Text'#.TEMP'
n.SearchFor.Text'42'

{}∆Select n.StartBtn
0.2 ∆Process n.Form
GoToTidyUp n.HitList.Items'Fns' 'f1' 'NS' 'PI'

{}∆Select n.ReplaceBtn
∆Process n.Form
n2#._Fire.Fire.Replace.n
n2.ReplaceBy.Text'2.14'

{}∆Select n2.StartBtn
∆Process n.Form
body1,/(⎕UCS 13),¨⎕SRC #.TEMP.NS
GoToTidyUp 3+/'2.14'body
GoToTidyUp 0+/'42'body

∆TidyUp:
CloseFire
17 changes: 9 additions & 8 deletions APLSource/TestCases-11/Test_Replace_079-21.aplf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
RTest_Replace_079(stopFlag batchFlag);n;n2;⎕TRAP;rf;code;Top2;buffer;dlb
RTest_Replace_079(stopFlag batchFlag);n;n2;⎕TRAP;rf;code;Top2;buffer;dlb;body
Find and replace with emphasize on "Match case"
⎕TRAP(999 'C' '. ⍝ Deliberate error')(0 'N')
R∆Failed
Expand All @@ -7,8 +7,8 @@
Preconditions
#.⎕SHADOW'TEMP'
'TEMP'#.⎕NS''
(' '10#.TEMP.⎕FX'r←Hello1' 'b←0' 'c←¯1' 'A←1 ⋄ a←2' 'a←3' 'A←4')/'.'
(' '10#.TEMP.⎕FX'r←(fns Hello2)y;a' 'b←0' 'c←¯1' 'A←1 ⋄ a←2 ' 'a←3 ' 'A←4 ')/'.'
Assert' '=10#.TEMP.⎕FX'r←Hello1' 'b←0' 'c←¯1' 'A←1 ⋄ a←2' 'a←3' 'A←4'
Assert' '=10#.TEMP.⎕FX'r←(fns Hello2)y;a' 'b←0' 'c←¯1' 'A←1 ⋄ a←2 ' 'a←3 ' 'A←4 '
#.TEMP.dfns{
b0
c¯1
Expand Down Expand Up @@ -54,7 +54,7 @@
code,':EndClass'
#.TEMP.⎕FIX,¨code
code':Namespace NS'
code,'Dfns1←{c←0 ⋄ a←1 ⋄ A←2}'
code,'Dfns1←{c←0 ⋄ a←1 ⋄ A←2} ⋄ a←1'
code,'Dfns2←{'
code,'b←0'
code,'c←¯1'
Expand Down Expand Up @@ -96,7 +96,7 @@

{}∆Select n.StartBtn
0.2 ∆Process n.Form
GoToTidyUp 11#._Fire.Fire.G.NoOfObjects
GoToTidyUp 12#._Fire.Fire.G.NoOfObjects

{}∆Select n.ReplaceBtn
∆Process n.Form
Expand All @@ -106,16 +106,17 @@

{}∆Select n2.StartBtn
∆Process n2.Form
GoToTidyUp 11#._Fire.Fire.Replace.NoOfReplacements
GoToTidyUp 12#._Fire.Fire.Replace.NoOfReplacements

GoToTidyUp(⎕NR'#.TEMP.Hello1')' r←Hello1' ' b←0' ' c←¯1' ' A←1 ⋄ A←2' ' A←3' ' A←4'
GoToTidyUp(⎕NR'#.TEMP.Hello2')' r←(fns Hello2)y;A' ' b←0' ' c←¯1' ' A←1 ⋄ A←2' ' A←3' ' A←4'
GoToTidyUp(dlb ⎕NR'#.TEMP.dfns')dlb' dfns←{' ' b←0' ' c←¯1' ' A←1 ⋄ A←2' ' A←3' ' A←4' ' }'
GoToTidyUp(dlb ⎕NR'#.TEMP.dop')dlb' dop←{' ' b←0 c←¯1' ' A←1 ⋄ A←⍺⍺ 2' ' A←3' ' A←4' ' }'
buffer,¨':Class Foo' 'Dfns1←{c←0 ⋄ A←1 ⋄ A←2}' 'Dfns2←{' 'b←0' 'c←¯1' 'A←1 ⋄ A←2' 'A←3' 'A←4' '}' 'Top1←{c←0 ⋄ A←1 ⋄ A←⍺⍺ 2}' 'Top2←{' 'b←0' 'c←¯1' 'A←1 ⋄ A←⍺⍺ 2' 'A←3' 'A←4' '}' '∇r←Fns' 'b←0' 'c←¯1' 'A←1 ⋄ A←2' 'A←3' 'A←4' '' '∇r←(fns Top) y' 'A←1 ⋄ A←fns 2' 'A←3' 'A←4' '' ':EndClass'
GoToTidyUp(dlb ⎕SRC #.TEMP.Foo)dlb buffer
buffer,¨':Namespace NS' ' Dfns1←{c←0 ⋄ A←1 ⋄ A←2}' ' Dfns2←{' ' b←0' ' c←¯1' ' A←1 ⋄ A←2' ' A←3' ' A←4' ' }' ' Top1←{c*0 ⋄ A←1 ⋄ A←⍺⍺ 2}' ' Top2←{' ' b←0' ' c←¯1' ' A←1 ⋄ A←⍺⍺ 2' ' A←3' ' A←4' ' }' ' ∇ r←Fns' ' b←0' ' c←¯1' ' A←1 ⋄ A←2' ' A←3' ' A←4' '' ' ∇ r←(fns Top)y' ' b←0' ' c←¯1' ' A←1 ⋄ A←fns 2' ' A←3' ' A←4' '' ':EndNamespace'
GoToTidyUp(dlb ⎕SRC #.TEMP.NS)dlb buffer
buffer,¨':Namespace NS' 'Dfns1←{c←0 ⋄ A←1 ⋄ A←2}⋄ A←1' 'Dfns2←{' 'b←0' 'c←¯1' 'A←1 ⋄ A←2' 'A←3' 'A←4' '}' 'Top1←{c*0 ⋄ A←1 ⋄ A←⍺⍺ 2}' 'Top2←{' 'b←0' 'c←¯1' 'A←1 ⋄ A←⍺⍺ 2' 'A←3' 'A←4' '}' '∇ r←Fns' 'b←0' 'c←¯1' 'A←1 ⋄ A←2' 'A←3' 'A←4' '' '∇ r←(fns Top)y' 'b←0' 'c←¯1' 'A←1 ⋄ A←fns 2' 'A←3' 'A←4' '' ':EndNamespace'
bodydlb ⎕SRC #.TEMP.NS
GoToTidyUp bodybuffer
R∆OK

∆TidyUp:
Expand Down
2 changes: 1 addition & 1 deletion APLSource/TestCases-11/Test_Replace_223-21.aplf
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
∆Process n.Form
GoToTidyUp 7#._Fire.Fire.Replace.NoOfReplacements
code1,/(⎕UCS 13),¨⎕SRC #.TEMP.Foo
GoToTidyUp 12+/'abcd←2000'code
GoToTidyUp 11+/'abcd←2000'code
R∆OK

∆TidyUp:
Expand Down
Loading

0 comments on commit fab390f

Please sign in to comment.