Skip to content

Commit

Permalink
Serious Replace bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
aplteam committed May 2, 2024
1 parent 71541b1 commit ce2b1f4
Show file tree
Hide file tree
Showing 12 changed files with 139 additions and 24 deletions.
4 changes: 2 additions & 2 deletions APLSource/Fire/GUI/CheckSALTedScripts.aplf
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
CheckSALTedScripts{
Check whether any SALT managed scripts got changed and if so report them.
This is because Fire changes thenm in the WS but does NOT tell SALT about it.
(0no##.G.ChangedSaltedScript):
m(no),' script',((1<no)/'s'),' managed by SALT got changed,'
(0no##.G.ChangedSaltedScript):
m(no),' script',((1<no)/'s'),' potentially managed by SALT got changed,'
m,' Would you like to get ',((1=no)/'a '),'SALT "Save" command',((1<no)/'s'),' printed to []SE?'
(0=##.Question.YesOrNo m):
##.ReportSALTedScripts
Expand Down
6 changes: 5 additions & 1 deletion APLSource/Fire/History.apla
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
(
'⍝ Contains information regarding the last release. A full history is available on GitHub. (This line is ignored)'
''
'* 9.6.3 from 2023-10-28'
'* 9.6.4 from 2024-05-02'
' * 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.'
''
'* 9.6.3 from 2024-04-04'
' * "Search QNL" corrected: "#" cannot be a hot key.'
' * Under some circumstances Fire did not find its release notes '
''
Expand Down
18 changes: 8 additions & 10 deletions APLSource/Fire/Replace/FixScript.aplf
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
{r}FixScript(ref name code i noOf);flag;msg;saltFlag;salt;_;cs;taa;managedFlag
{r}FixScript(ref name code i noOf);flag;msg;saltFlag;salt;_;cs;tbt;managedFlag;res
Establishes script (class, interface or scripted namespace) "name" in the namepsace
ref is pointing to with the contents "code".
Returns 1 in case the user has cancelled the process, otherwise 0.
rflag0
taa'' Collect the names acre needs to be told about
tbt'' Collect the names acre needs To Be Told about
:Repeat
:If saltFlag9=ref.⎕NC name,'.SALT_Data' Controlled by SALT?!
saltref.⎕NS name,'.SALT_Data'
:EndIf
managedFlagIsManagedByInterpreter name
:Trap 11
ref.⎕FIX code
resref.⎕FIX code
flag1
:If saltFlag
'SALT_Data'(ref.name).⎕NS salt.SALT_Data Restore the SALT data
##.G.ChangedSaltedScript,name
:ElseIf managedFlag
##.G.ChangedSaltedScript,name
:EndIf
taa,(ref),'.',name
##.G.ChangedSaltedScript##.G.ChangedSaltedScript,name
tbt,(res)
:Else
msg'Sorry, but fixing the script of this object:'
msg'Sorry, but the attempt to fix the script of this object:'
msg,' ',name
msg,'(no. ',(i+1),' of ',(noOf),')'
msg,'did not work.'
Expand All @@ -40,7 +38,7 @@
:EndSelect
:EndTrap
:Until flag
:If ~TellAcre taa
TellLink taa
:If ~TellAcre tbt
TellLink tbt
:EndIf
Done
12 changes: 6 additions & 6 deletions APLSource/Fire/Replace/QFX.aplf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@
lref.⎕FX code
flag0
:Repeat
:If ' '10l
:If ' '=10l
flag1
:If ~TellAcre(ref),'.',l
TellLink(ref),'.',l
:EndIf
:Else
msg'Sorry, but fixing the code of this object:'
msg,' ',name
msg,'(no. ',(i),' of ',(noOf),')'
Expand All @@ -41,11 +46,6 @@
:Case 2 Cancel the whole operation
r1 :Return
:EndSelect
:Else
flag1
:If ~TellAcre(ref),'.',name
TellLink(ref),'.',name
:EndIf
:EndIf
:Until flag
:EndIf
2 changes: 1 addition & 1 deletion APLSource/Fire/Version.aplf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
rVersion
See also `History`
r'Fire' '9.6.3+284' '2024-04-04'
r'Fire' '9.6.4+286' '2024-05-02'
50 changes: 50 additions & 0 deletions APLSource/TestCases/Test_Replace_068.aplf
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
RTest_Replace_068(stopFlag batchFlag);n;Text;n2;⎕TRAP;expected;tempDir;res;parms
Replace a string in a function that changes the name; check whether Link is informed
⎕TRAP(999 'C' '. ⍝ Deliberate error')(0 'N')
RT._Failed

Preconditions
1 #.Fire.Fire.Run 0
n#.Fire.Fire.GUI.n

tempDirFilesAndDirs.GetTempSubDir⎕SI
#.⎕SHADOW'TEMP'
'TEMP'#.⎕NS''
#.TEMP.⎕FX'r←Foo' 'r←42'
parms⎕NS''
parms.watch'ns'
resparms ⎕SE.Link.Create'#.TEMP'tempDir
Assert res'Linked: #.TEMP → ',tempDir
Assert('.linkconfig' 'Foo.aplf'){,/1⎕NPARTS }¨FilesAndDirs.Dir tempDir,'/'

n.SearchFor.Text'Foo'
n.StartSearchIn.Text'#.TEMP'
n.(Case APL_Name).State1

{}∆Select n.StartBtn
∆Process n.Form
T.GoToTidyUp(,'Foo')n.HitList.Items
expected,'#.TEMP'
T.GoToTidyUp expectedn.HitList.ReportInfo[;0]

{}∆Select n.ReplaceBtn
∆Process n.Form

n2#.Fire.Fire.Replace.n
n2.ReplaceBy.Text'TheAnswerIs'

{}∆Select n2.StartBtn
∆Process n.Form
T.GoToTidyUp 1#.Fire.Fire.Replace.NoOfReplacements
T.GoToTidyUp' r←Foo' ' r←42'⎕NR'#.TEMP.Foo'
T.GoToTidyUp 42#.TEMP.TheAnswerIs
T.GoToTidyUp~(,'TheAnswerIs.aplf'){,/1⎕NPARTS }¨FilesAndDirs.Dir tempDir,'/'

RT._OK

∆TidyUp:
CloseFire
{}⎕SE.Link.Break'#.TEMP'
#.⎕EX'TEMP'
{}FilesAndDirs.RmDirByForce tempDir
Done
50 changes: 50 additions & 0 deletions APLSource/TestCases/Test_Replace_069.aplf
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
RTest_Replace_069(stopFlag batchFlag);n;Text;n2;⎕TRAP;expected;tempDir;res;parms
Replace a string in a script that changes the name of the script; check whether Link is informed
⎕TRAP(999 'C' '. ⍝ Deliberate error')(0 'N')
RT._Failed

Preconditions
1 #.Fire.Fire.Run 0
n#.Fire.Fire.GUI.n

tempDirFilesAndDirs.GetTempSubDir⎕SI
#.⎕SHADOW'TEMP'
'TEMP'#.⎕NS''
#.TEMP.⎕FIX':Namespace Foo' '∇r←Get' 'r←42' '' ':EndNamespace'
parms⎕NS''
parms.watch'ns'
resparms ⎕SE.Link.Create'#.TEMP'tempDir
Assert res'Linked: #.TEMP → ',tempDir
Assert('.linkconfig' 'Foo.apln'){,/1⎕NPARTS }¨FilesAndDirs.Dir tempDir,'/'

n.SearchFor.Text'Foo'
n.StartSearchIn.Text'#.TEMP'
n.(Case APL_Name).State1

{}∆Select n.StartBtn
∆Process n.Form
T.GoToTidyUp(,'Foo')n.HitList.Items
expected,'#.TEMP'
T.GoToTidyUp expectedn.HitList.ReportInfo[;0]

{}∆Select n.ReplaceBtn
∆Process n.Form

n2#.Fire.Fire.Replace.n
n2.ReplaceBy.Text'TheAnswerIs'

{}∆Select n2.StartBtn
∆Process n.Form
T.GoToTidyUp 1#.Fire.Fire.Replace.NoOfReplacements
T.GoToTidyUp 42#.TEMP.Foo.Get
T.GoToTidyUp 42#.TEMP.TheAnswerIs.Get
T.GoToTidyUp~(,'TheAnswerIs.apln'){,/1⎕NPARTS }¨FilesAndDirs.Dir tempDir,'/'

RT._OK

∆TidyUp:
CloseFire
{}⎕SE.Link.Break'#.TEMP'
#.⎕EX'TEMP'
{}FilesAndDirs.RmDirByForce tempDir
Done
5 changes: 5 additions & 0 deletions Docs/ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ A bump of the minor number indicates added functionality plus possibly bug fixes

A bump of the patch number indicates bug fixes.

## Version 9.6.4 from 2024-05-02

* 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.

## Version 9.6.3 from 2024-04-04

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




Loading

0 comments on commit ce2b1f4

Please sign in to comment.