|
| 1 | +:Class EventCodes |
| 2 | +⍝ This class carries all trappable event codes in Dyalog APL up to -- and including -- version 15.0.\\ |
| 3 | +⍝ For transforming a number to the symbolic name see function `GetName`. |
| 4 | + |
| 5 | + ⎕IO←1 ⋄ ⎕ML←1 |
| 6 | + |
| 7 | + :Field Public Shared ReadOnly WS_FULL ←1 |
| 8 | + :Field Public Shared ReadOnly SYNTAX_ERROR ←2 |
| 9 | + :Field Public Shared ReadOnly INDEX_ERROR ←3 |
| 10 | + :Field Public Shared ReadOnly RANK_ERROR ←4 |
| 11 | + :Field Public Shared ReadOnly LENGTH_ERROR ←5 |
| 12 | + :Field Public Shared ReadOnly VALUE_ERROR ←6 |
| 13 | + :Field Public Shared ReadOnly FORMAT_ERROR ←7 |
| 14 | + :Field Public Shared ReadOnly LIMIT_ERROR ←10 |
| 15 | + :Field Public Shared ReadOnly DOMAIN_ERROR ←11 |
| 16 | + :Field Public Shared ReadOnly HOLD_ERROR ←12 |
| 17 | + :Field Public Shared ReadOnly NONCE_ERROR ←16 |
| 18 | + :Field Public Shared ReadOnly FILE_TIE_ERROR ←18 |
| 19 | + :Field Public Shared ReadOnly FILE_ACCESS_ERROR ←19 |
| 20 | + :Field Public Shared ReadOnly FILE_INDEX_ERROR ←20 |
| 21 | + :Field Public Shared ReadOnly FILE_FULL ←21 |
| 22 | + :Field Public Shared ReadOnly FILE_NAME_ERROR ←22 |
| 23 | + :Field Public Shared ReadOnly FILE_DAMAGED ←23 |
| 24 | + :Field Public Shared ReadOnly FILE_TIED ←24 |
| 25 | + :Field Public Shared ReadOnly FILE_TIED_REMOTELY ←25 |
| 26 | + :Field Public Shared ReadOnly FILE_SYSTEM_ERROR ←26 |
| 27 | + :Field Public Shared ReadOnly FILE_SYSTEM_NOT_AVAILABLE ←28 |
| 28 | + :Field Public Shared ReadOnly FILE_SYSTEM_TIES_USED_UP ←30 |
| 29 | + :Field Public Shared ReadOnly FILE_TIE_QUOTA_USED_UP ←31 |
| 30 | + :Field Public Shared ReadOnly FILE_NAME_QUOTA_USED_UP ←32 |
| 31 | + :Field Public Shared ReadOnly FILE_SYSTEM_NO_SPACE ←34 |
| 32 | + :Field Public Shared ReadOnly FILE_ACCESS_ERROR_CONVERTING_FILE ←35 |
| 33 | + :Field Public Shared ReadOnly FILE_COMPONENT_DAMAGED ←38 |
| 34 | + :Field Public Shared ReadOnly FIELD_CONTENTS_RANK_ERROR ←52 |
| 35 | + :Field Public Shared ReadOnly FIELD_CONTENTS_TOO_MANY_COLUMNS ←53 |
| 36 | + :Field Public Shared ReadOnly FIELD_POSITION_ERROR ←54 |
| 37 | + :Field Public Shared ReadOnly FIELD_SIZE_ERROR ←55 |
| 38 | + :Field Public Shared ReadOnly FIELD_CONTENTS_TYPE_MISMATCH ←56 |
| 39 | + :Field Public Shared ReadOnly FIELD_TYPE_BEHAVIOUR_UNRECOGNISED ←57 |
| 40 | + :Field Public Shared ReadOnly FIELD_ATTRIBUTES_RANK_ERROR ←58 |
| 41 | + :Field Public Shared ReadOnly FIELD_ATTRIBUTES_LENGTH_ERROR ←59 |
| 42 | + :Field Public Shared ReadOnly FULL_SCREEN_ERROR ←60 |
| 43 | + :Field Public Shared ReadOnly KEY_CODE_UNRECOGNISED ←61 |
| 44 | + :Field Public Shared ReadOnly KEY_CODE_RANK_ERROR ←62 |
| 45 | + :Field Public Shared ReadOnly KEY_CODE_TYPE_ERROR ←63 |
| 46 | + :Field Public Shared ReadOnly FORMAT_FILE_ACCESS_ERROR ←70 |
| 47 | + :Field Public Shared ReadOnly FORMAT_FILE_ERROR ←71 |
| 48 | + :Field Public Shared ReadOnly NO_PIPES ←72 |
| 49 | + :Field Public Shared ReadOnly PROCESSOR_TABLE_FULL ←76 |
| 50 | + :Field Public Shared ReadOnly TRAP_ERROR ←84 |
| 51 | + :Field Public Shared ReadOnly EXCEPTION ←90 |
| 52 | + :Field Public Shared ReadOnly TRANSLATION_ERROR ←92 |
| 53 | + :Field Public Shared ReadOnly STOP_VECTOR ←1001 |
| 54 | + :Field Public Shared ReadOnly WEAK_INTERRUPT ←1002 |
| 55 | + :Field Public Shared ReadOnly INTERRUPT ←1003 |
| 56 | + :Field Public Shared ReadOnly EOF_INTERRUPT ←1005 |
| 57 | + :Field Public Shared ReadOnly TIMEOUT ←1006 |
| 58 | + :Field Public Shared ReadOnly RESIZE ←1007 |
| 59 | + :Field Public Shared ReadOnly DEADLOCK ←1008 |
| 60 | + |
| 61 | + ∇ r←Version |
| 62 | + :Access Public Shared |
| 63 | + r←({⍵}⍕⎕THIS)'1.2.0' '2018-02-19' |
| 64 | + ∇ |
| 65 | + |
| 66 | + ∇ History |
| 67 | + :Access Public Shared |
| 68 | + ⍝ * 1.2.0 |
| 69 | + ⍝ * First release after the conversion from the APL wiki to GitHub. |
| 70 | + ⍝ * 1.1.0 |
| 71 | + ⍝ * `GetName` can now process vectors as well. |
| 72 | + ⍝ * Method `History` added |
| 73 | + ⍝ * Now managed by acre 3 |
| 74 | + ⍝ * 1.0.0 |
| 75 | + ∇ |
| 76 | + |
| 77 | + ∇ __name←GetName __eventCode;__allNumbers;__ind |
| 78 | + ⍝ Returns the symbolic names for one or more event codes. |
| 79 | + ⍝ * If the right argument is a scalar or a one-element vector then a text vector is returned. |
| 80 | + ⍝ * If the right argument is a vector then a vector of text vectors is returned. |
| 81 | + :Access Public Shared |
| 82 | + :If 0∊⍴__eventCode |
| 83 | + __name←'' |
| 84 | + :Else |
| 85 | + __allNumbers←⎕NL-2 |
| 86 | + __allNumbers←⍎¨('__'∘≢¨2↑¨__allNumbers)/__allNumbers |
| 87 | + __ind←__allNumbers⍳__eventCode |
| 88 | + 'Unknown event number'⎕SIGNAL 6/⍨__ind∨.>⍴__allNumbers |
| 89 | + __name←(⎕NL-2)[__ind] |
| 90 | + __name←⊃∘,⍣(⊃1=⍴,__ind)⊣__name |
| 91 | + :EndIf |
| 92 | + ∇ |
| 93 | + |
| 94 | + ∇ __allNumbers←List __start |
| 95 | + ⍝ Returns a matrix with all symbolic names and their numbers in case `__start` is empty.\\ |
| 96 | + ⍝ In case `__start` is not empty only the symbolic names that start with `__start` are listed.\\ |
| 97 | + ⍝ `start` is **not** case sensitive. |
| 98 | + :Access Public Shared |
| 99 | + __allNumbers←⎕NL-2 |
| 100 | + __allNumbers←('__'∘≢¨2↑¨__allNumbers)/__allNumbers |
| 101 | + __allNumbers←__allNumbers,[1.5]⍎¨__allNumbers |
| 102 | + :If ~0∊⍴__start←{1(819⌶)⍵}__start~'*' |
| 103 | + __allNumbers←(((⍴,__start)↑[2]↑__allNumbers[;1])∧.=__start)⌿__allNumbers |
| 104 | + :EndIf |
| 105 | + ∇ |
| 106 | + |
| 107 | +:EndClass |
0 commit comments