#8 Exit Handler Problem ?

closed
None
5
2005-01-11
2001-12-30
Anonymous
No

I have just Interfaced Regina to a MDI Visual Basic
program Using the Exit Handler Hooks: RXSIO and RXTRC.
It works great, except that when we invoke another Rexx
source file from the first, the exit Handlers seem to
get lost.
------------------
A2.rex
parse version VER
say "regina Version=" ver
say "calling A1"
zz = A1(5 8)
say "done with A1"
say "zz=" zz
parse pull qq
say qq
--------------------
A1.rex
arg a b
say "I am in A1.rex"
i = a * b
push "this is pushed"
exit i
----------------------
Output from Running A2 is:
regina Version= REXX-Regina_3.0beta2 4.95 17 Oct 2001
calling A1
done with A1
zz= 40
this is pushed
----------------------
A1 was successfully called from A2 (the stack and exit
code show ok). But the SAY in A1 never gets output !!
It looks like the exit handlers do not propagate to the
execution of the external rexx routine.

Discussion

  • Mark Hessling

    Mark Hessling - 2002-04-26
    • assigned_to: nobody --> rexx
     
  • Florian Grosse-Coosmann

    Logged In: YES
    user_id=262734

    This bug may have been fixed by another bug fix. The example
    below
    should reproduce the bug's behaviour. It doesn't show the error
    from above. The following code line may be broken by
    SourceForge, sigh.

    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>

    #define INCL_RXSHV
    #define INCL_RXFUNC
    #define INCL_RXSYSEXIT
    #define INCL_RXSUBCOM
    #define INCL_RXQUEUE

    #include "rexxsaa.h"

    #ifdef _MSC_VER
    /* This picky compiler claims about unused formal parameters.
    * This is correct but hides (for human eyes) other errors
    since they
    * are many and we can't reduce them all.
    * Error 4100 is "unused formal parameter".
    */
    # pragma warning(disable:4100)
    #endif

    LONG APIENTRY it_say_exit( LONG ExNum, LONG Subfun, PEXIT
    PBlock )
    {
    RXSIOSAY_PARM *psiosay = (RXSIOSAY_PARM *)PBlock;

    if ( ExNum != RXSIO )
    printf( "\n---\nExNum on entry is not RXSIO\n---\n" );
    if ( Subfun != RXSIOSAY )
    printf( "\n---\nSubfun on entry is not RXSIOSAY\n---\n" );

    printf( "say exit: >%.*s<\n",
    (int) psiosay->rxsio_string.strlength ,
    psiosay->rxsio_string.strptr );

    return RXEXIT_HANDLED ;
    }

    extern int unlink( const char *pathname ); /* include file
    depends on system */

    static int create_a1( const char *fn )
    {
    FILE *fp = fopen( fn, "w" );

    if ( !fp )
    {
    perror( fn );
    return 0;
    }
    fprintf( fp, "/* */\n"
    "arg a b\n"
    "say \"I am in %s\"\n"
    "i = a * b\n"
    "push \"this is pushed\"\n"
    "exit i\n",
    fn );
    if ( ferror( fp ) )
    {
    perror( fn );
    fclose( fp );
    unlink( fn );
    return 0;
    }
    if ( fclose( fp ) == EOF )
    {
    perror( fn );
    fclose( fp );
    unlink( fn );
    return 0;
    }
    return 1;
    }

    int main( int argc, char *argv[] )
    {
    RXSTRING Instore[2];
    RXSYSEXIT Exits[4];
    int rc;
    char a2[500];
    static const char a1[] = "a1.rexx";

    /* We want to see surprisings at once: */
    setvbuf(stdout,NULL,_IONBF,0);
    setvbuf(stderr,NULL,_IONBF,0);

    if ( !create_a1( a1 ) )
    return 0;

    sprintf( a2, "parse version VER\n"
    "say \"regina Version=\" ver\n"
    "say \"calling %s\"\n"
    "zz = '%s'(5 8)\n"
    "say \"done with %s\"\n"
    "say \"zz=\" zz\n"
    "parse pull qq\n"
    "say qq\n",
    a1, a1, a1 );

    RexxRegisterExitExe( "say", (PFN)it_say_exit, NULL );

    Exits[0].sysexit_name = "say";
    Exits[0].sysexit_code = RXSIO;
    Exits[1].sysexit_code = RXENDLST;

    Instore[0].strptr = a2;
    Instore[0].strlength = strlen( Instore[0].strptr );
    Instore[1].strptr = NULL;

    rc = RexxStart( 0, NULL, "Testing", Instore, "Foo",
    RXCOMMAND,
    Exits, NULL, NULL );

    RexxDeregisterExit( "say", NULL );

    unlink( a1 );

    return 0 ;
    }

     
  • Florian Grosse-Coosmann

    Logged In: YES
    user_id=262734

    Mark, there is no further notice, please close the
    bug.

    Cheers, Florian

     
  • Mark Hessling

    Mark Hessling - 2005-01-11

    Logged In: YES
    user_id=86185

    Closed as no feedback to contradict that it is fixed.

     
  • Mark Hessling

    Mark Hessling - 2005-01-11
    • status: open --> closed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks