Yes, context->GetArguments() returns an ooRexx array containing the
raw, unprocessed argument objects originally passed to the method.
Since the ArrayAt() API returns NULLOBJECT if an element does not
exist, this is a reliable test for if the argument is there.  This is
basically equivalent to the following that can be done in ooRexx code:

args = arg(1, 'a')
count = 0
do i = 1 to args~size
    if args~hasIndex(i) then count += 1
end

Of course, you could also just send the ITEMS mesaage to that argument
array and count things that way.  It's probably a lot more efficient,
even with the need to convert the result back into a binary number.

Rick

On Fri, Dec 5, 2008 at 10:12 AM, Mark Miesfeld <[EMAIL PROTECTED]> wrote:
> On Fri, Dec 5, 2008 at 3:39 AM, Rick McGuire <[EMAIL PROTECTED]> wrote:
>
>> I think there may still be a small misunderstanding on your part on
>> how some of this works.
>
> Well, yeah there was.  <grin>
>
>> argumentExists() applies only to the arguments passed to the native
>> method, and that includes any pseudo arguments in the specification.
>> The array returned by context->getArguments() only returns the
>> arguments that are actually passed on the method call by the user.  If
>> there no pseudo arguments being used, these will match up.  Any pseudo
>> arguments will mess things up.  If you're dealing with the array
>> returned from context->GetArguments(), a more appropriate existence
>> test would be to test if the index position is NULLOBJECT.
>
> I didn't understand that the array from context->GetArguments() was
> only the arguments actually used in the ooRexx code and didn't contain
> the pseudo-arguments.  I thought it was a convenience method to get
> all the arguments at one time, that the array returned was the same as
> context->arguments.
>
> The problem with testing for NULLOBJECT is that if the argument type
> is a C / C++ number, int32_t, and 0 is valid value for that arg, then
> the test doesn't work correctly.
>
> Okay, after I wrote the above I had to drive to work and realized I
> still might be missing your point.  ;-(   So, I looked it up.
>
> GetArguments() returns a ooRexx array class object, so a test for
> NULLOBJECT would work.
>
> context->arguments is an array of pointers to ValueDescriptor.
>
> In this case I wanted a convenience method to count the number of
> existing args in the ooRexx code, not count the pseudo-arguments.
>
> So the function does what I want, as long as the RexxMethodX function
> signatures adhere to my convention of not interspersing
> pseudo-arguments with the real arguments.
>
> Thanks for spotting that I was still confused.
>
> --
> Mark Miesfeld
>
> ------------------------------------------------------------------------------
> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
> The future of the web can't happen without you.  Join us at MIX09 to help
> pave the way to the Next Web now. Learn more and register at
> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
> _______________________________________________
> Oorexx-devel mailing list
> Oorexx-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/oorexx-devel
>

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to