Skip to content

Commit 6831df6

Browse files
committed
...
1 parent 1ea5aee commit 6831df6

16 files changed

+247
-42
lines changed

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
.acre
1+
.acre/
2+
aplcore
23
Dist/
3-
Development.dws
4+
change_history/
5+
.gitignore

APLSource/Initialize.aplf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{r}←Initialize;⎕TRAP
2+
⎕TRAP←0 'S'
3+
r←⍬
4+
{}⎕SE.UCMD'cd ',AcreConfig.ProjectFolder
5+
⎕SE.aplteam.InitializeAPLTreeProject ⎕THIS
6+
⍝Done

APLSource/ShowChmHelp.aplc

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,18 @@
1717

1818
⎕IO←1 ⋄ ⎕ml←3
1919

20-
:Include APLTreeUtils
21-
2220
∇ r←Version
2321
:Access Public shared
24-
r←(Last⍕⎕THIS)'2.0.0.5' '2020-03-23'
22+
r←'ShowChmHelp' '3.0.0.10' '2020-09-26'
2523
2624

2725
∇ History
2826
:Access Public shared
29-
⍝ * 2.0.0
30-
⍝ * BREAKING CHANGE: File extension changed from .DYALOG to .APLC
27+
⍝ * 3.0.0
28+
⍝ * BREAKING CHANGES:
29+
⍝ * Requires Dyalog 18.0 or better
30+
⍝ * Does not `:Include APLTreeUtils anymore
31+
⍝ * Release comes as a Tatin package
3132
⍝\\
3233
⍝ For information regarding older versions see <https://github.com/aplteam/ShowChmHelp/releases>
3334
@@ -54,11 +55,7 @@
5455
5556

5657
∇ InitExternalFns dummy
57-
'ToLower'⎕NA'I4 USER32.C32|CharLower',('*A'⊃⍨1+12>{⍎⍵↑⍨¯1+⍵⍳'.'}2⊃'.'⎕WG'APLVersion'),' =0T'
58-
'ToUpper'⎕NA'I4 USER32.C32|CharUpper',('*A'⊃⍨1+12>{⍎⍵↑⍨¯1+⍵⍳'.'}2⊃'.'⎕WG'APLVersion'),' =0T'
5958
'GetDesktopWindow'⎕NA'I4 user32.C32∣GetDesktopWindow'
60-
'∆FindFirstFile'⎕NA'I4 kernel32.C32|FindFirstFile',('*A'⊃⍨1+12>{⍎⍵↑⍨¯1+⍵⍳'.'}2⊃'.'⎕WG'APLVersion'),' <0T >{I4 {I4 I4} {I4 I4} {I4 I4} {I4 I4} {I4 I4} T[260] T[14]}'
61-
'∆FindClose'⎕NA'kernel32.C32|FindClose I4'
6259
'∆DisplayTopic'⎕NA'I4 hhctrl.ocx.C32∣HtmlHelp',('*A'⊃⍨1+12>{⍎⍵↑⍨¯1+⍵⍳'.'}2⊃'.'⎕WG'APLVersion'),' I <0T[] I I'
6360
'∆DisplayHelpfile'⎕NA'I4 hhctrl.ocx.C32|HtmlHelp',('*A'⊃⍨1+12>{⍎⍵↑⍨¯1+⍵⍳'.'}2⊃'.'⎕WG'APLVersion'),' I <0T[] I I'
6461
'∆Quit'⎕NA'I4 hhctrl.ocx.C32|HtmlHelp',('*A'⊃⍨1+12>{⍎⍵↑⍨¯1+⍵⍳'.'}2⊃'.'⎕WG'APLVersion'),' I I I I'
@@ -69,8 +66,8 @@
6966
∇ Init Parms;Allowed
7067
_WindowsDefault←''
7168
:If IsChar _WindowsDefault
72-
_WindowsDefault←Uppercase _WindowsDefault
73-
:If ~0∊⍴,_WindowsDefault
69+
_WindowsDefault←1 ⎕C _WindowsDefault
70+
:If 0≠≢,_WindowsDefault
7471
:AndIf (⊂_WindowsDefault)∊'DEVELOPMENT' 'DESKTOP'
7572
6 ⎕SIGNAL⍨'Check parameter "WindowsDefault"!'
7673
:EndIf
@@ -94,10 +91,10 @@
9491
∇ {R}←DisplayHelpfile Filename;handle
9592
:Access Public Instance
9693
handle←GetDefaultHandle''
97-
:If '.CHM'≢Uppercase ¯4↑Filename
94+
:If '.CHM'≢1 ⎕C ¯4↑Filename
9895
Filename,←'.chm'
9996
:EndIf
100-
:If DoesFileExist Filename
97+
:If ⎕NEXISTS Filename
10198
R←(∆DisplayHelpfile handle Filename HH_.DISPLAY_TOPIC 0)''
10299
:Else
103100
R←¯1 'File not found'
@@ -117,7 +114,7 @@
117114
⍎cs.{l←⊃,/' ',¨⎕NL-2 ⋄
118115
('(',l,')←cs.⍎''',l,'''')}⍬
119116
:EndIf
120-
:If DoesFileExist filename
117+
:If ⎕NEXISTS filename
121118
:If '.HTM'≢¯4↑filename←filename,'::/',topicName
122119
filename,←'.htm'
123120
:EndIf
@@ -133,21 +130,6 @@
133130

134131
⍝⍝⍝ Private stuff
135132

136-
∇ R←DoesFileExist Filename;Handle;Trash
137-
Filename↓⍨←{(-+/∧\(⌽⍵)∊'/\')}Filename
138-
:If R←0≠Handle←1⊃FindFirstFile Filename''
139-
Trash←∆FindClose Handle
140-
:EndIf
141-
142-
143-
FindFirstFile←{
144-
⎕IO←0
145-
¯1=↑rslt←∆FindFirstFile ⍵:0 ∆GetLastError
146-
(1 6⊃rslt)←FindTrim(1 6⊃rslt) ⍝ shorten the file name at the null delimiter
147-
(1 7⊃rslt)←FindTrim(1 7⊃rslt) ⍝ and for the alternate name
148-
rslt
149-
}
150-
151133
∇ R←GetDefaultHandle Type
152134
⍝ Type may be "Development" or "Desktop" or empty.
153135
⍝ If it is empty, _WindowsDefault is taken as a default.

APLSource/TestCases/Prepare.aplf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
Prepare
2+
⎕IO←1 ⋄ ⎕ML←1
23
T←⎕NEW ##.Tester2 ⎕THIS
4+
T.codeCoverage←⎕NEW ##.CodeCoverage(,⊂'#.',{⍵,'.',⍵}2↓⍕⎕THIS.##)
5+
T.codeCoverage.filename←(⊃1 ⎕NPARTS''),'TestResults/CodeCoverage'
6+
⍝Done

APLSource/TestCases/RunTests.aplf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
RunTests;dcfFilename;htmlFilename;tno
2+
Prepare
3+
dcfFilename←(⊃,/¯1↓⎕NPARTS T.codeCoverage.filename),'.dcf'
4+
:If ##.FilesAndDirs.IsFile dcfFilename
5+
:AndIf ∆YesOrNo'CodeCovarge data file already exists; override?'
6+
tno←dcfFilename ⎕FTIE 0
7+
dcfFilename ⎕FERASE tno
8+
:EndIf
9+
T.Run 1
10+
htmlFilename←##.CodeCoverage.ProcessDataAndCreateReport T.codeCoverage.filename
11+
##.APLTreeUtils2.GoToWebPage'file://',htmlFilename
12+
⍝Done

APLSource/TestCases/Test_001.aplf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
myHelp←⎕NEW ##.ShowChmHelp
77
path←GetFileRoot
88
filename←path,'\','demo.chm'
9-
→T.FailsIf ¯1=h←myHelp.DisplayHelpfile filename
9+
→T.FailsIf ¯1=h←myHelp.DisplayHelpfile filename
1010

1111
R←T._OK

APLSource/TestCases/Test_002.aplf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
myHelp←⎕NEW ##.ShowChmHelp
77
path←GetFileRoot
88
filename←path,'\','demo.chm'
9-
→T.FailsIf ¯1=h←myHelp.DisplayTopic filename'Links'
9+
→T.FailsIf ¯1=h←myHelp.DisplayTopic filename'Links'
1010

1111
R←T._OK

APLSource/TestCases/Test_ZZZ_999.aplf

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
1-
R←Test_ZZZ_999(stopFlag batchFlag);v;n;d;xml;rf;f1;f2;⎕TRAP
1+
R←Test_ZZZ_999(stopFlag batchFlag);⎕IO;⎕ML;v;n;d;xml;rf;f1;f2;⎕TRAP
22
⍝ Check the "Version" function and publish.config.
3+
⎕IO←1 ⋄ ⎕ML←1
34
⎕TRAP←(999 'C' '. ⍝ Deliberate error')(0 'N')
45
R←T._Failed
56

67
rf←#.ShowChmHelp.ShowChmHelp
78

89
⍝ First we check whether "Version" returns a valid result:
910
(n v d)←rf.Version
11+
d←{⍵/⍨3>+\'-'=⍵}d ⍝ Remove trailing stuff like "-beta"
1012
v←{⍵/⍨3>+\'.'=⍵}v ⍝ Remove build ID
1113
f1←~5≤⍴v
1214
f1∨←2≠'.'+.=v
1315
f1∨←~∧/⎕D∊⍨v~'.'
1416

1517
f1∨←10≠⍴d
16-
f1∨←d[4 7+⎕IO]∨.≠'-'
18+
f1∨←d[5 8]∨.≠'-'
1719
f1∨←~∧/⎕D∊⍨d~'-'
1820

1921
⍝ publish.config must be in line with what "Version" returns of course:
20-
xml←⎕XML'flat'##.APLTreeUtils.ReadUtf8File'publish.config'
21-
f2←v≢(2+⎕IO)⊃xml[xml[;1+⎕IO]⍳⊂'version';]
22-
f2∨←d≢(2+⎕IO)⊃xml[xml[;1+⎕IO]⍳⊂'date';]
22+
xml←⎕XML⊃⎕NGET'publish.config'
23+
f2←v≢3⊃xml[xml[;2]⍳⊂'version';]
24+
f2∨←d≢3⊃xml[xml[;2]⍳⊂'date';]
2325

2426
:If f1
2527
⎕←'Result of the "Version" function is invalid.'
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
yesOrNo←{default}∆YesOrNo question;isOkay;answer;add;dtb;answer2
2+
⍝ Ask a simple question and allows just "Yes" or "No" as answers.
3+
⍝ You may specify a default via the optional left argument which when specified
4+
⍝ rules what happens when the user just presses <enter>.
5+
⍝ `default` must be either 1 (yes) or 0 (no).
6+
⍝ Note that this function does not work as expected when traced!
7+
isOkay←0
8+
default←{0<⎕NC ⍵:⍎⍵ ⋄ ''}'default'
9+
isOkay←0
10+
:If 0≠≢default
11+
'Left argument must be a scalar'⎕SIGNAL 11/⍨1≠≢default
12+
:AndIf ~default∊0 1
13+
'The left argument. if specified, must be a Boolean or empty'⎕SIGNAL 11
14+
:EndIf
15+
:If 0=≢default
16+
add←' (y/n) '
17+
:Else
18+
:If default
19+
add←' (Y/n) '
20+
:Else
21+
add←' (y/N) '
22+
:EndIf
23+
:EndIf
24+
:If 1<≡question
25+
((≢question)⊃question)←((≢question)⊃question),add
26+
question←⍪question
27+
:Else
28+
question←question,add
29+
:EndIf
30+
:Repeat
31+
⍞←question
32+
answer←⍞
33+
:If answer≡question ⍝ Did... (since version 18.0 trailing blanks are not removed anynmore)
34+
:OrIf (≢answer)=¯1+≢question ⍝ ..the ...
35+
:OrIf 0=≢answer ⍝ ...user just...
36+
dtb←{⍵↓⍨-+/∧\' '=⌽⍵}
37+
answer2←dtb answer
38+
:OrIf answer2≡((-≢answer2)↑(⎕UCS 10){~⍺∊⍵:⍵ ⋄ ' ',dtb ⍺{⌽⍵↑⍨1+⍵⍳⍺}⌽⍵}question) ⍝ ...press <enter>?
39+
:If 0≠≢default
40+
yesOrNo←default
41+
isOkay←1
42+
:EndIf
43+
:Else
44+
answer←¯1↑{⍵↓⍨-+/∧\' '=⌽⍵}answer
45+
:If answer∊'YyNn'
46+
isOkay←1
47+
yesOrNo←answer∊'Yy'
48+
:EndIf
49+
:EndIf
50+
:Until isOkay
51+
⍝Done

Make/Make.bat

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)