|
17 | 17 |
|
18 | 18 | ⎕IO←1 ⋄ ⎕ml←3 |
19 | 19 |
|
20 | | - :Include APLTreeUtils |
21 | | - |
22 | 20 | ∇ r←Version |
23 | 21 | :Access Public shared |
24 | | - r←(Last⍕⎕THIS)'2.0.0.5' '2020-03-23' |
| 22 | + r←'ShowChmHelp' '3.0.0.10' '2020-09-26' |
25 | 23 | ∇ |
26 | 24 |
|
27 | 25 | ∇ History |
28 | 26 | :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 |
31 | 32 | ⍝\\ |
32 | 33 | ⍝ For information regarding older versions see <https://github.com/aplteam/ShowChmHelp/releases> |
33 | 34 | ∇ |
|
54 | 55 | ∇ |
55 | 56 |
|
56 | 57 | ∇ 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' |
59 | 58 | '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' |
62 | 59 | '∆DisplayTopic'⎕NA'I4 hhctrl.ocx.C32∣HtmlHelp',('*A'⊃⍨1+12>{⍎⍵↑⍨¯1+⍵⍳'.'}2⊃'.'⎕WG'APLVersion'),' I <0T[] I I' |
63 | 60 | '∆DisplayHelpfile'⎕NA'I4 hhctrl.ocx.C32|HtmlHelp',('*A'⊃⍨1+12>{⍎⍵↑⍨¯1+⍵⍳'.'}2⊃'.'⎕WG'APLVersion'),' I <0T[] I I' |
64 | 61 | '∆Quit'⎕NA'I4 hhctrl.ocx.C32|HtmlHelp',('*A'⊃⍨1+12>{⍎⍵↑⍨¯1+⍵⍳'.'}2⊃'.'⎕WG'APLVersion'),' I I I I' |
|
69 | 66 | ∇ Init Parms;Allowed |
70 | 67 | _WindowsDefault←'' |
71 | 68 | :If IsChar _WindowsDefault |
72 | | - _WindowsDefault←Uppercase _WindowsDefault |
73 | | - :If ~0∊⍴,_WindowsDefault |
| 69 | + _WindowsDefault←1 ⎕C _WindowsDefault |
| 70 | + :If 0≠≢,_WindowsDefault |
74 | 71 | :AndIf (⊂_WindowsDefault)∊'DEVELOPMENT' 'DESKTOP' |
75 | 72 | 6 ⎕SIGNAL⍨'Check parameter "WindowsDefault"!' |
76 | 73 | :EndIf |
|
94 | 91 | ∇ {R}←DisplayHelpfile Filename;handle |
95 | 92 | :Access Public Instance |
96 | 93 | handle←GetDefaultHandle'' |
97 | | - :If '.CHM'≢Uppercase ¯4↑Filename |
| 94 | + :If '.CHM'≢1 ⎕C ¯4↑Filename |
98 | 95 | Filename,←'.chm' |
99 | 96 | :EndIf |
100 | | - :If DoesFileExist Filename |
| 97 | + :If ⎕NEXISTS Filename |
101 | 98 | R←(∆DisplayHelpfile handle Filename HH_.DISPLAY_TOPIC 0)'' |
102 | 99 | :Else |
103 | 100 | R←¯1 'File not found' |
|
117 | 114 | ⍎cs.{l←⊃,/' ',¨⎕NL-2 ⋄ |
118 | 115 | ('(',l,')←cs.⍎''',l,'''')}⍬ |
119 | 116 | :EndIf |
120 | | - :If DoesFileExist filename |
| 117 | + :If ⎕NEXISTS filename |
121 | 118 | :If '.HTM'≢¯4↑filename←filename,'::/',topicName |
122 | 119 | filename,←'.htm' |
123 | 120 | :EndIf |
|
133 | 130 |
|
134 | 131 | ⍝⍝⍝ Private stuff |
135 | 132 |
|
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 | | - |
151 | 133 | ∇ R←GetDefaultHandle Type |
152 | 134 | ⍝ Type may be "Development" or "Desktop" or empty. |
153 | 135 | ⍝ If it is empty, _WindowsDefault is taken as a default. |
|
0 commit comments