예제 #1
0
/*{
** Name: opc_exhandler() - Exception handler for OPC.
**
** Description:
**      This is the exception handler for OPC. Currently it is used for
**	dealing with floating-point number overflow.
**
** Inputs:
**      ex_args                         EX_ARGS struct.
**	    .ex_argnum			Tag for the exception that occurred.
**
** Outputs:
**	none.
**
**	Returns:
**	    The signal is resignaled if it is not recognized.
**	Exceptions:
**	    none
**
** Side Effects:
**	None.
**
** History:
**      11-jan-91 (stec)
**          Created.
*/
STATUS
opc_exhandler(
		EX_ARGS	*ex_args)
{
    STATUS  stat; 

    switch (EXmatch(ex_args->exarg_num, (i4)1, (EX)EXFLTOVF))
    {
	case 1:
	    {
		stat = EXDECLARE;
		break;
	    }
	default:
	    {
		stat = EXRESIGNAL;
		break;
	    }
    }

    return(stat);
}
예제 #2
0
/*{
** Name: opn_mhandler	- exception handler for out of memory errors
**
** Description:
**	This exception handler used in out-of-memory error
**      situations, in which a recovery may be possible.  Any other
**      exception will be resignalled.
** Inputs:
**      args                            arguments which describe the 
**                                      exception which was generated
**
** Outputs:
**	Returns:
**	    EXRESIGNAL                 - if this was an unexpected exception
**          EXDECLARE                  - if an expected, internally generated
**                                      exception was found
**	Exceptions:
**	    none
**
** Side Effects:
**	    This routine will remove the calling frame to the point at which
**          the exception handler was declared.
**
** History:
**	27-oct-86 (seputis)
**          initial creation 
**	8-nov-88 (seputis)
**          exception handling interface changed
**	8-nov-88 (seputis)
**          look for EX_UNWIND
**	20-dec-90 (seputis)
**	    add support for floating point exceptions handling
**	4-feb-90 (seputis)
**	    add support for floating point exceptions handling
**	18-apr-91 (seputis)
**	    - fix for bug 36920, floating point handling problem
**	1-may-91 (seputis)
**	    - fix for 18-apr-91 integration problem
**	11-mar-92 (rog)
**	    Remove EX_DECLARE and change the EX_UNWIND case to return
**	    EXRESIGNAL instead of EX_OK.
[@history_line@]...
*/
static STATUS
opn_mhandler(
	EX_ARGS            *args)
{
    OPX_ERROR	    error;
    bool	    hard;

    switch (EXmatch(args->exarg_num, (i4)10, EX_JNP_LJMP, EX_UNWIND, EXFLTUND,
       EXFLTOVF, EXFLTDIV, EXINTOVF, EXINTDIV, EXHFLTDIV, EXHFLTOVF, EXHFLTUND))
    {
    case 1:
    {
	if ((args->exarg_count > 0)
	    && (args->exarg_array[0] == E_OP0400_MEMORY))
	    return (EXDECLARE);    /* return to invoking exception point
                                    ** - this is an out-of-memory error which
                                    ** perhaps can be handled
                                    */
	return(EXRESIGNAL);        /* resignal since this is normal
                                    ** enumeration completion exit - this
                                    ** will have the side effect of deleting
                                    ** the exception handler at this level */
    }
    case 2:
				    /* a lower level exception handler has
				    ** cleared the stack so return OK
				    ** to satisfy the protocol */
	return (EXRESIGNAL);
    case 10:
	hard = TRUE;
	error = E_OP049E_FLOAT_UNDERFLOW;
        break;
    case 3:
	hard = FALSE;
	error = E_OP049E_FLOAT_UNDERFLOW;
        break;
    case 9:
	hard = TRUE;
	error = E_OP04A0_FLOAT_OVERFLOW;
        break;
    case 4:
	hard = FALSE;
	error = E_OP04A0_FLOAT_OVERFLOW;
        break;
    case 8:
	hard = TRUE;
	error = E_OP049F_FLOAT_DIVIDE;
        break;
    case 5:
	hard = FALSE;
	error = E_OP049F_FLOAT_DIVIDE;
        break;
    case 6:
	hard = FALSE;
	error = E_OP04A1_INT_OVERFLOW;
        break;
    case 7:
	hard = FALSE;
	error = E_OP04A2_INT_DIVIDE;
        break;
    default:
        return (EXRESIGNAL);	    /* handle unexpected exception at lower
				    ** level exception handler, this exception
                                    ** handler only deals with out of memory
				    ** errors than can be recovered from */
    }
    return(opx_float(error, hard)); /* process float/integer problem by skipping
				    ** search space */
}