I take that back, I do see something obviously wrong.  Rexx arrays are
1-based, not 0-based, so your put call needs to be specifying an index
of "i+1".

Rick

On Tue, Feb 21, 2012 at 3:37 PM, Rick McGuire <[email protected]> wrote:
> I don't see anthing obviously wrong here. Provide a sample program so
> I can recreate this, and I'll take a look at it.
>
> Rick
>
> On Tue, Feb 21, 2012 at 2:42 PM, Rony G. Flatscher
> <[email protected]> wrote:
>> The RXOFNC and RXEXF exits are the "oo" exits for which the PARM-block
>> defines RexxObjectPtr et.al. types.
>>
>> As I am getting a very strange behaviour in both exits when processing the
>> argument array it may be the case that I am not iterating correctly over the
>> array, so here is first the definition of the parameter block according to
>> rexxpg.pdf followed by the code, followed by the output and the Rexx
>> condition raised in it:
>>
>> typedef struct _RXOFNC_FLAGS { /* fl */
>>       unsigned rxfferr : 1; /* Invalid call to routine. */
>>       unsigned rxffnfnd : 1; /* Function not found. */
>>       unsigned rxffsub : 1; /* Called as a subroutine */
>> } RXOFNC_FLAGS ;
>>
>> typedef struct _RXOFNCCAL_PARM { /* fnc */
>>       RXOFNC_FLAGS rxfnc_flags ; /* function flags */
>>       CONSTRXSTRING rxfnc_name; // the called function name
>>       size_t rxfnc_argc; /* Number of args in list. */
>>       RexxObjectPtr *rxfnc_argv; /* Pointer to argument list. */
>>       RexxObjectPtr rxfnc_retc; /* Return value. */
>> } RXOFNCCAL_PARM;
>>
>>
>> ---- the program iterating over the rxfnc_argv pointer via a local pointer
>> of the same type:
>>
>>         case RXOFNC:    // system exit # 15, "processes calls to external
>> functions, before search starts", OO version
>>             {
>>                 RXOFNCCAL_PARM *pb=(RXOFNCCAL_PARM *) parmBlock;
>>
>>                 if (subfunction==RXOFNCCAL)   // 1
>>                 {
>>                     CONSTRXSTRING function_name;
>>                     size_t         argc=0;
>>                     RexxObjectPtr *argv=NULL;
>>
>>                     RXOFNCCAL_PARM *pb=(RXOFNCCAL_PARM *) parmBlock;
>>                     function_name=pb->rxfnc_name;
>>                     argc         =pb->rxfnc_argc;
>>                     argv         =pb->rxfnc_argv;
>>
>> ... cut ...
>>
>>                         // create RexxArrayObject from RexxObjectPtr list
>> and store it as a Java array object
>>                     RexxArrayObject rao=context->NewArray(argc);
>>                     for (size_t i=0; i<argc; i++)
>>                     {
>> fprintf(stderr, "C++ RXOFNC -> argv[%lu]=[%p]=[%.128s], before:
>> CheckCondition()=[%d]",i,argv[i],context->ObjectToStringValue(argv[i]),context->CheckCondition());fflush(stderr);
>>
>>                         context->ArrayPut(rao, argv[i], i);
>>
>> fprintf(stderr, ", after: CheckCondition()=[%d]
>> ...\n",context->CheckCondition());fflush(stderr);
>>                     }
>> ... cut ...
>>
>>                 }
>>             }
>>             break;
>>
>> Running the program causes an "incorrect call to method", namely: "Error
>> 93.907:  Method argument 2 must be a positive whole number; found "&2"".
>> Here is the output, which shows that the Rexx condition is raised in the
>> ArrayPut() function:
>>
>> C++ RXOFNC/RXEXF -> argp[0]=[7F01AF60]=[ONE], before: CheckCondition()=[0],
>> after: CheckCondition()=[1] ...
>> C++ RXOFNC/RXEXF -> argp[1]=[7F01AF88]=[TWO], before: CheckCondition()=[1],
>> after: CheckCondition()=[1] ...
>> Exception in thread "main" org.rexxla.bsf.engines.rexx.RexxException:
>> BSF4ooRexx/routine/jniRexxRunProgram(), error 9:
>>     47 *-* call does_not_exist one, two
>> Error 93 running
>> F:\work\svn\bsf4oorexx\trunk\samples\Java\handlers\testExitHandlers\12_RXEXF\testRexxWith_RXEXF_Exit.rxj
>> line 47:  Incorrect call to method
>> Error 93.907:  Method argument 2 must be a positive whole number; found "&2"
>>
>> And indeed it is this call which triggers the RXOFNC exit in the Rexx
>> statement "call does_not_exist one, two".
>>
>> The same observation is with the RXEXF exit while processing the arguments.
>>
>> Is there something I am doing wrong processing the argv pointer to
>> RexxObjectPtr the way I am doing it?
>>
>> BTW, if doing a ClearCondition() immediately after the ArrayPut() everything
>> works, but I am not aware that ArrayPut() would raise such a condition in
>> other parts of my program.  (This is now all running under 4.1.1 beta.)
>>
>> ---rony
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Keep Your Developer Skills Current with LearnDevNow!
>> The most comprehensive online learning library for Microsoft developers
>> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
>> Metro Style Apps, more. Free future releases when you subscribe now!
>> http://p.sf.net/sfu/learndevnow-d2d
>> _______________________________________________
>> Oorexx-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/oorexx-devel
>>

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to