-
Notifications
You must be signed in to change notification settings - Fork 2
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
188 changed files
with
6,828 additions
and
5 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ api: "CodeCoverage", assets: "", date: 20221212.172732, description: "Monitors which parts of an application got actually executed", documentation: "", files: "", group: "aplteam", io: 1, license: "MIT", lx: "", maintainer: "[email protected]", minimumAplVersion: "18.0", ml: 1, name: "CodeCoverage", os_lin: 1, os_mac: 1, os_win: 1, project_url: "https://github.com/aplteam/CodeCoverage", source: "CodeCoverage.aplc", tags: "code-coverage,test-framework,unit-tests", uri: "https://tatin.dev/", userCommandScript: "", version: "0.9.4+52",} | ||
|
221 changes: 221 additions & 0 deletions
221
-packages_dev/aplteam-CommTools-1.2.2/APLSource/CommTools/ADOC_Doc.apla
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,221 @@ | ||
( | ||
'## Overview' | ||
'' | ||
'This package comes with functions that allow you to interrogate the user, and make her...' | ||
'' | ||
'* answer simple questions like "Are you sure?" or "Really delete this file?"' | ||
'* select an item (or several items) from a list of items, or quit ' | ||
' ' | ||
'This is useful for interacting with the user in the session, something that user commands do' | ||
'pretty frequently.' | ||
'' | ||
'## Interrupting "YesOrNo" and/or "Select"' | ||
'' | ||
'Once a user is asked for input one cannot interrupt with neither a weak nor a strong interrupt,' | ||
'and answering the question or selecting an item and then trying to interrupt the code is on' | ||
'modern machines not working well since they are just too fast.' | ||
'' | ||
'`YesOrNo` as well as `Select` allow you to enter `∘∘∘`, and that make the functions run onto' | ||
'a stop vector that is dynamically set for just this purpose. ' | ||
'' | ||
'## Automating answers and selections' | ||
'' | ||
'First of all, what''s the application for this? Well, in test cases one often needs particular' | ||
'decisions and selections to be made. In such an instance the presence of a human in front of the' | ||
'screen is required. The automation feature is designed to make such tests work without a human.' | ||
'' | ||
'Both `YesOrNo` and `Select` can be integrated into tests so that no user is required to' | ||
'answer any questions, or select any item(s). This is achieved by providing data on global ' | ||
'variables that usually do not exist.' | ||
'' | ||
'### The function "YesOrNo"' | ||
'' | ||
'Imagine you are asking this question:' | ||
' ' | ||
'```' | ||
'CommTools.YesOrNo ''Sure you want to delete this file?''' | ||
'```' | ||
'' | ||
'To automatically answer this question create a global variable `YesOrNo_Answers` as a matrix' | ||
'with two columns:' | ||
'' | ||
'| `[;1]` | Contains the question that should be answered automatically.' | ||
'| `[;2]` | The answer to be given, so usually either "y" or "no".' | ||
'' | ||
'So in our case we specify:' | ||
'' | ||
'```' | ||
'CommTools.YesOrNo_Answers←1 2⍴''Sure you want to delete this file?'' ''y''' | ||
'``` ' | ||
'' | ||
'When the question is asked:' | ||
' ' | ||
'```' | ||
'CommTools.YesOrNo ''Sure you want to delete this file?''' | ||
'```' | ||
'' | ||
'`YesOrNo` would do the following:' | ||
'' | ||
'1. Check whether there is a global variable `YesOrNo_Answers` around.' | ||
'2. If there is it would try to match the question to any row of the first column of `YesOrNo_Answers` ' | ||
'3. If there is a match it would return the value in the second column of the identified row' | ||
'' | ||
'Notes:' | ||
'' | ||
'* Leading spaces in the question are removed' | ||
'* If multiple entries in `YesOrNo_Answers` match the question an error is thrown' | ||
'* If the second column is empty `YesOrNo` would return the default answer which is defined by the' | ||
' left argument: 1="Y", 0="N"' | ||
' ' | ||
' If there is no left argument provided in such a case `YesOrNo` would throw an error' | ||
'* If no row in `YesOrNo_Answers` matches the question it would ask the question as usual' | ||
'' | ||
'#### Dynamic questions' | ||
' ' | ||
'Sometimes one has to ask dynamically created questions like "Sure you want to delete the file /foo/boo/this-will-change.txt"' | ||
'' | ||
'In this case specify just "Sure you want to delete the file" as the text to be matched: in case of no full match `YesOrNo` ' | ||
'will start looking for questions that _start_ with the text given, so it would still find a hit. ' | ||
'' | ||
'#### Multiple-line questions ' | ||
'' | ||
'`YesNorNo` accepts nested vectors as questions as well as a character vector with `⎕UCS 10` in it. (Note that a nested vector' | ||
'is transformed internally into a simple character vector with `⎕UCS 10` in it)' | ||
'' | ||
'In case the two search attempts outlined above are not finding a hit `YesNorNo` would isolate the last bit of the question ' | ||
'and check that for a full match.' | ||
'' | ||
'This is best explained by an example:' | ||
'' | ||
'```' | ||
' q←⊂''file1''' | ||
' q,←⊂''file1''' | ||
' q,←⊂''Sure you wanna delete these?''' | ||
' CommTools.YesOrNo_Answers←1 2⍴ (3⊃q) ''y''' | ||
' ⎕←CommTools.YesOrNo q' | ||
('y'⋄) | ||
'```' | ||
'' | ||
'#### Using aliases' | ||
'' | ||
'With version 1.2 aliases were introduced. An alias is marked with the `@` glyph.' | ||
'' | ||
'Everyting up to and including the `@` is taken as alias, which means that this part is not shown as question but' | ||
'can be used as a matching string, again including the (trailing) `@` character. ' | ||
'' | ||
'Note that although aliases may look like a perfect solution, they also reduce readability. If you create a larger' | ||
'number of answers upfront early in your application this might get a bit confusing.' | ||
'' | ||
'There are two ways to avoid this:' | ||
'' | ||
'1. Use a meaningful expression as alias rather than, say, just `1@`' | ||
'' | ||
'2. You may add something _after_ the `@` glyph in `YesOrNo_Answers`. This will be ignored and can therefore be used' | ||
' as a comment' | ||
'' | ||
' It could be a hint or the name of the function that question is going to be asked by etc.' | ||
'' | ||
'### The function "Select"' | ||
'' | ||
'Imagine you are going to present a list with three items, and you need the second one to be selected.' | ||
'' | ||
'This can be achieved by creating a global variable `Select_Choices` as a matrix with two' | ||
'columns:' | ||
'' | ||
'| `[;1]` | Contains the caption of the list.' | ||
'| `[;2]` | The answer to be given, so usually either an integer pointing to the item selected,<<br>>or a vector of integers (in case "a" was entered) or `⍬` (in case "q" was entered).' | ||
'' | ||
'`Select` would do the following:' | ||
'' | ||
'1. Check whether there is a global variable `Select_Choices` around' | ||
'2. If there is it would try to match the caption to any row of the first column of `Select_Choices` ' | ||
'3. If there is a match it would return the value in the second column of the identified row' | ||
'' | ||
'Notes:' | ||
'' | ||
'* Leading spaces in choices are removed' | ||
'* If multiple entries in `Select_Choices` match the caption an error is thrown' | ||
'* If no row in `Select_Choices` matches the caption it would present the list for selection ' | ||
'' | ||
'So in our case we specify:' | ||
'' | ||
'```' | ||
' l←⊂''First''' | ||
' l,←⊂''Second''' | ||
' l,←⊂''Third''' | ||
' caption←''Please select hot item:''' | ||
' CommTools.Select_Choices←1 2⍴caption 2' | ||
' ⎕←caption CommTools.Select l ' | ||
('2'⋄) | ||
'``` ' | ||
'' | ||
'For all items:' | ||
'' | ||
'``` ' | ||
' CommTools.Select_Choices←1 2⍴caption ''a''' | ||
' ⎕←caption CommTools.Select l ' | ||
'1 2 3' | ||
'``` ' | ||
'' | ||
'For no items ("quit"):' | ||
'' | ||
'``` ' | ||
' CommTools.Select_Choices←1 2⍴caption ''q''' | ||
' ⎕←⍬≡caption CommTools.Select l ' | ||
('1'⋄) | ||
'``` ' | ||
'' | ||
'#### Dynamic captions' | ||
' ' | ||
'It is possible to dynamically create a caption like "Select action for file /foo/boo/this-will-change.txt".' | ||
'' | ||
'In this case specify just "Select action for file" as the text to be matched: in case of no full match `Select` ' | ||
'will check whether the _start_ of the caption matches the text given, so it would still find a hit. ' | ||
'' | ||
'#### Using aliases' | ||
'' | ||
'With version 1.2 aliases were introduced. An alias is marked with the `@` glyph.' | ||
'' | ||
'Everyting up to and including the `@` is taken as alias, which means that this part is not shown as caption but' | ||
'can be used as a matching string, again including the (trailing) `@` character. ' | ||
'' | ||
'Note that although aliases may look like a perfect solution, they also reduce readability. If you create a larger' | ||
'number of answers upfront early in your application this might get a bit confusing.' | ||
'' | ||
'There are two ways to avoid this:' | ||
'' | ||
'1. Use a meaningful expression as alias rather than, say, just `1@`' | ||
'' | ||
'2. You may add something _after_ the `@` glyph in `Select_Choices`. This will be ignored and can therefore be used' | ||
' as a comment' | ||
'' | ||
' It could be a hint or the name of the function that question is going to be asked by etc.' | ||
'' | ||
'#### Specifying a choice' | ||
' ' | ||
'In case you need a specific choice to be returned but don''t know the item number in advance because the list is created ' | ||
'dynamically then instead of specifying an integer you can specify the choice itself.' | ||
'' | ||
'For example:' | ||
'' | ||
'```' | ||
' CommTools.Select_Choices←1 2⍴caption ''Second''' | ||
' ⎕←caption CommTools.Select l' | ||
'2 ' | ||
'```' | ||
'' | ||
'### Cleaning up' | ||
'' | ||
'Of course there is nothing wrong with deleting the global variables yourself with this:' | ||
'' | ||
'```' | ||
'⎕EX ''CommTools.Select_Choices''' | ||
'⎕EX ''CommTools.YesOrNo_Answers''' | ||
'```' | ||
'' | ||
'Having said this, you can also just call the function `Cleanup` which will do the job for you.' | ||
'' | ||
'Also, in case `CommTools` would be enhanced in the future, `Cleanup` might do more than that, so' | ||
'calling it rather doing the job yourself it safer as well. ' | ||
'' | ||
) |
1 change: 1 addition & 0 deletions
1
-packages_dev/aplteam-CommTools-1.2.2/APLSource/CommTools/Assert.aplf
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 @@ | ||
Assert←{⍺←'' ⋄ (,1)≡,⍵:r←1 ⋄ ⎕ML←1 ⋄ ⍺ ⎕SIGNAL 1↓(⊃∊⍵),11} |
3 changes: 3 additions & 0 deletions
3
-packages_dev/aplteam-CommTools-1.2.2/APLSource/CommTools/Cleanup.aplf
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,3 @@ | ||
Cleanup | ||
⎕EX'Select_Choices' | ||
⎕EX'YesOrNo_Answers' |
2 changes: 2 additions & 0 deletions
2
-packages_dev/aplteam-CommTools-1.2.2/APLSource/CommTools/Copyright.aplf
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,2 @@ | ||
r←Copyright | ||
r←'Copyright by Kai Jaeger ⋄ https://kai-jaeger.de ⋄ [email protected]' |
2 changes: 2 additions & 0 deletions
2
-packages_dev/aplteam-CommTools-1.2.2/APLSource/CommTools/ErrNo.aplf
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,2 @@ | ||
r←ErrNo | ||
r←811 |
2 changes: 2 additions & 0 deletions
2
-packages_dev/aplteam-CommTools-1.2.2/APLSource/CommTools/Help.aplf
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,2 @@ | ||
Help | ||
⎕SE.UCMD'ADOC ',⍕⎕THIS |
24 changes: 24 additions & 0 deletions
24
-packages_dev/aplteam-CommTools-1.2.2/APLSource/CommTools/History.apla
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,24 @@ | ||
( | ||
'* 1.2.2 from 2022-01-15' | ||
' * An alias in a caption was only ignored when `Select_Choices` was defined' | ||
'* 1.2.1 from 2021-12-13' | ||
' * `Select` had a problem when Select_Choices did exist but had zero rows ' | ||
' * `YesOrNo` had a problem when YesOrNo_Answers did exist but had zero rows' | ||
'* 1.2.0 from 2021-12-12' | ||
' * `Select` and `YesOrNow` now support aliases.' | ||
'* 1.1.0 from 2021-10-10' | ||
' * `YesAndNo` now checks the global `YesOrNo_Answers`: if it is not empty it is used to answer the question' | ||
' automatically' | ||
' * `Select` now checks the global `Select_Choices`: if it is not empty it is used to select an item' | ||
' automatically ' | ||
' * `Cleanup` added as a means to get rid of all global variables used for automation' | ||
' * `Public` added in order to identify the public interface' | ||
' * `Help` added with extensive documentation including details regarding automation' | ||
' * Both `YesOrNo` and `Select` can now be interrupted by entering "∘∘∘"' | ||
' * Bug fixes' | ||
' * `Select` produced an error message when an item of ⍵ was a scalar' | ||
'* 1.0.1 from 2021-10-12' | ||
' * Bug fix: API decleration was wrong' | ||
'* 1.0.0 from 2021-10-11' | ||
' * First release' | ||
) |
2 changes: 2 additions & 0 deletions
2
-packages_dev/aplteam-CommTools-1.2.2/APLSource/CommTools/LF.aplf
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,2 @@ | ||
r←LF | ||
r←⎕UCS 10 |
6 changes: 6 additions & 0 deletions
6
-packages_dev/aplteam-CommTools-1.2.2/APLSource/CommTools/Public.aplf
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,6 @@ | ||
r←Public | ||
r←'' | ||
r,←⊂'Select' | ||
r,←⊂'YesOrNo' | ||
r,←⊂'Cleanup' | ||
r,←⊂'Help' |
92 changes: 92 additions & 0 deletions
92
-packages_dev/aplteam-CommTools-1.2.2/APLSource/CommTools/Select.aplf
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,92 @@ | ||
index←{x}Select choices;flag;answer;question;value;bool;⎕ML;⎕IO;manyFlag;mustFlag;caption;buff;flag2;alias;blankFlag | ||
⍝ Presents `choices` 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 multiple (positional) choices: | ||
⍝ * `caption` is shown above the choices. | ||
⍝ * `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.\\ | ||
⍝ Notes: | ||
⍝ * `choices` must not have more than 999 items.\\ | ||
⍝ * By entering "`∘∘∘`" the user may interrupt `Select`: this activates a stop. | ||
⍝ * If the user aborts by entering "q" (for "quit") `⍬` will be returned. | ||
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≠|≡choices | ||
'Right argument has more than 999 items'⎕SIGNAL ErrNo/⍨999<≢choices | ||
flag←0 | ||
:If 0<⎕NC'Select_Choices' | ||
Select_Choices←(0<≢¨Select_Choices[;1])⌿Select_Choices | ||
:AndIf 0<≢Select_Choices | ||
:If '@'∊caption | ||
(alias caption)←{l←⍵⍳'@' ⋄ (l↑⍵)(l↓⍵)}caption | ||
flag←0<+/bool←({⍵↑⍨⍵⍳'@'}¨Select_Choices[;1])≡¨⊂alias | ||
:Else | ||
:If 0=+/bool←Select_Choices[;1]≡¨⊂caption | ||
bool←caption∘{⍵≡⍺↑⍨≢⍵}¨Select_Choices[;1] | ||
:EndIf | ||
flag←0<+/bool | ||
:EndIf | ||
:If flag | ||
'Multiple choices qualify?!'Assert 1=+/bool | ||
index←2⊃Select_Choices[bool⍳1;] | ||
:If (⊂index)∊0 ⍬ | ||
index←⍬ | ||
:ElseIf ' '=1↑0⍴∊index ⍝ Text?! | ||
:If (,'a')≡,index | ||
index←⍳≢choices | ||
:ElseIf (,'q')≡,index | ||
index←⍬ | ||
:ElseIf 0<≢buff←⍸index∘≡¨choices | ||
index←buff | ||
:ElseIf 1=≢index←⍸index∘≡¨(≢index)↑¨{⍵↓⍨+/∧\' '=⍵}¨choices | ||
index←⊃index | ||
:Else | ||
'Invalid selection'Assert 0 | ||
:EndIf | ||
:Else | ||
'Invalid selection'Assert∧/index∊⍳≢choices | ||
:EndIf | ||
:EndIf | ||
:EndIf | ||
:If ~flag | ||
flag2←0 | ||
:Repeat | ||
blankFlag←0≠≢caption | ||
⎕←{⍵↑'---',(blankFlag/' '),({'@'∊⍵:⍵↓⍨⍵⍳'@' ⋄⍵}caption),(blankFlag/' '),⍵⍴'-'}⎕PW-1 | ||
⎕←⍪{((⊂'. '),¨⍨(⊂3 0)⍕¨⍳≢⍵),¨⍵}choices | ||
⎕←'' | ||
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 '∘∘∘'≡¯3↑answer | ||
(1+⊃⎕LC)⎕STOP⊃⎕SI | ||
∘∘∘ ⍝ Deliberate stop caused by user input | ||
:EndIf | ||
:If 1=≢answer | ||
:AndIf answer∊'Qq',manyFlag/'Aa' | ||
:If answer∊'Qq' | ||
:If 0=mustFlag | ||
index←⍬ | ||
flag2←1 | ||
:EndIf | ||
:Else | ||
index←⍳≢choices | ||
flag2←1 | ||
:EndIf | ||
:Else | ||
(bool value)←⎕VFI answer | ||
:If ∧/bool | ||
:AndIf manyFlag∨1=+/bool | ||
value←bool/value | ||
:AndIf ∧/value∊⍳⍴choices | ||
index←value | ||
flag2←0≠≢index | ||
:EndIf | ||
:EndIf | ||
:EndIf | ||
:Until flag2 | ||
index←{1<≢⍵:⍵ ⋄ ⊃⍵}⍣(⍬≢index)⊣index | ||
:EndIf | ||
⍝Done |
9 changes: 9 additions & 0 deletions
9
-packages_dev/aplteam-CommTools-1.2.2/APLSource/CommTools/Version.aplf
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,9 @@ | ||
r←Version;json;ns | ||
⍝ See also `History` | ||
:If 0<##.⎕NC'CiderConfig' | ||
json←⊃⎕NGET ##.CiderConfig.HOME,'/apl-package.json' | ||
:Else | ||
json←⊃⎕NGET TatinVars.HOME,'/apl-package.json' | ||
:EndIf | ||
ns←⎕JSON⍠('Dialect' 'JSON5')⊢json | ||
r←ns.version |
Oops, something went wrong.