int ScriptParser::returnCommand()
{
    if ( !last_nest_info->previous || last_nest_info->nest_mode != NestInfo::LABEL )
        errorAndExit( "return: not in gosub" );
    
    current_label_info = script_h.getLabelByAddress( last_nest_info->next_script );
    current_line = script_h.getLineByAddress( last_nest_info->next_script );

    const char *label = script_h.readStr();
    if (label[0] != '*')
        script_h.setCurrent( last_nest_info->next_script );
    else
        setCurrentLabel( label+1 );

    bool textgosub_flag = last_nest_info->textgosub_flag;
    char *wait_script = last_nest_info->wait_script;

    last_nest_info = last_nest_info->previous;
    delete last_nest_info->next;
    last_nest_info->next = NULL;
    
    if (textgosub_flag){
        if (wait_script && label[0] != '*'){
            script_h.setCurrent(wait_script);
            return RET_CONTINUE;
        }

        // if this is the end of the line, pretext becomes enabled
        line_enter_status = 0;
        page_enter_status = 0;
    }

    return RET_CONTINUE;
}
void PonscripterLabel::trapHandler()
{
    trap_mode = TRAP_NONE;
    setCurrentLabel(trap_dist);
    readToken();
    stopAnimation(clickstr_state);
    event_mode = IDLE_EVENT_MODE;
    advancePhase();
}
void ScriptParser::gosubReal( const char *label, char *next_script )
{
    last_nest_info->next = new NestInfo();
    last_nest_info->next->previous = last_nest_info;

    last_nest_info = last_nest_info->next;
    last_nest_info->next_script = next_script;

    setCurrentLabel( label );
}
bool ONScripter::trapHandler()
{
    if (trap_mode & TRAP_STOP){
        trap_mode |= TRAP_CLICKED;
        return false;
    }
    
    trap_mode = TRAP_NONE;
    stopAnimation( clickstr_state );
    setCurrentLabel( trap_dist );
    current_button_state.button = 0; // to escape from screen effect

    return true;
}
void ScriptParser::gosubReal( const char *label, char *next_script, bool textgosub_flag )
{
    last_nest_info->next = new NestInfo();
    last_nest_info->next->previous = last_nest_info;

    last_nest_info = last_nest_info->next;
    last_nest_info->next_script = next_script;

    if (textgosub_flag){
        last_nest_info->textgosub_flag = true;
        last_nest_info->wait_script = script_h.getWait();
    }

    setCurrentLabel( label );
}
Пример #6
0
void ScriptParser::gosubReal( const char *label, char *next_script, bool textgosub_flag )
{
    last_nest_info->next = new NestInfo();
    last_nest_info->next->previous = last_nest_info;

    last_nest_info = last_nest_info->next;
    last_nest_info->next_script = next_script;
    pretext_buf = &last_nest_info->next_script;

    if (textgosub_flag){
        script_h.pushStringBuffer(string_buffer_offset);
        last_nest_info->textgosub_flag = true;
    }

    setCurrentLabel( label );
}
Пример #7
0
void QSEnv::init()
{
    stackDep = 0;
    shutDown = FALSE;
#ifndef QS_LEAK
    classList.setAutoDelete(TRUE);
#endif
    scopeChain = new ScopeChain();
    args = 0;

    sharedList = new QSShared();

    objClass = new QSObjectClass(this);
    undefClass = new QSUndefinedClass(objClass);
    nilClass = new QSNullClass(objClass);
    boolClass = new QSBooleanClass(objClass);
    numClass = new QSNumberClass(objClass);
    strClass = new QSStringClass(objClass);
    charClass = new QSCharacterClass(strClass);
    typClass = new QSTypeClass(objClass);

    datClass = new QSDateClass(objClass);
    matClass = new QSMathClass(objClass);
    regClass = new QSRegExpClass(objClass);
    arrClass = new QSArrayClass(objClass);
    errClass = new QSErrorClass(objClass);
    refClass = new QSFuncRefClass(objClass);

    globClass = new QSGlobalClass(objClass);
    argsClass = new QSArgumentsClass(objClass);
    dynClass = new QSDynamicClass(objClass);
    dbgClass = new QSDebugClass(objClass);
    sysClass = new QSSystemClass(objClass);

    objClass->init();
    boolClass->init();
    numClass->init();
    strClass->init();

    thVal = createUndefined();

    execMode = Normal;
    setCurrentLabel(QString::null);
}
int ScriptParser::breakCommand()
{
    if (!last_nest_info->previous || last_nest_info->nest_mode != NestInfo::FOR)
        errorAndExit("break: not in for loop\n");

    char *buf = script_h.getNext();
    if ( buf[0] == '*' ){
        last_nest_info = last_nest_info->previous;
        delete last_nest_info->next;
        last_nest_info->next = NULL;
        
        setCurrentLabel( script_h.readLabel()+1 );
    }
    else{
        break_flag = true;
    }
    
    return RET_CONTINUE;
}
int ScriptParser::returnCommand()
{
    if ( !last_nest_info->previous || last_nest_info->nest_mode != NestInfo::LABEL )
        errorAndExit( "return: not in gosub" );
    
    current_label_info = script_h.getLabelByAddress( last_nest_info->next_script );
    current_line = script_h.getLineByAddress( last_nest_info->next_script );
    
    char *buf = script_h.getNext();
    if ( buf[0] == 0x0a || buf[0] == ':' || buf[0] == ';' )
	script_h.setCurrent( last_nest_info->next_script );
    else
	setCurrentLabel(script_h.readStr()+1);
    
    last_nest_info = last_nest_info->previous;
    delete last_nest_info->next;
    last_nest_info->next = NULL;
    
    return RET_CONTINUE;
}
Пример #10
0
void QSEnv::setExecutionMode(ExecutionMode mode)
{
    if (mode == Normal) {
        switch (execMode) {
        case Normal:
        case ReturnValue:
            break;
        case Continue:
        case Break:
            setCurrentLabel(QString::null);
            break;
        case Throw:
            exMsg = QString::null;
#ifdef QSDEBUGGER
            if (eng->debugger())
                eng->debugger()->storeExceptionStack();
#endif
            break;
        }
    }
    execMode = mode;
}
void ScriptParser::gosubReal( const char *label, char *next_script, bool textgosub_flag )
{
    last_nest_info->next = new NestInfo();
    last_nest_info->next->previous = last_nest_info;

    last_nest_info = last_nest_info->next;
    last_nest_info->next_script = next_script;
    pretext_buf = &last_nest_info->next_script;
	
	//added by Taigacon
	 if (is_user_func){
        is_user_func = false;
        last_nest_info->is_func = true;
    }
    if (textgosub_flag){
        
        last_nest_info->textgosub_flag = true;
		last_nest_info->wait_script = script_h.getWait();
    }

    setCurrentLabel( label );
}
int ScriptParser::gotoCommand()
{
    setCurrentLabel( script_h.readLabel()+1 );
    
    return RET_CONTINUE;
}