On Wed, Jan 30, 2019 at 5:51 AM Rony G. Flatscher <rony.flatsc...@wu.ac.at>
wrote:

> Thanks, one last question in this context.
>
> On 29.01.2019 21:07, Rick McGuire wrote:
>
> On Tue, Jan 29, 2019 at 1:18 PM Rony G Flatscher <rony.flatsc...@wu.ac.at>
> wrote:
>
>> Looked thru the code, a few quick questions:
>>
>> If a command handler that has no redirection, would the last argument
>> ioctl be NULL?
>>
> No, if the command handler is registered as a redirecting handler, then it
> will always be passed an IOContext. You can then query the context to see
> if there has been any redirection requested and what types.
>
> There is a new IsRedirectionRequested() function listed and documented as:
>
> 8.17.100. *NEW* IsRedirectionRequested
>
> This API is available in context I/O Redirector since ooRexx 5.0.
>
> logical_t flag;
> // Method Syntax Form(s)
> flag = context->IsRedirectionRequested();
>
> Tests whether for the current command any redirection was requested using
> the WITH subkeyword of an ADDRESS instruction.
>
> Arguments: None.
>
> Returns: 1 if any redirection was requested, 0 otherwise.
>
> See also methods *NEW* AreOutputAndErrorSameTarget, *NEW*
> IsErrorRedirected, *NEW* IsInputRedirected, *NEW* IsOutputRedirected, *NEW*
> ReadInput, *NEW* ReadInputBuffer, *NEW* WriteError, *NEW* WriteErrorBuffer,
> *NEW* WriteOutput, and *NEW* WriteOutputBuffer.
>
>
> The function "AddCommandEnvironment(name,handler,type)" has a "type"
> argument that may be one of two: DIRECT_COMMAND_ENVIRONMENT and
> REDIRECTING_COMMAND_ENVIRONMENT.
>
> Question:
>
> What is exactly the difference between the two?
>
>
The type indicates what sort of handler you have written. The redirecting
one is passed an io context, the non-redirecting one does not. The
non-redirecting ones are the same as command handlers that exist for 4.2.0.
The API merely allows one to be added by other than an option when the
interpreter instance is created.


>
> E.g. the REDIRECTING_COMMAND_ENVIRONMENT must use the
> "ReadInput[Buffer]()" and the "Write{Error|Output}[Buffer]()" functions,
> whereas the "DIRECT_COMMAND_ENVIRONMENT" must use .input for reading,
> .output and .error for writing instead?
>
> Question:
>
> Can "IsRedirectionRequested()" be issued for both handler types?
>
> IsRedirectionRequested() is one of the APIs for the IOContect. Since only
the redirecting handlers get passed an IOContext, the answer is NO.


> And if so, in the case of a DIRECT_COMMAND_ENVIRONMENT would then the
> functions "AreOutputAndErrorSameTarget()", "IsErrorRedirected()",
> "IsInputRedirected()", "IsOutputRedirected()" be available as well? If so,
> how about the "Write[*]()" functions?
>
> Again, NO. These calls can only be made using the passed IO context.
DIRECT_COMMAND_ENVIRONMENTs do not get passed an I/O context.

Rick



> ---rony
>
>
>
> _______________________________________________
> Oorexx-devel mailing list
> Oorexx-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/oorexx-devel
>
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to