Example #1
0
unsigned Execute( bool tracing, bool do_flip )
{
    unsigned    conditions;
    bool        stack_cmds;
    static unsigned executing = 0;

    if( !CheckStackPos() )
        return( COND_USER );
    if( !AdvMachState( ACTION_EXECUTE ) )
        return( COND_USER );

    if( executing == 0 ) {
        ++executing;
        HookNotify( true, HOOK_EXEC_START );
        --executing;
    }

    /* get rid of useless pending input information */
    for( ;; ) {
        if( CurrToken != T_LINE_SEPARATOR )
            break;
        if( InpStack == NULL )
            break;
        if( InpStack->type & (INP_HOLD|INP_STOP_PURGE) )
            break;
        if( InpStack->rtn( InpStack->handle, INP_RTN_EOL ) )
            continue;
        PopInpStack();
    }
    _SwitchOff( SW_TRAP_CMDS_PUSHED );
    conditions = ExecProg( tracing, do_flip, true );
    SetCodeDot( GetRegIP() );
    stack_cmds = true;
    if( tracing && (conditions & COND_BREAK) )
        stack_cmds = false;
    if( ReportTrap( conditions, stack_cmds ) ) {
        _SwitchOn( SW_TRAP_CMDS_PUSHED );
    }
    if( executing == 0 ) {
        ++executing;
        HookNotify( true, HOOK_EXEC_END );
        --executing;
    }
    if( conditions & COND_TERMINATE ) {
        HookNotify( true, HOOK_PROG_END );
    }
    return( conditions );
}
Example #2
0
static bool ProcPending( void )
{
    for( ;; ) {
        for( ;; ) {
            if( InpStack == NULL ) return( FALSE );
            if( InpStack->type & INP_NEW_LANG ) {
                InpStack->type &= ~INP_NEW_LANG;
                if( (CodeAddrMod != NO_MOD) && !IsInternalMod( CodeAddrMod ) ) {
                    NewLang( ModSrcLang( CodeAddrMod ) );
                }
            }
            if( InpStack->type & INP_STOP_PURGE ) return( FALSE );
            if( InpStack->type & INP_NO_CMD ) break;
            if( CurrToken == T_LINE_SEPARATOR ) break;
            _SwitchSet( SW_CMD_INTERACTIVE, !(InpStack->type & (INP_BREAK_POINT|INP_HOOK)));
            _SwitchSet( SW_IN_REPLAY_MODE, (InpStack->type & INP_REPLAYED) );
            ProcACmd();
        }
        if( InpStack->rtn( InpStack->handle, INP_RTN_EOL ) ) continue;
        PopInpStack();
    }
}