-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathRun.aplf
44 lines (44 loc) · 1.98 KB
/
Run.aplf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Run path_;res;qdmx;sep;paths;DLB;DTB;path;cacheFilename;tie;data
⍝ Brings Cider's and Tatin's APIs into ⎕SE and makes sure that the associated user commands will be found.
⍝ This is for version 19.0 and later but not the new user command framework.
⍝ The function is part of the Tatin project.
⍝ Version 1.2.0 from 2025-01-21 ⋄ Kai Jaeger
path←⊃,/1 ⎕NPARTS∊path_,'/../../SessionExtensions/CiderTatin'
:If 19≤⊃(//)⎕VFI{⍵↑⍨¯1+⍵⍳'.'}2⊃# ⎕WG'APLVersion'
⎕SE.⎕EX'_Tatin' ⍝ In case Tatin was saved as part of the session file
:Trap 0
'_Tatin'⎕SE.⎕CY path,'/Tatin/Client.dws'
:Else
qdmx←⎕DMX
⎕←'Copying Tatin from <',path,'> failed (',qdmx.EM,', RC=',(⍕qdmx.EN),')' ⋄ →0
:EndTrap
:Trap 0
⎕SE._Tatin.Admin.EstablishClientInQuadSE ⍬
:Else
qdmx←⎕DMX
⎕←'Attempt to establish Tatin in ⎕SE failed (',qdmx.EM,', RC=',(⍕qdmx.EN),')' ⋄ →0
:EndTrap
DLB←{⍵↓⍨+/∧\' '=⍵}
DTB←{⍵↓⍨-+/∧\' '=⌽⍵}
:If ⎕NEXISTS path,'/Cider' ⍝ People might not have activated Cider
:Trap 0
res←⎕SE.Tatin.LoadDependencies(path,'/Cider')⎕SE
:If ~∨/'_Cider_'⍷∊⍕res
⎕←'Attempt to load the "Cider" package failed'
:EndIf
:Else
qdmx←⎕DMX
⎕←'Attempt to load the "Cider" package failed (',qdmx.EM,', RC=',(⍕qdmx.EN),')'
:EndTrap
:EndIf
:EndIf
⎕SE.⎕EX'CiderTatin'
cacheFilename←⎕SE.SALTUtils.UCMDCACHEFILE,⍨⊃⎕NPARTS ¯1↓⎕SE.Dyalog.StartupSession.VerSpec
:If ~⎕NEXISTS cacheFilename ⍝ If there is no user command cache we must create one
tie←cacheFilename ⎕FSTIE 0
data←⎕FREAD tie 2
⎕FUNTIE tie
:OrIf ~(⊂'tatin')∊data[;1] ⍝ There is a user command cache but it does not know about "tatin"
⎕SE.SALTUtils.ResetUCMDcache ¯1
:EndIf
⍝Done