| 73 | |
| 74 | |
| 75 | ResultType InputObject::Invoke(ResultToken &aResultToken, int aID, int aFlags, ExprTokenType *aParam[], int aParamCount) |
| 76 | { |
| 77 | switch (aID) |
| 78 | { |
| 79 | case M_Start: |
| 80 | if (input.InProgress()) |
| 81 | return OK; |
| 82 | input.Buffer[input.BufferLength = 0] = '\0'; |
| 83 | return InputStart(input); |
| 84 | |
| 85 | case M_Wait: |
| 86 | DWORD wait_ms, tick_start; |
| 87 | wait_ms = ParamIndexIsOmitted(0) ? UINT_MAX : (UINT)(ParamIndexToDouble(0) * 1000); |
| 88 | tick_start = GetTickCount(); |
| 89 | while (input.InProgress() && (GetTickCount() - tick_start) < wait_ms) |
| 90 | MsgSleep(); |
| 91 | // Return EndReason: |
| 92 | case P_EndReason: |
| 93 | _o_return(input.GetEndReason(NULL, 0)); |
| 94 | |
| 95 | case M_Stop: |
| 96 | if (input.InProgress()) |
| 97 | input.Stop(); |
| 98 | return OK; |
| 99 | |
| 100 | case P_Input: |
| 101 | _o_return(input.Buffer, input.BufferLength); |
| 102 | |
| 103 | case P_InProgress: |
| 104 | _o_return(input.InProgress()); |
| 105 | |
| 106 | case P_EndKey: |
| 107 | aResultToken.symbol = SYM_STRING; |
| 108 | if (input.Status == INPUT_TERMINATED_BY_ENDKEY) |
| 109 | input.GetEndReason(aResultToken.marker = _f_retval_buf, _f_retval_buf_size); |
| 110 | else |
| 111 | aResultToken.marker = _T(""); |
| 112 | return OK; |
| 113 | |
| 114 | case P_EndMods: |
| 115 | { |
| 116 | aResultToken.symbol = SYM_STRING; |
| 117 | TCHAR *cp = aResultToken.marker = aResultToken.buf; |
| 118 | const auto mod_string = MODLR_STRING; |
| 119 | for (int i = 0; i < 8; ++i) |
| 120 | if (input.EndingMods & (1 << i)) |
| 121 | { |
| 122 | *cp++ = mod_string[i * 2]; |
| 123 | *cp++ = mod_string[i * 2 + 1]; |
| 124 | } |
| 125 | *cp = '\0'; |
| 126 | return OK; |
| 127 | } |
| 128 | |
| 129 | case P_Match: |
| 130 | aResultToken.symbol = SYM_STRING; |
| 131 | if (input.Status == INPUT_TERMINATED_BY_MATCH && input.EndingMatchIndex < input.MatchCount) |
| 132 | aResultToken.marker = input.match[input.EndingMatchIndex]; |
nothing calls this directly
no test coverage detected