void cmdPoll() { #if defined CFG_PRINTF_UART while (uartRxBufferDataPending()) { uint8_t c = uartRxBufferRead(); cmdRx(c); } #endif #if defined CFG_PRINTF_USBCDC int numBytesToRead, numBytesRead, numAvailByte; CDC_OutBufAvailChar (&numAvailByte); if (numAvailByte > 0) { numBytesToRead = numAvailByte > 32 ? 32 : numAvailByte; numBytesRead = CDC_RdOutBuf (&usbcdcBuf[0], &numBytesToRead); int i; for (i = 0; i < numBytesRead; i++) { cmdRx(usbcdcBuf[i]); } } #endif }
void cmdPoll() { while (uartDataAvailable()) { uint8_t c = uartReceive(); cmdRx(c); } }
void cmdPoll() { #if defined CFG_PRINTF_UART while (uartRxBufferDataPending()) { uint8_t c = uartRxBufferRead(); cmdRx(c); } #endif }
void QScriptCompletionTask::start() { Q_D(QScriptCompletionTask); d->type = NoCompletion; // see if we're typing a command // ### don't hardcode the command prefix QRegExp cmdRx(QString::fromLatin1("^\\s*\\.([a-zA-Z]*)")); int cmdIndex = cmdRx.indexIn(d->contents); if ((cmdIndex != -1) && d->console) { int len = cmdRx.matchedLength(); QString prefix = cmdRx.capturedTexts().at(1); if ((d->cursorPosition >= cmdIndex) && (d->cursorPosition <= (cmdIndex+len))) { // editing command --> get command completions d->results = d->console->commandManager()->completions(prefix); d->position = cmdRx.pos(1); d->length = prefix.length(); d->type = CommandNameCompletion; d->appendix = QString::fromLatin1(" "); emit finished(); } else { QScriptDebuggerConsoleCommand *cmd = d->console->commandManager()->findCommand(prefix); if (!cmd) { emit finished(); return; } // editing an argument int argNum = 0; QString arg; int pos = cmdIndex + len; while (pos < d->contents.size()) { while ((pos < d->contents.size()) && d->contents.at(pos).isSpace()) ++pos; if (pos < d->contents.size()) { int pos2 = pos + 1; while ((pos2 < d->contents.size()) && !d->contents.at(pos2).isSpace()) ++pos2; if ((d->cursorPosition >= pos) && (d->cursorPosition <= pos2)) { arg = d->contents.mid(pos, pos2 - pos); break; } pos = pos2; ++argNum; } } QString argType = cmd->argumentTypes().value(argNum); if (!argType.isEmpty()) { if (argType == QLatin1String("command-or-group-name")) { d->results = d->console->commandManager()->completions(arg); } else if (argType == QLatin1String("script-filename")) { d->position = pos; d->length = arg.length(); d->type = CommandArgumentCompletion; QScriptDebuggerJob *job = new QScriptCompleteScriptsJob(arg, d, d->commandScheduler); d->jobScheduler->scheduleJob(job); } else if (argType == QLatin1String("subcommand-name")) { for (int i = 0; i < cmd->subCommands().size(); ++i) { QString name = cmd->subCommands().at(i); if (isPrefixOf(arg, name)) d->results.append(name); } qStableSort(d->results); } else if (argType == QLatin1String("script")) { d->completeScriptExpression(); } else { emit finished(); } if ((d->type == NoCompletion) && !d->results.isEmpty()) { d->position = pos; d->length = arg.length(); d->type = CommandArgumentCompletion; emit finished(); } } } } else { // assume it's an eval expression d->completeScriptExpression(); } }