/**
 * Execute an IF/WHEN instruction.
 *
 * @param context The current execution context.
 * @param stack   The current evaluation stack.
 */
void RexxInstructionIf::execute(RexxActivation *context, ExpressionStack *stack)
{
    context->traceInstruction(this);

    // evaluate and trace the condition expression.
    RexxObject *result = condition->evaluate(context, stack);
    context->traceResult(result);

    // the comparison methods return either .true or .false, so we
    // can to a quick test against those.
    if (result == TheFalseObject)
    {
        // we execute the ELSE branch
        context->setNext(else_location->nextInstruction);
    }

    // if it is not the .true object, we need to perform a fuller
    // evaluation of the result.
    else if (result != TheTrueObject)
    {
        // evaluate and decide if we take the ELSE branch
        if (!result->truthValue(Error_Logical_value_if))
        {
            context->setNext(else_location->nextInstruction);
        }
    }

    // We do nothing for true...we just continue on to the next instruction.

    context->pauseInstruction();
}
/**
 * Do the actual invocation of the security manager.
 *
 * @param methodName The method name to invoke.
 * @param arguments  The arguments to the specific method.
 *
 * @return true if the security manager overrode this, false otherwise.
 */
bool SecurityManager::callSecurityManager(RexxString *methodName, DirectoryClass *arguments)
{
    ProtectedObject result;
    // invoke the manager
    RexxObject *resultObj = manager->sendMessage(methodName, arguments, result);
    // a result is required
    if (resultObj == OREF_NULL)
    {
        reportException(Error_No_result_object_message, methodName);
    }
    return resultObj->truthValue(Error_Logical_value_authorization);
}