Skip to content

Commit

Permalink
Merge pull request #611 from Dyalog/fix-603
Browse files Browse the repository at this point in the history
Fix #603
  • Loading branch information
mkromberg authored Dec 4, 2023
2 parents 7760908 + f33c69c commit 12038be
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
14 changes: 11 additions & 3 deletions StartupSession/Link/Utils.apln
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@
:If ts tslist[4;] :Else ts :EndIf

(fixed failed)opts FixFiles(target source overwrite);⎕AVU;FixFile;_;actname;actnames;actnc;actncs;alldirs;allexts;allfiles;allnames;dir;expfiles;expname;expnames;ext;extorder;exts;file;fixedfiles;flatten;fullname;hasnc;hidden;i;inx;lasttodo;list;mask;ncorder;ns;order;parent;parents;quadfile;source;todo
(fixed failed)opts FixFiles(target source overwrite);⎕AVU;FixFile;_;actname;actnames;actnc;actncs;alldirs;allexts;allfiles;allnames;dir;expfiles;expname;expnames;ext;extorder;exts;file;fixedfiles;flatten;fullname;hasnc;hidden;i;inx;lasttodo;list;mask;ncorder;ns;order;parent;parents;quadfile;source;todo;classic;z
Load items from files in folders
overwrite=¯1 : empty target - no overwrite
overwrite=0 : non-empty target - no overwrite
Expand All @@ -1139,7 +1139,7 @@
:Else allfilesopts(1 ListFiles 0)source whole directory including root
:EndIf

:If 82=⎕DR'' Classic
:If classic82=⎕DR'' Classic
:AndIf (allfiles)i(¯10¨allfiles)⎕C'/⎕AVU.apla' Source contains ⎕AVU
:Trap 0 Try to set ⎕AVU so that all ⎕NGET/⎕FIX operations will use saved ⎕AVU
⎕AVU(opts.ns).⎕AVU⎕SE.Dyalog.Array.Deserialise⎕NGET iallfiles
Expand All @@ -1151,7 +1151,15 @@
(parents expnames actnames actncs)opts DetermineAplName allfiles expected names (one per file), actual names (one list per file), actual name classes (one list per file)
:If opts.singlefile
:AndIf actnamesexpnames
Error 'Source file defines "',actnames,'", rather than "',expnames,'"'
:If classic0=actnames Empty name in Classic?
:Trap 92 TRANSLATION ERROR
zGetFile allfiles
:Else
Error ⎕DMX.(EM,' ',Message)
:EndTrap
:Else
Error 'Source file defines "',actnames,'", rather than "',expnames,'"'
:EndIf
:EndIf
:If opts.fastLoad do not spend time avoiding name clashes - actnc will be all 0's anyway
maskactncs¯1 invalid names
Expand Down
19 changes: 14 additions & 5 deletions Test/test_classic.aplf
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
oktest_classic(folder name);foosrc;foobytes;read;goosrc;goobytes;nsref
oktest_classic(folder name);foosrc;foobytes;read;goosrc;goobytes;nsref;z;nsbytes
:If 82⎕DR'' Classic interpreter required for classic QA !
Log'Not a classic interpreter - not running ',⎕SI
ok1 :Return
:EndIf
3 QMKDIR folder

check that key and friends are correctly translated in classic edition
--- check that key and friends are correctly translated in classic edition
{}⎕SE.Link.Create name folder
name'foo'⎕SE.Link.Fix foosrc' res←foo arg' ' res←{⍺ ⍵}⎕U2338 arg'
readNREADALL folder,'/foo.aplf'
foobytes32 114 101 115 ¯30 ¯122 ¯112 102 111 111 32 97 114 103 13 10 32 114 101 115 ¯30 ¯122 ¯112 123 ¯30 ¯115 ¯70 32 ¯30 ¯115 ¯75 125 ¯30 ¯116 ¯72 32 97 114 103 13 10
assert'(read~13)≡(foobytes~13)'
assert'(read~13 32)≡(foobytes~13 32)' Also exclude spaces since source may or may not be preserved "as typed"

goobytes1+@8foobytes turn foo into goo
goosrc{'g'@6}¨@1foosrc
goobytes{tie ⎕NCREATE 0 _ ⎕NAPPEND tie 83 1:_⎕NUNTIE tie}folder,'/goo.aplf'
Notify 'changed' (folder,'/goo.aplf')
assert'goosrc≡⎕NR ''',name,'.goo'''
assert'goosrc≡⍥{⍵~¨'' ''}⎕NR ''',name,'.goo'''

{}⎕SE.Link.Break name
CleanUp folder name

test handling of non-default ⎕AVU
--- test handling of non-default ⎕AVU
nsrefname ⎕NS''⎕EX name
assert'nsref.⎕AVU[60]=8866' Default: right tack
nsref.⎕FX foosrc' foo' '⍝⊢'
Expand All @@ -38,6 +38,15 @@
{}⎕SE.Link.Break name
⎕EX name

Check error messages when TRANSLATION ERROR occurs in Classic (issue #603)
Define :Namespace with comment containing copyright symbol

nsbytes¯17 ¯69 ¯65 58 78 97 109 101 83 112 97 99 101 32 105 54 48 51 13 10
nsbytes,¯30 ¯115 ¯99 32 ¯62 ¯87 13 10, 58 69 110 100 78 97 109 101 115 112 97 99 101 13 10
nsbytes {tie ⎕NCREATE 0 _ ⎕NAPPEND tie 83 1:_⎕NUNTIE tie}folder,'/i603.apln'

assertError 'z←⎕SE.Link.Import name (folder,''/i603.apln'')' '(U+00A9) not in ⎕AVU'

{}LinkCreate name folder
assert'foosrc≡⎕NR ''',name,'.foo'''
assert'nsref.⎕AVU[60]=164' Check ⎕AVU has been set to non-default
Expand Down

0 comments on commit 12038be

Please sign in to comment.