Skip to content

Commit ce2b1f4

Browse files
committed
Serious Replace bug fixed
1 parent 71541b1 commit ce2b1f4

12 files changed

+139
-24
lines changed

APLSource/Fire/GUI/CheckSALTedScripts.aplf

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
CheckSALTedScripts←{
22
⍝ Check whether any SALT managed scripts got changed and if so report them.
33
⍝ This is because Fire changes thenm in the WS but does NOT tell SALT about it.
4-
(0∊no←##.G.ChangedSaltedScript):⍬
5-
m←⊂(⍕no),' script',((1<no)/'s'),' managed by SALT got changed,'
4+
(0∊no←##.G.ChangedSaltedScript):⍬
5+
m←⊂(⍕no),' script',((1<no)/'s'),' potentially managed by SALT got changed,'
66
m,←⊂' Would you like to get ',((1=no)/'a '),'SALT "Save" command',((1<no)/'s'),' printed to []SE?'
77
(0=##.Question.YesOrNo m):⍬
88
##.ReportSALTedScripts ⍬

APLSource/Fire/History.apla

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
(
22
'⍝ Contains information regarding the last release. A full history is available on GitHub. (This line is ignored)'
33
''
4-
'* 9.6.3 from 2023-10-28'
4+
'* 9.6.4 from 2024-05-02'
5+
' * When a function or a script was renamed implicitly via a "Replace" operation, Link/acre were given the old name '
6+
' rather than the new one, effectively loosing the change when the WS was destroyed one way or the other.'
7+
''
8+
'* 9.6.3 from 2024-04-04'
59
' * "Search QNL" corrected: "#" cannot be a hot key.'
610
' * Under some circumstances Fire did not find its release notes '
711
''

APLSource/Fire/Replace/FixScript.aplf

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,24 @@
1-
{r}←FixScript(ref name code i noOf);flag;msg;saltFlag;salt;_;cs;taa;managedFlag
1+
{r}←FixScript(ref name code i noOf);flag;msg;saltFlag;salt;_;cs;tbt;managedFlag;res
22
⍝ Establishes script (class, interface or scripted namespace) "name" in the namepsace
33
⍝ ref is pointing to with the contents "code".
44
⍝ Returns 1 in case the user has cancelled the process, otherwise 0.
55
r←flag←0
6-
taa←'' ⍝ Collect the names acre needs to be told about
6+
tbt←'' ⍝ Collect the names acre needs To Be Told about
77
:Repeat
88
:If saltFlag←9=ref.⎕NC name,'.SALT_Data' ⍝ Controlled by SALT?!
99
salt←ref.⎕NS name,'.SALT_Data'
1010
:EndIf
1111
managedFlag←IsManagedByInterpreter name
1212
:Trap 11
13-
ref.⎕FIX code
13+
res←ref.⎕FIX code
1414
flag←1
1515
:If saltFlag
1616
'SALT_Data'(ref.⍎name).⎕NS salt.SALT_Data ⍝ Restore the SALT data
17-
##.G.ChangedSaltedScript,←⊂name
18-
:ElseIf managedFlag
19-
##.G.ChangedSaltedScript,←⊂name
2017
:EndIf
21-
taa,←⊂(⍕ref),'.',name
18+
##.G.ChangedSaltedScript←∪##.G.ChangedSaltedScript,⊂name
19+
tbt,←⊂(⍕res)
2220
:Else
23-
msg←⊂'Sorry, but fixing the script of this object:'
21+
msg←⊂'Sorry, but the attempt to fix the script of this object:'
2422
msg,←⊂' ',name
2523
msg,←⊂'(no. ',(⍕i+1),' of ',(⍕noOf),')'
2624
msg,←⊂'did not work.'
@@ -40,7 +38,7 @@
4038
:EndSelect
4139
:EndTrap
4240
:Until flag
43-
:If ~TellAcre taa
44-
TellLink taa
41+
:If ~TellAcre tbt
42+
TellLink tbt
4543
:EndIf
4644
⍝Done

APLSource/Fire/Replace/QFX.aplf

+6-6
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@
2121
l←ref.⎕FX code
2222
flag←0
2323
:Repeat
24-
:If ' '≠1↑0⍴l
24+
:If ' '=1↑0⍴l
25+
flag←1
26+
:If ~TellAcre(⍕ref),'.',l
27+
TellLink(⍕ref),'.',l
28+
:EndIf
29+
:Else
2530
msg←⊂'Sorry, but fixing the code of this object:'
2631
msg,←⊂' ',name
2732
msg,←⊂'(no. ',(⍕i),' of ',(⍕noOf),')'
@@ -41,11 +46,6 @@
4146
:Case 2 ⍝ Cancel the whole operation
4247
r←1 ⋄ :Return
4348
:EndSelect
44-
:Else
45-
flag←1
46-
:If ~TellAcre(⍕ref),'.',name
47-
TellLink(⍕ref),'.',name
48-
:EndIf
4949
:EndIf
5050
:Until flag
5151
:EndIf

APLSource/Fire/Version.aplf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
r←Version
22
⍝ See also `History`
3-
r←'Fire' '9.6.3+284' '2024-04-04'
3+
r←'Fire' '9.6.4+286' '2024-05-02'
+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
R←Test_Replace_068(stopFlag batchFlag);n;Text;n2;⎕TRAP;expected;tempDir;res;parms
2+
⍝ Replace a string in a function that changes the name; check whether Link is informed
3+
⎕TRAP←(999 'C' '. ⍝ Deliberate error')(0 'N')
4+
R←T._Failed
5+
6+
⍝ Preconditions
7+
1 #.Fire.Fire.Run 0
8+
n←#.Fire.Fire.GUI.n
9+
10+
tempDir←FilesAndDirs.GetTempSubDir↑⎕SI
11+
#.⎕SHADOW'TEMP'
12+
'TEMP'#.⎕NS''
13+
#.TEMP.⎕FX'r←Foo' 'r←42'
14+
parms←⎕NS''
15+
parms.watch←'ns'
16+
res←parms ⎕SE.Link.Create'#.TEMP'tempDir
17+
Assert res≡'Linked: #.TEMP → ',tempDir
18+
Assert('.linkconfig' 'Foo.aplf')≡{↑,/1↓⎕NPARTS ⍵}¨↑FilesAndDirs.Dir tempDir,'/'
19+
20+
n.SearchFor.Text←'Foo'
21+
n.StartSearchIn.Text←'#.TEMP'
22+
n.(Case APL_Name).State←1
23+
24+
{}∆Select n.StartBtn
25+
∆Process n.Form
26+
→T.GoToTidyUp(,⊂'Foo')≢n.HitList.Items
27+
expected←,⊂'#.TEMP'
28+
→T.GoToTidyUp expected≢n.HitList.ReportInfo[;0]
29+
30+
{}∆Select n.ReplaceBtn
31+
∆Process n.Form
32+
33+
n2←#.Fire.Fire.Replace.n
34+
n2.ReplaceBy.Text←'TheAnswerIs'
35+
36+
{}∆Select n2.StartBtn
37+
∆Process n.Form
38+
→T.GoToTidyUp 1≠#.Fire.Fire.Replace.NoOfReplacements
39+
→T.GoToTidyUp' r←Foo' ' r←42'≢⎕NR'#.TEMP.Foo'
40+
→T.GoToTidyUp 42≢#.TEMP.TheAnswerIs
41+
→T.GoToTidyUp~(,⊂'TheAnswerIs.aplf')∊{↑,/1↓⎕NPARTS ⍵}¨↑FilesAndDirs.Dir tempDir,'/'
42+
43+
R←T._OK
44+
45+
∆TidyUp:
46+
CloseFire
47+
{}⎕SE.Link.Break'#.TEMP'
48+
#.⎕EX'TEMP'
49+
{}FilesAndDirs.RmDirByForce tempDir
50+
⍝Done
+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
R←Test_Replace_069(stopFlag batchFlag);n;Text;n2;⎕TRAP;expected;tempDir;res;parms
2+
⍝ Replace a string in a script that changes the name of the script; check whether Link is informed
3+
⎕TRAP←(999 'C' '. ⍝ Deliberate error')(0 'N')
4+
R←T._Failed
5+
6+
⍝ Preconditions
7+
1 #.Fire.Fire.Run 0
8+
n←#.Fire.Fire.GUI.n
9+
10+
tempDir←FilesAndDirs.GetTempSubDir↑⎕SI
11+
#.⎕SHADOW'TEMP'
12+
'TEMP'#.⎕NS''
13+
#.TEMP.⎕FIX':Namespace Foo' '∇r←Get' 'r←42' '∇' ':EndNamespace'
14+
parms←⎕NS''
15+
parms.watch←'ns'
16+
res←parms ⎕SE.Link.Create'#.TEMP'tempDir
17+
Assert res≡'Linked: #.TEMP → ',tempDir
18+
Assert('.linkconfig' 'Foo.apln')≡{↑,/1↓⎕NPARTS ⍵}¨↑FilesAndDirs.Dir tempDir,'/'
19+
20+
n.SearchFor.Text←'Foo'
21+
n.StartSearchIn.Text←'#.TEMP'
22+
n.(Case APL_Name).State←1
23+
24+
{}∆Select n.StartBtn
25+
∆Process n.Form
26+
→T.GoToTidyUp(,⊂'Foo')≢n.HitList.Items
27+
expected←,⊂'#.TEMP'
28+
→T.GoToTidyUp expected≢n.HitList.ReportInfo[;0]
29+
30+
{}∆Select n.ReplaceBtn
31+
∆Process n.Form
32+
33+
n2←#.Fire.Fire.Replace.n
34+
n2.ReplaceBy.Text←'TheAnswerIs'
35+
36+
{}∆Select n2.StartBtn
37+
∆Process n.Form
38+
→T.GoToTidyUp 1≠#.Fire.Fire.Replace.NoOfReplacements
39+
→T.GoToTidyUp 42≢#.TEMP.Foo.Get
40+
→T.GoToTidyUp 42≢#.TEMP.TheAnswerIs.Get
41+
→T.GoToTidyUp~(,⊂'TheAnswerIs.apln')∊{↑,/1↓⎕NPARTS ⍵}¨↑FilesAndDirs.Dir tempDir,'/'
42+
43+
R←T._OK
44+
45+
∆TidyUp:
46+
CloseFire
47+
{}⎕SE.Link.Break'#.TEMP'
48+
#.⎕EX'TEMP'
49+
{}FilesAndDirs.RmDirByForce tempDir
50+
⍝Done

Docs/ReleaseNotes.md

+5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ A bump of the minor number indicates added functionality plus possibly bug fixes
1313

1414
A bump of the patch number indicates bug fixes.
1515

16+
## Version 9.6.4 from 2024-05-02
17+
18+
* Bug fix: when a function or a script was renamed implicitly via a "Replace" operation, Link/acre were given the old name rather than the new one, effectively loosing the change when the WS was destroyed one way or the other.
19+
1620
## Version 9.6.3 from 2024-04-04
1721

1822
* Bug fixes
@@ -164,3 +168,4 @@ Bug fix: people who do not tick "Options > Object Syntax > Expose GUI Properties
164168

165169

166170

171+

0 commit comments

Comments
 (0)