Re: [Oorexx-devel] Question ad AddCommandHandler()

2019-01-30 Thread Rony G. Flatscher
On 30.01.2019 11:57, Rick McGuire wrote:
>
> On Wed, Jan 30, 2019 at 5:51 AM Rony G. Flatscher  > 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 > > 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.
>
... cut ...

> 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.
>  

So then the difference is reflected in the called handler function as well,

for the non-directing signature:

RexxObjectPtr RexxEntry nonDirectingCommandHandler(RexxExitContext *context,
  RexxStringObject address,
  RexxStringObject command)

for the redirecting signature:

RexxObjectPtr RexxEntry reDirectingCommandHandler(RexxExitContext *context,
 RexxStringObject address,
 RexxStringObject command,
 RexxIORedirectorContext *ioContext)

Thanks!

---rony

P.S.: Sorry, the first reply went directly to Rick instead of to the list!

___
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel


Re: [Oorexx-devel] Question ad AddCommandHandler()

2019-01-30 Thread Rick McGuire
On Wed, Jan 30, 2019 at 5:51 AM Rony G. Flatscher 
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 
> 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


Re: [Oorexx-devel] Question ad AddCommandHandler()

2019-01-30 Thread Rony G. Flatscher
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  > 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?
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?

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?

---rony



___
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel


Re: [Oorexx-devel] Question ad AddCommandHandler()

2019-01-29 Thread Rick McGuire
On Tue, Jan 29, 2019 at 1:18 PM Rony G Flatscher 
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.


> Can one query the list (names) of the currently loaded command handlers?
>

No.


> Would one be able to remove a command handler by name?
>
> No.

> —-rony
>
> Rony G. Flatscher (mobil/e)
>
> > Am 29.01.2019 um 14:02 schrieb Rony G. Flatscher <
> rony.flatsc...@wu.ac.at>:
> >
> >> On 28.01.2019 22:24, Rick McGuire wrote:
> >> I suggest you look at the test command handler that Erich just added to
> the test cases. This will
> >> show you how the command handlers are implemented and how to use the
> redirection APIs.
> >
> > Thanks, will do.
> >
> > ---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
>
___
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel


Re: [Oorexx-devel] Question ad AddCommandHandler()

2019-01-29 Thread Rony G Flatscher
Looked thru the code, a few quick questions:

If a command handler that has no redirection, would the last argument ioctl be 
NULL?
Can one query the list (names) of the currently loaded command handlers?
Would one be able to remove a command handler by name?

—-rony

Rony G. Flatscher (mobil/e)

> Am 29.01.2019 um 14:02 schrieb Rony G. Flatscher :
> 
>> On 28.01.2019 22:24, Rick McGuire wrote:
>> I suggest you look at the test command handler that Erich just added to the 
>> test cases. This will
>> show you how the command handlers are implemented and how to use the 
>> redirection APIs.
> 
> Thanks, will do.
> 
> ---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


Re: [Oorexx-devel] Question ad AddCommandHandler()

2019-01-29 Thread Rony G. Flatscher
On 28.01.2019 22:24, Rick McGuire wrote:
> I suggest you look at the test command handler that Erich just added to the 
> test cases. This will
> show you how the command handlers are implemented and how to use the 
> redirection APIs.

Thanks, will do.

---rony




___
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel


Re: [Oorexx-devel] Question ad AddCommandHandler()

2019-01-28 Thread Rick McGuire
I suggest you look at the test command handler that Erich just added to the
test cases. This will show you how the command handlers are implemented and
how to use the redirection APIs.

Rick

On Mon, Jan 28, 2019 at 4:14 PM Rony G Flatscher 
wrote:

> How does the implentation (have to?) differ?
>
> The readon of asking: once ooRexx 5 gets released, I plan a version of
> BSF4ooRexx that exploits the new ooRexx features.
>
> As the current version already supports command handlers implemented in
> Java (or in ooRexx via BSF4ooRexx) at interpreter creation time, I would
> like to support this new API in all of its facets.
>
> —-rony
>
>
> Rony G. Flatscher (mobil/e)
>
> Am 28.01.2019 um 21:15 schrieb Rick McGuire :
>
> The two handler types have different call signatures. When you register
> the handler, you are telling the interpreter which call signature is used
> to call the handler.
>
> Rick
>
> On Mon, Jan 28, 2019 at 1:43 PM Rony G. Flatscher 
> wrote:
>
>> Question ad new C++ method "context->AddCommandEnvironment(name, handler,
>> type);", where the documentaiton for "type" reads:
>>
>> "type": The type of command handler to add. DIRECT_COMMAND_ENVIRONMENT
>> for a command handler with no support for redirection.
>> REDIRECTING_COMMAND_ENVIRONMENT for a command handler that supports
>> redirection.
>>
>> How would the "handler" become able to support the new
>> "REDIRECTING_COMMAND_ENVIRONMENT" ability? How could the "handler"
>> determine whether redirection is in place and if so, what should it
>> do/support for each kind of redirection?
>>
>> ---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
>
> ___
> 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


Re: [Oorexx-devel] Question ad AddCommandHandler()

2019-01-28 Thread Rony G Flatscher
How does the implentation (have to?) differ? 

The readon of asking: once ooRexx 5 gets released, I plan a version of 
BSF4ooRexx that exploits the new ooRexx features. 

As the current version already supports command handlers implemented in Java 
(or in ooRexx via BSF4ooRexx) at interpreter creation time, I would like to 
support this new API in all of its facets.

—-rony


Rony G. Flatscher (mobil/e)

> Am 28.01.2019 um 21:15 schrieb Rick McGuire :
> 
> The two handler types have different call signatures. When you register the 
> handler, you are telling the interpreter which call signature is used to call 
> the handler. 
> 
> Rick
> 
>> On Mon, Jan 28, 2019 at 1:43 PM Rony G. Flatscher  
>> wrote:
>> Question ad new C++ method "context->AddCommandEnvironment(name, handler, 
>> type);", where the documentaiton for "type" reads: 
>> 
>> "type": The type of command handler to add. DIRECT_COMMAND_ENVIRONMENT for a 
>> command handler with no support for redirection. 
>> REDIRECTING_COMMAND_ENVIRONMENT for a command handler that supports 
>> redirection.
>> 
>> How would the "handler" become able to support the new 
>> "REDIRECTING_COMMAND_ENVIRONMENT" ability? How could the "handler" determine 
>> whether redirection is in place and if so, what should it do/support for 
>> each kind of redirection?
>> 
>> ---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
___
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel


Re: [Oorexx-devel] Question ad AddCommandHandler()

2019-01-28 Thread Rick McGuire
The two handler types have different call signatures. When you register the
handler, you are telling the interpreter which call signature is used to
call the handler.

Rick

On Mon, Jan 28, 2019 at 1:43 PM Rony G. Flatscher 
wrote:

> Question ad new C++ method "context->AddCommandEnvironment(name, handler,
> type);", where the documentaiton for "type" reads:
>
> "type": The type of command handler to add. DIRECT_COMMAND_ENVIRONMENT for
> a command handler with no support for redirection.
> REDIRECTING_COMMAND_ENVIRONMENT for a command handler that supports
> redirection.
>
> How would the "handler" become able to support the new
> "REDIRECTING_COMMAND_ENVIRONMENT" ability? How could the "handler"
> determine whether redirection is in place and if so, what should it
> do/support for each kind of redirection?
>
> ---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


[Oorexx-devel] Question ad AddCommandHandler()

2019-01-28 Thread Rony G. Flatscher
Question ad new C++ method "context->AddCommandEnvironment(name, handler, 
type);", where the
documentaiton for "type" reads:

"type": The type of command handler to add. DIRECT_COMMAND_ENVIRONMENT for 
a command handler
with no support for redirection.
REDIRECTING_COMMAND_ENVIRONMENT for a command handler that supports 
redirection.

How would the "handler" become able to support the new 
"REDIRECTING_COMMAND_ENVIRONMENT" ability?
How could the "handler" determine whether redirection is in place and if so, 
what should it
do/support for each kind of redirection?

---rony


___
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel