In an ooRexx package there are the following statements:

   ... cut ...

   ::ROUTINE xBSF                   PUBLIC   EXTERNAL "LIBRARY BSF4ooRexx BSF        
         "

   ... cut ...

   ::CLASS BSF

   ::ATTRIBUTE rBSF CLASS

   ::METHOD init    CLASS
      expose rBSF
      rBSF =.routines["XBSF"]   -- fetch and store routine object
      ... cut ...

   ::METHOD unknown UNGUARDED
      ... cut ...
      signal on syntax

      self~class~rBSF~callWith(arr)  -- invoke external routine
      return bsf.wrap(result)
   syntax:
      ... cut ...
      co=condition('o')
      call ppJavaExceptionChain(co,.true)
      raise propagate

So a native routine BSF() gets defined and named in the package as the public routine xBSF which in the class constructor for the class BSF gets fetched from the .routines directory and stored as a routine object with a class attribute named rBSF. In the BSF instance method unknown this routine object gets fetched from the class attribute and using CALLWITH it gets invoked supplying a Rexx array with arguments.

The native routine BSF() in this case may raise an exception using

    rtc->RaiseException(Rexx_Error_Incorrect_call_user_defined, ra);

However, upon return from the native routine BSF the raised exception does not get trapped in the ooRexx unknown method such that the code after the syntax label does not get executed.

Doing instead

   res=xbsf("invoke", j4, "sendMessageScoped", "abc", "1", "2", "3")

traps the rtc->RaiseException() condition ("abc" in this test will not yield a 
Rexx class object).

---rony

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

Reply via email to