示例#1
0
/** Save vector information */
void KstRVector::save(QTextStream &ts, const QString& indent, bool saveAbsolutePosition) {
  if (_file) {    
    ts << indent << "<vector>" << endl;

    ts << indent << "  <tag>" << QStyleSheet::escape(tagName()) << "</tag>" << endl;
    _file->readLock();
    ts << indent << "  <filename>" << QStyleSheet::escape(_file->fileName()) << "</filename>" << endl;
    _file->unlock();
    ts << indent << "  <field>" << _field << "</field>" << endl;
    if (saveAbsolutePosition) {
      ts << indent << "  <start>" << F0 << "</start>" << endl;
      ts << indent << "  <num>" << NF << "</num>" << endl;
    } else {
      ts << indent << "  <start>" << ReqF0 << "</start>" << endl;
      ts << indent << "  <num>" << ReqNF << "</num>" << endl;
    }
    if (doSkip()) {
      ts << indent << "  <skip>" << Skip << "</skip>" << endl;
      if (doAve()) {
        ts << indent << "  <doAve/>" << endl;
      }
    }
    ts << indent << "</vector>" << endl;
  }
}
 virtual size_t read(
     /* [in] */ void* buffer,
     /* [in] */ size_t size)
 {
     if (NULL == buffer) {
         if (0 == size) {
             return 0;
         } else {
             /*  InputStream.skip(n) can return <=0 but still not be at EOF
                 If we see that value, we need to call read(), which will
                 block if waiting for more data, or return -1 at EOF
              */
             size_t amountSkipped = 0;
             do {
                 size_t amount = doSkip(size - amountSkipped);
                 if (0 == amount) {
                     char tmp;
                     amount = doRead(&tmp, 1);
                     if (0 == amount) {
                         // if read returned 0, we're at EOF
                         mIsAtEnd = true;
                         break;
                     }
                 }
                 amountSkipped += amount;
             } while (amountSkipped < size);
             return amountSkipped;
         }
     }
     return doRead(buffer, size);
 }
示例#3
0
void DataRange::setWidgetDefaults() {
  //FIXME Do we need a V->readLock() here?
  dialogDefaults().setValue("vector/range", range());
  dialogDefaults().setValue("vector/start", start());
  dialogDefaults().setValue("vector/countFromEnd", countFromEnd());
  dialogDefaults().setValue("vector/readToEnd", readToEnd());
  dialogDefaults().setValue("vector/skip", skip());
  dialogDefaults().setValue("vector/doSkip", doSkip());
  dialogDefaults().setValue("vector/doAve", doFilter());
  dialogDefaults().setValue("vector/rangeUnits", rangeUnits());
  dialogDefaults().setValue("vector/startUnits", rangeUnits());
}
示例#4
0
void DataRange::doSkipChanged() {
  _skip->setEnabled(doSkip());
  _doFilter->setEnabled(doSkip());
}
示例#5
0
//=============================================================================
// METHOD    : SPELLcontroller::executeCommand()
//=============================================================================
void SPELLcontroller::executeCommand( const ExecutorCommand& cmd )
{
	// If a (repeatable) command is being executed, discard this one
	if (isCommandPending() &&
	    (cmd.id != CMD_ABORT) &&
	    (cmd.id != CMD_FINISH) &&
	    (cmd.id != CMD_INTERRUPT) &&
	    (cmd.id != CMD_PAUSE) &&
	    (cmd.id != CMD_CLOSE))
	{
		LOG_WARN("Discarding command " + cmd.id);
		return;
	}

	LOG_INFO("Now executing command " + cmd.id);

    startCommandProcessing();

    if (cmd.id == CMD_ABORT)
    {
        doAbort();
    }
    else if (cmd.id == CMD_FINISH)
    {
        doFinish();
    }
    else if (cmd.id == CMD_ACTION)
    {
        doUserAction();
    }
    else if (cmd.id == CMD_STEP)
    {
        doStep( false );
    }
    else if (cmd.id == CMD_STEP_OVER)
    {
        doStep( true );
    }
    else if (cmd.id == CMD_RUN)
    {
        doPlay();
    }
    else if (cmd.id == CMD_SKIP)
    {
        doSkip();
    }
    else if (cmd.id == CMD_GOTO)
    {
        if (cmd.earg == "line")
        {
            DEBUG("[C] Processing go-to-line " + cmd.arg);
            try
            {
                int line = STRI(cmd.arg);
                doGoto( line );
            }
            catch(...) {};
        }
        else if (cmd.earg == "label")
        {
            DEBUG("[C] Processing go-to-label " + cmd.arg);
            doGoto( cmd.arg );
        }
        else
        {
        	SPELLexecutor::instance().getCIF().error("Unable to process Go-To command, no target information", LanguageConstants::SCOPE_SYS );
        }
    }
    else if (cmd.id == CMD_PAUSE)
    {
        doPause();
    }
    else if (cmd.id == CMD_INTERRUPT)
    {
        doInterrupt();
    }
    else if (cmd.id == CMD_SCRIPT)
    {
    	/** \todo determine when to override */
        doScript(cmd.arg,false);
    }
    else if (cmd.id == CMD_CLOSE)
    {
        m_recover = false;
        m_reload = false;
        doClose();
    }
    else if (cmd.id == CMD_RELOAD)
    {
        doReload();
    }
    else if (cmd.id == CMD_RECOVER)
    {
        doRecover();
    }
    else
    {
        LOG_ERROR("[C] UNRECOGNISED COMMAND: " + cmd.id)
    }
	m_mailbox.commandProcessed();

	// The command has finished, release the dispatcher
	setCommandFinished();
	DEBUG("[C] Command execution finished " + cmd.id);

	//TEMPORARILY DISABLED: it creates deadlocks.
	// notifyCommandToCore( cmd.id );
}