-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
133 changed files
with
20,823 additions
and
25 deletions.
There are no files selected for viewing
402 changes: 402 additions & 0 deletions
402
-packages_dev/aplteam-APLTreeUtils2-1.1.1/APLTreeUtils2.aplc
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
406 changes: 406 additions & 0 deletions
406
-packages_dev/aplteam-APLTreeUtils2-1.1.3/APLTreeUtils2.aplc
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
924 changes: 924 additions & 0 deletions
924
-packages_dev/aplteam-CodeCoverage-0.9.4/CodeCoverage.aplc
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
:Class CommTools | ||
⍝ Comes with a set of very simple communication tools designed to interact with the user via the session. | ||
⍝ These tools are typically used by user commands, or their API's.\\ | ||
|
||
|
||
:Field Public Shared ErrNo←811 | ||
|
||
∇ r←Version | ||
:Access Public Shared | ||
r←'CommTools' '1.0.1+7' '2020-10-12' | ||
∇ | ||
|
||
∇ History | ||
:Access Public Shared | ||
⍝ * 1.0.1 from 2021-10-12 | ||
⍝ * Bug fix: API decleration was wrong | ||
⍝ * 1.0.0 from 2021-10-11 | ||
⍝ * First release | ||
∇ | ||
|
||
∇ r←CR | ||
r←⎕UCS 13 | ||
∇ | ||
|
||
∇ yesOrNo←{default}YesOrNo question;isOkay;answer;add;dtb;answer2 | ||
:Access Public Shared | ||
⍝ Asks a simple question and allows just "Yes" or "No" as answers.\\ | ||
⍝ You may specify a default via the optional left argument which when specified | ||
⍝ rules what happens when the user just presses <enter>. | ||
⍝ `default` must be either 1 (yes) or 0 (no).\\ | ||
⍝ You may inject CR into the question, making it a multi-line question.\\ | ||
⍝ Note that this function does NOT work as expected when traced! | ||
isOkay←0 | ||
default←{0<⎕NC ⍵:⍎⍵ ⋄ ''}'default' | ||
isOkay←0 | ||
:If 0≠≢default | ||
'Left argument must be a scalar'⎕SIGNAL 11/⍨1≠≢default | ||
:AndIf ~default∊0 1 | ||
'The left argument. if specified, must be a Boolean or empty'⎕SIGNAL 11 | ||
:EndIf | ||
:If 0=≢default | ||
add←' (y/n) ' | ||
:Else | ||
:If default | ||
add←' (Y/n) ' | ||
:Else | ||
add←' (y/N) ' | ||
:EndIf | ||
:EndIf | ||
:If 1<≡question | ||
((≢question)⊃question)←((≢question)⊃question),add | ||
question←⍪question | ||
:Else | ||
question←question,add | ||
:EndIf | ||
:Repeat | ||
⎕←'' | ||
⍞←question | ||
answer←⍞ | ||
:If answer≡question ⍝ Did ... (since version 18.0 trailing blanks are not removed anymore) | ||
:OrIf (≢answer)=¯1+≢question ⍝ ... the ... | ||
:OrIf 0=≢answer ⍝ ... user ... | ||
:OrIf question≡(-≢question)↑answer ⍝ ... just ... | ||
dtb←{⍵↓⍨-+/∧\' '=⌽⍵} | ||
answer2←dtb answer | ||
:OrIf answer2≡((-≢answer2)↑(⎕UCS 10){~⍺∊⍵:⍵ ⋄ ' ',dtb ⍺{⌽⍵↑⍨1+⍵⍳⍺}⌽⍵}question) ⍝ ... press ... | ||
:OrIf answer≡{1↓⊃¯1↑(⍵∊⎕UCS 10 13)⊂⍵}(⎕UCS 10),question ⍝ ... <enter>? | ||
:If 0≠≢default | ||
yesOrNo←default | ||
isOkay←1 | ||
:EndIf | ||
:Else | ||
answer←¯1↑{⍵↓⍨-+/∧\' '=⌽⍵}answer | ||
:If answer∊'YyNn' | ||
isOkay←1 | ||
yesOrNo←answer∊'Yy' | ||
:EndIf | ||
:EndIf | ||
:Until isOkay | ||
⍝Done | ||
∇ | ||
|
||
∇ index←{x}Select options;flag;answer;question;value;bool;⎕ML;⎕IO;manyFlag;mustFlag;caption | ||
:Access Public Shared | ||
⍝ Presents `options` as a numbered list and allows the user to select either exactly one or multiple ones.\\ | ||
⍝ One is the default.\\ | ||
⍝ The optional left argument allows you to specify more (positional) options: | ||
⍝ * `caption` is shown above the options. | ||
⍝ * `manyFlag` defaults to 0 (meaning just one item might be selected) or 1, in which case multiple items can be specified. | ||
⍝ * `mustFlag` forces the user to select at least one option. | ||
⍝ `options` must not have more than 999 items. | ||
⍝ If the user aborts by entering "q" (for "quit") `index` will be `⍬`. | ||
x←{0<⎕NC ⍵:⊆⍎⍵ ⋄ ''}'x' | ||
(caption manyFlag mustFlag)←x,(⍴,x)↓'' 0 0 | ||
⎕IO←1 ⋄ ⎕ML←1 | ||
'Invalid right argument; must be a vector of text vectors.'⎕SIGNAL ErrNo/⍨2≠≡options | ||
'Right argument has more than 999 items'⎕SIGNAL ErrNo/⍨999<≢options | ||
flag←0 | ||
:Repeat | ||
⎕←{⍵↑'--- ',caption,((0≠≢caption)/' '),⍵⍴'-'}⎕PW-1 | ||
⎕←⍪{((⊂'. '),¨⍨(⊂3 0)⍕¨⍳≢⍵),¨⍵}options | ||
⎕←'' | ||
question←'Select one ',(manyFlag/'or more '),'item',((manyFlag)/'s'),' ' | ||
question,←((manyFlag∨~mustFlag)/'('),((~mustFlag)/'q=quit'),((manyFlag∧~mustFlag)/', '),(manyFlag/'a=all'),((manyFlag∨~mustFlag)/')'),' :' | ||
:If 0<≢answer←⍞,0/⍞←question | ||
answer←(⍴question)↓answer | ||
:If 1=≢answer | ||
:AndIf answer∊'Qq',manyFlag/'Aa' | ||
:If answer∊'Qq' | ||
:If 0=mustFlag | ||
index←⍬ | ||
flag←1 | ||
:EndIf | ||
:Else | ||
index←⍳≢options | ||
flag←1 | ||
:EndIf | ||
:Else | ||
(bool value)←⎕VFI answer | ||
:If ∧/bool | ||
:AndIf manyFlag∨1=+/bool | ||
value←bool/value | ||
:AndIf ∧/value∊⍳⍴options | ||
index←value | ||
flag←0≠≢index | ||
:EndIf | ||
:EndIf | ||
:EndIf | ||
:Until flag | ||
index←{1<≢⍵:⍵ ⋄ ⊃⍵}⍣(⍬≢index)⊣index | ||
∇ | ||
|
||
:endclass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.