9.6.2.0680 ABORT" abort-quote EXCEPTION EXT

Extend the semantics of 6.1.0680 ABORT" to be:

Interpretation:

Interpretation semantics for this word are undefined.

Compilation:

( "ccc<quote>" -- )

Parse ccc delimited by a " (double-quote). Append the run-time semantics given below to the current definition.

Run-time:

( i * x x1 -- | i * x ) ( R: j * x -- | j * x )

Remove x1 from the stack. If any bit of x1 is not zero, perform the function of -2 THROW, displaying ccc if there is no exception frame on the exception stack.

See:

Testing:

DECIMAL
-1 CONSTANT exc_abort
-2 CONSTANT exc_abort"
-13 CONSTANT exc_undef
: t6 ABORT ;

The 77 in t10 is necessary for the second ABORT" test as the data stack is restored to a depth of 2 when THROW is executed. The 77 ensures the top of stack value is known for the results check.

: t10 77 SWAP ABORT" This should not be displayed" ;
: c6 CATCH
   CASE exc_abort OF 11 ENDOF
        exc_abort" OF 12 ENDOF
        exc_undef OF 13 ENDOF
   ENDCASE
;

T{ 1 2 '  t6 c6 -> 1 2 11  }T    \ Test that ABORT is caught
T{ 3 0 ' t10 c6 -> 3 77    }T    \ ABORT" does nothing
T{ 4 5 ' t10 c6 -> 4 77 12 }T    \ ABORT" caught, no message

ContributeContributions