On Wed, Mar 25, 2009 at 12:19 PM, Rick McGuire <object.r...@gmail.com> wrote:
> Yes, I believe the docs are wrong there....I suspect as a result of
> the reworking of things in the API, but the current behavior is
> definitely cleaner.

Rick,

I've been thinking about this and ran the same test under 3.2.0.  The
RexxStart() return code itself was always 0, except for when a a
condition is raised.  In which case it is the negated condition code.

If someone has a compiled binary that takes some action if the return
is not 0, then that is now broke.  Something like:

return_code = RexxStart(,,,);
if ( return_code > 0 )
{
    // Some serious problem, abort.
    return errorHandler(...);
}

// All okay proceed ...

So, I think we need to return 0 here where ever 3.2.0 returned 0, don't we?

Under 3.2.0:

E:\work.ooRexx>rxStart echoArg.rex
C++, round # [1] ...
... RexxStart() return code=[0] | returned result value=[1] |
converted return code=[1]
---
C++, round # [2] ...
... RexxStart() return code=[0] | returned result value=[2] |
converted return code=[2]
---
C++, round # [3] ...
... RexxStart() return code=[0] | returned result value=[3] |
converted return code=[3]
---
C++, round # [4] ...
... RexxStart() return code=[0] | returned result value=[4] |
converted return code=[4]
---
C++, round # [5] ...
... RexxStart() return code=[0] | returned result value=[5] |
converted return code=[5]
---

E:\work.ooRexx>rxStart echoArg.rex
C++, round # [1] ...
... RexxStart() return code=[0] | returned result value=[-9] |
converted return code=[-9]
---
C++, round # [2] ...
... RexxStart() return code=[0] | returned result value=[-8] |
converted return code=[-8]
---
C++, round # [3] ...
... RexxStart() return code=[0] | returned result value=[-7] |
converted return code=[-7]
---
C++, round # [4] ...
... RexxStart() return code=[0] | returned result value=[-6] |
converted return code=[-6]
---
C++, round # [5] ...
... RexxStart() return code=[0] | returned result value=[-5] |
converted return code=[-5]
---

E:\work.ooRexx>rxStart echoArg.rex
C++, round # [1] ...
     3 *-* x = 3 / 0
Error 42 running E:\work.ooRexx\echoArg.rex
line 3:  Arithmetic overflow/underflow
Error 42.3:  Arithmetic overflow; divisor must not be zero
... RexxStart() return code=[-42] | returned result value=[null
string] | converted return code=[28932]
---
C++, round # [2] ...
     3 *-* x = 3 / 0
Error 42 running E:\work.ooRexx\echoArg.rex
line 3:  Arithmetic overflow/underflow
Error 42.3:  Arithmetic overflow; divisor must not be zero
... RexxStart() return code=[-42] | returned result value=[null
string] | converted return code=[28932]
---
C++, round # [3] ...
     3 *-* x = 3 / 0
Error 42 running E:\work.ooRexx\echoArg.rex
line 3:  Arithmetic overflow/underflow
Error 42.3:  Arithmetic overflow; divisor must not be zero
... RexxStart() return code=[-42] | returned result value=[null
string] | converted return code=[28932]
---
C++, round # [4] ...
     3 *-* x = 3 / 0
Error 42 running E:\work.ooRexx\echoArg.rex
line 3:  Arithmetic overflow/underflow
Error 42.3:  Arithmetic overflow; divisor must not be zero
... RexxStart() return code=[-42] | returned result value=[null
string] | converted return code=[28932]
---
C++, round # [5] ...
     3 *-* x = 3 / 0
Error 42 running E:\work.ooRexx\no.prologue\echoArg.rex
line 3:  Arithmetic overflow/underflow
Error 42.3:  Arithmetic overflow; divisor must not be zero
... RexxStart() return code=[-42] | returned result value=[null
string] | converted return code=[28932]
---

In RexxStart(), it ends like this:


// go run this program
arguments.invoke(exits, envname);
*retcode = arguments.retcode;

// terminate and clean up the interpreter runtime.  This only works
// if there are no active instances
Interpreter::terminateInterpreter();

return (int)arguments.rc;          /* return the error code (negated)   */

But, I can't figure out where arguments.rc is getting set.  A hack would be:

/* Maintain backward compatibility */
return (arguments.rc > 0 ? 0 : (int)arguments.rc);

It probably makes more sense to change it where arguments.rc gets set.

--
Mark Miesfeld

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

Reply via email to